From c81bc4521f24963d457e6f14b300dbe2337f5bf8 Mon Sep 17 00:00:00 2001 From: Jiawei Shao Date: Thu, 4 May 2023 08:07:28 +0000 Subject: [PATCH] D3D12: Disable the toggles about alpha blending on latest Intel driver This patch disables all the toggles about the alpha blending issue on the latest Intel D3D12 driver which has the fix against all the related driver bugs. Bug: dawn:1579 Change-Id: Ief8b08fd00df1b2872d663245d728374fb38a5b3 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131440 Reviewed-by: Corentin Wallez Kokoro: Kokoro Commit-Queue: Jiawei Shao --- src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp b/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp index a3ff85c3d5..18304834d3 100644 --- a/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp +++ b/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp @@ -547,14 +547,18 @@ void PhysicalDevice::SetupBackendDeviceToggles(TogglesState* deviceToggles) cons // Currently this toggle is only needed on Intel Gen9 and Gen9.5 GPUs. // See http://crbug.com/dawn/1579 for more information. if (gpu_info::IsIntelGen9(vendorId, deviceId)) { - // We can add workaround when the blending operation is "Add", DstFactor is "Zero" and - // SrcFactor is "DstAlpha". - deviceToggles->ForceSet( - Toggle::D3D12ReplaceAddWithMinusWhenDstFactorIsZeroAndSrcFactorIsDstAlpha, true); + const gpu_info::DriverVersion kFixedDriverVersion = {31, 0, 101, 2121}; + if (gpu_info::CompareWindowsDriverVersion(vendorId, GetDriverVersion(), + kFixedDriverVersion) < 0) { + // We can add workaround when the blending operation is "Add", DstFactor is "Zero" and + // SrcFactor is "DstAlpha". + deviceToggles->ForceSet( + Toggle::D3D12ReplaceAddWithMinusWhenDstFactorIsZeroAndSrcFactorIsDstAlpha, true); - // Unfortunately we cannot add workaround for other cases. - deviceToggles->ForceSet( - Toggle::NoWorkaroundDstAlphaAsSrcBlendFactorForBothColorAndAlphaDoesNotWork, true); + // Unfortunately we cannot add workaround for other cases. + deviceToggles->ForceSet( + Toggle::NoWorkaroundDstAlphaAsSrcBlendFactorForBothColorAndAlphaDoesNotWork, true); + } } #if D3D12_SDK_VERSION >= 602