14#include "CoreMinimal.h"
17#include "Engine/TextureRenderTarget2D.h"
37 template <CEnum FormatType>
44 template <CEnum ToFormatType, CEnum FromFormatType>
45 requires (!CSameAs<ToFormatType, FromFormatType>)
48 return static_cast<ToFormatType
>(from);
52 template <CEnum ToFormatType, CEnum FromFormatType>
53 requires CSameAs<ToFormatType, FromFormatType>
64 case PF_G8:
return RTF_R8;
65 case PF_R8G8:
return RTF_RG8;
66 case PF_B8G8R8A8:
return RTF_RGBA8;
68 case PF_R16F:
return RTF_R16f;
69 case PF_G16R16F:
return RTF_RG16f;
70 case PF_FloatRGBA:
return RTF_RGBA16f;
72 case PF_R32_FLOAT:
return RTF_R32f;
73 case PF_G32R32F:
return RTF_RG32f;
74 case PF_A32B32G32R32F:
return RTF_RGBA32f;
75 case PF_A2B10G10R10:
return RTF_RGB10A2;
79 ->WithMessageF(
TEXT_"Unhandled ETextureRenderTargetFormat entry {0}", GetPixelFormatString(from))
92 case RTF_R8:
return PF_G8;
93 case RTF_RG8:
return PF_R8G8;
94 case RTF_RGBA8:
return PF_B8G8R8A8;
95 case RTF_RGBA8_SRGB:
return PF_B8G8R8A8;
97 case RTF_R16f:
return PF_R16F;
98 case RTF_RG16f:
return PF_G16R16F;
99 case RTF_RGBA16f:
return PF_FloatRGBA;
101 case RTF_R32f:
return PF_R32_FLOAT;
102 case RTF_RG32f:
return PF_G32R32F;
103 case RTF_RGBA32f:
return PF_A32B32G32R32F;
104 case RTF_RGB10A2:
return PF_A2B10G10R10;
107 auto enumName = UEnum::GetValueAsString(from);
109 ->WithMessageF(
TEXT_"Unhandled ETextureRenderTargetFormat entry {0}", enumName)
122 template <CScalar SizeType, CEnum InFormatType>
129 template <CScalar SizeTypeArg, CEnum FormatTypeArg>
130 TTextureSize(SizeTypeArg width, SizeTypeArg height, FormatTypeArg format)
131 :
Width(static_cast<SizeType>(width))
132 ,
Height(static_cast<SizeType>(height))
136 template <CTextureSize OtherTextureSize>
143 template <CTextureSize OtherTextureSize>
154 operator bool()
const
159 template <CTextureSize OtherTextureSize>
160 operator OtherTextureSize()
const
162 return OtherTextureSize(
169 template <CTextureSize Left, CTextureSize Right>
172 return l.Width == r.Width
173 && l.Height == r.Height
178 template <CTextureSize Left, CTextureSize Right>
179 bool operator != (Left
const& l, Right
const& r) {
return !(l == r); }
#define ASSERT_QUIT(condition, returnOnFailure,...)
Use this instead of check macro if the checked expression shouldn't be ignored in shipping builds....
This header exists because STL headers in Android doesn't define STL concepts (other than same_as whi...
#define TEXT_
A convenience alternative to Unreal's own TEXT macro but this one doesn't require parenthesis around ...
Describing a struct which can give texture size and layout information.
This namespace contain utilities regarding high-level cross-platform and cross-rhi texture objects.
constexpr auto GetUnknownFormat< ETextureRenderTargetFormat >()
FORCEINLINE_DEBUGGABLE EPixelFormat ConvertFormat< EPixelFormat, ETextureRenderTargetFormat >(ETextureRenderTargetFormat from)
MCRO_API FUnrealTextureSize GetTextureSize(UTexture *texture)
FORCEINLINE_DEBUGGABLE ETextureRenderTargetFormat ConvertFormat< ETextureRenderTargetFormat, EPixelFormat >(EPixelFormat from)
constexpr auto GetUnknownFormat< EPixelFormat >()
constexpr auto GetUnknownFormat()
Specialize this function template to define the unknown format for an RHI texture format.
bool operator==(Left const &l, Right const &r)
bool operator!=(Left const &l, Right const &r)
MCRO_API FRHITexture * GetRhiTexture2D(UTexture *target)
Get the lower level RHI texture from a high level UTexture2D object if it's possible,...
ToFormatType ConvertFormat(FromFormatType from)
Specialize this function template to define format conversion of equivalent formats between RHIs.
A simple texture size description which can be used for checking the need to recreate a texture resou...
TTextureSize(OtherTextureSize &&other)
TTextureSize(OtherTextureSize const &other)
TTextureSize(SizeTypeArg width, SizeTypeArg height, FormatTypeArg format)