diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-05-30 00:52:37 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-05-30 14:43:33 +0300 |
commit | 596492e639f07b6a0a3f705a0f944dc57f94b7e4 (patch) | |
tree | 55f3dfa9ee3ad03c90954bec26f7c85157dc2d1b /source/blender/draw/engines/eevee | |
parent | 32a2bfddcb4b0dedbea987ae3e335dc6aecdaed8 (diff) |
DRW: Refactor to use object pointer for drawcall by default
This cleans up a bit of duplicated code and some confusion about
what was culled and what wasn't.
Now everything is culled based on the given object pointer.
If the object pointer is NULL there is no culling performed.
Diffstat (limited to 'source/blender/draw/engines/eevee')
6 files changed, 15 insertions, 15 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_depth_of_field.c b/source/blender/draw/engines/eevee/eevee_depth_of_field.c index 4675901b952..8c3e58e76c9 100644 --- a/source/blender/draw/engines/eevee/eevee_depth_of_field.c +++ b/source/blender/draw/engines/eevee/eevee_depth_of_field.c @@ -217,7 +217,7 @@ void EEVEE_depth_of_field_cache_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_ DRW_shgroup_uniform_texture_ref(grp, "cocBuffer", &effects->dof_coc); DRW_shgroup_uniform_vec4(grp, "bokehParams", effects->dof_bokeh, 2); - DRW_shgroup_call_procedural_triangles(grp, sprite_len, NULL); + DRW_shgroup_call_procedural_triangles(grp, NULL, sprite_len); DRW_PASS_CREATE(psl->dof_resolve, DRW_STATE_WRITE_COLOR); diff --git a/source/blender/draw/engines/eevee/eevee_effects.c b/source/blender/draw/engines/eevee/eevee_effects.c index 8e670da2ab7..8f2fd633890 100644 --- a/source/blender/draw/engines/eevee/eevee_effects.c +++ b/source/blender/draw/engines/eevee/eevee_effects.c @@ -292,7 +292,7 @@ void EEVEE_effects_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) 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_copy(grp, "Layer", 0); - DRW_shgroup_call_instances(grp, quad, NULL, 6); + DRW_shgroup_call_instances(grp, NULL, quad, 6); } { diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c index 6253a9d3808..bbad169f363 100644 --- a/source/blender/draw/engines/eevee/eevee_lightprobes.c +++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c @@ -398,7 +398,7 @@ void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedat DRW_shgroup_uniform_block(grp, "planar_block", sldata->planar_ubo); DRW_shgroup_uniform_block(grp, "grid_block", sldata->grid_ubo); - DRW_shgroup_call_procedural_triangles(grp, cube_len * 2, NULL); + DRW_shgroup_call_procedural_triangles(grp, NULL, cube_len * 2); } /* Grid Display */ @@ -424,7 +424,7 @@ void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedat DRW_shgroup_uniform_block(shgrp, "grid_block", sldata->grid_ubo); DRW_shgroup_uniform_block(shgrp, "common_block", sldata->common_ubo); int tri_count = egrid->resolution[0] * egrid->resolution[1] * egrid->resolution[2] * 2; - DRW_shgroup_call_procedural_triangles(shgrp, tri_count, NULL); + DRW_shgroup_call_procedural_triangles(shgrp, NULL, tri_count); } } @@ -787,7 +787,7 @@ void EEVEE_lightprobes_cache_finish(EEVEE_ViewLayerData *sldata, EEVEE_Data *ved DRW_shgroup_uniform_texture_ref(grp, "source", &txl->planar_pool); DRW_shgroup_uniform_float(grp, "fireflyFactor", &sldata->common_data.ssr_firefly_fac, 1); - DRW_shgroup_call_procedural_triangles(grp, pinfo->num_planar, NULL); + DRW_shgroup_call_procedural_triangles(grp, NULL, pinfo->num_planar); } } diff --git a/source/blender/draw/engines/eevee/eevee_lights.c b/source/blender/draw/engines/eevee/eevee_lights.c index e966fadbcdb..24d35e2bd45 100644 --- a/source/blender/draw/engines/eevee/eevee_lights.c +++ b/source/blender/draw/engines/eevee/eevee_lights.c @@ -453,7 +453,7 @@ void EEVEE_lights_cache_shcaster_add(EEVEE_ViewLayerData *UNUSED(sldata), struct GPUBatch *geom, Object *ob) { - DRW_shgroup_call_object(stl->g_data->shadow_shgrp, geom, ob); + DRW_shgroup_call(stl->g_data->shadow_shgrp, geom, ob); } void EEVEE_lights_cache_shcaster_material_add(EEVEE_ViewLayerData *sldata, @@ -483,7 +483,7 @@ void EEVEE_lights_cache_shcaster_material_add(EEVEE_ViewLayerData *sldata, DRW_shgroup_uniform_float(grp, "alphaThreshold", alpha_threshold, 1); } - DRW_shgroup_call_object(grp, geom, ob); + DRW_shgroup_call(grp, geom, ob); } /* Make that object update shadow casting lights inside its influence bounding box. */ diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c index cd75cce89a9..3b78d8718ef 100644 --- a/source/blender/draw/engines/eevee/eevee_materials.c +++ b/source/blender/draw/engines/eevee/eevee_materials.c @@ -1126,10 +1126,10 @@ void EEVEE_materials_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) #define ADD_SHGROUP_CALL(shgrp, ob, geom, oedata) \ do { \ if (oedata) { \ - DRW_shgroup_call_object_with_callback(shgrp, geom, ob, oedata); \ + DRW_shgroup_call_with_callback(shgrp, geom, ob, oedata); \ } \ else { \ - DRW_shgroup_call_object(shgrp, geom, ob); \ + DRW_shgroup_call(shgrp, geom, ob); \ } \ } while (0) diff --git a/source/blender/draw/engines/eevee/eevee_volumes.c b/source/blender/draw/engines/eevee/eevee_volumes.c index 47a02a285f5..e3afa91a5a9 100644 --- a/source/blender/draw/engines/eevee/eevee_volumes.c +++ b/source/blender/draw/engines/eevee/eevee_volumes.c @@ -356,7 +356,7 @@ void EEVEE_volumes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) DRW_shgroup_uniform_texture(grp, "sampflame", e_data.dummy_flame); DRW_shgroup_uniform_vec2_copy(grp, "unftemperature", (float[2]){0.0f, 1.0f}); - DRW_shgroup_call_procedural_triangles(grp, common_data->vol_tex_size[2], NULL); + DRW_shgroup_call_procedural_triangles(grp, NULL, common_data->vol_tex_size[2]); effects->enabled_effects |= (EFFECT_VOLUMETRIC | EFFECT_POST_BUFFER); } @@ -367,7 +367,7 @@ void EEVEE_volumes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) grp = DRW_shgroup_create(e_data.volumetric_clear_sh, psl->volumetric_world_ps); DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo); - DRW_shgroup_call_procedural_triangles(grp, common_data->vol_tex_size[2], NULL); + DRW_shgroup_call_procedural_triangles(grp, NULL, common_data->vol_tex_size[2]); } } @@ -462,7 +462,7 @@ void EEVEE_volumes_cache_object_add(EEVEE_ViewLayerData *sldata, /* TODO Reduce to number of slices intersecting. */ /* TODO Preemptive culling. */ - DRW_shgroup_call_procedural_triangles(grp, sldata->common_data.vol_tex_size[2], ob->obmat); + DRW_shgroup_call_procedural_triangles(grp, ob, sldata->common_data.vol_tex_size[2]); vedata->stl->effects->enabled_effects |= (EFFECT_VOLUMETRIC | EFFECT_POST_BUFFER); } @@ -495,7 +495,7 @@ void EEVEE_volumes_cache_finish(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) DRW_shgroup_uniform_block(grp, "shadow_block", sldata->shadow_ubo); DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo); - DRW_shgroup_call_procedural_triangles(grp, common_data->vol_tex_size[2], NULL); + DRW_shgroup_call_procedural_triangles(grp, NULL, common_data->vol_tex_size[2]); DRW_PASS_CREATE(psl->volumetric_integration_ps, DRW_STATE_WRITE_COLOR); grp = DRW_shgroup_create(e_data.volumetric_integration_sh, psl->volumetric_integration_ps); @@ -503,7 +503,7 @@ void EEVEE_volumes_cache_finish(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) DRW_shgroup_uniform_texture_ref(grp, "volumeExtinction", &txl->volume_transmit); DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo); - DRW_shgroup_call_procedural_triangles(grp, common_data->vol_tex_size[2], NULL); + DRW_shgroup_call_procedural_triangles(grp, NULL, common_data->vol_tex_size[2]); DRW_PASS_CREATE(psl->volumetric_resolve_ps, DRW_STATE_WRITE_COLOR); grp = DRW_shgroup_create(e_data.volumetric_resolve_sh, psl->volumetric_resolve_ps); @@ -513,7 +513,7 @@ void EEVEE_volumes_cache_finish(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) DRW_shgroup_uniform_texture_ref(grp, "inSceneDepth", &e_data.depth_src); DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo); - DRW_shgroup_call_procedural_triangles(grp, 1, NULL); + DRW_shgroup_call_procedural_triangles(grp, NULL, 1); } } |