Commit Graph

133 Commits

Author SHA1 Message Date
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
jamie hayes
4523c7cecd * 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: jamie.hayes
#ROBOMERGE-SOURCE: CL 18359911 via CL 18375369 via CL 18375397
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18375424 by jamie hayes in ue5-release-engine-test branch]
2021-12-03 17:54:14 -05:00
jamie hayes
4590780053 Eliminate usage of RWLocks for cached mesh draws, opting instead to defer adding meshcommands to the scene's lists after they are created in parallel.
This is generally cheaper or the same under low-contention scenarios, but saves a large amount of time in high-contention scenarios.

#rb zach.bethel
#lockdown jeff.farris
#preflight 6172132095715b0001973c93

#ROBOMERGE-AUTHOR: jamie.hayes
#ROBOMERGE-SOURCE: CL 17894788 via CL 18005601 via CL 18370337 via CL 18370420
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18370490 by jamie hayes in ue5-release-engine-test branch]
2021-12-03 13:42:30 -05:00
jeanfrancois dube
96a754d25a Removed non-required memory allocations from FMeshDrawCommand::GetPipelineStateSortingKey when GRHISupportsPipelineStateSortKey is false.
#rb graham.wihlidal
#lockdown vincent.beauchemin
#preflight 6148d0ae59380f00016608ee

#ROBOMERGE-AUTHOR: jeanfrancois.dube
#ROBOMERGE-SOURCE: CL 17575001 via CL 17946689 via CL 18363884 via CL 18363994
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18364093 by jeanfrancois dube in ue5-release-engine-test branch]
2021-12-02 23:11:46 -05:00
danny couture
277a9c67a3 Avoid temporary FString allocs for breadcrumb events
- Reduce alloc count from 15.4M to 13.3M for 24s of gameplay ~85K allocs/s

#rb Christopher.Waters
#preflight 619d1d12f934c1a291fd89e3

#ROBOMERGE-AUTHOR: danny.couture
#ROBOMERGE-SOURCE: CL 18285493 in //UE5/Release-5.0/... via CL 18285506
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18285514 by danny couture in ue5-release-engine-test branch]
2021-11-24 12:36:39 -05:00
aurel cordonnier
69fe095547 Merge from Release-Engine-Staging @ 17636544 to Release-Engine-Test
This represents UE4/Main @17638339 and Dev-PerfTest @17636504

[CL 17638842 by aurel cordonnier in ue5-release-engine-test branch]
2021-09-27 19:54:25 -04:00
charles derousiers
048f49b600 Add per-object triangle sorting per view for improving translucent ordering artifact.
Review https://p4-swarm.epicgames.net/reviews/17501695/

#rb sebastien.hillaire, krzysztof.narkowicz
#jira none
#preflight 614d4f8274f7e7000107c026

#ROBOMERGE-AUTHOR: charles.derousiers
#ROBOMERGE-SOURCE: CL 17619122 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v871-17566257)
#ROBOMERGE[STARSHIP]: UE5-Release-Engine-Staging Release-5.0

[CL 17619134 by charles derousiers in ue5-release-engine-test branch]
2021-09-24 01:20:27 -04:00
christopher waters
6c4b4a91a4 Adding a required StencilRef argument to SetGraphicsPipelineState.
#jira none
#rb zach.bethel, mihnea.balta, florin.pascu
#preflight 61312f4a79ce170001d4a79e

#ROBOMERGE-SOURCE: CL 17422777 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v865-17346139)
#ROBOMERGE[bot1]: emt

[CL 17422941 by christopher waters in ue5-release-engine-test branch]
2021-09-03 12:04:52 -04:00
graham wihlidal
29b4ac53b7 Implemented a new payload data allocator and buffer in GPU Scene that will be used to allow instances to dynamically allocate optional side-car data rather than always paying a fixed high watermark cost in the scene data layout (often features are never used by most instances).
#rb brian.karis
[FYI] christopher.waters, ola.olsson, krzysztof.narkowicz
#preflight 6123e56d8ff55400011df401
[FYI] Dmitriy.Dyomin

#ROBOMERGE-OWNER: graham.wihlidal
#ROBOMERGE-AUTHOR: graham.wihlidal
#ROBOMERGE-SOURCE: CL 17275101 via CL 17276332
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v858-17259218)

