Commit Graph

138 Commits

Author SHA1 Message Date
graham wihlidal
bac2a2b090 Moved all Nanite defines shared between C++ and shaders into a common header file, removing all the "keep this define in sync with this file" cases all over the code, and make the code a lot more maintainable. Common definitions now have a NANITE_ prefix to disambiguate global symbols
#rb rune.stubbe
#preflight 61f94f9ea6632a34f372dc39
[FYI] brian.karis, ola.olsson, jamie.hayes, andrew.lauritzen

#ROBOMERGE-AUTHOR: graham.wihlidal
#ROBOMERGE-SOURCE: CL 18808945 in //UE5/Release-5.0/... via CL 18809413 via CL 18822535
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v908-18788545)

[CL 18823295 by graham wihlidal in ue5-main branch]
2022-02-02 05:33:52 -05:00
andrew lauritzen
482b3e6acf Reimplement clipmap panning to reduce full-level cache invalidations during camera movement
#rb graham.wihlidal
[FYI] ola.olsson
#jira UE-140434
#preflight 61f885a8a6632a34f3603419

#ROBOMERGE-AUTHOR: andrew.lauritzen
#ROBOMERGE-SOURCE: CL 18805354 in //UE5/Release-5.0/... via CL 18807961 via CL 18821749
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v908-18788545)

[CL 18822110 by andrew lauritzen in ue5-main branch]
2022-02-02 02:18:54 -05:00
andrew lauritzen
203ad2cfa3 Ignore false positive static analysis warning
#rb trivial
#jira UE-140528
#preflight 61f83eba41414fb013d767bb

#ROBOMERGE-AUTHOR: andrew.lauritzen
#ROBOMERGE-SOURCE: CL 18795859 in //UE5/Release-5.0/... via CL 18796008 via CL 18797665
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v908-18788545)

[CL 18798117 by andrew lauritzen in ue5-main branch]
2022-01-31 16:46:48 -05:00
andrew lauritzen
5717424035 Fix over-allocation of shadow mask/visualization textures causing alignment issues when viewport was resized down in editor.
#preflight 61f360fc8255dba0d6c49db1
#rb graham.wihlidal

#ROBOMERGE-AUTHOR: andrew.lauritzen
#ROBOMERGE-SOURCE: CL 18768164 in //UE5/Release-5.0/... via CL 18768175 via CL 18768219
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18768233 by andrew lauritzen in ue5-main branch]
2022-01-27 23:31:28 -05:00
andrew lauritzen
ef2fd132f7 Add VSM projection visualizations to the editor menu
#rb graham.wihlidal
[FYI] ola.olsson
#preflight 61f1a689fc74f46b5645b225

#ROBOMERGE-AUTHOR: andrew.lauritzen
#ROBOMERGE-SOURCE: CL 18757572 in //UE5/Release-5.0/... via CL 18759665 via CL 18760682
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18760914 by andrew lauritzen in ue5-main branch]
2022-01-27 15:49:31 -05:00
ola olsson
dc9e277e00 Disable (remaining) VSM shader compilation for platforms that don't support Nanite.
#rb graham.wihlidal
#preflight 61f2c33bf50f352300d098c6

#ROBOMERGE-AUTHOR: ola.olsson
#ROBOMERGE-SOURCE: CL 18754327 in //UE5/Release-5.0/... via CL 18754334 via CL 18757414
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18758408 by ola olsson in ue5-main branch]
2022-01-27 14:34:07 -05:00
andrew davidson
3542cab338 FMatrix explicit cast fixes - Renderer
#rb ben.ingram, zak.middleton
#preflight 61f285e71e5d78c38307cda4

#ROBOMERGE-AUTHOR: andrew.davidson
#ROBOMERGE-SOURCE: CL 18752245 in //UE5/Release-5.0/... via CL 18752267 via CL 18752335
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18752338 by andrew davidson in ue5-main branch]
2022-01-27 07:20:20 -05:00
zak middleton
36c99f6887 #ue5 - LWC: FVector4f <-> FVector4d conversion is now explicit.
FLinearColor has also been modified to make any double->float conversions explicit. Previously all 3D TVector versions were allowed to be implicit and thus could convert TVector<double> => FLinearColor => TVector4<float>.

