Commit Graph

29 Commits

Author SHA1 Message Date
graham wihlidal
1b2976b0c9 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
#ROBOMERGE-BOT: (v834-16658389)
#ROBOMERGE-CONFLICT from-shelf

[CL 16660883 by graham wihlidal in ue5-main branch]
2021-06-14 13:42:46 -04:00
ola olsson
5560667259 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
#ROBOMERGE-BOT: (v831-16623017)

[CL 16628539 by ola olsson in ue5-main branch]
2021-06-10 15:46:35 -04:00
andrew lauritzen
c373a4445f Fix depth range precision and offset/clamping issues with VSM cached pages
- Instead, create a reference depth range with a guard band that we reuse frame to frame until we get too close to the edge, at which point we invalidate that clipmap level's cached pages (if any)
- Does not significantly affect invalidations, even when moving quickly near surfaces, since those cases would already get invalidated when those pixels moved to a different clipmap level
- Sets up for not re-copying cached VSM pages every frame

#rb ola.olsson
[FYI] brian.karis

#ROBOMERGE-SOURCE: CL 16492432 in //UE5/Private-Frosty/...
#ROBOMERGE-BOT: STARSHIP (Private-Frosty -> Main) (v823-16466674)

[CL 16492445 by andrew lauritzen in ue5-main branch]
2021-05-27 17:36:27 -04:00
zach bethel
2ab8c34577 Replaced FRDGBufferUploader with internal RDG upload. Removes several transitions and passes and removes immediate command list passes from the graph.
#rb jian.ru

[CL 16459303 by zach bethel in ue5-main branch]
2021-05-25 20:46:17 -04:00
richard wallis
2eef69096c PhysicalPagePool needs to be UInt compatible and PhysicalPagePoolHw needs to be float compatible. Slightly modified version of CL by Andrew Lauritzen after testing on macOS Big Sur.
#jira UE-116080
[REVIEW] [at]Andrew.Lauritzen,  [at]Juan.Canada,  [at]will.damon

#ROBOMERGE-SOURCE: CL 16406023 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v804-16311228)

[CL 16406075 by richard wallis in ue5-main branch]
2021-05-20 13:24:00 -04:00
zach bethel
7c28e71d9e Batch RDG upload passes together to reduce transitions and RDG compilation work.
#rb charles.derousisers, andrew.lauritzen
#jira UE-114621

[CL 16209728 by zach bethel in ue5-main branch]
2021-05-05 13:20:09 -04:00
zach bethel
9fc8b1722d Refactored RDG ConvertToUntrackedX functionality into the RDG builder; renamed the operation to 'FinalizeAccess' for clarity, as the resource is considered finalized in the graph and will not transition to any other state. This operation now supports multiple resources, improving performance in cases where multiple resources are finalized back-to-back. Added validation to check that the user don't attempt to use it outside of its finalized state. Fixed up a few places where this assumption was being violated. Minor refactors in various places to use new API.
#rb arne.schober, christopher.waters
#jira none

[CL 15931331 by zach bethel in ue5-main branch]
2021-04-06 11:45:09 -04:00
andrew lauritzen
b3d0079200 Better naming for different HZBs.
Clean up VSM HZB by moving to previous frame data and removing redundantly exported previous frame page table.
For view contexts with VSM caching "show flag" disabled, also disable HZB so we aren't leaking HZB references out of these graphs either.

#rb graham.wihlidal
[FYI] brian.karis

#ROBOMERGE-OWNER: andrew.lauritzen
#ROBOMERGE-AUTHOR: andrew.lauritzen
#ROBOMERGE-SOURCE: CL 15826082 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v785-15821902)
#ROBOMERGE-CONFLICT from-shelf

[CL 15833868 by andrew lauritzen in ue5-main branch]
2021-03-25 18:19:54 -04:00
ola olsson
d8d9131a1e Add showflag to disable VSM caching for thumbnail scenes to avoid using huge amounts of memory
#rb graham.wihlidal
#preflight 605b41f1d88d2d00019ec060

#ROBOMERGE-SOURCE: CL 15798607 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v783-15756269)

