From 59e9267e3d33cb29f06d8a4f583e7633360ef259 Mon Sep 17 00:00:00 2001 From: CrossVR Date: Sun, 27 Jul 2025 05:43:17 +0900 Subject: [PATCH 1/2] DriverDetails: Disable depth_clamp_control on AMD official drivers --- Source/Core/VideoBackends/Vulkan/VulkanContext.cpp | 2 +- Source/Core/VideoCommon/DriverDetails.cpp | 3 +++ Source/Core/VideoCommon/DriverDetails.h | 9 ++++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp b/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp index 60580aff40..93cd5a969b 100644 --- a/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp +++ b/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp @@ -664,7 +664,7 @@ bool VulkanContext::SelectDeviceExtensions(bool enable_surface) AddExtension(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, false); AddExtension(VK_EXT_MEMORY_BUDGET_EXTENSION_NAME, false); - if (!DriverDetails::HasBug(DriverDetails::BUG_BROKEN_D32F_CLEAR)) + if (!DriverDetails::HasBug(DriverDetails::BUG_BROKEN_DEPTH_CLAMP_CONTROL)) { // Unrestricted depth range is one of the few extensions that changes the behavior // of Vulkan just by being enabled, so we rely on lazy evaluation to ensure it is diff --git a/Source/Core/VideoCommon/DriverDetails.cpp b/Source/Core/VideoCommon/DriverDetails.cpp index 037c5c0439..41f49f490a 100644 --- a/Source/Core/VideoCommon/DriverDetails.cpp +++ b/Source/Core/VideoCommon/DriverDetails.cpp @@ -158,6 +158,8 @@ constexpr BugInfo m_known_bugs[] = { BUG_BROKEN_DYNAMIC_SAMPLER_INDEXING, -1.0, -1.0, true}, {API_VULKAN, OS_ANDROID, VENDOR_QUALCOMM, DRIVER_QUALCOMM, Family::UNKNOWN, BUG_SLOW_OPTIMAL_IMAGE_TO_BUFFER_COPY, -1.0, -1.0, true}, + {API_VULKAN, OS_WINDOWS, VENDOR_ATI, DRIVER_ATI, Family::UNKNOWN, + BUG_BROKEN_DEPTH_CLAMP_CONTROL, -1.0, -1.0, true}, }; static std::map m_bugs; @@ -297,6 +299,7 @@ static const char* to_string(Bug bug) case BUG_BROKEN_DISCARD_WITH_EARLY_Z: return "broken-discard-with-early-z"; case BUG_BROKEN_DYNAMIC_SAMPLER_INDEXING: return "broken-dynamic-sampler-indexing"; case BUG_SLOW_OPTIMAL_IMAGE_TO_BUFFER_COPY: return "slow-optimal-image-to-buffer-copy"; + case BUG_BROKEN_DEPTH_CLAMP_CONTROL: return "broken-depth-clamp-control"; } return "Unknown"; } diff --git a/Source/Core/VideoCommon/DriverDetails.h b/Source/Core/VideoCommon/DriverDetails.h index 5d45da43a3..fbf36928e1 100644 --- a/Source/Core/VideoCommon/DriverDetails.h +++ b/Source/Core/VideoCommon/DriverDetails.h @@ -342,7 +342,14 @@ enum Bug // Affected devices: Adreno // Started Version: -1 // Ended Version: -1 - BUG_SLOW_OPTIMAL_IMAGE_TO_BUFFER_COPY + BUG_SLOW_OPTIMAL_IMAGE_TO_BUFFER_COPY, + + // BUG: Incorrect implementation of VK_EXT_depth_clamp_control causes incorrect depth values to + // be written to the depth buffer. + // Affected devices: AMD (Windows) + // Started Version: -1 + // Ended Version: -1 + BUG_BROKEN_DEPTH_CLAMP_CONTROL }; // Initializes our internal vendor, device family, and driver version From 0d87f835e2321992159d4b2f8eac923e2275c436 Mon Sep 17 00:00:00 2001 From: CrossVR Date: Sun, 27 Jul 2025 15:18:22 +0900 Subject: [PATCH 2/2] VKPipeline: Don't include depth clamp control struct when not supported This should not be needed --- Source/Core/VideoBackends/Vulkan/VKPipeline.cpp | 2 +- Source/Core/VideoCommon/DriverDetails.cpp | 4 ++-- Source/Core/VideoCommon/DriverDetails.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Core/VideoBackends/Vulkan/VKPipeline.cpp b/Source/Core/VideoBackends/Vulkan/VKPipeline.cpp index 1b8dd0eb9a..1e6eb68b7c 100644 --- a/Source/Core/VideoBackends/Vulkan/VKPipeline.cpp +++ b/Source/Core/VideoBackends/Vulkan/VKPipeline.cpp @@ -380,7 +380,7 @@ std::unique_ptr VKPipeline::Create(const AbstractPipelineConfig& con static const VkRect2D scissor = {{0, 0}, {1, 1}}; static const VkPipelineViewportStateCreateInfo viewport_state = { VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, - &depth_clamp_state, + g_backend_info.bSupportsUnrestrictedDepthRange ? &depth_clamp_state : nullptr, 0, // VkPipelineViewportStateCreateFlags flags; 1, // uint32_t viewportCount &viewport, // const VkViewport* pViewports diff --git a/Source/Core/VideoCommon/DriverDetails.cpp b/Source/Core/VideoCommon/DriverDetails.cpp index 41f49f490a..22d6fff2d0 100644 --- a/Source/Core/VideoCommon/DriverDetails.cpp +++ b/Source/Core/VideoCommon/DriverDetails.cpp @@ -158,8 +158,8 @@ constexpr BugInfo m_known_bugs[] = { BUG_BROKEN_DYNAMIC_SAMPLER_INDEXING, -1.0, -1.0, true}, {API_VULKAN, OS_ANDROID, VENDOR_QUALCOMM, DRIVER_QUALCOMM, Family::UNKNOWN, BUG_SLOW_OPTIMAL_IMAGE_TO_BUFFER_COPY, -1.0, -1.0, true}, - {API_VULKAN, OS_WINDOWS, VENDOR_ATI, DRIVER_ATI, Family::UNKNOWN, - BUG_BROKEN_DEPTH_CLAMP_CONTROL, -1.0, -1.0, true}, + {API_VULKAN, OS_ALL, VENDOR_ATI, DRIVER_ATI, Family::UNKNOWN, BUG_BROKEN_DEPTH_CLAMP_CONTROL, + -1.0, -1.0, true}, }; static std::map m_bugs; diff --git a/Source/Core/VideoCommon/DriverDetails.h b/Source/Core/VideoCommon/DriverDetails.h index fbf36928e1..597b2848d4 100644 --- a/Source/Core/VideoCommon/DriverDetails.h +++ b/Source/Core/VideoCommon/DriverDetails.h @@ -346,7 +346,7 @@ enum Bug // BUG: Incorrect implementation of VK_EXT_depth_clamp_control causes incorrect depth values to // be written to the depth buffer. - // Affected devices: AMD (Windows) + // Affected devices: Official AMD (RADV is unaffected) // Started Version: -1 // Ended Version: -1 BUG_BROKEN_DEPTH_CLAMP_CONTROL