Commit Graph

177 Commits

Author SHA1 Message Date
zach bethel
94dae5bea0 Ported GPU scene buffers to RDG.
#rb Krysztof.narkowicz
#preflight 627149d0fe09c0cfbc3c7bdd

[CL 20027095 by zach bethel in ue5-main branch]
2022-05-03 12:08:20 -04:00
jason hoerner
af48ea5a98 UE5_MAIN: Multi-view-family scene renderer refactor, part 2. Move FSceneTextures singleton out of RDG blackboard and FSceneTexturesConfig global variable singleton, into FViewFamilyInfo. This is necessary to allow multiple view families to render in a single render graph and a single scene renderer call.
* Existing calls to CreateSceneTextureShaderParameters and similar functions use "GetSceneTexturesChecked", which allows for the possibility that they are reached in a code path where scene textures haven't been initialized, and nullptr is returned instead of asserting.  The shader parameter setup functions then fill in dummy defaults for that case.  The goal was to precisely match the original behavior, which queried the RDG blackboard, and gracefully handled null if scene textures weren't there.  This definitely appears to occur in FNiagaraGpuComputeDispatch::ProcessPendingTicksFlush, which can be called with a dummy scene with no scene textures.  In the future, I may change this so dummy defaults are filled in for FSceneTextures at construction time, so the structure is never in an uninitialized state, but I would like to set up a test case for the Niagara code path before doing that, and the checks aren't harmful in the meantime.
* I marked as deprecated global functions which query values from FSceneTexturesConfig, but they'll still work with the caveat that if you use multi-view-family rendering, the results will be indeterminate (whatever view family rendered last).  There was only one case outside the scene renderer that accessed the globals (depth clear value), which I removed, noting that there is nowhere in the code where we modify the depth clear value from its global default.  I would like to permanently deprecate or remove these at some point.  Display Cluster is the only code that's currently using the multi-view-family code path, and as a new (still incomplete) feature, third party code can't be using it, and won't be affected.

#jira NONE
#rb chris.kulla zach.bethel mihnea.balta
#preflight 6261aca76119a1a496bd2644

[CL 19873983 by jason hoerner in ue5-main branch]
2022-04-22 17:33:02 -04:00
jason hoerner
b19bb6be2f UE5_MAIN: Multi-view-family scene renderer refactor, part 1. Major structural change to allow scene renderer to accept multiple view families, with otherwise negligible changes in internal behavior.
* Added "BeginRenderingViewFamilies" render interface call that accepts multiple view families.  Original "BeginRenderingViewFamily" falls through to this.
* FSceneRenderer modified to include an array of view families, plus an active view family and the Views for that family.
* Swap ViewFamily to ActiveViewFamily.
* Swap Views array from TArray<FViewInfo> to TArrayView<FViewInfo>, including where the Views array is passed to functions.
* FSceneRenderer iterates over the view families, rendering each one at a time, as separate render graph executions.
* Some frame setup and cleanup logic outside the render graph runs once.
* Moved stateful FSceneRenderer members to FViewFamilyInfo, to preserve existing one-at-a-time view family rendering behavior.
* Display Cluster (Virtual Production) uses new API.

Next step will push everything into one render graph, which requires handling per-family external resources and cleaning up singletons (like FSceneTextures and FSceneTexturesConfig).  Once that's done, we'll be in a position to further interleave rendering, properly handle once per frame work, and solve artifacts in various systems.

#jira none
#rnx
#rb zach.bethel
#preflight 625df821b21bb49791d377c9

[CL 19813996 by jason hoerner in ue5-main branch]
2022-04-19 14:45:26 -04:00
krzysztof narkowicz
b17a57b96a Lumen - moved Lumen atlasses to a single graph resource. Instead of of multiple RegisterExternalTexture/ConvertToExternalTexture calls per frame, there's only one pair which keeps RDG textures inside FLumenSceneFrameTemporaries.
#preflight 625d7c4a6813aa38e3cdf9de

#ROBOMERGE-AUTHOR: krzysztof.narkowicz
#ROBOMERGE-SOURCE: CL 19791441 via CL 19791552 via CL 19791599
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v939-19570697)

[CL 19809541 by krzysztof narkowicz in ue5-main branch]
2022-04-19 11:32:50 -04:00
graham wihlidal
f38a3deddf Changed r.Nanite.ProgrammableRaster to be a global off/on toggle, added per Nanite raster pass toggles (i.e. r.Nanite.ProgrammableRaster.Lumen), and removed r.Nanite.AllowProgrammableRasterSW
#rb jamie.hayes, krzysztof.narkowicz
[FYI] brian.karis, daniel.wright
#preflight skip

