Commit Graph

76 Commits

Author SHA1 Message Date
ola olsson
09858c9218 Add filtering of shadow subjects at the proxy level for GPU-Scene supporting primitives (VSM / non-VSM)
- Enables turning off non VSM for more cases.
- Only send primitives with dynamic relevance down the dynamic subject path.
- Optimization: cache IsNaniteProxy flag on FLightPrimitiveInteraction.
- Fix the MaxNonFarCascadeDistance calculation to not include DF cascades.
- Skip SM allocation for uncached SMs without subject primitives.
- Add flag bSupportsGPUScene to FPrimitiveSceneProxy and helper to set up EnableGPUSceneSupportFlags (also turns on bVFRequiresPrimitiveUniformBuffer)
- Add error check to make sure bSupportsGPUScene is not set unless all VFs actually supports GPU-Scene

#rb andrew.lauritzen
#preflight 61af2fe02b3384289ae39e36

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

[CL 18393321 by ola olsson in ue5-release-engine-test branch]
2021-12-07 05:26:32 -05:00
jon nabozny
b27dcfb385 Support for multiple root pages per Nanite resource
Added UI for changing minimum residency
Decoupled imposter data allocation from root page allocation
Removed convoluted logic around a page's dependencies including itself for legacy reasons
Made streaming of imposter data optional (r.Nanite.Streaming.Imposters)
#rb andrew.lauritzen, ola.olsson
#preflight 6163f8f8eaa06c0001e409ee
#lockdown michal.valient

#ROBOMERGE-OWNER: jon.nabozny
#ROBOMERGE-AUTHOR: rune.stubbe
#ROBOMERGE-SOURCE: CL 17770690 via CL 17986013 via CL 18368123 via CL 18368152
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18368223 by jon nabozny in ue5-release-engine-test branch]
2021-12-03 10:01:28 -05:00
jon nabozny
3e478185e0 Moved optional GPU memory over to dynamic payload allocator + various CPU/threading optimizations (avoid expensive contention grabbing per instance render data buffer unless absolutely necessary). Saves upwards of ~222MB GPU memory in Frosty, and ~840MB GPU memory if world partition is disabled (4x more instances loaded).
#rb ola.olsson
#preflight 614a1091286e3b00010e7380
[FYI] brian.karis, rune.stubbe, jason.nadro, krzysztof.narkowicz, andy.firth
#lockdown michal.valient

#ROBOMERGE-OWNER: jon.nabozny
#ROBOMERGE-AUTHOR: graham.wihlidal
#ROBOMERGE-SOURCE: CL 17588680 via CL 17950709 via CL 18364633 via CL 18364726
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18364781 by jon nabozny in ue5-release-engine-test branch]
2021-12-02 23:38:54 -05:00
jon nabozny
1044ec5252 Moved per instance local bounds and Nanite hierarchy offset over to optional sidecar data, and updated all areas to source from the correct data + refactored GPU Scene to populate the new arrays correctly (the only current user of them). Also removed per instance flags in favor of dynamically deriving the important bits on GPU Scene upload. Reduces size of FPrimitiveInstance from 80 bytes down to 48 bytes (single 4x3 float FRenderTransform remains, could be 2x float4s with FCompressedTransform in the future).
#preflight 6138020f25e54000015502f6
#rb brian.karis, krzysztof.narkowicz
[FYI] daniel.wright, ola.olsson, rune.stubbe

#ROBOMERGE-OWNER: jon.nabozny
#ROBOMERGE-AUTHOR: graham.wihlidal
#ROBOMERGE-SOURCE: CL 17488104 via CL 17933105 via CL 18363029 via CL 18363080
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)

[CL 18363108 by jon nabozny in ue5-release-engine-test branch]
2021-12-02 20:49:23 -05:00
aurel cordonnier
a12d56ff31 Merge from Release-Engine-Staging @ 17791557 to Release-Engine-Test
This represents UE4/Main @17774255, Release-5.0 @17791557 and Dev-PerfTest @17789485

[CL 17794212 by aurel cordonnier in ue5-release-engine-test branch]
2021-10-12 21:21:22 -04:00
dmitriy dyomin
eee06e854c Fixed Geometry collection rendering issues on mobile
#jira UE-126462

