- SRVNonPixel is needed by mobile to insert a barrier between fragment -> vertex texture fetch, but since this is a heavyweight barrier, it is opt-in with SHADER_PARAMETER_RDG_NON_PIXEL_SRV.
- Small refactor to FRDGTextureAccess to allow for arbitrary subresources, as the current model only allows full resource transitions.
#rb mihnea.balta, luke.thatcher, serge.bernier
#jira UE-211883
[CL 33179861 by zach bethel in ue5-main branch]
- RDG uses its own breadcrumb allocator for RDG scopes. When the graph executes, this allocator is attached to the parent one owned by the immediate command list.
- Later, when a pass makes use of the immediate command list, a new breadcrumb is inserted on that command list's allocator, which gets reattached to the RDG allocator, forming a circular reference.
- The circular reference causes a memory leak, and a crash on shutdown when the underlying mempage allocators are destroyed.
- The reference only occurs in bypass mode, and when platform RHIs skip the DispatchToRHIThread inside FRDGBuilder::BeginFlushResourcesRHI().
- Fix is to swap out the immediate command list's allocator for the RDG one when the graph executes. This is now done in FRHICommandListBase::AttachBreadcrumbSubTree(...).
Also added RHI validation to check for circular references in the RHI breadcrumb allocators.
#jira UE-212035
#rb mihnea.balta
[CL 33101846 by luke thatcher in ue5-main branch]
- Extended RHI[Begin|End]OcclusionQueryBatch to support timestamp queries, and renamed to RHI[Begin|End]RenderQueryBatch
- The GPU profiler starts a query batch in BeginFrame, which persists on the immediate command list until EndFrame.
- RDG forwards the current batch to the parallel command lists it creates.
- Platform RHIs use the active batch to group completion events / sync points to reduce overhead. If no batch is active, they fall back to how they worked before, creating individual sync points per query.
#rb christopher.waters
[CL 32763061 by luke thatcher in ue5-main branch]
- Replaced with range iteration of set bits, using MakeFlagsRange().
- Results in better code gen.
#rb zach.bethel
[CL 32049770 by luke thatcher in ue5-main branch]
- Async compute resources are able to alias with each other on the async compute pipe.
- Added r.RDG.AsyncComputeTransientAliasing and GRHIGlobals.SupportsAsyncComputeTransientAliasing to control at runtime and per-platform, respectively.
- Offload D3D12 create placed resource calls to tasks.
- Placed resource creation in D3D12 is very expensive relative to other platforms.
- Fixed tracking of transient memory on platforms that support virtual pages.
- Added more debug information to RDG insights.
- Refactored D3D12 barrier implementation to support acquire / discard operations on async compute.
#jira UE-198603
#rb Luke.Thatcher
[CL 32042201 by zach bethel in ue5-main branch]
- Back compatible with legacy 16 bit insights traces.
- Fixed SkipTracking validation to not check states to allow for writable access.
[CL 32025670 by zach bethel in ue5-main branch]
These UAVs need to be handled as UINT, not float. Also fixed some undefined float to int type casting in the function which was computing the integer clobber value.
#jira UE-207822
#rnx
#rb zach.bethel
[CL 31912873 by mihnea balta in ue5-main branch]
* Visualize texture system starts out in an inactive state until a command is issued, avoiding overhead of tracking views and scene textures, saving 1.4% on the render thread.
* Visualization overhead eliminated for views besides the one currently being visualized.
* Support for visualization of textures from scene captures, via "view=N" option (specifying the unique ID of the view), with "view=?" displaying a list of views for reference.
* Improved visualization for cube maps. PIP uses 2:1 aspect for the longitudinal render to match resource viewer display, and pixel perfect option shows tiled flat cube map faces (actual pixels) rather than running a projection.
* Padding for scene or screen pass textures is removed in the visualization -- the padding otherwise shows up as garbage or blank space.
To remove scene texture padding, it's necessary to add a field to RDG textures to provide an option to track the viewport sizes that were rendered for a given texture. If not set, the assumption is the whole texture was rendered. The field is set for FSceneTextures and FScreenPassTexture, covering the vast majority of cases, plus the denoiser was spot fixed -- worst case if any other cases are missed, you still see the padding. You can tell padding was present when visualizing by contrasting the texture size with the viewport size.
Padding was always a potential issue for the visualizer, but is exacerbated by scene captures, as the padded scene textures are set to a size that's a union of the main view and any scene captures. Padding is also exacerbated by dynamic resolution scaling, as the buffers will be padded to the maximum resolution. For example, a cube map rendering at 512x512 will have 93% of the pixel area as padding if the front buffer is at 1440p, or the default dynamic resolution setup will have 70% of the pixels as padding at minimum res.
#rb Jason.Nadro
[CL 31160232 by jason hoerner in ue5-main branch]
Significant refactor of RHI command list management and submission, and RHI breadcrumbs / RenderGraph (RDG) scopes, to allow for parallel translation of most RHI command lists.
See individual changelists in //UE5/Dev-ParallelRendering for details. A summary of the changes is as follows:
This work's primary goal was to allow as many RHI command lists as possible to be parallel translated, to make more efficient use of many-core systems. To achieve this:
- The submission code paths for the immediate and parallel RHI command lists have been merged into a single function: FRHICommandListExecutor::Submit().
- A "dispatch thread" (which is simply a series of chained task graph tasks) is used to decide which command lists are batched together in a single parallel translate job.
- Individual command lists can disable parallel translate, which forces them to be executed on the RHI thread. This happens automatically if an RHI command list performs an operation that is not thread safe (e.g. buffer lock, or low-level resource transition).
One of the primary blockers for parallel translation was the RHI breadcrumb system, and the way RDG builds scopes. This was also refactored to remove these limitations:
- RDG could only push/pop events on the immediate command list, which resulted in parallel and immediate work being interleaved, breaking any opportunity for parallelism.
- Platform RHI implementations of breadcrumbs (e.g. in D3D12 RHI) was not correct across multiple RHI contexts. Push/pop operations aren't necessarily balanced within any one RHI context given that RDG builds "parallel pass sets" containing arbitrary ranges of renderer passes.
A summary of the new RHI breadcrumb system is as follows:
- A tree of breadcrumb nodes is built by the render thread and RDG. Each node contains the node name, and pointers to the parent and next nodes. When fully built, the nodes form a depth-first linked list which is used for traversing the tree for GPU crash debugging.
- The memory for breadcrumb nodes is provided by ref-counted allocator objects. These allocators are pipelined through the RHI, allowing the platform RHI implementation to extend their lifetime for GPU crash debugging purposes.
- RHIPushEvent / RHIPopEvent have been removed, replaced with RHIBeginBreadcrumbGPU / RHIEndBreadcrumbGPU. Platform RHIs implement these functions to perform GPU immediate writes using the unique ID of each node, for tracking GPU progress.
- Format string arguments are captured by-value to remove the cost of string formatting while building the breadcrumb tree. String formatting only occurs when the actual formatted string is required (e.g. during GPU crash breadcrumb stack traversal, or when calling platform GPU profiling APIs).
RenderGraph scopes have been simplified:
- The separate scope trees / arrays of ops have been combined. There is now a single tree of RDG scopes containing all types.
- Each RDG pass holds a pointer to the scope it was created under.
- BeginCPU / EndCPU is called on each RDG scope as the various RDG threads enter / exit them. This allows us to mark-up each worker thread with the relevant Unreal Insights scopes.
Other changes include:
- Fixes for bugs uncovered when parallel translate was enabled.
- Adjusted platform affinities necessary due to the new layout of thread tasks in the renderer.
- Refactored RHI draw call stats to better fit the new pipeline design.
#rb jeannoe.morissette, zach.bethel
#jira UE-139543
[CL 30973133 by Luke Thatcher in ue5-main branch]