Commit Graph

1081 Commits

Author SHA1 Message Date
christopher waters
5609090383 Big D3D12Viewport cleanup
- Moved all FD3D12Viewport members to be together.
- Merged the three FD3D12Viewport viewport texture arrays and the mGPU index array into a single array.
- CalculateSwapChainDepth always took in the same count that was given on viewport construction so it was renamed to InitializeBackBufferArrays and NumBackBuffers is now constant per platform.
- Merged D3D11 and D3D12 GetRenderTargetFormat implementations, which were the exact same, into UE::DXGIUtilities::GetSwapChainFormat.
- Renaming D3D12_USE_DUMMY_BACKBUFFER to D3D12RHI_USE_DUMMY_BACKBUFFER since it's not a d3d12.h define.
- FD3D12BackBufferReferenceTexture2D is now only used when D3D12RHI_USE_DUMMY_BACKBUFFER is defined.
- Adding D3D12RHI_USE_SDR_BACKBUFFER to prevent uses of SDR texture pointers when we don't need them.
- Adding D3D12RHI_SUPPORTS_UAV_BACKBUFFER to replace uses of RHISupportsSwapchainUAVs(GMaxRHIShaderPlatform)

#rb Luke.Thatcher, zach.bethel

[CL 32810092 by christopher waters in ue5-main branch]
2024-04-08 18:44:38 -04:00
luke thatcher
b3a74829e0 Remove RHIGenerateMips and RHIRequiresComputeGenerateMips
- Generating mips is now always done via the FGenerateMips helper class in RenderCore, which uses either a pixel or compute shader.
 - OpenGL cannot use these shaders due to lack of support for SRVs that target single mips of a texture resource. As such, the RHIGenerateMips implementation for OpenGL has been kept, but moved to the IOpenGLDynamicRHI interface so that it can be removed from the base RHI contexts, which FGenerateMips makes use of.

Deprecate TexCreate_GenerateMipCapable
 - This flag was only to make D3D11 RHI set the D3D11_RESOURCE_MISC_GENERATE_MIPS flag on texture creation. Since RHIGenerateMips is no longer implemented in D3D11 RHI, the flag is not required.
 - Textures should be created with TexCreate_UAV or TexCreate_RenderTargetable to make them compatible with FGenerateMips.
 - Added checks to FGenerateMips to catch incompatible textures.

#rb christopher.waters

[CL 32792595 by luke thatcher in ue5-main branch]
2024-04-08 10:34:40 -04:00
christopher waters
dd2f49d25c Adding RHIResourceCollection RHI resource type which can store bindless indices in a buffer.
#rb Luke.Thatcher

[CL 32764889 by christopher waters in ue5-main branch]
2024-04-05 13:22:22 -04:00
daniele vettorel
4f1d46c4cc Add GPU memory stats to DX11, share DXGI code between DX11 and DX12, and standardize reporting across platforms.
* In case of multiple GPUs, use the memory information from the one with the largest memory budget.
* Do not crash if the driver does not support querying memory information.
* Only write CSV stats for Windows, where there's a high chance of this information being useful (with a discrete card having dedicated VRAM).

#rb christopher.waters

[CL 32763588 by daniele vettorel in ue5-main branch]
2024-04-05 12:43:34 -04:00
christopher waters
c2d36d891f Removing unused getters from the D3D11 state cache.
#rb jeannoe.morissette

[CL 32763022 by christopher waters in ue5-main branch]
2024-04-05 12:28:28 -04:00
joe kirchoff
88811ab621 Fix or suppress Clang 18 issues, support Intel compiler 2024.1
#jira UE-210910
#rb christopher.waters

[CL 32618000 by joe kirchoff in ue5-main branch]
2024-03-29 13:13:48 -04:00
jason hoerner
296c4faa6e Scene capture cube: Support for automatic mip map generation. Upgraded FGenerateMips API to support generating cube mip maps in both compute and raster code paths. Also needed to fix a spurious error in FRHITextureSRVCreateInfo::Validate.
#rb zach.bethel

[CL 32472183 by jason hoerner in ue5-main branch]
2024-03-25 12:03:28 -04:00
steve robb
8517c776db Added UE_DEPRECATED_HEADER which acts like UE_DEPRECATED and should be placed in headers that should no longer be included.
#rb devin.doucette

