diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2017-06-09 16:19:48 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2017-06-09 17:39:36 +0300 |
commit | f35df9a25adec35a384ba45c5b2b2d5767e7e87d (patch) | |
tree | 3e01b0f5653b110185d0f424dc0b42cee93b9463 /source/blender | |
parent | 35f8a024969ac81eca7a967884585ab4057ca547 (diff) |
Draw Manager: stop using stack memory!
We still do it a few times, but that helps already. Related to T51718.
Note that it also reinforces the idea that any geometry datablock will
have a generated copy-on-write Mesh provided by Depsgraph.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/draw/engines/clay/clay_engine.c | 2 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_manager.c | 12 |
2 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/draw/engines/clay/clay_engine.c b/source/blender/draw/engines/clay/clay_engine.c index 845e946c454..e2e3fa3efbc 100644 --- a/source/blender/draw/engines/clay/clay_engine.c +++ b/source/blender/draw/engines/clay/clay_engine.c @@ -790,7 +790,7 @@ static void CLAY_cache_populate(void *vedata, Object *ob) DRW_shgroup_call_sculpt_add(depth_shgrp, ob, ob->obmat); } else { - DRW_shgroup_call_add(depth_shgrp, geom, ob->obmat); + DRW_shgroup_call_object_add(depth_shgrp, geom, ob); } } diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 40991a5e707..3b4c65fb54b 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -33,6 +33,7 @@ #include "BIF_glutil.h" #include "BKE_global.h" +#include "BKE_mesh.h" #include "BKE_object.h" #include "BKE_pbvh.h" #include "BKE_paint.h" @@ -210,6 +211,7 @@ typedef struct DRWCall { float obmat[4][4]; Batch *geometry; + Mesh *mesh; /* Optional. */ Object *ob; /* Optionnal */ } DRWCall; @@ -876,7 +878,7 @@ void DRW_shgroup_call_object_add(DRWShadingGroup *shgroup, Batch *geom, Object * copy_m4_m4(call->obmat, ob->obmat); call->geometry = geom; - call->ob = ob; + call->mesh = ob->data; BLI_addtail(&shgroup->calls, call); } @@ -1647,13 +1649,13 @@ static void draw_geometry_execute(DRWShadingGroup *shgroup, Batch *geom) } } -static void draw_geometry(DRWShadingGroup *shgroup, Batch *geom, const float (*obmat)[4], Object *ob) +static void draw_geometry(DRWShadingGroup *shgroup, Batch *geom, const float (*obmat)[4], Mesh *me) { float *texcoloc = NULL; float *texcosize = NULL; - if (ob != NULL) { - BKE_object_obdata_texspace_get(ob, NULL, &texcoloc, &texcosize, NULL); + if (me != NULL) { + BKE_mesh_texspace_get_reference(me, NULL, &texcoloc, NULL, &texcosize); } draw_geometry_prepare(shgroup, obmat, texcoloc, texcosize); @@ -1790,7 +1792,7 @@ static void draw_shgroup(DRWShadingGroup *shgroup, DRWState pass_state) GPU_SELECT_LOAD_IF_PICKSEL(call); if (call->head.type == DRW_CALL_SINGLE) { - draw_geometry(shgroup, call->geometry, call->obmat, call->ob); + draw_geometry(shgroup, call->geometry, call->obmat, call->mesh); } else { BLI_assert(call->head.type == DRW_CALL_GENERATE); |