Commit Graph

175 Commits

Author SHA1 Message Date
ola olsson
e856b953f3 Implement batching of instance culling for non-nanite VSM, all local lights are processed as one dispatch, also:
- Factor out the batching setup & merging from the deferred instance culling
- Refactor the instance culling load balancer to be able to share types between different allocators
- Make batching logic use scene rendering allocator
- Rename RenderVirtualShadowMapsHw to RenderVirtualShadowMapsNonNanite (and similar names)
- Refactor view setup logic for Nanite & Non into common functions

#rb andrew.lauritzen

#ROBOMERGE-AUTHOR: ola.olsson
#ROBOMERGE-SOURCE: CL 18293379 via CL 18373760 via CL 18373855
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18373879 by ola olsson in ue5-release-engine-test branch]
2021-12-03 16:38:33 -05:00
jon nabozny
9efdf04301 Added a common Nanite::FSharedContext type that contains data and settings used by culling and raster contexts and passes. This will provide a place to do a large scale refactor and cleanup later that brings more common stuff into this stuff, and helps provide a much cleaner public API to users of Nanite. This change uses this to (temporarily) disable mesh shaders during VSMs while keeping it enabled on other pipelines.
#rb brian.karis, andrew.lauritzen
#preflight 618054de56ec0b00017311dd
#lockdown michal.valient
[FYI] jeff.farris, andrew.firth

#ROBOMERGE-OWNER: jon.nabozny
#ROBOMERGE-AUTHOR: graham.wihlidal
#ROBOMERGE-SOURCE: CL 18022098 via CL 18022691 via CL 18370649 via CL 18370684
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18370735 by jon nabozny in ue5-release-engine-test branch]
2021-12-03 13:57:28 -05:00
ola olsson
1744646e6d Add building VSM HZB for only pages that are allocated, using indirect-dispatch, saves around 0.4ms in typical views.
#rb andrew.lauritzen
#preflight 615468dcf4d2a400010d35c1
#lockdown michal.valient

#ROBOMERGE-AUTHOR: ola.olsson
#ROBOMERGE-SOURCE: CL 17675060 via CL 17966250 via CL 18365947 via CL 18366073
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18366176 by ola olsson in ue5-release-engine-test branch]
2021-12-03 01:31:24 -05:00
jon nabozny
87abd3f7ad Initial implementation of separate static/dynamic VSM page caching to lower cost of dynamic invalidations
- Disabled by default pending some additional optimization, but showing promising initial results

#rb ola.olsson
[FYI] brian.karis, rune.stubbe
#preflight 614262b39bba9a0001a9ee58
#lockdown michal.valient

#ROBOMERGE-OWNER: jon.nabozny
#ROBOMERGE-AUTHOR: andrew.lauritzen
#ROBOMERGE-SOURCE: CL 17528599 via CL 17943875 via CL 18363706 via CL 18363947
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18364037 by jon nabozny in ue5-release-engine-test branch]
2021-12-02 23:08:02 -05:00
jon nabozny
a6136b2a60 Occlusion cull instances drawing into non-nanite VSM (controlled by r.Shadow.Virtual.NonNanite.UseHZB, default mode 2)
- Added stats for non-nanite VSM instance culling (moved VSM stats functionality into own file).
- r.Shadow.Virtual.NonNanite.UseHZB == 2 (default) uses the current-frame Nanite VSM HZB as this enables correct culling for camera cuts & light movement and contains most of the occluding geometry.

#rb Andrew.Lauritzen
#preflight 6138a6582d09b90001568819

#ROBOMERGE-OWNER: jon.nabozny
#ROBOMERGE-AUTHOR: ola.olsson
#ROBOMERGE-SOURCE: CL 17470225 via CL 17923040 via CL 18360986 via CL 18361244
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18361409 by jon nabozny in ue5-release-engine-test branch]
2021-12-02 18:25:13 -05:00
ola olsson
9d099e1d50 Properly filter shadow casting draws into VSM & non-VSM shadow maps (avoids caching empty SMs if all geometry supports VSM)
- fixes both naniite and non-nanite cases.

