From e30b783505247753723c95eab5239c802b19b047 Mon Sep 17 00:00:00 2001 From: Christopher Egert Date: Tue, 8 Nov 2022 23:47:01 +0100 Subject: [PATCH] d3d9: Use a different rvalue for depth bias on NV --- src/d3d9/d3d9_device.cpp | 3 ++- src/d3d9/d3d9_util.h | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/d3d9/d3d9_device.cpp b/src/d3d9/d3d9_device.cpp index a89cc4631..93da5ce3d 100644 --- a/src/d3d9/d3d9_device.cpp +++ b/src/d3d9/d3d9_device.cpp @@ -1382,7 +1382,8 @@ namespace dxvk { m_flags.set(D3D9DeviceFlag::DirtyFramebuffer); if (ds != nullptr) { - float rValue = GetDepthBufferRValue(ds->GetCommonTexture()->GetFormatMapping().FormatColor); + const int32_t vendorId = m_dxvkDevice->adapter()->deviceProperties().vendorID; + float rValue = GetDepthBufferRValue(ds->GetCommonTexture()->GetFormatMapping().FormatColor, vendorId); if (m_depthBiasScale != rValue) { m_depthBiasScale = rValue; m_flags.set(D3D9DeviceFlag::DirtyDepthBias); diff --git a/src/d3d9/d3d9_util.h b/src/d3d9/d3d9_util.h index 4358233f8..5da8e95db 100644 --- a/src/d3d9/d3d9_util.h +++ b/src/d3d9/d3d9_util.h @@ -176,14 +176,14 @@ namespace dxvk { void ConvertRect(RECT rect, VkOffset2D& offset, VkExtent2D& extent); - inline float GetDepthBufferRValue(VkFormat Format) { + inline float GetDepthBufferRValue(VkFormat Format, int32_t vendorId) { switch (Format) { case VK_FORMAT_D16_UNORM_S8_UINT: case VK_FORMAT_D16_UNORM: - return float(1 << 16); + return vendorId == 0x10de ? float(1 << 15) : float(1 << 16); case VK_FORMAT_D24_UNORM_S8_UINT: - return float(1 << 24); + return vendorId == 0x10de ? float(1 << 23) : float(1 << 24); default: case VK_FORMAT_D32_SFLOAT_S8_UINT: