Run a compute job that packs most commonly used instance data (LocalToWorld matrix and some other bits - 80 bytes) into per-instance vertex buffer. Vertex shader does not have access to GPUScene and instead loads instance data from a per-instance vertex buffer. If it needs more primitive/instance data than available then it will load it from Primitive UB, binding unique uniform buffer and breaking auto-instancing. Pixel shader has a full access to a GPUScene
There are 3 ways how FSceneDataIntermediates gets populated
1. PrimitiveId + GPUScene (Desktop)
2. Per-Instance data + Primitive UB (Mobile)
3. Primitive UB (auto-instancing disabled)
Details for GPUScene specific vertex inputs and access to FSceneDataIntermediates are hidden behind a macro:
VF_GPUSCENE_DECLARE_INPUT_BLOCK
VF_GPUSCENE_GET_INTERMEDIATES
FSceneDataIntermediates is now stored in FVertexFactoryIntermediates, FMaterialVertexParameters. Added a few GetPrimitiveData() overloads that allows you to access PrimitiveData depending on current context. Removed most of the cases where GetPrimitiveData() gets used with PrimitiveId.
#rb Ola.Ollson
[CL 17093848 by Dmitriy Dyomin in ue5-main branch]
Move SubmitDrawCommands functionality into FInstanceCullingContext so we may use per-draw auxiliary information collected at Setup step
"UnCulled" bucket will use an optimized permutation that assumes that all submitted items are 'single instance'.
#rb ola.olsson
#fyi krzysztof.narkowicz
[CL 17029558 by Dmitriy Dyomin in ue5-main branch]
- Refactored RDG to support free-threaded execution of passes.
- Refactored renderer to use specific RHI command list variants in pass lambda. Immediate command list passes are forced to stay on the render thread, while other variants can be parallelized.
#rb christopher.waters
[CL 16838717 by zach bethel in ue5-main branch]
- Uses the InstanceCullingLoadBalancer to pre-distribute the work on the CPU to ensure even load.
- Make instance culling use the instance data offset in MDC instead of translating primitive IDs.
- Track single-instance draws separately from instanced to optimize handling (disable culling for single-instance primitives).
#rb Graham.wihlidal,andrew.lauritzen
#fyi dmitriy.dyomin
#preflight 60d0eafa2ab2180001269160
[CL 16733827 by Ola Olsson in ue5-main branch]
- provides easier iteration on related code, plus sets the stage for abstraction for desktop/mobile version.
#preflight 60bf64925bc96f0001ba7fe1
[CL 16587267 by Ola Olsson in ue5-main branch]