#ROBOMERGE-AUTHOR: graham.wihlidal
#ROBOMERGE-SOURCE: CL 19615918 via CL 19616490 via CL 19617150
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v938-19570697)

[CL 19618563 by graham wihlidal in ue5-main branch]
2022-04-04 20:18:17 -04:00
graham wihlidal
25f8e29153 Removed a massive number of Nanite rasterizer shader permutations across all platforms/shaderdbs, significantly improving iteration times for the editor and cooker, especially when these numbers get multiplied by the number of materials that utilize programmable features in addition to the default material "fixed function" path.
Reductions *per material*:

SM5
--
FHWRasterizeVS: 832 -> 21
FHWRasterizePS: 104 -> 39

SM6
--
FHWRasterizeVS: 320 -> 9
FHWRasterizeMS: 640 -> 9
FHWRasterizePS: 120 -> 30

Vulkan
--
FHWRasterizeVS: 320 -> 9
FHWRasterizePS: 40 -> 15

Other platforms redacted =)

-- Details

* CLUSTER_PER_PAGE has been fully removed (since we no longer ever run CLUSTER_PER_PAGE=0), which now makes it mutually inclusive with VIRTUAL_TEXTURE_TARGET
* HAS_RASTER_BIN has been replaced with a dynamic branch, since this is just a per cluster index offset based on a simple uniform buffer load
* ADD_CLUSTER_OFFSET has been replaced with a dynamic branch, since this is just a per cluster index offset based on a simple uniform buffer load
* HAS_PREV_DRAW_DATA has been replaced with a dynamic branch, since this is just a per cluster index offset based on a simple uniform buffer load
* NEAR_CLIP (only change to significantly affect codegen) has been turned into a dynamic branch based on FNaniteView - this lets us merge depth clip/clamp rasterizer calls in VSM together instead of relying on HAS_PREV_DRAW_DATA, and a future optimization can now be done to merge local and directional light full Nanite pipeline calls together.
* VISUALIZE permutation removed from VS/MS since it only loaded unform values that passed down per-vertex into fragment stage as nointerpolation parameters. Pixel shader now constructs this uint2 directly under the VISUALIZE permutation
* NANITE_MESH_SHADER_INTERP removed by default but still left in the code, since it is a work in progress potential optimization for DX12 mesh shaders
* Removed explicit Lumen and VSM usage of NANITE_RENDER_FLAG_HAVE_PREV_DRAW_DATA (now the dynamic branch path is only taken if CullRasterizeMultiPass implicitly breaks the rasterization into multiple calls due to NANITE_MAX_VIEWS_PER_CULL_RASTERIZE_PASS overflow)

Performance was tested on a 2080Ti in AncientGame, and the delta is effectively noise (tested cached and uncached VSM). Further testing on other platforms will occur, but important to get this change in for all the benefits and easy to tweak things later if needed.

#rb rune.stubbe
#fyi brian.karis, ola.olsson, andrew.lauritzen, jamie.hayes, daniel.wright, krzysztof.narkowicz
#preflight 622e684c7e2e35638c96a16a
#robomerge FNNC

[CL 19370372 by graham wihlidal in ue5-main branch]
2022-03-13 23:18:25 -04:00
jeannoe morissette
6939189858 VulkanRHI: Fix occasional layout error in VT depending on which pass runs first after it's resized.
#rb Jeremy.Moore, Mihnea.Balta
#preflight 622a159303062eac59d0f9d0

[CL 19336166 by jeannoe morissette in ue5-main branch]
2022-03-10 10:28:17 -05:00
graham wihlidal
4171f6f73f Big rewrite/optimization of Nanite programmable raster pipeline registration with GPUScene on the CPU, added raster bin visualization plus duplicate define code cleanup, added initial WIP two sided material support (will optimize the math shortly), and fixed a number of programmable raster VSM related bugs.
#rb brian.karis
#fyi rune.stubbe, jamie.hayes
#preflight 6216c0b0f8704e8ca91c7dbd
#robomerge FNNC

[CL 19104646 by graham wihlidal in ue5-main branch]
2022-02-23 18:42:05 -05:00
graham wihlidal
b2376c8e92 Implemented initial Nanite raster pipeline register/unregister/de-duplication, including launching each raster pipeline during Nanite rasterization if programmable raster is enabled. Also hooked up graph GetMaterialMask() to Nanite HW raster pixel shader stage.
#fyi brian.karis, rune.stubbe
#preflight 62097af2d332bab853f5eb79

