Commit Graph

1037 Commits

Author SHA1 Message Date
jonathan bard
ddf6dd3934 Refactored render target to texture conversion so that it can be done on any UTextureRenderTarget / UTexture type :
* Added BP functions to create all types of UTexture from their UTextureRenderTarget counterpart (except UTextureRenderTargetCubeArray, since we don't have much of anything available to produce these ATM, but there's no reason it shouldn't work)
* Fixed crash when trying to create a UTexture out of a UTextureRenderTarget with a non-supported format. The error is also appropriately reported to the user via blueprint message log, instead of a message box in the past

Misc:
* UTextureRenderTarget have to implement CanConvertToTexture to indicate if they are currently able to be converted to a texture (e.g. valid size, supported format, etc.)
* There's now a generic UpdateTexture and ConstructTexture function on UTextureRenderTarget that can be used to update an existing texture or create a new one
* D3D11 and D3D12's RHIReadSurfaceData now support reading from (cube) texture arrays
* Added R8G8 to FColor conversion (the missing .BA channels are filled with 0 and 255, respectively)
* Deprecated all redundant ReadPixels / ReadFloat16Pixels from child classes of FRenderTarget (FTextureResource, FTextureRenderTargetVolumeResource, FTextureRenderTarget2DArrayResource). Note that ReadPixels / ReadFloat16Pixels / ReadLinearColorPixels are now virtual to avoid this situation and yet allow FTextureRenderTargetVolumeResource to implement them in its own way (unlike all other implementations, it uses Read3DSurfaceFloatData internally)
* Fixed typo in FTextureRenderTargetVolumeResource::GetDisplayGamma(), which didn't take PF_R32_FORMAT into account
* Added FTextureSourceFormatInfo and GTextureSourceFormats, which provides information about the various supported formats in ETextureSourceFormat (similar to EPixelFormat and GPixelFormats)

#jira UE-194364
#rb jon.cain
#tests editor

[CL 28494190 by jonathan bard in ue5-main branch]
2023-10-05 08:12:26 -04:00
zach bethel
5be1ae901a Fix crash in D3D11 when FMaterialRenderProxy::UpdateDeferredCachedUniformExpressions is using a non-immediate command list.
#rb mihnea.balta
#rnx

[CL 28283518 by zach bethel in ue5-main branch]
2023-09-27 14:17:10 -04:00
zach bethel
e7fdf09eb9 Fixed various RHI's to only clear targets with clear actions rather than all targets when any clear action is specified.
#jira UE-195766

[CL 28206288 by zach bethel in ue5-main branch]
2023-09-25 17:20:21 -04:00
zach bethel
0f40a4d17f Fixed RHIBindDebugLabelName to take a command list.
#jira UE-195436

[CL 27966365 by zach bethel in ue5-main branch]
2023-09-18 13:51:58 -04:00
christopher waters
3cc28e6db6 Removing individual parameter binding methods from IRHI*Context now that everything uses batched shader parameters
- RHISetShaderTexture, RHISetShaderSampler, RHISetUAVParameter, RHISetShaderResourceViewParameter, RHISetShaderUniformBuffer, RHISetShaderParameter
- Only removing from the interface, each RHI still uses them in conjunction with UE::RHICore::RHISetShaderParametersShared, which uses the RHI type and not the interface.
- These methods are not part of the "public" interface so no deprecation is needed.

#rb luke.thatcher

[CL 27605633 by christopher waters in ue5-main branch]
2023-09-05 14:29:04 -04:00
christopher waters
ae3bd2b8da Don't add unbind commands if the RHI doesn't do anything with them.
- Discovered that a number of RHISetShaderResourceViewParameter and RHISetUAVParameter implementations do nothing with null resources, meaning that RHISetShaderUnbinds calls end up doing zero work with all the overhead.
- Adding GRHIGlobals::NeedsShaderUnbinds for RHIs to signal they need/handle unbind commands.
- RHIs that actually do work with RHISetShaderUnbinds now set NeedsShaderUnbinds on startup.
- Removed RHISetShaderUnbinds implementations that did zero work.

#rb luke.thatcher

[CL 27554898 by christopher waters in ue5-main branch]
2023-09-01 10:28:05 -04:00
christopher waters
2ccaffb472 RHITransferBufferUnderlyingResource and RHITransferRayTracingGeometryUnderlyingResource need to be given a command list for future rename support.
#jira UE-162016
#rb jeannoe.morissette

[CL 27101943 by christopher waters in ue5-main branch]
2023-08-15 10:12:23 -04:00
zach bethel
8f41b4b6c0 Moved RHICreateTexture to support non-immediate command lists.
#jira none

[CL 27029875 by zach bethel in ue5-main branch]
2023-08-11 11:27:36 -04:00
christopher waters
b7881548a3 RHIUpdateTexture2D Fixes
- Fixing implementations to handle source offsets.
- Fixing implementations to handle source data smaller than the image's pitch (very small regions).
- Fixing implementations to handle RHI bypass correctly.

#rb Dmitriy.Dyomin, Florin.Pascu, Jeannoe.Morissette, Luke.Thatcher, Mihnea.Balta

[CL 26920943 by christopher waters in ue5-main branch]
2023-08-08 12:57:59 -04:00
david harvey
bdb4199eeb Remove unnecessary WindowsHWrapper.h & MinWindows.h include - both files will be automatically included by AllowWindowsPlatformTypes.h
#jira UE-152863
#rnx
#rb Josh.Adams

[CL 26912096 by david harvey in ue5-main branch]
2023-08-08 05:50:53 -04:00
mihnea balta
d5454e36b4 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*.
#rb trivial

[CL 26807006 by mihnea balta in ue5-main branch]
2023-08-03 08:31:33 -04:00
bryan sefcik
64f140d78d Added shader.build.cs file.
Updated build.cs files to use new shader module.

#jira
#rb Joe.Kirchoff and guillaume.abadie

[CL 26664107 by bryan sefcik in ue5-main branch]
2023-07-27 22:53:25 -04:00
juan portillo
dc54558e4b Fix issue with XAudio2 dll expecting ref count to increment when GetDllHandle not doing so if the dll is already loaded
#rb Brian.Chrisman

[CL 26511091 by juan portillo in ue5-main branch]
2023-07-21 10:34:06 -04:00
christopher waters
e908b9544b 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 26158360 by christopher waters in ue5-main branch]
2023-06-21 15:19:41 -04:00
zach bethel
a7a9029b20 Deprecated InitRHI() in favor of InitRHI(FRHICommandListBase&).
#rb mihnea.balta, luke.thatcher, christopher.waters

[CL 26097009 by zach bethel in ue5-main branch]
2023-06-19 13:56:56 -04:00
henrik karlsson
5db685f97d [Engine]
* Moved dllexport from type to methods/staticvar in all Engine runtime code. This improves compile times, memory and performance in dll builds

[CL 26082269 by henrik karlsson in ue5-main branch]
2023-06-17 18:13:06 -04:00
henrik karlsson
b8482b44dd [Engine]
* Changed type dllexport to method/staticvar dll export. Various changes for code that upgrade script get wrong

[CL 26082043 by henrik karlsson in ue5-main branch]
2023-06-17 16:57:38 -04:00
mihnea balta
9fa6081aec Add support for volumes and texture arrays in FRHIGPUTextureReadback.
#jira UE-185652
#rnx
#rb Luke.Thatcher

[CL 26012765 by mihnea balta in ue5-main branch]
2023-06-15 09:49:43 -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