[CL 15807649 by ola olsson in ue5-main branch]
2021-03-24 16:27:31 -04:00
andrew lauritzen
2e95eb31b4 Add cvar for resizing the virtual shadow map physical page pool
Refactoring to clean up some cross-frame resource references and enable more explicit allocations if needed
Allow nanite to take an external depth buffer to write to instead of creating one internally.

#rb ola.olsson

#ROBOMERGE-OWNER: andrew.lauritzen
#ROBOMERGE-AUTHOR: andrew.lauritzen
#ROBOMERGE-SOURCE: CL 15781280 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v783-15756269)
#ROBOMERGE-CONFLICT from-shelf

[CL 15789787 by andrew lauritzen in ue5-main branch]
2021-03-23 21:23:57 -04:00
andrew lauritzen
92b07781d7 Always use compute shader for VSM projection
- Adaptive ray counts for SMRT now work even with pass per light
- Removes a few divergences between the logic in the two paths

Remove debug projection stuff for now; will reimplement with a separate UAV write later

Remove temporal filtering for denoiser (it was broken and would need to be implemented slightly differently with the new path anyways)

Split cvar to allow separate denoiser toggle for directional (default on) and local (default off) lights

Enable SMRT for local lights and VSM caching by default

#rb brian.karis

#ROBOMERGE-OWNER: andrew.lauritzen
#ROBOMERGE-AUTHOR: andrew.lauritzen
#ROBOMERGE-SOURCE: CL 15707229 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v781-15675533)
#ROBOMERGE-CONFLICT from-shelf

[CL 15708180 by andrew lauritzen in ue5-main branch]
2021-03-15 22:06:28 -04:00
andrew lauritzen
9b0a6fab9d Remove complete shadow maps and replace with direct VSM sampling
- Move VSM parameters into a single uniform buffer; required for base pass rendering.
  - SRVs are initialized to dummy data until they are computed during the frame and subsequently updated before any VSM sampling.
  - Make names and usage more consistent with other UB bindings in mesh passes
- Direct injection of VSM into translucent volume and fog
- Support VSM sampling in forward lighting shaders
  - Enabled and bound currently for translucent forward and single pass water meshes
- Support VSM sampling in sky atmosphere and cloud rendering
  - NOTE: Sky atmosphere LUT pass currently executes before BasePass and ShadowDepths so it will not sample proper data and throw a warning. Moving passes around to address this will come in a future commit.

#rb Brian.Karis, Ola.Olsson, Sebastien.Hillaire, Zachary.Bethel

#ROBOMERGE-OWNER: andrew.lauritzen
#ROBOMERGE-AUTHOR: andrew.lauritzen
#ROBOMERGE-SOURCE: CL 15649858 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v779-15635321)
#ROBOMERGE-CONFLICT from-shelf

[CL 15650486 by andrew lauritzen in ue5-main branch]
2021-03-08 23:14:54 -04:00
ola olsson
09532969fe Added (read only) cvar r.Shadow.Virtual.NonNaniteVSM to toggle non-nanite VSM support
#rb Brian.Karis,Andrew.Lauritzen

#ROBOMERGE-SOURCE: CL 15526905 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v771-15082668)

[CL 15526909 by ola olsson in ue5-main branch]
2021-02-25 05:03:27 -04:00
brian karis
43ca1bf181 VSM atomic depth writes
#rb ola.olsson, andrew.lauritzen

#ROBOMERGE-SOURCE: CL 15492121 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v771-15082668)

[CL 15492123 by brian karis in ue5-main branch]
2021-02-22 14:47:36 -04:00
graham wihlidal
200151a3bc Renamed r.Shadow.v.* cvars to r.Shadow.Virtual.* to be more obvious, and also renamed VSM.* resource prefixes to Shadow.Virtual.*
#rb brian.karis
[FYI] ola.olsson, andrew.lauritzen

#ROBOMERGE-SOURCE: CL 15450709 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v771-15082668)

[CL 15454805 by graham wihlidal in ue5-main branch]
2021-02-18 13:44:36 -04:00
graham wihlidal
579f03fbaa Prefixed Nanite and VSM resources so that RDG filtering works nicely.
#rb trivial
[FYI] brian.karis, zach.bethel

#ROBOMERGE-OWNER: graham.wihlidal
#ROBOMERGE-AUTHOR: graham.wihlidal
#ROBOMERGE-SOURCE: CL 15449112 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v771-15082668)
#ROBOMERGE-CONFLICT from-shelf