[CL 32297380 by steve robb in ue5-main branch]
2024-03-18 07:05:59 -04:00
luke thatcher
5538d91f1f Remove "rhi.ResourceTableCaching" and associated counters in RHIBeginScene / RHIEndScene implementations
- The counters were unused.

#rb Kenzo.Terelst

[CL 32297276 by luke thatcher in ue5-main branch]
2024-03-18 06:55:32 -04:00
william belcher
ee20867fc2 QOL: Deprecate AVEncoder (for removal) and its dependencies (to be moved to plugins)
#rb luke.bermingham
#jira UE-174651
[FYI]

[CL 32265425 by william belcher in ue5-main branch]
2024-03-14 20:30:26 -04:00
bob tellez
99b2de638e [Backout] - CL32236602
[FYI] William.Belcher
Original CL Desc
-----------------------------------------------------------------
Fix: Move creation of FWindowsVideoRecordingSystem away from FWindowsPlatformFeaturesModule constructor

#rb Aidan.Possemiers
[FYI]

[CL 32237646 by bob tellez in ue5-main branch]
2024-03-14 00:42:20 -04:00
will brown
0b34b68dcd [Backout] - CL32235200 - CIS Compile Error
[FYI] William.Belcher
Original CL Desc
-----------------------------------------------------------------
QOL: Deprecate AVEncoder (for removal) and its dependencies (to be moved to plugins)

#rb Luke.Bermingham
#jira UE-174651
[FYI]

[CL 32237625 by will brown in ue5-main branch]
2024-03-14 00:41:57 -04:00
william belcher
800183f55d Fix: Move creation of FWindowsVideoRecordingSystem away from FWindowsPlatformFeaturesModule constructor
#rb Aidan.Possemiers
[FYI]

[CL 32236629 by william belcher in ue5-main branch]
2024-03-13 21:58:00 -04:00
william belcher
d65b075f20 QOL: Deprecate AVEncoder (for removal) and its dependencies (to be moved to plugins)
#rb Luke.Bermingham
#jira UE-174651
[FYI]

[CL 32236597 by william belcher in ue5-main branch]
2024-03-13 21:56:03 -04:00
luke thatcher
8bcaa1fff8 Remove use of SwitchPipeline at the bottom-of-pipe (i.e. during RHI command list execution).
- This was mainly used for bindless descriptor updates, where updates need to be applied to all GPU pipelines.
 - Switching pipeline can change the current active breadcrumb on the new pipeline. Doing this at the bottom-of-pipe is not possible as the start/end breadcrumbs for each command list must be known at dispatch time (before execution / translation).
 - Added EnqueueLambdaMultiPipe which passes an array of RHI contexts to the lambda. This generally replaces the FRHICommandListBase& which is handed down through the platform RHI.
 - EnqueueLambdaMultiPipe may only be called at the top-of-pipe.

Replace RHITransfer[...]UnderlyingResource with RHIReplaceResources on FDynamicRHI / platform implementations
 - Old function was always bottom-of-pipe, so couldn't call EnqueueLambdaMultiPipe. New function takes the RHICmdList and is called at top-of-pipe.
 - All resource types are merged into the same function (currently buffers and raytracing geometry).

Remove use of RHILockBuffer and RHIUnlockBuffer at the bottom-of-pipe
 - Since platform RHIs need to use EnqueueLambdaMultiPipe for buffer locks/unlocks, it is no longer possible to call RHILock/UnlockBuffer at the bottom-of-pipe.
 - Also, buffers locked on parallel translating command lists are broken. Lock/unlock calls RHIThreadFence(true), which flags the command list for single-thread translate, however calling this at the bottom-of-pipe is too late, as the decision to dispatch the command list in parallel has already been made.
 - Added checks in these functions to catch future use.

#rb zach.bethel
#jira UE-208823
[FYI] christopher.waters

[CL 32220227 by luke thatcher in ue5-main branch]
2024-03-13 13:49:59 -04:00
luke thatcher
a329ec3e01 Move the FShaderResourceTable and StaticSlots arrays from platform RHI implementations into the base FRHIShader type
- This data is required by uniform binding code, and was copy/paste across platform RHIs. Moving it to the base RHI type will allow the RHI validation layer to enumerate resources in uniform buffers, which have been opaque up until now.
 - FShaderResourceTable has moved from RenderCore to RHI.
 - UE::RHICore::ApplyStaticUniformBuffers and UE::RHICore::SetResourcesFromTables now only need the shader, since the binding info is stored within it.
 - The serializer functions in shader format modules and platform RHIs have been fixed up to handle the SRT being in the base type. The data format has not changed, so no shader versions need bumping.
 - Removed unnecessary operator == and GetTypeHash functions in some places.

