From 50857537d6dc7ce27b9e511aaa6be877beb247d0 Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Mon, 26 Sep 2022 20:27:06 +0200 Subject: [PATCH] [d3d9] Use D32 not D32_S8 when upgrading formats without stencil aspect. --- src/d3d9/d3d9_common_texture.cpp | 4 ++-- src/d3d9/d3d9_format.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/d3d9/d3d9_common_texture.cpp b/src/d3d9/d3d9_common_texture.cpp index 32a5d5e5a97..67fba7b09fd 100644 --- a/src/d3d9/d3d9_common_texture.cpp +++ b/src/d3d9/d3d9_common_texture.cpp @@ -40,8 +40,8 @@ namespace dxvk { m_mapMode = DetermineMapMode(); m_shadow = DetermineShadowState(); - m_upgradedToD32f = ConvertFormatUnfixed(m_desc.Format).FormatColor != VK_FORMAT_D32_SFLOAT_S8_UINT && - m_mapping.FormatColor == VK_FORMAT_D32_SFLOAT_S8_UINT; + m_upgradedToD32f = ConvertFormatUnfixed(m_desc.Format).FormatColor != m_mapping.FormatColor && + (m_mapping.FormatColor == VK_FORMAT_D32_SFLOAT_S8_UINT || m_mapping.FormatColor == VK_FORMAT_D32_SFLOAT); m_supportsFetch4 = DetermineFetch4Compatibility(); const bool createImage = m_desc.Pool != D3DPOOL_SYSTEMMEM && m_desc.Pool != D3DPOOL_SCRATCH && m_desc.Format != D3D9Format::NULL_FORMAT; diff --git a/src/d3d9/d3d9_format.cpp b/src/d3d9/d3d9_format.cpp index 13d19fde462..90ebfd93e78 100644 --- a/src/d3d9/d3d9_format.cpp +++ b/src/d3d9/d3d9_format.cpp @@ -473,7 +473,7 @@ namespace dxvk { return D3D9_VK_FORMAT_MAPPING(); if (!m_d24s8Support && mapping.FormatColor == VK_FORMAT_D24_UNORM_S8_UINT) - mapping.FormatColor = VK_FORMAT_D32_SFLOAT_S8_UINT; + mapping.FormatColor = mapping.Aspect & VK_IMAGE_ASPECT_STENCIL_BIT ? VK_FORMAT_D32_SFLOAT_S8_UINT : VK_FORMAT_D32_SFLOAT; if (!m_d16s8Support && mapping.FormatColor == VK_FORMAT_D16_UNORM_S8_UINT) mapping.FormatColor = m_d24s8Support ? VK_FORMAT_D24_UNORM_S8_UINT : VK_FORMAT_D32_SFLOAT_S8_UINT;