#rb andrew.lauritzen
#preflight 619e467b974d7d5726ab06d9

#ROBOMERGE-AUTHOR: ola.olsson
#ROBOMERGE-SOURCE: CL 18283460 in //UE5/Release-5.0/... via CL 18283557
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18283599 by ola olsson in ue5-release-engine-test branch]
2021-11-24 09:56:31 -05:00
arciel rekman
f302f8f030 Fix CVars not being picked up from other sections (UE-135567).
- Some projects put rendering CVars in other sections than RendererSettings.

#jira UE-135567
[at]Josh.Adams, [at]Dmitriy.Dyomin
#rb Josh.Adams, Dmitriy.Dyomin

#ROBOMERGE-AUTHOR: arciel.rekman
#ROBOMERGE-SOURCE: CL 18270117 in //UE5/Release-5.0/... via CL 18270123
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18270137 by arciel rekman in ue5-release-engine-test branch]
2021-11-23 10:17:56 -05:00
Marc Audy
0c3be2b6ad Merge Release-Engine-Staging to Test @ CL# 18240298
[CL 18241953 by Marc Audy in ue5-release-engine-test branch]
2021-11-18 14:37:34 -05:00
aurel cordonnier
fc542f6cfd Merge from Release-Engine-Staging @ 18081189 to Release-Engine-Test
This represents UE4/Main @18073326, Release-5.0 @18081140 and Dev-PerfTest @18045971

[CL 18081471 by aurel cordonnier in ue5-release-engine-test branch]
2021-11-07 23:43:01 -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
andrew davidson
57beb335f2 Merging //UE5/Dev-LargeWorldCoordinates [at] 17581892 to //UE5/Main
#ROBOMERGE-AUTHOR: andrew.davidson
#ROBOMERGE-SOURCE: CL 17595295 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v871-17566257)

[CL 17595306 by andrew davidson in ue5-release-engine-test branch]
2021-09-22 10:01:48 -04:00
ola olsson
a75d70417c Fix instance shadow culling of dynamic primitives by adding a deferred culling pass after shadow setup.
- Also correctly handle invalid instances (made possible by the above)
 - Make VSM invalidation also respect invalid instance flag.
 - Refactor FInstanceCullingManager interface to remove defunct CullInstances function.

#preflight 613f0c8c3bbb480001036f62
#rb Dmitriy.Dyomin
[FYI] jamie.hayes,zach.bethel

#ROBOMERGE-AUTHOR: ola.olsson
#ROBOMERGE-SOURCE: CL 17490146 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v870-17433530)

[CL 17490149 by ola olsson in ue5-release-engine-test branch]
2021-09-13 05:33:42 -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
andrew lauritzen
5ff9308581 Decouple shadow depth rendering from bOcclusionBeforeBasePass.
Remove early shadow depth rendering.

#preflight 6126de4eaf9a8f00019d96fc
#rb daniel.wright
[FYI] brian.karis, graham.wihlidal, ola.olsson, sebastien.hillaire, charles.derousiers

#ROBOMERGE-SOURCE: CL 17312835 via CL 17315510
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v861-17282326)

[CL 17315898 by andrew lauritzen in ue5-release-engine-test branch]
2021-08-26 07:38:44 -04:00
daniel wright
7f6fdce01e Make Shadow Depth Rendering check Nanite::GStreamingManager.HasResourceEntries()
#preflight skip to unblock people crashing

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

[CL 17122981 by daniel wright in ue5-release-engine-test branch]
2021-08-10 15:59:14 -04:00
graham wihlidal
3dd703b933 Removed Nanite scratch buffer workaround, and also skip any Nanite processing/allocations if the scene does not have any Nanite assets loaded. Saves ~1ms of GPU time in ShooterGame, and ~200mb
#rb rune.stubbe
[FYI] brian.karis, daniel.wright, andrew.lauritzen
#preflight 61122b8aafd67e0001dd018d

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

