rhi: Add D32FS8
This is commonly supported in the desktop world, more commonly than D24S8. (which AMD does not like for instance) Change-Id: I43104bd9dbf28159fd8a806ff44ad5d094bdd599 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
This commit is contained in:
parent
51c5259fe9
commit
c63a7e3ba7
@ -4362,6 +4362,9 @@ bool QRhiRenderBuffer::createFrom(NativeRenderBuffer src)
|
||||
|
||||
\value D32F 32-bit depth (32-bit float)
|
||||
|
||||
\value D32FS8 32-bit depth (32-bit float), 8 bits of stencil, 24 bits unused
|
||||
(64 bits total) This enum value is introduced in Qt 6.9.
|
||||
|
||||
\value BC1
|
||||
\value BC2
|
||||
\value BC3
|
||||
@ -8240,6 +8243,10 @@ void QRhiImplementation::textureFormatInfo(QRhiTexture::Format format, const QSi
|
||||
bpc = 4;
|
||||
break;
|
||||
|
||||
case QRhiTexture::D32FS8:
|
||||
bpc = 8;
|
||||
break;
|
||||
|
||||
default:
|
||||
Q_UNREACHABLE();
|
||||
break;
|
||||
@ -8257,6 +8264,7 @@ bool QRhiImplementation::isStencilSupportingFormat(QRhiTexture::Format format) c
|
||||
{
|
||||
switch (format) {
|
||||
case QRhiTexture::D24S8:
|
||||
case QRhiTexture::D32FS8:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
|
@ -933,6 +933,7 @@ public:
|
||||
D24,
|
||||
D24S8,
|
||||
D32F,
|
||||
D32FS8,
|
||||
|
||||
BC1,
|
||||
BC2,
|
||||
|
@ -1555,6 +1555,8 @@ static inline DXGI_FORMAT toD3DTextureFormat(QRhiTexture::Format format, QRhiTex
|
||||
return DXGI_FORMAT_R24G8_TYPELESS;
|
||||
case QRhiTexture::D32F:
|
||||
return DXGI_FORMAT_R32_TYPELESS;
|
||||
case QRhiTexture::D32FS8:
|
||||
return DXGI_FORMAT_R32G8X24_TYPELESS;
|
||||
|
||||
case QRhiTexture::BC1:
|
||||
return srgb ? DXGI_FORMAT_BC1_UNORM_SRGB : DXGI_FORMAT_BC1_UNORM;
|
||||
@ -1635,6 +1637,7 @@ static inline bool isDepthTextureFormat(QRhiTexture::Format format)
|
||||
case QRhiTexture::Format::D24:
|
||||
case QRhiTexture::Format::D24S8:
|
||||
case QRhiTexture::Format::D32F:
|
||||
case QRhiTexture::Format::D32FS8:
|
||||
return true;
|
||||
|
||||
default:
|
||||
@ -3255,6 +3258,8 @@ static inline DXGI_FORMAT toD3DDepthTextureSRVFormat(QRhiTexture::Format format)
|
||||
return DXGI_FORMAT_R24_UNORM_X8_TYPELESS;
|
||||
case QRhiTexture::Format::D32F:
|
||||
return DXGI_FORMAT_R32_FLOAT;
|
||||
case QRhiTexture::Format::D32FS8:
|
||||
return DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS;
|
||||
default:
|
||||
Q_UNREACHABLE();
|
||||
return DXGI_FORMAT_R32_FLOAT;
|
||||
@ -3272,6 +3277,8 @@ static inline DXGI_FORMAT toD3DDepthTextureDSVFormat(QRhiTexture::Format format)
|
||||
return DXGI_FORMAT_D24_UNORM_S8_UINT;
|
||||
case QRhiTexture::Format::D32F:
|
||||
return DXGI_FORMAT_D32_FLOAT;
|
||||
case QRhiTexture::Format::D32FS8:
|
||||
return DXGI_FORMAT_D32_FLOAT_S8X24_UINT;
|
||||
default:
|
||||
Q_UNREACHABLE();
|
||||
return DXGI_FORMAT_D32_FLOAT;
|
||||
|
@ -3894,6 +3894,8 @@ static inline DXGI_FORMAT toD3DTextureFormat(QRhiTexture::Format format, QRhiTex
|
||||
return DXGI_FORMAT_R24G8_TYPELESS;
|
||||
case QRhiTexture::D32F:
|
||||
return DXGI_FORMAT_R32_TYPELESS;
|
||||
case QRhiTexture::Format::D32FS8:
|
||||
return DXGI_FORMAT_R32G8X24_TYPELESS;
|
||||
|
||||
case QRhiTexture::BC1:
|
||||
return srgb ? DXGI_FORMAT_BC1_UNORM_SRGB : DXGI_FORMAT_BC1_UNORM;
|
||||
@ -4131,6 +4133,8 @@ static inline DXGI_FORMAT toD3DDepthTextureSRVFormat(QRhiTexture::Format format)
|
||||
return DXGI_FORMAT_R24_UNORM_X8_TYPELESS;
|
||||
case QRhiTexture::Format::D32F:
|
||||
return DXGI_FORMAT_R32_FLOAT;
|
||||
case QRhiTexture::Format::D32FS8:
|
||||
return DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -4149,6 +4153,8 @@ static inline DXGI_FORMAT toD3DDepthTextureDSVFormat(QRhiTexture::Format format)
|
||||
return DXGI_FORMAT_D24_UNORM_S8_UINT;
|
||||
case QRhiTexture::Format::D32F:
|
||||
return DXGI_FORMAT_D32_FLOAT;
|
||||
case QRhiTexture::Format::D32FS8:
|
||||
return DXGI_FORMAT_D32_FLOAT_S8X24_UINT;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -4162,6 +4168,7 @@ static inline bool isDepthTextureFormat(QRhiTexture::Format format)
|
||||
case QRhiTexture::Format::D24:
|
||||
case QRhiTexture::Format::D24S8:
|
||||
case QRhiTexture::Format::D32F:
|
||||
case QRhiTexture::Format::D32FS8:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
@ -216,6 +216,14 @@ QT_BEGIN_NAMESPACE
|
||||
#define GL_DEPTH_COMPONENT32F 0x8CAC
|
||||
#endif
|
||||
|
||||
#ifndef GL_DEPTH32F_STENCIL8
|
||||
#define GL_DEPTH32F_STENCIL8 0x8CAD
|
||||
#endif
|
||||
|
||||
#ifndef GL_FLOAT_32_UNSIGNED_INT_24_8_REV
|
||||
#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD
|
||||
#endif
|
||||
|
||||
#ifndef GL_UNSIGNED_INT_24_8
|
||||
#define GL_UNSIGNED_INT_24_8 0x84FA
|
||||
#endif
|
||||
@ -1313,6 +1321,12 @@ static inline void toGlTextureFormat(QRhiTexture::Format format, const QRhiGles2
|
||||
*glformat = GL_DEPTH_COMPONENT;
|
||||
*gltype = GL_FLOAT;
|
||||
break;
|
||||
case QRhiTexture::D32FS8:
|
||||
*glintformat = GL_DEPTH32F_STENCIL8;
|
||||
*glsizedintformat = *glintformat;
|
||||
*glformat = GL_DEPTH_STENCIL;
|
||||
*gltype = GL_FLOAT_32_UNSIGNED_INT_24_8_REV;
|
||||
break;
|
||||
default:
|
||||
Q_UNREACHABLE();
|
||||
*glintformat = GL_RGBA;
|
||||
@ -1331,6 +1345,7 @@ bool QRhiGles2::isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture
|
||||
switch (format) {
|
||||
case QRhiTexture::D16:
|
||||
case QRhiTexture::D32F:
|
||||
case QRhiTexture::D32FS8:
|
||||
return caps.depthTexture;
|
||||
|
||||
case QRhiTexture::D24:
|
||||
|
@ -3460,6 +3460,8 @@ static inline MTLPixelFormat toMetalTextureFormat(QRhiTexture::Format format, QR
|
||||
#endif
|
||||
case QRhiTexture::D32F:
|
||||
return MTLPixelFormatDepth32Float;
|
||||
case QRhiTexture::D32FS8:
|
||||
return MTLPixelFormatDepth32Float_Stencil8;
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
case QRhiTexture::BC1:
|
||||
|
@ -1072,6 +1072,8 @@ static inline VkFormat toVkTextureFormat(QRhiTexture::Format format, QRhiTexture
|
||||
return VK_FORMAT_D24_UNORM_S8_UINT;
|
||||
case QRhiTexture::D32F:
|
||||
return VK_FORMAT_D32_SFLOAT;
|
||||
case QRhiTexture::D32FS8:
|
||||
return VK_FORMAT_D32_SFLOAT_S8_UINT;
|
||||
|
||||
case QRhiTexture::BC1:
|
||||
return srgb ? VK_FORMAT_BC1_RGB_SRGB_BLOCK : VK_FORMAT_BC1_RGB_UNORM_BLOCK;
|
||||
@ -1164,6 +1166,7 @@ static constexpr inline bool isDepthTextureFormat(QRhiTexture::Format format)
|
||||
case QRhiTexture::Format::D24:
|
||||
case QRhiTexture::Format::D24S8:
|
||||
case QRhiTexture::Format::D32F:
|
||||
case QRhiTexture::Format::D32FS8:
|
||||
return true;
|
||||
|
||||
default:
|
||||
|
Loading…
x
Reference in New Issue
Block a user