diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-05-11 17:14:25 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-05-14 11:57:03 +0300 |
commit | b27492d078b49d5ef7291697497c90d373a8036e (patch) | |
tree | fc93dd88fe6a0bf35d79818bd3043e3bc2f94c37 /source/blender/draw | |
parent | cf8109d2aaaba00dd048be3f941a2050809e9a7f (diff) |
DRW: Make Instance count not a pointer
Goal is still to simplify the draw manager.
Diffstat (limited to 'source/blender/draw')
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_effects.c | 6 | ||||
-rw-r--r-- | source/blender/draw/intern/DRW_render.h | 6 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_manager.h | 3 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_manager_data.c | 23 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_manager_exec.c | 2 | ||||
-rw-r--r-- | source/blender/draw/modes/edit_curve_mode.c | 3 |
6 files changed, 7 insertions, 36 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_effects.c b/source/blender/draw/engines/eevee/eevee_effects.c index ea01f5d36df..b25573f89bc 100644 --- a/source/blender/draw/engines/eevee/eevee_effects.c +++ b/source/blender/draw/engines/eevee/eevee_effects.c @@ -305,15 +305,13 @@ void EEVEE_effects_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) } { - static int zero = 0; - static uint six = 6; psl->color_downsample_cube_ps = DRW_pass_create("Downsample Cube", DRW_STATE_WRITE_COLOR); DRWShadingGroup *grp = DRW_shgroup_create(e_data.downsample_cube_sh, psl->color_downsample_cube_ps); DRW_shgroup_uniform_texture_ref(grp, "source", &e_data.color_src); DRW_shgroup_uniform_float(grp, "texelSize", &e_data.cube_texel_size, 1); - DRW_shgroup_uniform_int(grp, "Layer", &zero, 1); - DRW_shgroup_call_instances_add(grp, quad, NULL, &six); + DRW_shgroup_uniform_int_copy(grp, "Layer", 0); + DRW_shgroup_call_instances_add(grp, quad, NULL, 6); } { diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h index 6f9f15a7aba..d43a0e97d24 100644 --- a/source/blender/draw/intern/DRW_render.h +++ b/source/blender/draw/intern/DRW_render.h @@ -445,11 +445,7 @@ void DRW_shgroup_call_sculpt_with_materials_add(DRWShadingGroup **shgroups, void DRW_shgroup_call_instances_add(DRWShadingGroup *shgroup, struct GPUBatch *geom, float (*obmat)[4], - uint *count); -void DRW_shgroup_call_object_instances_add(DRWShadingGroup *shgroup, - struct GPUBatch *geom, - struct Object *ob, - uint *count); + uint count); void DRW_shgroup_call_dynamic_add_array(DRWShadingGroup *shgroup, const void *attr[], uint attr_len); diff --git a/source/blender/draw/intern/draw_manager.h b/source/blender/draw/intern/draw_manager.h index d4a5c4b996b..ae765775929 100644 --- a/source/blender/draw/intern/draw_manager.h +++ b/source/blender/draw/intern/draw_manager.h @@ -149,8 +149,7 @@ typedef struct DRWCall { } range; struct { /* type == DRW_CALL_INSTANCES */ GPUBatch *geometry; - /* Count can be adjusted between redraw. If needed, we can add fixed count. */ - uint *count; + uint count; } instances; struct { /* type == DRW_CALL_PROCEDURAL */ uint vert_count; diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c index 0eac9512d0f..75dcf6e7796 100644 --- a/source/blender/draw/intern/draw_manager_data.c +++ b/source/blender/draw/intern/draw_manager_data.c @@ -574,7 +574,7 @@ void DRW_shgroup_call_object_add_with_callback(DRWShadingGroup *shgroup, void DRW_shgroup_call_instances_add(DRWShadingGroup *shgroup, GPUBatch *geom, float (*obmat)[4], - uint *count) + uint count) { BLI_assert(geom != NULL); BLI_assert(ELEM(shgroup->type, DRW_SHG_NORMAL, DRW_SHG_FEEDBACK_TRANSFORM)); @@ -591,27 +591,6 @@ void DRW_shgroup_call_instances_add(DRWShadingGroup *shgroup, #endif } -/* These calls can be culled and are optimized for redraw */ -void DRW_shgroup_call_object_instances_add(DRWShadingGroup *shgroup, - GPUBatch *geom, - Object *ob, - uint *count) -{ - BLI_assert(geom != NULL); - BLI_assert(ELEM(shgroup->type, DRW_SHG_NORMAL, DRW_SHG_FEEDBACK_TRANSFORM)); - - DRWCall *call = BLI_memblock_alloc(DST.vmempool->calls); - BLI_LINKS_APPEND(&shgroup->calls, call); - - call->state = drw_call_state_object(shgroup, ob->obmat, ob); - call->type = DRW_CALL_INSTANCES; - call->instances.geometry = geom; - call->instances.count = count; -#ifdef USE_GPU_SELECT - call->select_id = DST.select_id; -#endif -} - // #define SCULPT_DEBUG_BUFFERS typedef struct DRWSculptCallbackData { diff --git a/source/blender/draw/intern/draw_manager_exec.c b/source/blender/draw/intern/draw_manager_exec.c index a1532243381..ef50e9d5910 100644 --- a/source/blender/draw/intern/draw_manager_exec.c +++ b/source/blender/draw/intern/draw_manager_exec.c @@ -1289,7 +1289,7 @@ static void draw_shgroup(DRWShadingGroup *shgroup, DRWState pass_state) break; case DRW_CALL_INSTANCES: draw_geometry_execute_ex( - shgroup, call->instances.geometry, 0, *call->instances.count, true); + shgroup, call->instances.geometry, 0, call->instances.count, true); break; case DRW_CALL_PROCEDURAL: GPU_draw_primitive(call->procedural.prim_type, call->procedural.vert_count); diff --git a/source/blender/draw/modes/edit_curve_mode.c b/source/blender/draw/modes/edit_curve_mode.c index f1aa4d20a7e..e06974a338a 100644 --- a/source/blender/draw/modes/edit_curve_mode.c +++ b/source/blender/draw/modes/edit_curve_mode.c @@ -279,9 +279,8 @@ static void EDIT_CURVE_cache_populate(void *vedata, Object *ob) DRW_shgroup_call_add(wire_shgrp, geom, ob->obmat); if ((cu->flag & CU_3D) && (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_CU_NORMALS) != 0) { - static uint instance_len = 2; geom = DRW_cache_curve_edge_normal_get(ob); - DRW_shgroup_call_instances_add(wire_normals_shgrp, geom, ob->obmat, &instance_len); + DRW_shgroup_call_instances_add(wire_normals_shgrp, geom, ob->obmat, 2); } geom = DRW_cache_curve_edge_overlay_get(ob); |