1026 Commits

Author SHA1 Message Date
mihnea balta
e829956026 Deprecate IDXGISwapchainProvider::GetName and replace it with GetProviderName, because due to an unfortunate overshight, the previous method returned a TCHAR* instead of a const TCHAR*.
#jira none
#rb trivial

[CL 26806864 by mihnea balta in 5.3 branch]
2023-08-03 08:27:00 -04:00
Juan Portillo
e29869812e Fix issue with XAudio2 dll expecting ref count to increment when GetDllHandle not doing so if the dll is already loaded
#jira none
#rb Brian.Chrisman

[CL 26510739 by Juan Portillo in 5.3 branch]
2023-07-21 10:27:25 -04:00
christopher waters
e081123c3c Working on making Texture and Buffer memory accounting consistent
- Renaming GRHIGlobals.CurrentTextureMemorySize to GRHIGlobals.StreamingTextureMemorySizeInKB
- Renaming GRHIGlobals.CurrentRendertargetMemorySize to GRHIGlobals.NonStreamingTextureMemorySizeInKB
- Adding GRHIGlobals.BufferMemorySize and GRHIGlobals.UniformBufferMemorySize
- Deduplicating RHI stat accounting code and changing it to use RHI Descs.
- UE::RHICore::UpdateGlobalTextureStats is for StreamingTextureMemorySizeInKB and NonStreamingTextureMemorySizeInKB. This still allows platforms to control where the memory is counted.
- Adding more Buffer RHI stat accounting code to RHIs that were missing it.
- UE::RHICore::UpdateGlobalBufferStats is for BufferMemorySize and UniformBufferMemorySize.
- FillBaselineTextureMemoryStats initializes and fills the common members of FTextureMemoryStats.
- Adding ETextureCreateFlags::ForceIntoNonStreamingMemoryTracking which will force the texture to be counted in NonStreamingTextureMemorySizeInKB.
- Changing all RenderTargetPool textures to be flagged with ETextureCreateFlags::ForceIntoNonStreamingMemoryTracking so they aren't counted against streaming budgets.
- Adding UAV Texture stats instead of lumping them with regular textures
- Adding Buffer stats for ByteAddressBuffer, DrawIndirect and Misc

#jira UE-188415
#rb mihnea.balta, zach.bethel

[CL 26158700 by christopher waters in 5.3 branch]
2023-06-21 15:26:22 -04:00
zach bethel
c716a9d71b Deprecated InitRHI() in favor of InitRHI(FRHICommandListBase&).
#rb mihnea.balta, luke.thatcher, christopher.waters

[CL 26097154 by zach bethel in 5.3 branch]
2023-06-19 14:00:50 -04:00
henrik karlsson
562dc45ab9 [Engine]
* Moved dllexport from type to methods/staticvar in all Engine runtime code. This improves compile times, memory and performance in dll builds

[CL 26082288 by henrik karlsson in 5.3 branch]
2023-06-17 18:14:12 -04:00
henrik karlsson
2b09e81ebe [Engine]
* Changed type dllexport to method/staticvar dll export. Various changes for code that upgrade script get wrong

[CL 26082078 by henrik karlsson in 5.3 branch]
2023-06-17 16:59:11 -04:00
mihnea balta
f5a7f3f0f2 Add support for volumes and texture arrays in FRHIGPUTextureReadback.
#jira UE-185652
#rnx
#rb Luke.Thatcher

[CL 26037116 by mihnea balta in 5.3 branch]
2023-06-16 01:59:29 -04:00
zach bethel
a9a5fa39db Deprecated non-command list variant of InitResource and UpdateResource. Patched the engine to pass command lists through. Follow-up CL's will refactor individual locations to thread command lists through the various callstacks, but that was done very judiciously in this CL to reduce risk.
#rb mihnea.balta, christopher.waters

[CL 25953623 by zach bethel in ue5-main branch]
2023-06-13 11:46:40 -04:00
christopher waters
fe8ca2a9f9 Making sure we wait on Aftermath to finish processing GPU crash dumps before we force quit.
#rb mihnea.balta

