Commit Graph

268 Commits

Author SHA1 Message Date
marc audy
1b8e7f29c4 Rework GPUScene support on mobile platforms.
Platforms that do support uniform buffer objects can now provide batched primitive data through UBO. There is a limit UBO range that can be accessed in shaders, so we group instances into batches that fit into this limit. Switch uses 64KB views, other platfroms16KB views. For each primitive we allocate 512Bytes and 256Bytes for instance. Mobile platforms that do not support UBO will use a desktop version of GPUScene.
There are a few things that still missing: Dynamic mesh passes,  static lighting
#rb ola.olsson, benjamin.rouveyrol

[CL 26354848 by marc audy in ue5-main branch]
2023-06-30 16:34:38 -04:00
zach bethel
aa1b0c680f Deprecated non-command list RHI methods.
- RHICreate{Vertex, Index, Structured}Buffer
 - RHICreate{ShaderResource, UnorderedAccess}View
 - RHIUpdateUniformBuffer
 - Various initialization / locking methods for helper buffer types in RHIUtilities.h

The goal is to continue to force resource creation through command lists to avoid surprises with moving things off the render thread.

#rb christopher.waters

[CL 26183242 by zach bethel in ue5-main branch]
2023-06-22 11:08:27 -04:00
guillaume abadie
1241ede0bf Fixes VisualizeTexture not working with RDG_TEXTURE_ACCESS
#rb trivial
#jira UE-179496
[FYI] zach.bethel

[CL 25950307 by guillaume abadie in ue5-main branch]
2023-06-13 09:57:30 -04:00
tiago costa
5c93e0ec41 Disable AsyncCompute and ParallelExecute when FlushGPU is enabled.
- Previously there was a callback associated with r.RDG.Debug.FlushGPU that tried to disable AsyncCompute however it didn't work because it got reenabled by CVarRDGAsyncComputeSink.

#rb zach.bethel
#preflight 6465eb87317ee2d9d1e25325

[CL 25522735 by tiago costa in ue5-main branch]
2023-05-18 05:34:52 -04:00
aleksander netzel
03b4f30755 Fix RHI validation error for RayTracingSceneBuffer: add missing SRVMask flag.
#rb yuriy.odonnell
#jira UE-184367
#preflight 6453e6ff4574b81df47d50ad

[CL 25338279 by aleksander netzel in ue5-main branch]
2023-05-04 13:29:20 -04:00
christopher waters
6c040372a1 Minor dependency cleanup in RenderGraphBuilder.
#preflight 644944a7401d328ad908ff40

[CL 25203033 by christopher waters in ue5-main branch]
2023-04-26 13:58:21 -04:00
graham wihlidal
0fb04c0a8f Added CVar to RDG to control whether to enable expensive RDG validation in development builds (on by default).
#ushell-cherrypick of 24664569 by zach.bethel
#lockdown michal.valient
#rb graham.wihlidal, yuriy.odonnell
#preflight skip

[CL 24701530 by graham wihlidal in ue5-main branch]
2023-03-17 23:05:14 -04:00
zach bethel
becb452460 Fixed RHI validation error in virtual textures due to underlying physical textures not being transitioned to SRV.
#preflight 640faa0b3c2db400299ee0ab
#jira UE-173893
#rnx
#rb mihnea.balta
#lockdown mihnea.balta

[CL 24641083 by zach bethel in ue5-main branch]
2023-03-14 14:44:43 -04:00
luke thatcher
984a0bba79 Fix RHI validation layer error in SkeletalRenderGPUSkin.cpp
- MorphVertexBuffer was not in UAV state before being cleared with RHIClearUAVUint.

Fix RDGImmediate not uploading buffers if no render passes were enqueued.
 - Also remove stray debug string compare / debug break

#rb Zach.Bethel
#jira MH-8828
#preflight 64023e2aa726961ed9d598fe

[CL 24507908 by luke thatcher in ue5-main branch]
2023-03-03 17:05:15 -05:00
zach bethel
7ef5721365 Fixed race condition with RDG setup tasks and buffer creation callbacks.
#preflight trivial

[CL 24428159 by zach bethel in ue5-main branch]
2023-02-27 13:47:56 -05:00
zach bethel
15d39e7bd3 Always dispatch RHI thread in RDG BeginFlushResourcesRHI. Avoids a CPU induced stall when flushing the RHI thread.
#preflight trivial

[CL 24292145 by zach bethel in ue5-main branch]
2023-02-17 17:02:47 -05:00
christopher waters
1f21b73b25 Ran IWYU on RHI and RenderCore, private only.
#preflight 63d358c85c69f453c1f79c37

[CL 23889591 by christopher waters in ue5-main branch]
2023-01-27 14:54:10 -05:00
zach bethel
5fc7d77efc Fix for memory leak in transient allocator due to RDG async compute producer -> graphics consumer fence where the consumer was culled. This caused the passes resources to not be traversed and EndResourcesRHI was not called, resulting in a leak of the underlying memory.
- Fixed incorrect accumulation of reference counts when RDG culling is disabled but parallel setup is enabled.
 - Added assert to catch bad referencing counting in the future, which will be easier to debug than a leak.

#preflight 63d063d5f2318350a2bd6071
#jira UE-173062