[CL 18975360 by graham wihlidal in ue5-main branch]
2022-02-13 16:45:21 -05:00
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
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
graham wihlidal
8e3aa910d2 Implemented Nanite support for view visibility flags DrawInGame, DrawInEditor, VisibleInReflectionCaptures, VisibleInSceneCaptureOnly, HiddenInSceneCapture, ForceHidden, and others. Also partially implemented a GPUScene version of FPrimitiveProxy::IsShown().
#rb rune.stubbe, ola.olsson
[FYI] brian.karis, andrew.lauritzen, daniel.wright, krzysztof.narkowicz
#preflight 61f0e569fd5285142b30b907
#jira UE-127692

#ROBOMERGE-AUTHOR: graham.wihlidal
#ROBOMERGE-SOURCE: CL 18736993 in //UE5/Release-5.0/... via CL 18737108 via CL 18738215
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18738671 by graham wihlidal in ue5-main branch]
2022-01-26 13:04:40 -05:00
graham wihlidal
7e2bfe1928 Refactored Nanite hardware rasterizer to run as material shaders, allowing for future material graph evaluation of features like world position offset, pixel depth offset, and masked materials.
#rb brian.karis, ben.ingram
[FYI] zach.bethel, rune.stubbe, ola.olsson, andrew.lauritzen, jamie.hayes
#preflight 61ea1e0a1739bb8724e468da

#ROBOMERGE-AUTHOR: graham.wihlidal
#ROBOMERGE-SOURCE: CL 18685715 in //UE5/Release-5.0/... via CL 18685727 via CL 18685735
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v902-18672795)

[CL 18685741 by graham wihlidal in ue5-main branch]
2022-01-20 22:01:51 -05:00
arciel rekman
0c74b967c3 Exclude editor-only shaders from games that don't support a cooked editor.
#rb Josh.Adams, Jason.Nadro
[REVIEW] [at]Josh.Adams, [at]Jason.Nadro
#jira none
#preflight none

#ROBOMERGE-AUTHOR: arciel.rekman
#ROBOMERGE-SOURCE: CL 18647895 in //UE5/Release-5.0/... via CL 18649305 via CL 18649672
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v900-18638592)

[CL 18649956 by arciel rekman in ue5-main branch]
2022-01-18 17:45:43 -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
jon nabozny
305fde1710 GPU Messaging API
#rb ola.olsson
#preflight 613939522d09b900016845b9

#ROBOMERGE-OWNER: jon.nabozny
#ROBOMERGE-AUTHOR: zach.bethel
#ROBOMERGE-SOURCE: CL 17465657 via CL 17913847 via CL 18360942 via CL 18361199
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18361390 by jon nabozny in ue5-release-engine-test branch]
2021-12-02 18:23:59 -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
charles derousiers
13b7992198 Fix hair strands hit proxy and hair strands outline selection.
Hair strands now use the hair visibility output for injecting hitproxy & outline rendering, rather than rendering the hair strands geometry with a default material.

#rb none
#jira UE-130785
#preflight 616ff2c67f15cb000104e48c

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

[CL 17871504 by charles derousiers in ue5-release-engine-test branch]
2021-10-20 07:48:33 -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
jules blok
591e65b42a Merge OpenXR plugin from //UE4/Release-4.27
#rb chris.norden

#ROBOMERGE-SOURCE: CL 17296224 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v861-17282326)

[CL 17296230 by jules blok in ue5-release-engine-test branch]
2021-08-24 19:58:30 -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
christopher waters
87d758486e Moving gathering of shadow primitives to tasks that start before rendering prepass.
#rb Krzysztof.Narkowicz, Zach.Bethel

#ROBOMERGE-SOURCE: CL 17060876 via CL 17061461 via CL 17061467 via CL 17062908
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v850-17047176)
#ROBOMERGE[STARSHIP]: UE5-Main

[CL 17062917 by christopher waters in ue5-release-engine-test branch]
2021-08-04 21:06:07 -04:00
zach bethel
01d907ceef Permanently enable r.DoInitViewsLightingAfterPrepass.
#rb christopher.waters
#preflight 60ff71e9b9c16500014be455

#ROBOMERGE-SOURCE: CL 16965427 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v838-16927207)

[CL 16965430 by zach bethel in ue5-release-engine-test branch]
2021-07-27 00:19:30 -04:00
zach bethel
5ec769f91e RDG Parallel Execution (disabled by default)
- Refactored RDG to support free-threaded execution of passes.
 - Refactored renderer to use specific RHI command list variants in pass lambda. Immediate command list passes are forced to stay on the render thread, while other variants can be parallelized.

#rb christopher.waters

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

[CL 16838724 by zach bethel in ue5-release-engine-test branch]
2021-07-13 12:38:37 -04:00