[CL 25902295 by christopher waters in ue5-main branch]
2023-06-09 15:48:48 -04:00
zach bethel
6d657e92f1 Resubmitted InitDynamicRHI refactor with fixes for startup initialization.
[CL 25897584 by zach bethel in ue5-main branch]
2023-06-09 12:58:33 -04:00
zach bethel
f0efa3cf35 Undo refactor of InitDynamicRHI as there is a memory leak.
[CL 25872730 by zach bethel in ue5-main branch]
2023-06-08 11:34:52 -04:00
zach bethel
f84151acfa Deprecated {Init, Release}DynamicRHI in favor of just {Init, Release}RHI.
#rb luke.thatcher, christopher.waters, mihnea.balta

[CL 25859166 by zach bethel in ue5-main branch]
2023-06-07 17:33:37 -04:00
christopher waters
2f8dde07be D3D build script cleanup:
- Removed unnecessary virtuals.
- HeadMountedDisplay include paths were public but only needed to be private.
- Core and RHI need to be public dependencies.
- Formatting cleanup.

[CL 25792718 by christopher waters in ue5-main branch]
2023-06-05 11:12:33 -04:00
zach bethel
6cef8be37e Moved RHI view and ray tracing geometry creation to support non-immediate command lists.
#preflight 6467f3cccb141b29df90222c
#rb luke.thatcher

[CL 25743163 by zach bethel in ue5-main branch]
2023-06-01 17:25:42 -04:00
christopher waters
523ee6df6d Adding a fast path for shader parameter unsets, or "Unbinds"
- FRHIBatchedShaderUnbinds acts like FRHIBatchedShaderParameters but doesn't need to collect pointers.
- The context code can also avoid any attempts to access the resource since we know it's always null.
- This change will let us easily remove Unbinds for RHIs that won't need them in the future, aka after the parameter batching is done once per draw.
- This addresses the bulk of unbind performance regressions but there is still some a minor regression in the single unbind case.

#jira UE-186381
#rb jeannoe.morissette
#preflight 646d3ec9f85111e06c4b696f

[CL 25622480 by christopher waters in ue5-main branch]
2023-05-25 11:49:17 -04:00
christopher waters
e454a66f90 Adding interfaces for VerifyD3D11/12Result. These should go through the RHI interfaces to ensure the user is running the same RHI they're calling.
#jira none
#rb elizabeth.baumel
#preflight 6466753ba133ca477bdd2fe8

[CL 25545983 by christopher waters in ue5-main branch]
2023-05-19 12:02:52 -04:00
christopher waters
966d36ba92 Changing D3D11 global constant buffer updating to be more flexible with its efficient uploading.
When global constant buffers are updated with pending data, only PS and VS were trying to upload to smaller buffers to avoid the overhead of a full copy. This set of smaller buffers was hardcoded which was causing performance regressions when the max constant buffer size was increased.
This change extends the sub buffer allocations to all shader stages and makes it more flexible on the subbuffer count when the max constant buffer size changes.
Increased the Max constant buffer size in D3D11 to 16*4096 from 2*4096.
Changed the D3D11 VSConstantBuffers/PSConstantBuffers/etc from an array of 1 to single pointers.
Removed a number of unnecessary variables from the constant buffer code.

#jira UE-182587
#rb mihnea.balta, stu.mckenna
#preflight 6462ab47cf788a25584d1e3b

[CL 25481457 by christopher waters in ue5-main branch]
2023-05-15 18:14:44 -04:00
christopher waters
7d21fa901f Minor platform cleanup.
#preflight 6462a9ad592448f08be0319e

[CL 25481384 by christopher waters in ue5-main branch]
2023-05-15 18:11:10 -04:00
christopher waters
5b751e83bd Cleaning up more platform code.
#jira UE-185135
#rb robert.srinivasiah
#preflight 64628533aa3c584c0b0af08d