[CL 23841216 by zach bethel in ue5-main branch]
2023-01-24 18:24:36 -05:00
jason hoerner
38521eae14 Multi-GPU: strip out Alternate Frame Rendering (AFR). Michal Valient requested this for 5.2. AFR has heavily decayed in 5.0, not supporting Lumen, Nanite, VSMs. and likely other newer features, and it's impossible even in principle to get most of those features to ever work in a performant way, due to their temporal nature. Removing this lowers maintenance and support costs for MGPU going forward.
A lot of files touched, but generally it's a mechanical matter of removing the global variable GNumAlternateFrameRenderingGroups, and treating all code using it as if it's a fixed constant of one.  If a conditional becomes always false, the code block is removed.  Certain utility functions only called from dead stripped AFR code are then removed (e.g. RHIBroadcastTemporalEffect).  On the D3D11 side, RHIBeginUpdateMultiFrameResource / RHIEndUpdateMultiFrameResource become NOPs (return at the top of the function) when GNumAlternateFrameRenderingGroups is 1, so those are removed across the board.

#jira none
#rb jason.nadro
#preflight 63cea0afb91ac945f5117110

[CL 23820752 by jason hoerner in ue5-main branch]
2023-01-23 15:30:48 -05:00
jason hoerner
b7d1627e22 MGPU: Crash when moving camera on CitySample startup map. Crash was caused by FRHICommandListBase::SwitchPipeline calling ParameterBatcher.FlushAllParameters outside the SCOPED_GPU_MASK for the Pass, and thereby running on all GPUs as opposed to just the view's GPU. Fix is to make it so FRHICommandListScopedPipeline is inside the GPU mask scope.
#jira UE-173849
#rnx
#rb zach.bethel
#preflight 63c9eaed977c626356d0dc03

[CL 23785049 by jason hoerner in ue5-main branch]
2023-01-19 21:10:19 -05:00
wouter dek
b0bd284033 Add ConvertUniformBufferToExternal to allow RDG UBs to be used in non-RDG contexts (e.g. RT pipeline)
#rb zach.bethel, ola.olsson
#preflight 63c7d0372a6acaf162f8a691

[CL 23753417 by wouter dek in ue5-main branch]
2023-01-18 06:10:35 -05:00
zach bethel
5e756befaa Fixed RDG setup tasks to sync prior to launching buffer uploads.
#preflight trivial

[CL 23739283 by zach bethel in ue5-main branch]
2023-01-17 11:36:40 -05:00
Josie Yang
9726e5c9fb Add RHI resource owner name tracking to RDG buffers used by hair plugin.
#rb Charles.deRousiers, zach.bethel
#jira UE-167816
#preflight 63c1a0672e714f64ad28b52f

[CL 23736020 by Josie Yang in ue5-main branch]
2023-01-17 05:44:27 -05:00
zach bethel
b852db62b9 Added RHI resource lifetime scopes which defer deletion of unreferenced resources until all scopes are closed.
The RDG builder holds a scope in order to avoid deletion of any resources during the graph setup / execution. This resolves the need to hold a strong reference during the RDG graph lifetime.

If FlushPendingDeletes is called within one of these scopes, the resources are instead queued onto the immediate command list and flushed at the end of the scope.

This change removes strong references held of uniform buffers held by RHI commands and certain platform contexts. When a flush is encountered, the backends will clear all caches removing any potential dangling references.

Resources can opt out of lifetime extension by calling ->DisableLifetimeExtension(). Subsequent calls to FlushPendingDeletes will release the resource immediately. This is used by a couple edge cases where resources must be deleted mid-frame (namely, DumpGPU and BVH building).

#rb christopher.waters
#preflight 63c5e5722e714f64ad017cfd

[CL 23734079 by zach bethel in ue5-main branch]
2023-01-16 19:13:49 -05:00
Kenzo Terelst
d2f1a92b2f Fixes to make ray tracing dynamic geometry and TLAS builds on async compute again
#jira UE-168252
#rb Luke.Thatcher, Zach.Bethel
#preflight 635a782ed86d91ca2c3ca925
#rnx

[CL 23625138 by Kenzo Terelst in ue5-main branch]
2023-01-10 06:28:18 -05:00
danny couture
2c5090a518 Fix assert in IsInActualRenderingThread() by using an optional tag instead of replacing the renderthread one
#rnx
#rb Zach.Bethel
#preflight 63855306766a2aeed2c51ee5

[CL 23300853 by danny couture in ue5-main branch]
2022-11-28 19:51:10 -05:00
zach bethel
395c776305 Added CVar to RDG to control whether to use async destruction task.
[REVIEW] [at]mickael.gilabert, [at]john.huelin
#ushell-cherrypick of 23297379 by zach.bethel

#localization none
#tests manual

[CL 23300654 by zach bethel in ue5-main branch]
2022-11-28 19:30:42 -05:00
kenzo terelst
aa561403f4 Flush the ParallelPassCandidates set when changing the force bParallelTranslate flag
[REVIEW] [at]mihnea.balta, [at]luke.thatcher, [at]ben.woodhouse
#rb Luke.Thatcher

#localization none
#tests reprod and fixes issue and ran a few replays without any others issues. perf improvements are still there when nanite parallal translate is enabled again via cvar

[CL 23227981 by kenzo terelst in ue5-main branch]
2022-11-21 17:17:05 -05:00
luke thatcher
854e9e8e16 Manual merge of 23164565 to resolve robomerge conflict. Original CL desc:
Move nanite programmable raster command list build to parallel translate tasks to offload RHI thread on PC

[REVIEW] [at]yuriy.odonnell, [at]zach.bethel, [at]luke.thatcher, [at]mihnea.balta
#localization none
#tests ran local replay and compared perf with it on and off and saves around 3 to 4 msec on rhi thread

[CL 23227976 by luke thatcher in ue5-main branch]
2022-11-21 17:16:53 -05:00
zach bethel
df1568434e Optimized RDG async compute fence computation.
#preflight 636d34ef1c14fe4505fdfc0e
#jira none

#ushell-cherrypick of 23068227 by zach.bethel

[CL 23101437 by zach bethel in ue5-main branch]
2022-11-11 13:21:11 -05:00