From 5684e29718d211b0a715d13b7c9a6df8019f2732 Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Mon, 26 Sep 2022 11:18:59 +0200 Subject: [PATCH] [d3d9] Track if a texture is upgraded to D32f --- src/d3d9/d3d9_common_texture.cpp | 2 ++ src/d3d9/d3d9_common_texture.h | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/src/d3d9/d3d9_common_texture.cpp b/src/d3d9/d3d9_common_texture.cpp index b50bec821..32a5d5e5a 100644 --- a/src/d3d9/d3d9_common_texture.cpp +++ b/src/d3d9/d3d9_common_texture.cpp @@ -40,6 +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_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_common_texture.h b/src/d3d9/d3d9_common_texture.h index f0cf03f26..b727c8725 100644 --- a/src/d3d9/d3d9_common_texture.h +++ b/src/d3d9/d3d9_common_texture.h @@ -203,6 +203,14 @@ namespace dxvk { return m_shadow; } + /** + * \brief Dref Clamp + * \returns Whether the texture emulates an UNORM format with D32f + */ + bool IsUpgradedToD32f() const { + return m_upgradedToD32f; + } + /** * \brief FETCH4 compatibility * \returns Whether the format of the texture supports the FETCH4 hack @@ -499,6 +507,7 @@ namespace dxvk { D3D9_VK_FORMAT_MAPPING m_mapping; bool m_shadow; //< Depth Compare-ness + bool m_upgradedToD32f; // Dref Clamp bool m_supportsFetch4; int64_t m_size = 0;