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/intern/draw_manager_exec.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/intern/draw_manager_exec.c')
-rw-r--r-- | source/blender/draw/intern/draw_manager_exec.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/source/blender/draw/intern/draw_manager_exec.c b/source/blender/draw/intern/draw_manager_exec.c index cff4df89219..48e0115741f 100644 --- a/source/blender/draw/intern/draw_manager_exec.c +++ b/source/blender/draw/intern/draw_manager_exec.c @@ -964,6 +964,12 @@ static void draw_update_uniforms(DRWShadingGroup *shgroup, bind_texture(tex, BIND_TEMP); GPU_shader_uniform_texture(shgroup->shader, uni->location, tex); break; + case DRW_UNIFORM_TEXTURE_REF_PERSIST: + tex = *((GPUTexture **)uni->pvalue); + BLI_assert(tex); + bind_texture(tex, BIND_PERSIST); + GPU_shader_uniform_texture(shgroup->shader, uni->location, tex); + break; case DRW_UNIFORM_BLOCK: ubo = (GPUUniformBuffer *)uni->pvalue; bind_ubo(ubo, BIND_TEMP); @@ -974,6 +980,16 @@ static void draw_update_uniforms(DRWShadingGroup *shgroup, bind_ubo(ubo, BIND_PERSIST); GPU_shader_uniform_buffer(shgroup->shader, uni->location, ubo); break; + case DRW_UNIFORM_BLOCK_REF: + ubo = *((GPUUniformBuffer **)uni->pvalue); + bind_ubo(ubo, BIND_TEMP); + GPU_shader_uniform_buffer(shgroup->shader, uni->location, ubo); + break; + case DRW_UNIFORM_BLOCK_REF_PERSIST: + ubo = *((GPUUniformBuffer **)uni->pvalue); + bind_ubo(ubo, BIND_PERSIST); + GPU_shader_uniform_buffer(shgroup->shader, uni->location, ubo); + break; case DRW_UNIFORM_BLOCK_OBMATS: state->obmats_loc = uni->location; ubo = DST.vmempool->matrices_ubo[0]; @@ -1419,6 +1435,11 @@ static void drw_draw_pass_ex(DRWPass *pass, DRWShadingGroup *start_group, DRWShadingGroup *end_group) { + if (pass->original) { + start_group = pass->original->shgroups.first; + end_group = pass->original->shgroups.last; + } + if (start_group == NULL) { return; } @@ -1504,7 +1525,9 @@ static void drw_draw_pass_ex(DRWPass *pass, void DRW_draw_pass(DRWPass *pass) { - drw_draw_pass_ex(pass, pass->shgroups.first, pass->shgroups.last); + for (; pass; pass = pass->next) { + drw_draw_pass_ex(pass, pass->shgroups.first, pass->shgroups.last); + } } /* Draw only a subset of shgroups. Used in special situations as grease pencil strokes */ |