diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2017-11-06 18:54:33 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2017-11-06 19:43:14 +0300 |
commit | 9d77b5d5910b65bed88817169d5444cfb189eb63 (patch) | |
tree | 2c1b33f4aa44b94247ae977befd1fbc675076b39 /source/blender/draw | |
parent | ed555750eb8294005f54425094cb692f29830631 (diff) |
Eevee: Remove uses of DRW_shgroup_call_dynamic_add_empty in shadows and probe rendering.
This was adding an unecessary high number of DRWCall per objects.
Diffstat (limited to 'source/blender/draw')
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_effects.c | 3 | ||||
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_lightprobes.c | 2 | ||||
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_lights.c | 14 | ||||
-rw-r--r-- | source/blender/draw/intern/DRW_render.h | 2 |
4 files changed, 8 insertions, 13 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_effects.c b/source/blender/draw/engines/eevee/eevee_effects.c index a01ba6a3acf..e8ccd886630 100644 --- a/source/blender/draw/engines/eevee/eevee_effects.c +++ b/source/blender/draw/engines/eevee/eevee_effects.c @@ -214,8 +214,7 @@ void EEVEE_effects_cache_init(EEVEE_SceneLayerData *UNUSED(sldata), EEVEE_Data * DRW_shgroup_uniform_buffer(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); - for (int i = 0; i < 6; ++i) - DRW_shgroup_call_dynamic_add_empty(grp); + DRW_shgroup_set_instance_count(grp, 6); } { diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c index 7b134ab4967..7913689d299 100644 --- a/source/blender/draw/engines/eevee/eevee_lightprobes.c +++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c @@ -410,7 +410,7 @@ void EEVEE_lightprobes_cache_init(EEVEE_SceneLayerData *sldata, EEVEE_Data *veda // DRW_shgroup_uniform_texture(grp, "texJitter", e_data.jitter); DRW_shgroup_uniform_texture(grp, "probeHdr", sldata->probe_rt); - DRW_shgroup_call_dynamic_add_empty(grp); + DRW_shgroup_set_instance_count(grp, 1); } { diff --git a/source/blender/draw/engines/eevee/eevee_lights.c b/source/blender/draw/engines/eevee/eevee_lights.c index 5f25f5ef815..6c1ed277005 100644 --- a/source/blender/draw/engines/eevee/eevee_lights.c +++ b/source/blender/draw/engines/eevee/eevee_lights.c @@ -307,16 +307,12 @@ void EEVEE_lights_cache_shcaster_add(EEVEE_SceneLayerData *sldata, EEVEE_PassLis DRWShadingGroup *grp = DRW_shgroup_instance_create(e_data.shadow_sh, psl->shadow_cube_pass, geom); DRW_shgroup_uniform_block(grp, "shadow_render_block", sldata->shadow_render_ubo); DRW_shgroup_uniform_mat4(grp, "ShadowModelMatrix", (float *)obmat); - - for (int i = 0; i < 6; ++i) - DRW_shgroup_call_dynamic_add_empty(grp); + DRW_shgroup_set_instance_count(grp, 6); grp = DRW_shgroup_instance_create(e_data.shadow_sh, psl->shadow_cascade_pass, geom); DRW_shgroup_uniform_block(grp, "shadow_render_block", sldata->shadow_render_ubo); DRW_shgroup_uniform_mat4(grp, "ShadowModelMatrix", (float *)obmat); - - for (int i = 0; i < MAX_CASCADE_NUM; ++i) - DRW_shgroup_call_dynamic_add_empty(grp); + DRW_shgroup_set_instance_count(grp, MAX_CASCADE_NUM); } void EEVEE_lights_cache_shcaster_material_add( @@ -333,8 +329,7 @@ void EEVEE_lights_cache_shcaster_material_add( if (alpha_threshold != NULL) DRW_shgroup_uniform_float(grp, "alphaThreshold", alpha_threshold, 1); - for (int i = 0; i < 6; ++i) - DRW_shgroup_call_dynamic_add_empty(grp); + DRW_shgroup_set_instance_count(grp, 6); grp = DRW_shgroup_material_instance_create(gpumat, psl->shadow_cascade_pass, geom, ob); DRW_shgroup_uniform_block(grp, "shadow_render_block", sldata->shadow_render_ubo); @@ -343,8 +338,7 @@ void EEVEE_lights_cache_shcaster_material_add( if (alpha_threshold != NULL) DRW_shgroup_uniform_float(grp, "alphaThreshold", alpha_threshold, 1); - for (int i = 0; i < MAX_CASCADE_NUM; ++i) - DRW_shgroup_call_dynamic_add_empty(grp); + DRW_shgroup_set_instance_count(grp, MAX_CASCADE_NUM); } void EEVEE_lights_cache_finish(EEVEE_SceneLayerData *sldata) diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h index 599656ae163..fe489315e97 100644 --- a/source/blender/draw/intern/DRW_render.h +++ b/source/blender/draw/intern/DRW_render.h @@ -326,9 +326,11 @@ void DRW_shgroup_call_dynamic_add_array(DRWShadingGroup *shgroup, const void *at const void *array[] = {__VA_ARGS__}; \ DRW_shgroup_call_dynamic_add_array(shgroup, array, (sizeof(array) / sizeof(*array))); \ } while (0) +/* Use this only to make your instances selectable. */ #define DRW_shgroup_call_dynamic_add_empty(shgroup) do { \ DRW_shgroup_call_dynamic_add_array(shgroup, NULL, 0); \ } while (0) +/* Use this to set a high number of instances. */ void DRW_shgroup_set_instance_count(DRWShadingGroup *shgroup, int count); void DRW_shgroup_state_enable(DRWShadingGroup *shgroup, DRWState state); |