Commit Graph

190 Commits

Author SHA1 Message Date
graham wihlidal
71433246a0 Optimized Nanite visibility buffer clear - more efficient compared to the built in RHI clear, only clears the active portion of the screen according to dynamic resolution scaling, and batches up the debug view clears when view modes are active (2x faster for the retail game case, much more for the view mode case). Also fixed the "Nanite VisBuffer" stat gpu timer to exclude emit depth targets, and the unrelated HZB build.
#rb brian.karis
[FYI] rune.stubbe, ben.woodhouse, guillaume.abadie
#preflight skip

[CL 22803512 by graham wihlidal in ue5-main branch]
2022-10-26 23:19:17 -04:00
wouter dek
5a8597c521 Make Scene parameter of UploadDynamicPrimitiveShaderDataForView a reference to indicate this must be non-null
#jira FORT-524539
#rb ola.olsson
#preflight 634d0f0e181aa2a00d689ec6

[CL 22561585 by wouter dek in ue5-main branch]
2022-10-17 08:43:09 -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
graham wihlidal
f5db74a4dc Nanite CPU material culling to avoid unnecessary CPU and GPU overhead from numerous empty raster and shading dispatches/draws (content/view dependent).Also minor CPU optimization to deferred pipeline registration on the Nanite draw lists.
#rb ola.olsson, brian.karis
[FYI] rune.stubbe, yuriy.odonnell, zach.bethel
#preflight 631b6b31354826f8b3af2f0a

[CL 21930882 by graham wihlidal in ue5-main branch]
2022-09-09 19:17:31 -04:00
henrik karlsson
20d697fca2 [Engine]
* Brought back change 18252134 that included hitproxy shaders in all pc builds (to fix UEFN object selection/move). Description from cl below:


Removed editor-only flag test from the hit-proxy shader
This test was added in UE5 (see CL# 15606718) and has resulted in cooked editors having a stubbed version of this shader, which breaks hit-testing in the editor viewport (along with some other things, like selection outlines).
This is a quick-fix to restore the old UE4 behavior while we can investigate a proper fix for editor-only shaders in cooked editors.
#preflight 6192e2c11c373afe378d49b6
[REVIEW] [at]Jason.Stasik [at]Josh.Adams [at]Arciel.Rekman
#localization none
#tests preflight min build to verify fix

#ROBOMERGE-AUTHOR: henrik.karlsson
#ROBOMERGE-SOURCE: CL 21259080 via CL 21292682 via CL 21292782 via CL 21292833
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v972-20964824)

[CL 21296364 by henrik karlsson in ue5-main branch]
2022-08-09 15:42:28 -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
Wei Liu
06c9a5c84e 1. Remove all flip-y completely and only flip y at the end on androidl GL with a native window api, no need to handle flip-y on high level.
2. Supports CustomDepth in translucency pass on mobile LDR.

#jira none

#rb Dmitriy.Dyomin
#preflight 62be9894d94b57687c68aed1

[CL 20911586 by Wei Liu in ue5-main branch]
2022-07-01 03:38:17 -04:00
zach bethel
34623f0321 Replaced thread-local MemStack with ConcurrentLinearAllocator across the renderer.
- Removed scene render mem-mark among others. MemStack usage is now restricted to local scopes with known marks.
 - Render resources with destructors are allocated using the FSceneRenderingBulkObjectAllocator on FSceneRenderer, which is deleted when the scene render is.

#preflight 62b266e20d4d6228de97babe
#rb mihnea.balta, yuriy.odonnell

[CL 20907647 by zach bethel in ue5-main branch]
2022-06-30 19:55:24 -04:00
zach bethel
c9314c30fc Moving scene texture config and parameters into the engine library.
#preflight 62b2698cda272a658f705436
#rb kenzo.terelst

[CL 20775117 by zach bethel in ue5-main branch]
2022-06-22 11:27:45 -04:00
Wei Liu
e2116307da Fix a bug of resolving MSAA texture on IOS.
#jira none

#rb Dmitriy.Dyomin, Will.Damon
#preflight 62b27477ec5ee485eb718b82

[CL 20769627 by Wei Liu in ue5-main branch]
2022-06-21 22:04:03 -04:00
tyler staples
d59910a543 Debug Hud - Stat rendering optimizations
This cuts the cost of DrawStatsHUD by about half.

+ Remove implicit conversions from large world coords to floats by explicitly using float vector types.
+ Draw text effects (shadow, outline) in same pass as main text draw to avoid calling draw several times.
+ Updated the CharacterList to cache the FCharacterEntry's directly to avoid creation/copying of them.
+ Removed direct index cache from CharacterList as it didn't actually make it faster due to the complex logic when getting a character.
+ Updated FBatchedElements::AddVertex to takes float vectors to avoid expensive LWC conversions.

#rb matt.kuhlenschmidt, jamie.dale, simon.orr, patrick.boutot

#ROBOMERGE-AUTHOR: tyler.staples
#ROBOMERGE-SOURCE: CL 20765058 via CL 20765076 via CL 20765114 via CL 20765243 via CL 20765331
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v970-20704180)

[CL 20767653 by tyler staples in ue5-main branch]
2022-06-21 19:02:15 -04:00
jason hoerner
6144ebf450 Scene renderer no longer contains multiple view families. Instead, multiple view families are handled by creating multiple scene renderers, which are added to a linked list with the first scene renderer as the list head. This more or less reverses CL 19813996, while preserving the optimizations gained from having knowledge of multiple scene renderers. This includes deferring cross GPU resource transfer waits to the last scene render, running ray tracing scene update once, and only flushing resources once. Future optimizations and bug fixes may take advantage of additional information from other scene renderers.
The refactor to get rid of the FSceneTextures and FSceneTexturesConfig global singletons has also been preserved.  The FViewFamilyInfo is used to hold those structures, so client facing API functions that lack a scene renderer reference can still pull the FSceneTextures[Config] from the view family pointer.  All other scene renderer state has been moved from FViewFamilyInfo back into FSceneRenderer.

#jira none
#rnx
#rb ola.olsson krzysztof.narkowicz zach.bethel
#preflight 629f770e233ae0a8f8fb7f2e

[CL 20540730 by jason hoerner in ue5-main branch]
2022-06-07 13:19:54 -04:00
jamie hayes
8925dc289a Fix for crash that would occur when setting the Preview Render Level to SM5 after successfully rendering SM6.
#jira UE-155257
#preflight 6297d991b5519e984b431d93

[CL 20459664 by jamie hayes in ue5-main branch]
2022-06-01 17:31:16 -04:00
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