Includes all platforms / RHIs except OpenGL, which will follow in another CL.

#rb Kenzo.Terelst

[CL 31871815 by luke thatcher in ue5-main branch]
2024-02-28 10:47:02 -05:00
luke thatcher
01203093c6 Deprecate:
- FRHITexture2D
 - FRHITexture2DArray
 - FRHITexture3D
 - FRHITextureCube
 - FTexture2DRHIRef
 - FTexture2DArrayRHIRef
 - FTexture3DRHIRef
 - FTextureCubeRHIRef

Replaced with FRHITexture and FTextureRHIRef

These types were unified in UE 5.1 and have been defined via "using" statements to the same underlying texture type for several engine releases.

#rb christopher.waters

[CL 31724002 by luke thatcher in ue5-main branch]
2024-02-22 11:38:35 -05:00
luke thatcher
808b695e4f Replace use of FRHICommandListExecutor::GetImmediateCommandList() with FRHICommandListImmediate::Get()
- Only in places where it is trivially proven the call is only made on the render thread, due to an existing check(IsInRenderingThread()) assert somewhere in the function.
 - FRHICommandListImmediate::Get() itself contains a check(IsInRenderingThread()), so this enforces correct threading, and removes the need for extra checks at the call sites.
 - Remaining uses of FRHICommandListExecutor::GetImmediateCommandList() need investigation. Some may be bugs.
 - Also some changes to make use of the passed-in RHICmdList where possible (e.g. render commands that are given the immediate command list, but call the global getter rather than using the argument they were given).

#rb zach.bethel

[CL 31699633 by luke thatcher in ue5-main branch]
2024-02-21 17:26:04 -05:00
christopher waters
86a646812a Fixing includes in D3D11RHI so that all headers can be included independently.
[CL 31495373 by christopher waters in ue5-main branch]
2024-02-14 17:02:11 -05:00
kenzo terelst
bf282a7ec6 Provide debug name during RHIAsyncCreateTexture2D (otherwise all async created texture had the name RHIAsyncCreateTexture2D)
#jira UE-121439
#rb Luke.Thatcher

[CL 31334796 by kenzo terelst in ue5-main branch]
2024-02-09 07:23:19 -05:00
mihnea balta
95f0ddb37d Fix incorrect rendering in D3D11 and 12 when losing focus in exclusive fullscreen mode.
Slate switches to Windowed Fullscreen when we lose focus, but doesn't explicitly resize the window, so we never call SetWindowPos or ResizeTarget. If the fullscreen swapchain had a lower resolution than the monitor's native resolution, or if the swapchain had been windowed before, we were stretching the backbuffer to that smaller resolution inside the borderless window, instead of covering all of it. ResizeBuffers is not sufficient because it only affects the buffers, not the window. We need to also call ResizeTarget explicitly when dropping out of exclusive fullscreen, to make sure the window is correctly set up.

Vulkan doesn't have this problem because it doesn't support exclusive fullscreen.

#jira UE-203916
#rnx
#rb benjamin.rouveyrol

[CL 31290487 by mihnea balta in ue5-main branch]
2024-02-08 09:41:38 -05:00
jimmy smith
f6e7d5c5c5 Remove PLATFORM_HOLOLENS from Audio
#rb Brian.Chrisman, David.Harvey

[CL 31109342 by jimmy smith in ue5-main branch]
2024-02-01 18:32:13 -05:00
christopher waters
b68c15055f Deprecating IntelMetricsDiscovery and removing its integration from D3D11RHI.
#jira UE-205382
#rb Luke.Thatcher

[CL 31061418 by christopher waters in ue5-main branch]
2024-01-31 15:27:18 -05:00
Luke Thatcher
10cdd4a111 Merging //UE5/Dev-ParallelRendering/... (up to CL 30965645) to //UE5/Main/... (base CL 30962637)
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]
2024-01-29 12:47:28 -05:00
steve robb
f029468598 Fixed up a lot of bool-taking container resize functions to take EAllowShrinking instead.
[CL 30729174 by steve robb in ue5-main branch]
2024-01-19 16:41:35 -05:00