1. Generate shader code. Handled in
2. Single pass, texture-less, completely custom materials (such as the customshaders example, no interaction with lighting and other features etc. is needed there) done
3. Enable textures, blend and cull mode states, with lights uniform buffer set as well. Plus light probes. done
5. Enable demoing and testing various custom material cases: custom materials with lights and shadows. hacked something into the lights example done
This is important because the existing custommaterials example only uses light probes, same goes for all Lancelot cases; this means that a significant portion of the custom materials functionality is not tested in any form. See next point.
6. It turns out custom materials are pretty broken when it comes to lights, this is unrelated to RHI.
QTBUG-82587 out of scope for this task Turns out that this is not fully unexpected since what we inherited from Qt 3D Studio is simply not correctly prepared to handle all cases. For example, custom materials use their environment map texture even when environment mapping is explicitly disabled. Also they are not meant to handle diffuse or shadow(?!) contributions.
6.1 off-topic: direct OpenGL (no RHI) on macOS cannot display the custom material based objects with https://codereview.qt-project.org/c/qt/qtquick3d/+/293018 ("QSSG.gl_error: GL Error: GL_INVALID_OPERATION")
7. Lights. (directional, point, area, spot) done but see 6
7.1 The results with RHI (using the enhanced 'lights' example) do not match the non-RHI ones. (not even in the broken non-RHI form, that still looks better than what we get with RHI) done
8. Shadow mapping. done
8.1 Needs array support for combined image samplers (think for instance: layout(binding = 9) uniform samplerCube shadowCubes). This is totally unsupported by everything in the stack. Bummer. Needs a whole lot of new feature development in QRhi:
8.2 and then it all fails with HLSL due to dynamic looping (which calls functions etc. in the body)
8.3 we also hit a sampler slot limit (16) on D3D due to the why we translate SPIRV-V combined image samplers to HLSL. worked around see also
9. Need new Lancelot cases for 7 and 8. done
10. Ambient occlusion, depth prepass, depth texture. done (but note that SSAO is disfunctional with the built-in custom materials, meaning it will have no visible effect; this is similar to 6)
The following are moved to a separate task:
11. Non-property images. (?? there is code on the direct OpenGL code path but not sure what it is for)
12. Support multiple passes with BufferBlit commands in them.
13. Enable sourceless BufferBlits.
This raises an interesting issue, namely that it is possible to get a copy of the main framebuffer (see first BufferBlit in the example below), meaning all the content that was rendered before the object with the custom material in question.
With the QRhi-based pipeline the texture-to-texture copy would normally happen in the prepare phase, but we haven't even started the main renderpass at that point, so source-less BufferBlits cannot be supported this way.
It is very unfortunate that the old OpenGL implementation tends to rely on the 'do some draw calls, issue a blitFramebuffer to get the content rendered by the previous draw calls, do some more draw calls, ...' pattern, which, while being a performance hazard, is also non-portable to modern APIs (and by extension to QRhi).
So such materials will likely involve running a full main render pass up to the object in question, targeting the destination texture of such a BufferBlit, in the prepare phase. (so then such a BufferBlit is not a copy then but rather the result of partially performing the main renderpass, ugggh...)