From fb5e2beaa79573cbde4ed8052e15411ec2503d30 Mon Sep 17 00:00:00 2001 From: WinterSnowfall Date: Thu, 2 May 2024 16:25:46 +0300 Subject: [PATCH] [d3d9] Validate DS format support during CheckDepthStencilMatch --- src/d3d9/d3d9_adapter.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/d3d9/d3d9_adapter.cpp b/src/d3d9/d3d9_adapter.cpp index e0f1a185..aa14c90a 100644 --- a/src/d3d9/d3d9_adapter.cpp +++ b/src/d3d9/d3d9_adapter.cpp @@ -224,11 +224,15 @@ namespace dxvk { if (!IsDepthFormat(DepthStencilFormat)) return D3DERR_NOTAVAILABLE; + auto dsfMapping = ConvertFormatUnfixed(DepthStencilFormat); + if (dsfMapping.FormatColor == VK_FORMAT_UNDEFINED) + return D3DERR_NOTAVAILABLE; + if (RenderTargetFormat == dxvk::D3D9Format::NULL_FORMAT) return D3D_OK; - auto mapping = ConvertFormatUnfixed(RenderTargetFormat); - if (mapping.FormatColor == VK_FORMAT_UNDEFINED) + auto rtfMapping = ConvertFormatUnfixed(RenderTargetFormat); + if (rtfMapping.FormatColor == VK_FORMAT_UNDEFINED) return D3DERR_NOTAVAILABLE; return D3D_OK;