[CL 17276338 by graham wihlidal in ue5-release-engine-test branch]
2021-08-23 16:47:16 -04:00
graham wihlidal
cb67c7c372 - Split Nanite material VS into an indirect and multi view variant with compile-time grid size to have significantly improved codegen vs. int mod and other logic around variable grid size. Lumen (multi view) is now peak occupancy and trivial VS, and base pass (indirect) will be further optimized later.
- Added an optional default sort key override to FMeshDrawCommand::GetPipelineStateSortingKey() so Nanite material command ID could be used as a default instead of shader index, which results in much more effective context roll reduction in the absence of GRHISupportsPipelineStateSortKey
- Refactored Nanite base pass material draws to sort via MeshDrawCommand.GetPipelineStateSortingKey
- Removed "disable culling" path from Nanite base pass (no longer useful, and obviously much slower)
- Disabled depth compression on Nanite material depth if compute depth export is disabled (wasted bandwidth for an always cleared target without any contributing acceleration). - saves ~0.2ms to ~1.0ms in Nanite material pass, depending on scene complexity.
- Disabled NANITE_MATERIAL_STENCIL until RHIs no longer set stencil ref to 0 on a PSO change. This optimization is actually worse (forces a context roll per unique material draw, back to back). - saves ~0.3ms in Nanite material pass

#rb kryysztof.narkowicz
[FYI] brian.karis, rune.stubbe
#preflight 611e4267aabad100014f8441

#ROBOMERGE-SOURCE: CL 17238683 via CL 17257053
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v855-17104924)

[CL 17257293 by graham wihlidal in ue5-release-engine-test branch]
2021-08-20 22:46:51 -04:00
krzysztof narkowicz
e90dcc5bba Fixed FMeshDrawCommand::GetPipelineStateSortingKey crash
#preflight skip

#ROBOMERGE-SOURCE: CL 17194728 via CL 17194738
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v855-17104924)

[CL 17194760 by krzysztof narkowicz in ue5-release-engine-test branch]
2021-08-17 11:06:02 -04:00
krzysztof narkowicz
d3fd6c4ecc Added GetPipelineStateSortingKey which returns the pipeline state sort key, which can be used for sorting material draws to reduce context switches. It has also a fallback to vertex/pixel index in case if GRHISupportsPipelineStateSortKey isn't supported.
Implemented Lumen Nanite pass material apply pass sorting getting around 20% speedups on small draws.

[FYI] Graham.Wihlidal
#preflight 611532b019733b0001792b2f

#ROBOMERGE-SOURCE: CL 17152173 via CL 17152192
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v855-17104924)

[CL 17152202 by krzysztof narkowicz in ue5-release-engine-test branch]
2021-08-12 10:48:47 -04:00
yuriy odonnell
fa14d532ba Merging pull requests to improve rendering determinism through more stable draw sorting.
* Use a shader code hash instead of sorting by shader pointer in CalculateBasePassMeshStaticSortKey()
* Added a serial number to UPrimitiveComponent, which is generated in OnRegister() and then used in FPrimitiveArraySortKey as an extra sort key.

Contributed by andrewtop-cruise.

#github 7934
#github 8273
#preflight 61128303afd67e0001e7a14b
#rb Arciel.Rekman

#ROBOMERGE-SOURCE: CL 17150851 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v855-17104924)

[CL 17150861 by yuriy odonnell in ue5-release-engine-test branch]
2021-08-12 08:35:25 -04:00
dmitriy dyomin
b0828d6beb Mobile specific implementation for auto-instancing. (disabled by default atm)
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

#ROBOMERGE-SOURCE: CL 17093848 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v853-17066230)

[CL 17093856 by dmitriy dyomin in ue5-release-engine-test branch]
2021-08-07 07:20:52 -04:00
graham wihlidal
b80fb3e152 Fixed hair card rendering due to logical changes to indirect args override buffer in mesh processor (used for GPU Scene instance culling)
[FYI] ola.olsson
#preflight skip

#ROBOMERGE-SOURCE: CL 17028474 via CL 17028480
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v845-17028103)

[CL 17028489 by graham wihlidal in ue5-release-engine-test branch]
2021-08-03 07:17:05 -04:00
graham wihlidal
40f7ac8c00 First version of Nanite indirect material (culled) draws - currently off by default during development/optimization
#rb brian.karis
[FYI] rune.stubbe, ola.olsson, krzysztof.narkowicz
#preflight 610852425938f90001deda26

#ROBOMERGE-SOURCE: CL 17021390 via CL 17021409
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v839-17012307)

[CL 17021419 by graham wihlidal in ue5-release-engine-test branch]
2021-08-02 18:08:36 -04:00
ola olsson
137fd18fbb Add InstanceSceneDataOffset to visible/cached mesh draw commands and propagate
- Intermediate step towards making renderer instance-first.
 - Enables simplification of instance culling setup.

#rb Krzysztof.Narkowicz

#ROBOMERGE-SOURCE: CL 16729395 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v835-16672529)

[CL 16729413 by ola olsson in ue5-release-engine-test branch]
2021-06-21 12:27:09 -04:00
arciel rekman
1aeaed1309 Use material asset names, and not friendly names, for debug markers.
- Friendly name ignores material instances for historical reasons (it should really be using a debug name on the shadermap).

#rb Kevin.Ortegren
#jira none

#ROBOMERGE-SOURCE: CL 16606161 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v828-16531559)

[CL 16606165 by arciel rekman in ue5-release-engine-test branch]
2021-06-09 11:40:50 -04:00