diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-06-02 17:58:07 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-06-02 17:58:07 +0300 |
commit | b18c2a3c413b7741b2a854b7bd25721352be2589 (patch) | |
tree | 7dbdc9556a5eb4ff8f4d52afae01a9d3c47f7951 /source/blender/draw/engines/eevee/eevee_shadows.c | |
parent | b82cb0ad3241ead3faee699847bc3e0065e304cd (diff) |
EEVEE: Refactor of eevee_material.c
These are the modifications:
-With DRW modification we reduce the number of passes we need to populate.
-Rename passes for consistent naming.
-Reduce complexity in code compilation
-Cleanup how renderpass accumulation passes are setup, using pass instances.
-Make sculpt mode compatible with shadows
-Make hair passes compatible with SSS
-Error shader and lookdev materials now use standalone materials.
-Support default shader (world and material) using a default nodetree internally.
-Change BLEND_CLIP to be emulated by gpu nodetree. Making less shader variations.
-Use BLI_memblock for cache memory allocation.
-Renderpasses are handled by switching a UBO ref bind.
One major hack in this patch is the use of modified pointer as ghash keys.
This rely on the assumption that the keys will never overlap because the
number of options per key will never be bigger than the pointed struct.
The use of one single nodetree to support default material is also a bit hacky
since it won't support concurent usage of this nodetree.
(see EEVEE_shader_default_surface_nodetree)
Another change is that objects with shader errors now appear solid magenta instead
of shaded magenta. This is only because of code reuse purpose but could be changed
if really needed.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D7642
Diffstat (limited to 'source/blender/draw/engines/eevee/eevee_shadows.c')
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_shadows.c | 44 |
1 files changed, 1 insertions, 43 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_shadows.c b/source/blender/draw/engines/eevee/eevee_shadows.c index fb338d85fde..84c50a22ae6 100644 --- a/source/blender/draw/engines/eevee/eevee_shadows.c +++ b/source/blender/draw/engines/eevee/eevee_shadows.c @@ -159,47 +159,6 @@ void EEVEE_shadows_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) } } -/* Add a shadow caster to the shadowpasses */ -void EEVEE_shadows_caster_add(EEVEE_ViewLayerData *UNUSED(sldata), - EEVEE_StorageList *stl, - struct GPUBatch *geom, - Object *ob) -{ - DRW_shgroup_call(stl->g_data->shadow_shgrp, geom, ob); -} - -void EEVEE_shadows_caster_material_add(EEVEE_ViewLayerData *sldata, - EEVEE_PassList *psl, - struct GPUMaterial *gpumat, - struct GPUBatch *geom, - struct Object *ob, - const float *alpha_threshold) -{ - /* TODO / PERF : reuse the same shading group for objects with the same material */ - DRWShadingGroup *grp = DRW_shgroup_material_create(gpumat, psl->shadow_pass); - - if (grp == NULL) { - return; - } - - /* Unfortunately needed for correctness but not 99% of the time not needed. - * TODO detect when needed? */ - DRW_shgroup_uniform_block(grp, "probe_block", sldata->probe_ubo); - DRW_shgroup_uniform_block(grp, "grid_block", sldata->grid_ubo); - DRW_shgroup_uniform_block(grp, "planar_block", sldata->planar_ubo); - DRW_shgroup_uniform_block(grp, "light_block", sldata->light_ubo); - DRW_shgroup_uniform_block(grp, "shadow_block", sldata->shadow_ubo); - DRW_shgroup_uniform_block( - grp, "renderpass_block", EEVEE_material_default_render_pass_ubo_get(sldata)); - DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo); - - if (alpha_threshold != NULL) { - DRW_shgroup_uniform_float(grp, "alphaThreshold", alpha_threshold, 1); - } - - DRW_shgroup_call(grp, geom, ob); -} - /* Make that object update shadow casting lights inside its influence bounding box. */ void EEVEE_shadows_caster_register(EEVEE_ViewLayerData *sldata, Object *ob) { @@ -470,8 +429,7 @@ void EEVEE_shadow_output_init(EEVEE_ViewLayerData *sldata, DRW_shgroup_uniform_block(grp, "light_block", sldata->light_ubo); DRW_shgroup_uniform_block(grp, "shadow_block", sldata->shadow_ubo); DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo); - DRW_shgroup_uniform_block( - grp, "renderpass_block", EEVEE_material_default_render_pass_ubo_get(sldata)); + DRW_shgroup_uniform_block(grp, "renderpass_block", sldata->renderpass_ubo.combined); DRW_shgroup_uniform_texture_ref(grp, "shadowCubeTexture", &sldata->shadow_cube_pool); DRW_shgroup_uniform_texture_ref(grp, "shadowCascadeTexture", &sldata->shadow_cascade_pool); |