Fixed up all engine and game casts. Added "//LWC_TODO: precision loss" around any explicit casts that previously were silently explicit and we may need to revisit for precision loss analysis.

#jira UE-122085
#rb Ben.Ingram, Andrew.Davidson
#preflight 61f24af473238441cb7bb0f1

#ROBOMERGE-AUTHOR: zak.middleton
#ROBOMERGE-SOURCE: CL 18751249 in //UE5/Release-5.0/... via CL 18751253 via CL 18751319
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18751326 by zak middleton in ue5-main branch]
2022-01-27 03:30:41 -05:00
ola olsson
e833c86840 Add max distance threshold cvar (r.Shadow.Virtual.MaxMaterialPositionInvalidationRange) for stopping VSM invalidations from WPO (and PDO)
#rb andrew.lauritzen
[FYI] matt.oztalay
#preflight 61e93101cc5594132e061db9

#ROBOMERGE-AUTHOR: ola.olsson
#ROBOMERGE-SOURCE: CL 18672635 in //UE5/Release-5.0/... via CL 18672638 via CL 18672641
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v901-18665521)

[CL 18672642 by ola olsson in ue5-main branch]
2022-01-20 04:59:27 -05:00
andrew lauritzen
7960520813 Encode hierarchical page flags inside bits of page flags mip structure.
- Eliminates the additional HPageFlags buffer and associated scalar array indexing in constant buffer
- Unifies addressing logic and helpers (effectively now the addressing is just MipLevel + HMipLevel)
- Small reduction in memory
Move PageFlags and PageRectBounds into the VSM uniform buffer - similar to the page table - to avoid needing to individually funnel them through various interfaces that need to check page overlap
Rename nanitestats VSM_Perspective to VSM_Local for consistency with other cvars

#rb ola.olsson
#preflight 61e5e57ea2616066f68f3453

#ROBOMERGE-AUTHOR: andrew.lauritzen
#ROBOMERGE-SOURCE: CL 18642391 in //UE5/Release-5.0/... via CL 18642432 via CL 18642483
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v900-18638592)

[CL 18642585 by andrew lauritzen in ue5-main branch]
2022-01-18 13:05:54 -05:00
ola olsson
5d9aa916c8 Add tracking of culled prims for cached VSM, to correctly and efficiently invalidate primitives that move (even if they are culled)
- Disable view-dependent CPU culling of primitives for local-light VSMs (to fix incorrect caching).
- Track per-light cache data for clipmaps to enable storing bit flags for rendered primitives.
- Make invalidations skip primitives that were never rendered into a clipmap, and mark invalidated primitives as not rendered.

#rb andrew.lauritzen
#preflight 61e6c37b3778a195deabfb8a

#ROBOMERGE-AUTHOR: ola.olsson
#ROBOMERGE-SOURCE: CL 18639158 in //UE5/Release-5.0/... via CL 18639165 via CL 18639180
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v899-18417669)

[CL 18639190 by ola olsson in ue5-main branch]
2022-01-18 08:51:35 -05:00
zach bethel
a618c04cbf Converted light grid injection resources to RDG.
#preflight 61ddebe6ce7fe7aeff6fb109

#ROBOMERGE-AUTHOR: zach.bethel
#ROBOMERGE-SOURCE: CL 18576538 in //UE5/Release-5.0/... via CL 18576549
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v899-18417669)

[CL 18576556 by zach bethel in ue5-release-engine-test branch]
2022-01-11 15:57:18 -05:00
jason hoerner
5600dd7c35 UE5_RELEASE: MGPU, numerous fixes to get EngineTest AFR, and Virtual Production City map to run with multiple GPUs. Ultimately there were 3 crash sources (RayTracing, Nanite, Distance Field streaming), each of which required a couple fixes, plus infrastructure to support those fixes...
There remain significant visual artifacts in the Virtual Production City map.  Lumen has serious issues with multiple views in both single and multi-GPU modes -- I think Lumen data needs to be split per view family to solve this.  There is some corrupt geometry in the second view, which may be Nanite or instance rendering related (or something else entirely).  To narrow down these issues, I think I'm going to need to extend the DumpGPU feature to be able to do more effective MGPU graphical debugging, since none of PIX, RenderDoc, or NSight work.  But at least it doesn't crash now...

