This patch was originally designed to fix T66231 but went a bit over and I had to
redesign a bit more.
This patch is huge but since it fixes an important performance regression, could it
be considered for inclusion in 2.83? Having this refactor in for the LTS could help
backport fixes from future release. I don't have a strong opinion on this though.
I did check for regression tests and already fixed the issues. Only the hair+SSS test
needs to be updated.
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)
If anyone has a better idea let me know.
This improve CPU performance a bit in scene with lots of instancing.
A lot more cleanup can go in after this patch (removing unused shaders, routines).
I didn't want to bloat the patch with thoses.
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.