[CL 15454700 by graham wihlidal in ue5-main branch]
2021-02-18 13:40:42 -04:00
ola olsson
f7822cb8c5 Enable caching for Non-Nanite VSM
- added a path to propagate and cache whether material modifies position (WPO) to enable invalidating cached pages (touches whole mesh command pipeline).
- added pixel shader verision of page copying & clearing.
- also added flag for whether cached the mesh draw command supports primitive id (which enables checing this earlier).

#rb andrew.lauritzen,brian.karis,graham.wihlidal,Krzysztof.Narkowicz

#ROBOMERGE-SOURCE: CL 15436539 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v771-15082668)

[CL 15441336 by ola olsson in ue5-main branch]
2021-02-17 15:32:52 -04:00
Ola Olsson
fd6e6fe42c Fix pathological perf when processing a few large instance ranges to invalidate VSM cache.
#rb rune.stubbe
#rnx

[CL 15155617 by Ola Olsson in ue5-main branch]
2021-01-21 13:38:01 -04:00
Ola Olsson
3b528bb5d5 Move Virtual SM common parameters to a uniform buffer to resolve shader name class issues.
#rb andrew.lauritzen

[CL 15135494 by Ola Olsson in ue5-main branch]
2021-01-19 10:17:05 -04:00
andrew lauritzen
fb0b1d790b Initial shadow map ray tracing support for directional lights
- Disabled by defaul to start. Enable with r.Shadow.v.SMRT.RayCountDirectional 1
- Denoiser will now use temporal reprojection when SMRT is enabled (disable with r.Shadow.v.Denoiser.Temporal 0)
- Variety of fixes and refactors to existing VSM and projection code
- Still a few edge cases that will be improved in future around screen space trace and similar, but working fairly robustly for reasonable light source size settings

#rb ola.olsson
#fyi brian.karis

[CL 14942586 by andrew lauritzen in ue5-main branch]
2020-12-16 17:57:13 -04:00
Krzysztof Narkowicz
f484d3a594 Lumen - implemented virtual shadow map support for shadowing Lumen's surface cache.
#jira none
#rb Andrew.Lauritzen

[CL 14915815 by Krzysztof Narkowicz in ue5-main branch]
2020-12-14 14:39:11 -04:00
Ola Olsson
69d2af54aa Refactored GPU-Scene to store per-view dynamic primitives (for all views) in the one and primitive data buffer, after the regular primitives.
- Added step after dynamic primitives are gathered to allocate a range in GPU scene for the dynamic primitives.
- Moved more GPU-Scene functionality to member functions to clean up references to internal data
- Removed the PrimitiveShaderDataBuffer/Texture from FSceneViewState
- Removed OneFramePrimitiveShaderDataBuffer/Texture from FViewInfo
- Encapsulated the collection of dynamic primitive data for upload to avoid uploading twice and prepare for parallel upload.

#rb Krzysztof.Narkowicz,graham.wihlidal

[CL 14785776 by Ola Olsson in ue5-main branch]
2020-11-19 05:23:44 -04:00
Ola Olsson
a9b6b0e0a8 Refactor virtual shadow maps to remove needless extract and register external of RDG resources.
- Changed (most) intermediate buffers & textures in FVirtualShadowMapArray to RDG buffers/textures
- Removed GenerateIdentityPageTables as it was no longer working.
- Renamed GeneratePageFlagsFromLightGrid -> BuildPageAllocations to better reflect current function.

#rnx
#rb Andrew.Lauritzen

[CL 14693244 by Ola Olsson in ue5-main branch]
2020-11-09 15:47:39 -04:00
zach bethel
f3fb7ddab6 Moved RDG builder to top of Deferred Shading Render function. Ported hit proxy rendering to RDG.
#rb christopher.waters
#jira none

[CL 14589785 by zach bethel in ue5-main branch]
2020-10-27 13:40:36 -04:00
Marcus Wassmer
3b81cf8201 Merging using //UE5/Main_to_//UE5/Release-Engine-Staging @14384769
autoresolved files
#rb none

[CL 14384911 by Marcus Wassmer in ue5-main branch]
2020-09-24 00:43:27 -04:00