#ROBOMERGE-AUTHOR: dmitriy.dyomin
#ROBOMERGE-SOURCE: CL 17502442 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v870-17433530)

[CL 17502460 by dmitriy dyomin in ue5-release-engine-test branch]
2021-09-14 05:52:12 -04:00
graham wihlidal
596b78798c Removed per instance Nanite imposter flag and changed code to fetch it from the primitive flags instead. Also removed partially implemented per instance cast shadow flag in favor of the correct one on primitive flags.
#rb rune.stubbe
[FYI] brian.karis
#preflight 6130430317a8610001a7d102

#ROBOMERGE-OWNER: graham.wihlidal
#ROBOMERGE-AUTHOR: graham.wihlidal
#ROBOMERGE-SOURCE: CL 17397605 via CL 17397964
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v865-17346139)

[CL 17397969 by graham wihlidal in ue5-release-engine-test branch]
2021-09-02 00:54:16 -04:00
brett miller
8efa2a42b0 FractureTool
-- implemented HideUnselected mode

#jira UE-121963
#rb brice.criswell
#preflight 6123317d9db7df0001e5e4ff
#p4v-cherrypick 17309979

#ROBOMERGE-SOURCE: CL 17359069 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v865-17346139)

[CL 17359084 by brett miller in ue5-release-engine-test branch]
2021-08-30 17:11:38 -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
brett miller
83478abc70 GeometryCollectionSceneProxy
-- check for existence of PerBoneHitProxy before accessing it

#jira UE-112900
#rb none

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

[CL 16778242 by brett miller in ue5-release-engine-test branch]
2021-06-24 16:38:40 -04:00
graham wihlidal
860e7f89bb De-interleaved dynamic/material/uncommon data from FPrimitiveInstance into separate data streams to reduce CPU memory footprint, and an upcoming change will also de-interleave this data on the GPU, dramatically saving GPU memory/performance, and also optimizing GPU Scene uploads. This is a mid-refactor change with some crufty temporary code in places since the GPU memory is still interleaved, but it should be removed soon.
#rb brian.karis
[FYI] krzysztof.narkowicz, michal.valient, ola.olsson
#preflight 60ca8449634cd100013c3673

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

[CL 16699461 by graham wihlidal in ue5-release-engine-test branch]
2021-06-16 20:44:01 -04:00
graham wihlidal
f602dcf242 Big cleanup/refactor of InstanceData* (renamed to InstanceSceneData* to match many other places already calling it that, and to disambiguate upcoming changes that add another instance data buffer to GPU Scene for arbitrary data payloads). This change also removes the virtuals on FPrimitiveSceneProxy for the instance list along with lots of copy paste code for all the derived types, and instead makes it a built-in feature of the base proxy (since nearly everything supports GPU Scene instancing now).
#rb ola.olsson
[FYI] brian.karis
#preflight 60c4d5c586ce760001377f2a

#ROBOMERGE-OWNER: graham.wihlidal
#ROBOMERGE-AUTHOR: graham.wihlidal
#ROBOMERGE-SOURCE: CL 16660135 via CL 16660883
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v834-16658389)

[CL 16660909 by graham wihlidal in ue5-release-engine-test branch]
2021-06-14 13:43:26 -04:00
ola olsson
d19093164a Tracking GPU-Scene dirty state and specialize Primitive Id only updates to avoid redundant uploads.
- Added instance data validation
- Added general load balancer for instance processing on GPU (will move to own files later)
- Added initial GPU-side write access API for GPU scene.
- Addded specialized kernel to update primitive IDs in instances when that is the only change.

#rb graham.wihlidal
#jira UE-116671
#preflight 60c25d7b1264df0001aab80b

#ROBOMERGE-SOURCE: CL 16628528 via CL 16628539
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v831-16623017)

[CL 16628550 by ola olsson in ue5-release-engine-test branch]
2021-06-10 15:47:04 -04:00
graham wihlidal
0ee0bbe666 Removed LocalToWorld and PrevLocalToWorld from FPrimitiveInstance (instead the concatenating of instance and primitive transforms happens during SoA construction right before GPU Scene upload). In the future we'll also have a custom GPU Scene upload kernel that can do things like the concatentation (among other derivations) right on the GPU, but not affect the hot path of stuff like GetInstanceData(). This change also renames (Prev)InstanceToLocal to (Prev)LocalToPrimitive to make a lot more sense than the previous naming.
#rb ola.olsson, krzysztof.narkowicz, rune.stubbe
[FYI] brian.karis, jason.nadro