Full list of changes:
* CVAR (DC.MultiGPUMode) to override multi-GPU mode for Display Cluster, debug feature copied over from 4.27.
* Barrier and synchronization fixes for RHITransferTextures copied over 4.27.  Future work will make RDG handle multi-GPU transitions more seamlessly...
* CVAR (DC.ForceCrossGPUCopy) to force expensive full synchronization and copy of resources cross GPU at the end of each view family render (for debugging).  RHITransferTextures upgraded to support copying things besides 2D textures, including other texture resources and buffers.
* AFR temporal fixes from a previous CL (which I moved from my single GPU to multi GPU PC), now improved to avoid some validation asserts in Debug builds (pass inputs not declared, GetParent()->GetRHI() not working because parent not declared to pass).
* Ray tracing (hang):  acceleration buffers are branched per GPU, as GPU virtual addresses for resources internally referenced by these buffers may vary per GPU.  Needed to add infrastructure to support buffers that duplicate memory per GPU, rather than using driver aliasing of the underlying resource.
* Ray tracing (hang):  some buffer bindings weren't using a proper GPU index.
* Nanite (hang):  Force initial clear of Nanite.MainAndPostNodesAndClusterBatchesBuffer to run on all GPUs.  Solves GPU hang in shadow rendering the first frame (due to shadow rendering running across all GPUs), and later random hangs in view rendering.
* Distance field streaming (assert):  GPU readback staging buffers need to be branched per GPU, as the underlying class is single device.  GPU readback buffers and textures properly take into account the GPU they were last written on when locking and unlocking.  Includes handling an edge case where a write can be queued when a lock is active, due to the deferred way commands are played back in the render graph.
* Distance field streaming (assert):  UAV clear wasn't taking into account GPU index.
* GPU scene update needs to run across all GPUs.
* Fix for "DumpGPU" command to avoid assert with MGPU -- arbitrarily pick a GPU (last index) when the GPU mask contains multiple bits.  Hope to improve this in the future, but it works.

#rnx
#rb mihnea.balta juan.canada tiago.costa kenzo.terelst
#jira none
#preflight 61ba7edbdc58e54b3318fdf5

#ROBOMERGE-AUTHOR: jason.hoerner
#ROBOMERGE-SOURCE: CL 18472819 in //UE5/Release-5.0/... via CL 18473380
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v899-18417669)

[CL 18473412 by jason hoerner in ue5-release-engine-test branch]
2021-12-15 23:12:04 -05:00
ola olsson
d57b5986e3 Propagate ActorLabel to FLightSceneProxy such that names shown in logging/profiling/diagnostics match those shown in editor
- Removed dead code that once set up additional draw event scopes
- Deprecate FLightSceneProxy::GetComponentName and direct users to GetComponentFName to make it more clear what it does
- Change ComponentName to store the component name (not the owner name)
- Change uses of FName to use FString (for reporting invalid/unbaked lights etc)
- Make ACTOR_HAS_LABELS respect WITH_PROFILEGPU to enable profiling in Test & Shipping

#rb daniel.wright,JeanFrancois.Dube
#preflight 61b0b4f0b12ed60581aadaf9

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

[CL 18405129 by ola olsson in ue5-release-engine-test branch]
2021-12-08 09:04:29 -05:00
andrew lauritzen
eccc470d1c Initial VSM scalability settings
Expand Z range of clipmap levels to fix some rare artifacts related to SMRT walking off the Z range with certain settings.

#rb ola.olsson
#preflight 61aea891fc6bcc8e1975cdff

#ROBOMERGE-AUTHOR: andrew.lauritzen
#ROBOMERGE-SOURCE: CL 18400198 in //UE5/Release-5.0/... via CL 18400211
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v896-18170469)

[CL 18400217 by andrew lauritzen in ue5-release-engine-test branch]
2021-12-07 16:24:58 -05:00
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
andrew lauritzen
1dfa763b1f - Generalize one pass projection shadow mask to support up to 32 lights/pixel with 4bpp quantization
- Add some dither noise to both the SMRT result and the shadow mask lookup to minimize banding
- Fall back to a single sample VSM lookup (with a generous static bias) when overflowing the number of lights in one pass projection path
- Fix clamping issue with page dilation that was setting extraneous pages with point lights
- Fix SMRT issue with local lights jammed right next to geometry viewed at a distance
- Separate settings for page dilation for local and directional lights
- Add simple debug output for # lights in one pass projection
- Remove some dead code/parameters

