mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-20 15:25:38 +00:00
GPUDevice: Add D24S8/D32F/D32FS8 types
This commit is contained in:
parent
3f25db79b8
commit
d8bd35e8d6
|
@ -478,6 +478,9 @@ static constexpr std::array<D3DCommon::DXGIFormatMapping, static_cast<int>(GPUTe
|
||||||
{DXGI_FORMAT_B5G5R5A1_UNORM, DXGI_FORMAT_B5G5R5A1_UNORM, DXGI_FORMAT_B5G5R5A1_UNORM, DXGI_FORMAT_UNKNOWN }, // RGBA5551
|
{DXGI_FORMAT_B5G5R5A1_UNORM, DXGI_FORMAT_B5G5R5A1_UNORM, DXGI_FORMAT_B5G5R5A1_UNORM, DXGI_FORMAT_UNKNOWN }, // RGBA5551
|
||||||
{DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_UNKNOWN }, // R8
|
{DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_UNKNOWN }, // R8
|
||||||
{DXGI_FORMAT_R16_TYPELESS, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_D16_UNORM }, // D16
|
{DXGI_FORMAT_R16_TYPELESS, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_D16_UNORM }, // D16
|
||||||
|
{DXGI_FORMAT_R24G8_TYPELESS, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_D24_UNORM_S8_UINT }, // D24S8
|
||||||
|
{DXGI_FORMAT_R32_TYPELESS, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_D32_FLOAT }, // D32F
|
||||||
|
{DXGI_FORMAT_R32G8X24_TYPELESS, DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS,DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS, DXGI_FORMAT_D32_FLOAT_S8X24_UINT }, // D32FS8
|
||||||
{DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_UNKNOWN }, // R16
|
{DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_UNKNOWN }, // R16
|
||||||
{DXGI_FORMAT_R16_SINT, DXGI_FORMAT_R16_SINT, DXGI_FORMAT_R16_SINT, DXGI_FORMAT_UNKNOWN }, // R16I
|
{DXGI_FORMAT_R16_SINT, DXGI_FORMAT_R16_SINT, DXGI_FORMAT_R16_SINT, DXGI_FORMAT_UNKNOWN }, // R16I
|
||||||
{DXGI_FORMAT_R16_UINT, DXGI_FORMAT_R16_UINT, DXGI_FORMAT_R16_UINT, DXGI_FORMAT_UNKNOWN }, // R16U
|
{DXGI_FORMAT_R16_UINT, DXGI_FORMAT_R16_UINT, DXGI_FORMAT_R16_UINT, DXGI_FORMAT_UNKNOWN }, // R16U
|
||||||
|
|
|
@ -33,6 +33,9 @@ const char* GPUTexture::GetFormatName(Format format)
|
||||||
"RGB5551", // RGBA5551
|
"RGB5551", // RGBA5551
|
||||||
"R8", // R8
|
"R8", // R8
|
||||||
"D16", // D16
|
"D16", // D16
|
||||||
|
"D24S8", // D24S8
|
||||||
|
"D32F", // D32F
|
||||||
|
"D32FS8S", // D32FS8
|
||||||
"R16", // R16
|
"R16", // R16
|
||||||
"R16I", // R16I
|
"R16I", // R16I
|
||||||
"R16U", // R16U
|
"R16U", // R16U
|
||||||
|
@ -149,6 +152,9 @@ u32 GPUTexture::GetPixelSize(GPUTexture::Format format)
|
||||||
2, // RGBA5551
|
2, // RGBA5551
|
||||||
1, // R8
|
1, // R8
|
||||||
2, // D16
|
2, // D16
|
||||||
|
4, // D24S8
|
||||||
|
4, // D32F
|
||||||
|
8, // D32FS8
|
||||||
2, // R16
|
2, // R16
|
||||||
2, // R16I
|
2, // R16I
|
||||||
2, // R16U
|
2, // R16U
|
||||||
|
@ -171,13 +177,12 @@ u32 GPUTexture::GetPixelSize(GPUTexture::Format format)
|
||||||
|
|
||||||
bool GPUTexture::IsDepthFormat(Format format)
|
bool GPUTexture::IsDepthFormat(Format format)
|
||||||
{
|
{
|
||||||
return (format == Format::D16);
|
return (format >= Format::D16 && format <= Format::D32FS8);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GPUTexture::IsDepthStencilFormat(Format format)
|
bool GPUTexture::IsDepthStencilFormat(Format format)
|
||||||
{
|
{
|
||||||
// None needed yet.
|
return (format == Format::D24S8 || format == Format::D32FS8);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GPUTexture::IsCompressedFormat(Format format)
|
bool GPUTexture::IsCompressedFormat(Format format)
|
||||||
|
|
|
@ -41,6 +41,9 @@ public:
|
||||||
RGBA5551,
|
RGBA5551,
|
||||||
R8,
|
R8,
|
||||||
D16,
|
D16,
|
||||||
|
D24S8,
|
||||||
|
D32F,
|
||||||
|
D32FS8,
|
||||||
R16,
|
R16,
|
||||||
R16I,
|
R16I,
|
||||||
R16U,
|
R16U,
|
||||||
|
|
|
@ -39,6 +39,9 @@ static constexpr std::array<MTLPixelFormat, static_cast<u32>(GPUTexture::Format:
|
||||||
MTLPixelFormatA1BGR5Unorm, // RGBA5551
|
MTLPixelFormatA1BGR5Unorm, // RGBA5551
|
||||||
MTLPixelFormatR8Unorm, // R8
|
MTLPixelFormatR8Unorm, // R8
|
||||||
MTLPixelFormatDepth16Unorm, // D16
|
MTLPixelFormatDepth16Unorm, // D16
|
||||||
|
MTLPixelFormatDepth24Unorm_Stencil8, // D24S8
|
||||||
|
MTLPixelFormatDepth32Float, // D32F
|
||||||
|
MTLPixelFormatDepth32Float_Stencil8, // D32FS8
|
||||||
MTLPixelFormatR16Unorm, // R16
|
MTLPixelFormatR16Unorm, // R16
|
||||||
MTLPixelFormatR16Sint, // R16I
|
MTLPixelFormatR16Sint, // R16I
|
||||||
MTLPixelFormatR16Uint, // R16U
|
MTLPixelFormatR16Uint, // R16U
|
||||||
|
|
|
@ -36,6 +36,9 @@ const std::tuple<GLenum, GLenum, GLenum>& OpenGLTexture::GetPixelFormatMapping(G
|
||||||
{GL_RGB5_A1, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV}, // RGBA5551
|
{GL_RGB5_A1, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV}, // RGBA5551
|
||||||
{GL_R8, GL_RED, GL_UNSIGNED_BYTE}, // R8
|
{GL_R8, GL_RED, GL_UNSIGNED_BYTE}, // R8
|
||||||
{GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_SHORT}, // D16
|
{GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_SHORT}, // D16
|
||||||
|
{GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT}, // D24S8
|
||||||
|
{GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT}, // D32F
|
||||||
|
{GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL, GL_FLOAT}, // D32FS8
|
||||||
{GL_R16, GL_RED, GL_UNSIGNED_SHORT}, // R16
|
{GL_R16, GL_RED, GL_UNSIGNED_SHORT}, // R16
|
||||||
{GL_R16I, GL_RED_INTEGER, GL_SHORT}, // R16I
|
{GL_R16I, GL_RED_INTEGER, GL_SHORT}, // R16I
|
||||||
{GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT}, // R16U
|
{GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT}, // R16U
|
||||||
|
@ -63,6 +66,9 @@ const std::tuple<GLenum, GLenum, GLenum>& OpenGLTexture::GetPixelFormatMapping(G
|
||||||
{GL_RGB5_A1, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV}, // RGBA5551
|
{GL_RGB5_A1, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV}, // RGBA5551
|
||||||
{GL_R8, GL_RED, GL_UNSIGNED_BYTE}, // R8
|
{GL_R8, GL_RED, GL_UNSIGNED_BYTE}, // R8
|
||||||
{GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_SHORT}, // D16
|
{GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_SHORT}, // D16
|
||||||
|
{GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT}, // D24S8
|
||||||
|
{GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT}, // D32F
|
||||||
|
{GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL, GL_FLOAT}, // D32FS8
|
||||||
{GL_R16F, GL_RED, GL_HALF_FLOAT}, // R16
|
{GL_R16F, GL_RED, GL_HALF_FLOAT}, // R16
|
||||||
{GL_R16I, GL_RED_INTEGER, GL_SHORT}, // R16I
|
{GL_R16I, GL_RED_INTEGER, GL_SHORT}, // R16I
|
||||||
{GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT}, // R16U
|
{GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT}, // R16U
|
||||||
|
|
|
@ -78,6 +78,9 @@ const std::array<VkFormat, static_cast<u32>(GPUTexture::Format::MaxCount)> Vulka
|
||||||
VK_FORMAT_R5G5B5A1_UNORM_PACK16, // RGBA5551
|
VK_FORMAT_R5G5B5A1_UNORM_PACK16, // RGBA5551
|
||||||
VK_FORMAT_R8_UNORM, // R8
|
VK_FORMAT_R8_UNORM, // R8
|
||||||
VK_FORMAT_D16_UNORM, // D16
|
VK_FORMAT_D16_UNORM, // D16
|
||||||
|
VK_FORMAT_D24_UNORM_S8_UINT, // D24S8
|
||||||
|
VK_FORMAT_D32_SFLOAT, // D32F
|
||||||
|
VK_FORMAT_D32_SFLOAT_S8_UINT, // D32FS8
|
||||||
VK_FORMAT_R16_UNORM, // R16
|
VK_FORMAT_R16_UNORM, // R16
|
||||||
VK_FORMAT_R16_SINT, // R16I
|
VK_FORMAT_R16_SINT, // R16I
|
||||||
VK_FORMAT_R16_UINT, // R16U
|
VK_FORMAT_R16_UINT, // R16U
|
||||||
|
|
Loading…
Reference in a new issue