#ROBOMERGE-SOURCE: CL 16614552 via CL 16614986
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v828-16531559)

[CL 16615041 by graham wihlidal in ue5-release-engine-test branch]
2021-06-09 19:10:52 -04:00
graham wihlidal
70093e350c Instance data optimization - removed RenderBounds member, and refactored LocalBounds
#rb ola.olsson
[FYI] brian.karis, rune.stubbe, krzysztof.narkowicz

#ROBOMERGE-OWNER: graham.wihlidal
#ROBOMERGE-AUTHOR: graham.wihlidal
#ROBOMERGE-SOURCE: CL 16590738 via CL 16590845
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v828-16531559)

[CL 16590853 by graham wihlidal in ue5-release-engine-test branch]
2021-06-08 15:19:37 -04:00
graham wihlidal
67923137a7 More instance data memory and CPU optimizations, and general refactoring.
* Moved Nanite resource ID and hierarchy offset back to primitive data (indirection cost is largely noise these days, and memory savings is more important - GetInstanceData() fetches this data and stores in the pre-existing registers so all the callsites don't have to worry about it).
* Removed FNaniteInfo from FPrimitiveInfo (and the type itself) in favor of just having a 32bit per-instance hierarchy root offset. Hierarchy offset and runtime resource ID just sourced from primitive.
* Removed PrimitiveID from CPU instance data (GPU still needs it). This value was redundantly stored per-instance, and now the GPU Scene upload just blits it over from primitive when the instance data is uploaded.
* Added new virtual GetNaniteResourceInfo on FPrimitiveSceneProxy that retrieves the Nanite resource ID and hierarchy offset stored on a given primitive (needed now that FPrimitiveInstance doesn't cache a copy). The non-virtual FPrimitiveSceneProxy::IsNaniteMesh() helper is used to avoid this virtual function call for non-Nanite proxies.
* Removed deprecated and no longer referenced Nanite::FResources array on FNaniteGeometryCollectionSceneProxy
* Removed expensive per-instance checks() in a few spots
* Stubbed out upcoming per instance payload allocator offset
* Removed deprecated and never referenced non-GPUScene GetInstanceData uniform buffer path
* Significantly cleaned up and optimized a lot of ISM instance data retrieval, including avoiding unnecessary FRenderTransform <-> FMatrix conversions.
* Removed GetInstanceShaderValues API, it was inefficient and annoying to require retrieval of all parameters when often only one or two of them were ever used. In some cases even the origin was unused but .w was needed because of the per-instance random packing.
* Implemented explicit GetInstanceRandomID() accessor to fetch (under current packing) Origin.W without exposing this to the callsites
* Implemented public API for GetInstanceLightMapData(), since the internal version was only accessible by GetInstanceShaderValues()
* Renamed GetInstanceShaderCustomDataValues() -> GetInstanceCustomDataValues() for API consistency

#rb jason.nadro, krzysztof.narkowicz
[FYI] rune.stubbe, brian.karis


#ROBOMERGE-OWNER: graham.wihlidal
#ROBOMERGE-AUTHOR: graham.wihlidal
#ROBOMERGE-SOURCE: CL 16583156
#ROBOMERGE-BOT: (v828-16531559)
#ROBOMERGE-CONFLICT from-shelf

[CL 16583193 by graham wihlidal in ue5-main branch]
2021-06-07 23:55:28 -04:00
graham wihlidal
c850a02c69 Implemented a new WIP type called FRenderTransform that (for now) represents instance transforms as a float 4x3 matrix - in the future we expect a much tighter per-instance encoding (for example: 12bytes for position, 4bytes for rotation, 6bytes for scale), so this type can be optimized in that direction. Other than saving hundreds of MB in *heavy* instance scenes, faster updates/uploads, etc.. this type could be used to represent a transform that stays 32bit w/ a rebase offset. Passing around ambiguous FVector and FMatrix data is bound to get us into trouble, whereas a concrete type we can reason about for transforms in render-only code makes a good deal of sense.
This change is another basis for more instance data and GPUScene improvements coming down the pipe.

#rb jason.nadro, krzysztof.narkowicz, zach.bethel, zak.middleton, rune.stubbe, ben.woodhouse
[FYI] brian.karis, ola.olsson
#preflight 60b9608d0249c300016598de


#ROBOMERGE-OWNER: graham.wihlidal
#ROBOMERGE-AUTHOR: graham.wihlidal
#ROBOMERGE-SOURCE: CL 16555619
#ROBOMERGE-BOT: (v828-16531559)
#ROBOMERGE-CONFLICT from-shelf

[CL 16555914 by graham wihlidal in ue5-main branch]
2021-06-03 21:10:11 -04:00
jimmy andrews
8a78138782 Add option to use full precision UVs on geometry collection scene proxy
#rb brett.miller, tyson.brochu, david.hill
#preflight 60b6645c5719ca0001388544

#ROBOMERGE-SOURCE: CL 16518423 in //UE5/Private-Frosty/...
#ROBOMERGE-BOT: STARSHIP (Private-Frosty -> Main) (v826-16501804)

[CL 16518431 by jimmy andrews in ue5-main branch]
2021-06-01 14:20:47 -04:00
brett miller
272e3f018e FGeometryCollectionSceneProxy
-- dtor releases DynamicData instead of deleting it.

#jira UE-115064
[FYI] benn.gallagher

#ROBOMERGE-SOURCE: CL 16511485 in //UE5/Private-Frosty/...
#ROBOMERGE-BOT: STARSHIP (Private-Frosty -> Main) (v826-16501804)

[CL 16511488 by brett miller in ue5-main branch]
2021-05-31 22:01:58 -04:00
ola olsson
e3f2a7c297 Removed GPUCULL_TODO define (fixed in on-state)
#preflight 60acc49b58f02e0001a0a996
#rb graham.wihlidal,Arciel.Rekman,Brandon.Schaefer,will.damon

#ROBOMERGE-SOURCE: CL 16446355 in //UE5/Main/... via CL 16446362
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Test -> Release-Engine-Staging) (v816-16445697)

[CL 16446366 by ola olsson in ue5-release-engine-staging branch]
2021-05-25 08:17:18 -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
brett miller
0a87146d26 GeometryCollection
-- Fixed namespace collision

#jira none
#rb none

#ROBOMERGE-SOURCE: CL 16363752 in //UE5/Private-Frosty/... via CL 16370331
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v804-16311228)

