From aa64f7f14fcf3af9e5e605ffbe70151864b55856 Mon Sep 17 00:00:00 2001 From: OatmealDome Date: Fri, 23 Jul 2021 05:03:05 -0400 Subject: [PATCH 1/2] VulkanContext: Don't assume anv for Intel GPUs on macOS --- Source/Core/VideoBackends/Vulkan/VulkanContext.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp b/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp index 74d51c07dfc2..1e722178437b 100644 --- a/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp +++ b/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp @@ -869,8 +869,8 @@ void VulkanContext::InitDriverDetails() { // Apart from the driver version, Intel does not appear to provide a way to // differentiate between anv and the binary driver (Skylake+). Assume to be -// using anv if we not running on Windows. -#ifdef WIN32 +// using anv if we're not running on Windows or macOS. +#if defined(WIN32) || defined(__APPLE__) vendor = DriverDetails::VENDOR_INTEL; driver = DriverDetails::DRIVER_INTEL; #else From a256c11d2f885e950e68bcd43c34080676171f4a Mon Sep 17 00:00:00 2001 From: OatmealDome Date: Fri, 23 Jul 2021 08:32:21 -0400 Subject: [PATCH 2/2] DriverDetails: Add broken dual source blending bug to MoltenVK on Intel GPUs --- Source/Core/VideoBackends/Vulkan/VKPipeline.cpp | 8 +++++++- Source/Core/VideoCommon/DriverDetails.cpp | 2 ++ Source/Core/VideoCommon/DriverDetails.h | 11 +++++++---- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Source/Core/VideoBackends/Vulkan/VKPipeline.cpp b/Source/Core/VideoBackends/Vulkan/VKPipeline.cpp index 04c325cb7b3e..716f7be53073 100644 --- a/Source/Core/VideoBackends/Vulkan/VKPipeline.cpp +++ b/Source/Core/VideoBackends/Vulkan/VKPipeline.cpp @@ -14,6 +14,8 @@ #include "VideoBackends/Vulkan/VKVertexFormat.h" #include "VideoBackends/Vulkan/VulkanContext.h" +#include "VideoCommon/DriverDetails.h" + namespace Vulkan { VKPipeline::VKPipeline(VkPipeline pipeline, VkPipelineLayout pipeline_layout, @@ -137,7 +139,11 @@ static VkPipelineColorBlendAttachmentState GetVulkanAttachmentBlendState(const B vk_state.colorBlendOp = state.subtract ? VK_BLEND_OP_REVERSE_SUBTRACT : VK_BLEND_OP_ADD; vk_state.alphaBlendOp = state.subtractAlpha ? VK_BLEND_OP_REVERSE_SUBTRACT : VK_BLEND_OP_ADD; - if (state.usedualsrc && g_ActiveConfig.backend_info.bSupportsDualSourceBlend) + bool use_dual_source = + state.usedualsrc && g_ActiveConfig.backend_info.bSupportsDualSourceBlend && + (!DriverDetails::HasBug(DriverDetails::BUG_BROKEN_DUAL_SOURCE_BLENDING) || state.dstalpha); + + if (use_dual_source) { static constexpr std::array src_factors = { {VK_BLEND_FACTOR_ZERO, VK_BLEND_FACTOR_ONE, VK_BLEND_FACTOR_DST_COLOR, diff --git a/Source/Core/VideoCommon/DriverDetails.cpp b/Source/Core/VideoCommon/DriverDetails.cpp index 4b1ce936d0d6..6029654e57a2 100644 --- a/Source/Core/VideoCommon/DriverDetails.cpp +++ b/Source/Core/VideoCommon/DriverDetails.cpp @@ -95,6 +95,8 @@ constexpr BugInfo m_known_bugs[] = { BUG_BROKEN_DUAL_SOURCE_BLENDING, -1.0, -1.0, true}, {API_OPENGL, OS_OSX, VENDOR_INTEL, DRIVER_INTEL, Family::UNKNOWN, BUG_BROKEN_DUAL_SOURCE_BLENDING, -1.0, -1.0, true}, + {API_VULKAN, OS_OSX, VENDOR_INTEL, DRIVER_PORTABILITY, Family::UNKNOWN, + BUG_BROKEN_DUAL_SOURCE_BLENDING, -1.0, -1.0, true}, {API_OPENGL, OS_ALL, VENDOR_IMGTEC, DRIVER_IMGTEC, Family::UNKNOWN, BUG_BROKEN_BITWISE_OP_NEGATION, -1.0, 108.4693462, true}, {API_VULKAN, OS_WINDOWS, VENDOR_ATI, DRIVER_ATI, Family::UNKNOWN, BUG_PRIMITIVE_RESTART, -1.0, diff --git a/Source/Core/VideoCommon/DriverDetails.h b/Source/Core/VideoCommon/DriverDetails.h index 6a9927faa364..5e3f2ce1610e 100644 --- a/Source/Core/VideoCommon/DriverDetails.h +++ b/Source/Core/VideoCommon/DriverDetails.h @@ -229,13 +229,16 @@ enum Bug // index as a MRT location instead, or omit the binding completely. BUG_BROKEN_FRAGMENT_SHADER_INDEX_DECORATION, - // Bug: Dual-source outputs from fragment shaders are broken on AMD OpenGL drivers + // Bug: Dual-source outputs from fragment shaders are broken on some drivers. // Started Version: -1 // Ended Version: -1 - // Fragment shaders that specify dual-source outputs, cause the driver to crash - // sometimes this happens in the kernel mode part of the driver resulting in a BSOD. - // Disable dual-source blending support for now. + // On some AMD drivers, fragment shaders that specify dual-source outputs can cause the driver to + // crash. Sometimes this happens in the kernel mode part of the driver, resulting in a BSOD. + // These shaders are also particularly problematic on macOS's Intel drivers. On OpenGL, they can + // cause depth issues. On Metal, they can cause the driver to not write a primitive to the depth + // buffer whenever a fragment is discarded. Disable dual-source blending support on these drivers. BUG_BROKEN_DUAL_SOURCE_BLENDING, + // BUG: ImgTec GLSL shader compiler fails when negating the input to a bitwise operation // Started version: 1.5 // Ended version: 1.8@4693462