[CL 25480257 by christopher waters in ue5-main branch]
2023-05-15 16:56:55 -04:00
mihnea balta
5c24794294 Fix crashes caused by processing the deferred deletion queue at the wrong time, especially when running without an RHI thread.
Since FRHICommandListImmediate::ImmediateFlush() was calling FlushPendingDeletes() after executing the current list of commands, the lambda enqueued by that function was actually running as part of the next command list. Besides unnecessarily extending resource lifetimes, this also meant that the new command list started by flushing the deferred deletion queue, so anything added directly in there (instead of via another enqueued command) would be deleted before the commands were executed on the GPU. This was very easy to reproduce with -norhithread on DX12, because texture unlock operations add the staging buffer to the deferred deletion queue immediately, instead of enqueuing a command to do it, so the staging buffers were gone by the time the GPU tried to copy from them.

This changelist adds a boolean to RHISubmitCommandLists() which is true when we're flushing the immediate command list with the FlushRHIThreadFlushResources mode, so that the RHI can process the deletion queue internally after submission, instead of doing it in RHIPerFrameRHIFlushComplete(). I didn't want to move RHIPerFrameRHIFlushComplete() itself to another point in the timeline, because old RHIs (D3D11 and OpenGL) use that for other purposes, and it seems unwise to alter their behavior (e.g. D3D11 wants to resolve timing queries in there with a blocking wait, and running that at the end of the current command list would introduce a CPU/GPU sync point).

Also:
* deprecated FRHIResource::FlushPendingDeletes(), since all it does is call FlushPendingDeletes() on the command list being passed in, and code outside of the RHI really shouldn't be doing that.
* made FlushPendingDeleteRHIResources_RenderThread() flush the immediate command list instead of calling FlushPendingDeletes() directly

#jira UE-184426
#rnx
#preflight https://horde.devtools.epicgames.com/job/6455194d023fe5d3ad8faa64
#rb Luke.Thatcher

[CL 25423894 by mihnea balta in ue5-main branch]
2023-05-11 06:25:32 -04:00
jamie dale
6bb5205c1f No PCH build fix for Stats includes when STATS is 0
#jira
#rb none
#rnx

[CL 25339716 by jamie dale in ue5-main branch]
2023-05-04 14:49:36 -04:00
QRare
5b94eb4241 PR #10329: Add on screen warning Debug device (eg d3ddebug) is enabled during stats (Contributed by QRare)
Original PR only added functionality for d3d12. This CL includes support in d3d11 and Vulkan, and makes d3d11 and d3d12 use a cvar to store d3ddebug settings, rather than parsing the commandline directly into a bool. This makes debug device settings more consistent across RHIs and lets you enable d3ddebug from an ini file now. Also added GRHIGlobals.IsDebugLayerEnabled to make tracking whether or not we're using a debug device consistent and easy across all RHIs.

#review elizabeth.baumel, christopher.waters
#jira UE-182391
#preflight 644c64129c50ddcc0bff880b

[CL 25249712 by QRare in ue5-main branch]
2023-04-28 21:37:44 -04:00
Steve Robb
50502e75fe Fixed mismatched copy constructor/assignment operator in FD3D11LockedKey and FD3D12LockedKey.
#rb none
#jira none
#preflight none

[CL 25191089 by Steve Robb in ue5-main branch]
2023-04-25 18:21:50 -04:00
David Harvey
3592ba635a Adding ISaveGameSystemModule module, comparable to the platform chunk install module.
Example usage added to Windows platform, allowing Windows platform extensions to override the default save system.
```
[PlatformFeatures]
SaveGameSystemModule=MySaveModule
```

#jira UE-143574, UE-179187
#rb Wojciech.Krywult
#preflight 6447ee14864f15ebf5c5bd01

[CL 25181389 by David Harvey in ue5-main branch]
2023-04-25 11:33:54 -04:00
christopher waters
fc6a3fab0b Moving a number of DXGI_FORMAT helpers to RHICore that were in both D3D11RHI and D3D12RHI.
#preflight 6447dd889770663ce2c1bc63

[CL 25180619 by christopher waters in ue5-main branch]
2023-04-25 10:53:46 -04:00