#ROBOMERGE-AUTHOR: andrew.lauritzen
#ROBOMERGE-SOURCE: CL 18279117 via CL 18373418 via CL 18373449
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18373485 by andrew lauritzen in ue5-release-engine-test branch]
2021-12-03 16:23:04 -05:00
ola olsson
bcf06c3e25 Add message to read back page pool status to host & display error message
- also make GPUMessage thread safe

#rb andrew.lauritzen,rune.stubbe
[FYI] zach.bethel
#preflight 619bb74a88439fccfe6342fb

#ROBOMERGE-AUTHOR: ola.olsson
#ROBOMERGE-SOURCE: CL 18269058 via CL 18372981 via CL 18373072
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18373123 by ola olsson in ue5-release-engine-test branch]
2021-12-03 16:08:27 -05:00
guillaume abadie
aecd1b7f72 Fixes compilation failure in VirtualShadowMapArray.cpp
#ROBOMERGE-AUTHOR: guillaume.abadie
#ROBOMERGE-SOURCE: CL 18370136 in //UE5/Release-5.0/... via CL 18370159
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18370215 by guillaume abadie in ue5-release-engine-test branch]
2021-12-03 13:29:07 -05:00
ola olsson
cbf0961826 Fix inverted condition in VSM causing artifacts with dynamic/static separate pages
#rb rune.stubbe
#preflight 616426979c9d4500010de4f0
#lockdown michal.valient
[FYI] andrew.lauritzen

#ROBOMERGE-AUTHOR: ola.olsson
#ROBOMERGE-SOURCE: CL 17771873 via CL 17986059 via CL 18368160 via CL 18368236
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18368270 by ola olsson in ue5-release-engine-test branch]
2021-12-03 10:05:20 -05:00
andrew lauritzen
6c8a66737a Round HZB up to pow2 size in indirect VSM path as some of the sampling code depends on it.
Add cvar for 32 vs 16-bit VSM. Default 32 as currently but will revisit.
Minor cvar rename for consistency.
Enforce SM5 for VSM shaders (already implied by Nanite support, but make it explicit.)

#rb rune.stubbe
[FYI] ola.olsson
#preflight 615cc74ebb992a0001e4adaa
#lockdown michal.valient

#ROBOMERGE-AUTHOR: andrew.lauritzen
#ROBOMERGE-SOURCE: CL 17729626 via CL 17980774 via CL 18366981 via CL 18367016
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18367032 by andrew lauritzen in ue5-release-engine-test branch]
2021-12-03 03:01:35 -05:00
andrew lauritzen
2a232eb1f8 Fix indirect HZB generation for static pages
Minor cleanup to logic to try and avoid similar issues

#rb graham.wihlidal
[FYI] ola.olsson
#preflight 6156462e9dc4c50001365202
#lockdown michal.valient

#ROBOMERGE-AUTHOR: andrew.lauritzen
#ROBOMERGE-SOURCE: CL 17685329 via CL 17967455 via CL 18366106 via CL 18366202
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18366310 by andrew lauritzen in ue5-release-engine-test branch]
2021-12-03 01:39:26 -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
andrew lauritzen
401fa08b49 Compile fix
[FYI] ola.olsson
#jira horde

#ROBOMERGE-AUTHOR: andrew.lauritzen
#ROBOMERGE-SOURCE: CL 18364834 in //UE5/Release-5.0/... via CL 18364868
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18364933 by andrew lauritzen in ue5-release-engine-test branch]
2021-12-02 23:47:57 -05:00
andrew lauritzen
63b5077326 Fix typo in previous commit
#preflight skip
#lockdown michal.valient

#ROBOMERGE-AUTHOR: andrew.lauritzen
#ROBOMERGE-SOURCE: CL 17579073 via CL 17947318 via CL 18364005 via CL 18364105
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18364261 by andrew lauritzen in ue5-release-engine-test branch]
2021-12-02 23:18:40 -05:00