- MeshPassProcessor converted to use SetShaderParameters instead of setting individual resources. Caching of SRVs and Samplers was also removed.
- UnsetShaderSRVs and UnsetShaderUAVs now set all the null binds in a single SetShaderParameters command.
- Made some FRHIShaderParameterResource utilities more public.
#jira none
#rb jeannoe.morrisette, luke.thatcher
#preflight 637565eebf76990b71eb38d0
[CL 23197327 by christopher waters in ue5-main branch]
- Currently disabled by default (controlled using r.RayTracing.Nanite.Mode)
- Nanite triangle data is streamed out to temporary buffers and used to build BLASes.
- For hit shaders, instead of having to keep uncompressed vertex/index buffers, nanite data is referenced using an auxiliary buffer to identify page/cluster indices.
- BLAS build:
- Whenever a new Nanite page is installed/uninstalled, a rebuild of the associated mesh BLAS is requested.
- Compute shader is dispatched to stream out mesh data to temporary buffer as well as auxiliary data used by hit shaders.
- CPU then does a readback of part of the data to determine size of the BLAS etc and kicks off a BLAS rebuild.
- Added raytracing support to Nanite Vertex Factory.
#rb rune.stubbe, yuriy.odonnell
#preflight 6331cec7b20e73a0983d9326
[CL 22203852 by tiago costa in ue5-main branch]
Supply a mesh LOD index into MDC batching CS so it can fetch a correct lighting information for each instance
#rb ola.olsson
#jira UE-164402
#preflight 632d8688671a1a24b564bd0c
[CL 22163633 by dmitriy dyomin in ue5-main branch]
- use paramater FeatureLevel instead of touching possible nullptr scene
- move static stat members to global c++ files instead of storing them in the header
- fix check when PSO got rescheduled during precache background task
- only enable PSO precache validation when actual PSO precaching is enabled as well
#jira UE-139584
#rb Mihnea.Balta
[CL 22089969 by kenzo terelst in ue5-main branch]
(refactor internal pass processor code to share as much code as possible between building of mesh draw commands and setting up the PSOs which are used)
#jira UE-139584
#rb Jason.Nadro
#preflight 63235e28214d9e96980f588d
[CL 22032850 by kenzo terelst in ue5-main branch]
- MeshPassProcessor create function takes feature level as create parameter
- MeshPassProcessor base stores the processor enum type (handy for reference and stat tracking per pass type)
When pass enum value is not available then EMeshPassType::Num is used for now
#jira UE-139584
#rb Jason.Nadro, Mihnea.Balta, Zach.Bethel, Arciel.Rekman
#preflight 631b30f1304480f8f89fca35
[CL 21987972 by kenzo terelst in ue5-main branch]
Add PSOPrecache file which wraps engine level PSO structs and functions
- FPSOPrecacheParams used to wrap certain parameters which drive the PSO collection (mostly set from components)
- IPSOCollector interface used as engine entry to the mesh pass processors in renderer project
- FPSOCollectorCreateManager to wrap all statically registered IPSOCollector CreateFuncions
- PSOCollectorStats structs and helper functions
Add PSOPrecache support to PipelineStateCache:
- functions to precache compute and graphics PSOs
- functions to check current precache state
- FPrecacheGraphicsPipelineCache which wraps all currently precached PSOs
IMaterial entry function to PrecachePSOs with given vertex factories and params (implemented by UMaterial & UMaterialInstance) which forwards call to FMaterial and finally the FMaterialShaderMap
- FMaterialShaderMap will iterate all registered IPSOCollector to collect all possible PSOs used and forward them to the PipelineStateCache for actual (async) precaching
RHI Changes:
- Add RHI specific functions to retrieve & compare the FRHIVertexDeclaration and FGraphicsPipelineStateInitializer hash for each RHI
- Add helper functions to match RHI*State data by retrieving initializer
Minimal vertex factory changes for PSO precaching as prep - actual changes in upcoming CLs
MeshPassProcessor base functions to collect PSOs which can be used by all mesh pass processor implemention (actual changes in upcoming CLs)
- Cache complete precache data hash of stored minimal PSO so it can be used for fast actual PSO initializer hash computation (full PSO initializer is build at runtime)
- Cache if minimal PSO was successfully precache and option to skip draw when PSO is still precaching (disabled by default and doesn't work yet via GPU scene based rendering)
- Add helper functions to setup the per mesh pass render target data used during PSO collection
Refactor SceneTextureConfig so it can be initialized from an init struct and move all function to setup the internal members from SceneTexture to SceneTextureConfig using the data from the init struct (so it's available in Engine project)
Fix GBufferInfo format for velocity target (was always floating point while it should be unorm when not android
Make certain helper functions definitions to h file so they can be used everywhere (SupportsNaniteRendering, FTextureRenderTarget2DResource::GetFormat & CreateFlags)
#preflight 63189a5a967ffc68fb9044a5
#jira UE-139584
#rb Mihnea.Balta
[CL 21907508 by kenzo terelst in ue5-main branch]
#jira UE-151474
#rb Yuriy.ODonnell
Create raytracing miss shaders that implement light functions for raytraced reflections, refractions and the raytracing debug primary view. Each light with a valid light function material is assigned a miss shader in the main raytracing pipeline which is used to modulate the light intensity as part of the shadowing calculation. The light function implementation intentionally converts to grayscale for visual compatibility with the deferred renderer.
As part of this CL, the default behavior for miss shaders in RT pipeline is changed. We now require the caller to use RHISetRayTracingMissShader before the first dispatch to ensure the desired shader is assigned to the desired slot in the pipeline. This relaxes some prior assumptions about the shader slot index needing to matching the shader index in the pipeline (which would not hold after having added more miss shaders to the main raytracing pipeline).
Basic validation has been added to the D3D12 RHI to ensure we are correctly binding at least the 0'th miss shader slot prior to the first dispatch.
#preflight 62bc99aca966c9f7ae8b1df9
#preflight 62bcbbf45d53ca5bcefc828f
#preflight 62bccd7a3f0d6beee247ca53
[CL 20884852 by ehartNV in ue5-main branch]
Make sure decals are attached before the raytracing scene is created so that the right number of slots can be reserved
Fix miss/callbable shader typo
Fix potential crash when searching for default callable shader index
#jira UE-156382
#rb Tiago.Costa, Yuriy.ODonnell
#preflight 62abbb48c6467711b631c4e1
[CL 20697490 by chris kulla in ue5-main branch]
- FRHIRayTracingScene is created with NumCallableShaderSlots.
- Application can add entries to SBT using CallableCommands array.
- ShaderBindings are generated from CallableCommands in BindRayTracingMaterialPipeline(...) once the RTPSO is available so CallableShaderIndex is known.
- Shader Bindings are then merged and set during WaitForRayTracingScene.
#rb yuriy.odonnell
#preflight 628d4053b378b39d419afc4d
[CL 20356249 by tiago costa in ue5-main branch]
- useful to gather shader bindings to evaluate materials in callable shaders.
- similar to how it supports compute and hit group shaders.
#rb yuriy.odonnell
#preflight 6287503ac057ee6e23f2f8dc
[CL 20292265 by tiago costa in ue5-main branch]
- GetRayTracingCallableLibrary() similar to how we handle hitgroups.
FindRayTracingCallableIndex(...) to query callable shader index in RTPSO.
#rb yuriy.odonnell
#preflight 628620c99016c6dd8974b510
[CL 20278150 by tiago costa in ue5-main branch]
This method can be called before the render pass is executed, so the currently bound state is irrelevant. The calling code must extract the correct render target configuration from the pass parameters and send it. Relying on ApplyCachedRenderTargets could lead to incorrect sort keys or even crashes when the method was called in between passes, and the previously bound texture pointers were stale.
#jira none
#rnx
#rb Christopher.Waters
#preflight 61b3363313028c27d2928d57
#ROBOMERGE-AUTHOR: mihnea.balta
#ROBOMERGE-SOURCE: CL 18430152 in //UE5/Release-5.0/... via CL 18435290
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v897-18405271)
[CL 18435514 by mihnea balta in ue5-release-engine-test branch]
* Updates to the VirtualShadowMapArrayCacheManager to support the invalidation of cache pages upon removal of dynamic primitives
* Various updates and fixes to support writing dynamic primitives' instance scene data and instance payload data from the GPU
* All these changes are needed by a few existing systems that will be using them soon to render via GPU Scene
(NOTE: This change is a resubmit of 18375369 with CIS fixes that caused it to be backed out)
#rb ola.olsson
#preflight 61ae4176353890ce23d75a95
#ROBOMERGE-AUTHOR: jamie.hayes
#ROBOMERGE-SOURCE: CL 18384716 in //UE5/Release-5.0/... via CL 18384780
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v896-18170469)
[CL 18384814 by jamie hayes in ue5-release-engine-test branch]
[FYI] jamie.hayes
Original CL Desc
-----------------------------------------------------------------
* Updates to GPU Scene and the GPUSceneCollector to support handling the upload of multiple instances and instance payload data for dynamic primitives
* Updates to the VirtualShadowMapArrayCacheManager to support the invalidation of cache pages upon removal of dynamic primitives
* Various updates and fixes to support writing dynamic primitives' instance scene data and instance payload data from the GPU
* All these changes are needed by a few existing systems that will be using them soon to render via GPU Scene
#rb ola.olsson
#ROBOMERGE-AUTHOR: aurel.cordonnier
#ROBOMERGE-SOURCE: CL 18375767 via CL 18375771 via CL 18375781
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18375783 by aurel cordonnier in ue5-release-engine-test branch]