[CL 16370369 by brett miller in ue5-release-engine-test branch]
2021-05-18 13:09:00 -04:00
peter knepley
adf949236d GeometryCollection
-- Support for Nanite to GeometryCollection conversion
-- Support for multiple UV sets

#jira UE-114992
#rb jimmy.andrews
[FYI] brice.criswell

#ROBOMERGE-OWNER: peter.knepley
#ROBOMERGE-AUTHOR: brett.miller
#ROBOMERGE-SOURCE: CL 16363667 in //UE5/Private-Frosty/... via CL 16370251
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v804-16311228)

[CL 16370359 by peter knepley in ue5-release-engine-test branch]
2021-05-18 13:08:46 -04:00
brett miller
d603e260ae GeometryCollection
-- Fixed namespace collision

#jira none
#rb none

#ROBOMERGE-SOURCE: CL 16363752 in //UE5/Private-Frosty/...
#ROBOMERGE-BOT: STARSHIP (Private-Frosty -> Main) (v804-16311228)

[CL 16370331 by brett miller in ue5-main branch]
2021-05-18 13:07:36 -04:00
peter knepley
e07885e125 GeometryCollection
-- Support for Nanite to GeometryCollection conversion
-- Support for multiple UV sets

#jira UE-114992
#rb jimmy.andrews
[FYI] brice.criswell

#ROBOMERGE-OWNER: peter.knepley
#ROBOMERGE-AUTHOR: brett.miller
#ROBOMERGE-SOURCE: CL 16363667 in //UE5/Private-Frosty/...
#ROBOMERGE-BOT: STARSHIP (Private-Frosty -> Main) (v804-16311228)
#ROBOMERGE-CONFLICT from-shelf

[CL 16370251 by peter knepley in ue5-main branch]
2021-05-18 13:03:42 -04:00