Commit Graph

150 Commits

Author SHA1 Message Date
christopher waters
4e779095ab Chaning more code to use SetShaderParameters
- 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]
2022-11-18 12:10:55 -05:00
christopher waters
6bcc020b6c Removing deprecated code from Renderer and RenderCore.
#jira none
#rb zach.bethel
#preflight 636e8639232e3d12cbb610f9

[CL 23104907 by christopher waters in ue5-main branch]
2022-11-11 16:10:25 -05:00
kenzo terelst
057c27feb2 - Add option to skip indirect draws when PSOs are still precaching
- Precache Nanite programmable raster PSOs

#rb Rune.Stubbe, Graham.Wihlidal, Mihnea.Balta

[CL 23075419 by kenzo terelst in ue5-main branch]
2022-11-10 06:33:14 -05:00
tiago costa
6844473424 Support ray tracing high quality nanite meshes instead of fallback meshes.
- 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]
2022-09-27 08:28:24 -04:00
dmitriy dyomin
0f1ba0cf45 Mobile: Light map artifacts with specific mesh when launched on Android
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]
2022-09-23 20:02:18 -04:00
kenzo terelst
3c57c8e4fd Minor PSO precaching fixes:
- 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]
2022-09-20 04:55:47 -04:00
kenzo terelst
85ef30d293 PSO Precache: MeshPassProcessor implementation for all common used processors
(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]
2022-09-15 13:46:19 -04:00
chris kulla
dea81e04af Fix invalid check when there are loose parameters present
#rb Yuriy.ODonnell
#jira none
#preflight 63211325506f1a33e07fe6a6

[CL 21996202 by chris kulla in ue5-main branch]
2022-09-13 19:58:34 -04:00
kenzo terelst
ee56085de5 - ComputeMeshFillMode doesn't require MeshBatch as parameter
- 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]
2022-09-13 14:04:12 -04:00
kenzo terelst
5cffab66a5 PSO Precache Base Changes (disabled by default)
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]
2022-09-08 19:34:08 -04:00
patrick kelly
91e500d518 HetergenousVolumes: Adding support for shadow-casting from hard surfaces.
#rb sebastien.hillaire mihnea.balta
#preflight 631956d0d135b61bc5e853a9

[CL 21907421 by patrick kelly in ue5-main branch]
2022-09-08 19:31:50 -04:00
christopher waters
aee024fd71 Adding bindless support to more MDC parameter types. Removing unneeded data from MDC UB binding info.
#jira UE-139616
#rb zach.bethel
#preflight 6303ec020061f895d0edfe3d

[CL 21496103 by christopher waters in ue5-main branch]
2022-08-22 18:22:37 -04:00
zach bethel
b3219b1f1e Moved dynamic mesh passes and BeginSceneOcclusion off the render thread.
#preflight 62bf7ac9c941053728a722f5

[CL 20926630 by zach bethel in ue5-main branch]
2022-07-02 12:21:03 -04:00
ehartNV
e15f28eb8e PR #9166: Ray tracing light function implementation (Contributed by ehartNV)
#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]
2022-06-29 18:26:36 -04:00
chris kulla
240b46a004 Path Tracer: Fix potential crash in shader bindings when a decal material accesses scene textures
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]
2022-06-16 19:27:09 -04:00
zach bethel
bf1bcafa00 Refactored Nanite material GBuffer passes to run off the render thread.
#preflight 62a2129f081ed277df5aa9ed
#rb yuriy.odonnell, krzysztof.narkowicz, kenzo.terelst

[CL 20579258 by zach bethel in ue5-main branch]
2022-06-09 12:40:44 -04:00
zach bethel
78b6b40701 Remove view uniform buffer from ray tracing mesh draw commands and delete FPersistentUniformBuffers::ViewUniformBuffer. Deprecated the view uniform buffer from MeshPassRenderState.
#rb yuriy.odonnell
#preflight 629915e62e20b63f9a9d2d46

[CL 20475710 by zach bethel in ue5-main branch]
2022-06-02 16:57:29 -04:00
tiago costa
8da4936663 Support Callable Shaders in FRayTracingScene.
- 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]
2022-05-24 17:27:36 -04:00
tiago costa
d02ba08f8c Support Callable/Miss shaders in MeshPassProcessor.
- 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]
2022-05-20 05:18:06 -04:00
tiago costa
e98ce47a3b Keep track of all callable shaders to build RTPSO
- 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]
2022-05-19 07:03:30 -04:00
Arne Schober
4223ed6dcb U5 - fix copy and paste error from loadings refactor.
#preflight

[CL 18914852 by Arne Schober in ue5-main branch]
2022-02-09 02:59:22 -05:00
graham wihlidal
6f4cd03cf1 Added hook to skip mesh draw commands from all mesh pass processor types if certain visualization/debug conditions are met. Initially, this is used to implement a mode to only render non-Nanite mesh batches that reference Nanite coarse mesh static mesh assets (which is incorrect, as the proxy will be rendered directly instead of the original source mesh). This mode is off by default, and enabled in non-shipping builds with r.Nanite.IsolateInvalidCoarseMesh 1
#rb brian.karis, andrew.lauritzen
[FYI] ola.olsson
#preflight 61df710b484d866ec0243945

#ROBOMERGE-AUTHOR: graham.wihlidal
#ROBOMERGE-SOURCE: CL 18592541 in //UE5/Release-5.0/... via CL 18592572 via CL 18592580
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Test -> Main) (v899-18417669)

[CL 18592588 by graham wihlidal in ue5-main branch]
2022-01-12 19:46:57 -05:00
mihnea balta
6d2e2722ac Pass the render targets information explicitly to FMeshDrawCommand::GetPipelineStateSortingKey, instead of relying on whatever is currently bound.
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]
2021-12-10 17:45:35 -05:00
jamie hayes
15da3d166d * 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

(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]
2021-12-06 13:18:17 -05:00
aurel cordonnier
46a2f40da2 [Backout] - CL18359911 (due to CIS errors)
[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]
2021-12-03 19:54:06 -05:00