diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2024-02-22 18:31:25 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2024-02-23 17:26:25 +0100 |
commit | 51106995cbf51af0c92b34119f6d254568a67540 (patch) | |
tree | 7ac0b3f7446fbbf8dba18faac340b2a03af81f16 /src/gui/rhi | |
parent | fb81373313c4d1834437351aeb5df4a44303b93c (diff) |
rhi: d3d11: Fix depth texture by porting from the d3d12 backend
The newer D3D12 backend uses DXGI formats (for the texture, DSV, SRV)
that actually work. Backport these to the D3D11 backend. Otherwise
attempting to create a render target with a D24 or D24S8 QRhiTexture
as the depth/stencil buffer won't work.
In practice this is rarely exercised since the depth-stencil is
typically a QRhiRenderBuffer that maps to a
DXGI_FORMAT_D24_UNORM_S8_UINT texture but without
D3D11_BIND_SHADER_RESOURCE. Whereas textures get the latter flag,
and things break down. At least now the usage of typeless and
typed format is uniform. It could still be questioned if D24
should actually use R24G8_TYPELESS or if the original was fine,
but for now just sync with the D3D12 backend.
Pick-to: 6.7 6.6
Change-Id: I8a0564fc42a7866dae90f49f7b557c83dffc4d6e
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/gui/rhi')
-rw-r--r-- | src/gui/rhi/qrhid3d11.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gui/rhi/qrhid3d11.cpp b/src/gui/rhi/qrhid3d11.cpp index 35a115e5aa..58a8221a11 100644 --- a/src/gui/rhi/qrhid3d11.cpp +++ b/src/gui/rhi/qrhid3d11.cpp @@ -1521,9 +1521,9 @@ static inline DXGI_FORMAT toD3DTextureFormat(QRhiTexture::Format format, QRhiTex case QRhiTexture::D16: return DXGI_FORMAT_R16_TYPELESS; case QRhiTexture::D24: - return DXGI_FORMAT_R24_UNORM_X8_TYPELESS; + return DXGI_FORMAT_R24G8_TYPELESS; case QRhiTexture::D24S8: - return DXGI_FORMAT_D24_UNORM_S8_UINT; + return DXGI_FORMAT_R24G8_TYPELESS; case QRhiTexture::D32F: return DXGI_FORMAT_R32_TYPELESS; @@ -3236,7 +3236,7 @@ static inline DXGI_FORMAT toD3DDepthTextureDSVFormat(QRhiTexture::Format format) case QRhiTexture::Format::D16: return DXGI_FORMAT_D16_UNORM; case QRhiTexture::Format::D24: - return DXGI_FORMAT_R24_UNORM_X8_TYPELESS; + return DXGI_FORMAT_D24_UNORM_S8_UINT; case QRhiTexture::Format::D24S8: return DXGI_FORMAT_D24_UNORM_S8_UINT; case QRhiTexture::Format::D32F: |