[CL 17118305 by graham wihlidal in ue5-release-engine-test branch]
2021-08-10 12:27:11 -04:00
brian karis
d6cceb9564 Fix Nanite visualization bug where dbg targets will always be allocated and always be drawn to while in the editor whether enabled or not.
#rb graham.wihlidal
#preflight 610c94d26c6eb000019056fd

#ROBOMERGE-SOURCE: CL 17089477 via CL 17095481
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v853-17066230)

[CL 17095658 by brian karis in ue5-release-engine-test branch]
2021-08-07 15:32:08 -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
andrew lauritzen
33ca74fba3 Implement persistent shadow physical page pool
- Eliminates the previous frame texture (~128MB in default config) and copy
- Cached pages are kept in place, with a quick pass to find and allocate free pages following
  - Experimented with a persistent free list but for the small numbers of pages we are talking about (2k-4k ish standard), recomputing the free list each frame was cheap and robust
  - Main cost is synchronization/barriers between the new passes. Fairly low measured overhead compared to the much larger wins, but can revisit later if need be.
- Removed a few things that added complexity but were not making a big difference to performance, especially with the changes:
  - No longer support "panning" the directional light cascade cached pages. With the changes to the snapping and depth range invalidations this was no longer making much of a difference anyways.
  - No longer do the hierarchical "eliminate parent if all 4 mip children are marked" for local lights. Tested a bit and it was not making a measurable difference in most cases with caching. Can be revived if useful later.
- Moved ownership of the now persistent physical pool to CacheManager
- A bunch of related cleanup and fixes

#rb ola.olsson
#preflight 61008a655938f90001f04260

#ROBOMERGE-OWNER: andrew.lauritzen
#ROBOMERGE-AUTHOR: andrew.lauritzen
#ROBOMERGE-SOURCE: CL 16985509 via CL 16987414
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v838-16927207)

[CL 16987415 by andrew lauritzen in ue5-release-engine-test branch]
2021-07-28 17:00:37 -04:00
andrew lauritzen
9e9c6bfa2c Remove unused/no longer working VSM paths
#ROBOMERGE-SOURCE: CL 16917622 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v836-16769935)

[CL 16917631 by andrew lauritzen in ue5-release-engine-test branch]
2021-07-21 19:04:20 -04:00
christopher waters
c59eec22ea Minor cleanup of shadow passes focused on removing unnecessary command list and feature level arguments.
#jira none
#rb zach.bethel
#preflight 60f6f3a3a6959a00014e7388

#ROBOMERGE-SOURCE: CL 16898650 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v836-16769935)

[CL 16898660 by christopher waters in ue5-release-engine-test branch]
2021-07-20 13:31:10 -04:00
andrew lauritzen
35f696abf5 Use conservative CPU cull volume for VSM clipmaps to avoid missing non-nanite geometry in cached pages.
Better labeling for some GPU profiling regions.
Fix to frustum vertex buffer usage flag.

#rb ola.olsson

#ROBOMERGE-SOURCE: CL 16675237 via CL 16675244
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v835-16672529)

[CL 16675251 by andrew lauritzen in ue5-release-engine-test branch]
2021-06-15 12:47:24 -04:00
Jian Ru
13d2d6e79e Batch BuildRenderingCommands from major mesh passes inside the main render function
#jira UE-117281
#rb ola.olsson, zach.bethel

[CL 16572282 by Jian Ru in ue5-main branch]
2021-06-07 12:19:06 -04:00
Ola Olsson
df492855e0 Removed GPUCULL_TODO define (fixed in on-state)
#preflight 60acc49b58f02e0001a0a996
#rb graham.wihlidal,Arciel.Rekman,Brandon.Schaefer,will.damon

[CL 16446355 by Ola Olsson in ue5-main branch]
2021-05-25 08:15:14 -04:00
Ola Olsson
e49320f038 Batch GPU-Scene Instance Culling passes for shadows
#rb graham.wihlidal
#preflight 609e26220e81c70001cc778f

[CL 16327421 by Ola Olsson in ue5-main branch]
2021-05-14 04:16:02 -04:00