- Old code relied on atomic increments in the RHI_DRAW_CALL_INC / RHI_DRAW_CALL_STATS macros, which is expensive, particularly on platforms with poor atomic performance.
- New system replaces the atomic writes with a context-specific stats structure, which is accumulated by the RHI thread into the global structure.
- Contexts write stat data through a "Stats" pointer on the IRHIComputeContext, which is set automatically by the command list management code. The pointer is replaced whenever a new "draw call category" is pushed, to redirect the counts.
- Also moved some macro definitions around so more of the system can be removed when HAS_GPU_STATS is 0. Removed dependencies on CSV_PROFILER.
Moved Begin/EndFrame, Begin/EndScene, Begin/EndDrawingViewport into the immediate RHICmdList
- They were already immediate-only functions due to a check() they contain.
#rb Zach.Bethel
#preflight 635fed4af97758810b50cb06
[CL 22875455 by luke thatcher in ue5-main branch]
Capturing is disabled if resolution has been reduced, requiring the user to solve memory issues before capturing (by deleting items or reducing resolution). Logic was added so the reflection capture scene data is reset to allow it to shrink, in cases where an OOM had occurred due to resolution -- without this fix, the user would need to restart the editor. And if the resolution has been reduced since captures were taken (some were successfully captured, but then more were added, triggering the OOM logic), excess mips are discarded from the cached data to avoid an assert.
#jira UE-158096
#rnx
#rb mihnea.balta
#preflight 62ee8a7abc175ec68c7c958a
[CL 21297235 by jason hoerner in ue5-main branch]
The specific case we are trying to handle is that D3D12 fails to allocate a texture resource if its size equals or exceeds 4 GB, returning an OOM error, even if plenty of GPU memory is available. The goal is to degrade quality gracefully in the editor rather than crashing, and produce an actionable message otherwise.
#jira UE-158096
#rnx
#rb mihnea.balta
#preflight 62d031598a3c9910d1465bfc
[CL 21091695 by jason hoerner in ue5-main branch]
- Ported remaining ISceneViewExtension calls to RDG.
- Removed several empty override passes being added to the graph.
- Merged two graphs into one.
#preflight 62c4c61a2a05d4f55bd5912f
#rb luke.thatcher
[CL 20971717 by zach bethel in ue5-main branch]
The four places this applies include UEditorEngine::Tick, UGameEngine::Tick, FAdvancedPreviewScene::Tick, and FPreviewScene::UpdateCaptureContents. The last example is called from FBlueprintEditor::Tick and FThumbnailPreviewScene::Tick.
The counter-example is "UEditorEngine::BuildReflectionCaptures", which doesn't appear to be called anywhere from a Tick related function. It's called in startup functions, various commands, and as part of static lighting generation. If we run into further validation errors, we could add a flag to that function to differentiate those cases. Even though there's only one counter-example, I figured it was best to err on the side of not changing behavior of client code that may also be using the function, so by default "bInsideTick" is set to false.
#jira UE-153604
#rb mihnea.balta jason.nadro
#rnx
#preflight 628d89082f2409bc1e08a42e
[CL 20362380 by jason hoerner in ue5-main branch]
* Capture in editor(was +2) and loading from file(+1) added different reference count. The cubemap in use is not marked as delete correctly.
* When a capture is rebuilt, all reference should change to the new capture.
#jira UE-150154
#rb Juan.Canada
#preflight 626ca44eef3968f419d12513
[CL 20008692 by Tiantian Xie in ue5-main branch]
- Refactord 'Finalized Access' feature into a more flexible 'External' vs. 'Internal' access mode per resource toggle.
- Resources can transition between modes multiple times within the graph.
- Supports async compute pipeline.
- Supports queueing of requests to avoid back-to-back helper passes.
- This feature is needed to support conversion of GPU scene buffers.
- Deprecated the ReadOnly and ForceTracking resource flags and added a 'SkipTracking' flag instead.
- Previous semantics were confusing and error prone.
- New model requires a manual flag to tell RDG never to transition a resource.
- This flag is used for read-only dummy resources as an optimization.
- Renamed some of the auxiliary 'FinalizedResource' utilities since the name no longer matches the semantics.
#preflight 6266cc6d0634d0904ce4ba46
[CL 19904734 by zach bethel in ue5-main branch]
* 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]
- Deprecated all the Create functions in FRHITextureDesc
- Added Create functions to FRDGTextureDesc which now derives from FRHITextureDesc instead of just being an alias
- FRHITextureCreateDesc can now be constructed functionally via SetXXX functions that return a reference to the FRHITextureCreateDesc
- Fixed a couple bad uses of FRHITexture*Desc types that should have been using FRDGTextureDesc
#jira none
#rb zach.bethel, luke.thatcher, mihnea.balta
#preflight 623df2e16d39f6b5a057299e
[CL 19516773 by christopher waters in ue5-main branch]
- Converted to RDG.
- Converted mobile to use subresource transitions instead of awkward ping-ponging between render targets.
- Merged duplicate code paths between mobile / desktop.
- Eliminated FReflectionScratchCubemaps singleton in favor of explicit resource marshalling.
#preflight 623cdecc573f51b292c9c84a
#rb christopher.waters
[CL 19513281 by zach bethel in ue5-main branch]
* For thumbnail renderers, the prototype of RenderViewFamily (which is called by all the types of thumbnail renderers) has been changed to take a non-const FSceneView* parameter (so that SetupView can be called on it) and the various GetView functions have been renamed CreateView since it more accurately depicts what the functions do (plus they return the non-const view they've created)
* UGameViewportClient::Draw was calling SetupViewFamily but not SetupView
* Made sure FSceneRenderer::ViewExtensionPreRender_RenderThread is called right before RenderThreadBegin for all code paths
* Made sure view extensions are gathered for all code paths rendering a view family
Note: BeginRenderViewFamily (i.e. game-thread), PostRenderView_RenderThread and PostRenderViewFamily_RenderThread are still not called on the non-standard code paths
#jira UE-140273, UE-140489, UE-139067, UE-140425
#rb sebastien.lussier, rob.srinivasiah
#tests EngineTests (screenshots), editor
#preflight 61fd216ae17efe76d1b49a2d
#lockdown mihnea.balta
#ROBOMERGE-AUTHOR: jonathan.bard
#ROBOMERGE-SOURCE: CL 18884880 in //UE5/Release-5.0/... via CL 18884941 via CL 18885221
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v910-18824042)
[CL 18885607 by jonathan bard in ue5-main branch]
Submitted on behalf of fred.kimberley
#rb andy.davidson
#preflight 61f8700e41414fb013dd4002
#ROBOMERGE-AUTHOR: andrew.davidson
#ROBOMERGE-SOURCE: CL 18801433 in //UE5/Release-5.0/... via CL 18802090 via CL 18821511
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v908-18788545)
[CL 18821594 by andrew davidson in ue5-main branch]