summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorJMC47 <JMC4789@gmail.com>2022-07-10 19:35:55 -0400
committerGitHub <noreply@github.com>2022-07-10 19:35:55 -0400
commitcce6133ef6a95ddca18264290be005ababc6dc6e (patch)
tree9445dbc0f15707eac9a4574a04d5e7404575e878 /Source/Core
parent38cb76dea54b59fa0eae458e0898edebed13e7ca (diff)
parent25929789c1e80d7a22d6acdb14082bc44e4fb0e9 (diff)
Merge pull request #10749 from tellowkrinkle/IntelUbershaders
VideoCommon: Fix ubershaders on MoltenVK Intel
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/VideoBackends/Vulkan/VulkanContext.cpp4
-rw-r--r--Source/Core/VideoCommon/DriverDetails.cpp2
-rw-r--r--Source/Core/VideoCommon/DriverDetails.h6
-rw-r--r--Source/Core/VideoCommon/UberShaderPixel.cpp23
4 files changed, 19 insertions, 16 deletions
diff --git a/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp b/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp
index 0a82d6451f..1dc02e689a 100644
--- a/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp
+++ b/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp
@@ -377,6 +377,10 @@ void VulkanContext::PopulateBackendInfoFeatures(VideoConfig* config, VkPhysicalD
// We will use shader blending, so disable hardware dual source blending.
config->backend_info.bSupportsDualSourceBlend = false;
}
+
+ // Dynamic sampler indexing locks up Intel GPUs on MoltenVK/Metal
+ if (DriverDetails::HasBug(DriverDetails::BUG_BROKEN_DYNAMIC_SAMPLER_INDEXING))
+ config->backend_info.bSupportsDynamicSamplerIndexing = false;
}
void VulkanContext::PopulateBackendInfoMultisampleModes(
diff --git a/Source/Core/VideoCommon/DriverDetails.cpp b/Source/Core/VideoCommon/DriverDetails.cpp
index b532bf785d..d4d828e12e 100644
--- a/Source/Core/VideoCommon/DriverDetails.cpp
+++ b/Source/Core/VideoCommon/DriverDetails.cpp
@@ -140,6 +140,8 @@ constexpr BugInfo m_known_bugs[] = {
-1.0, -1.0, true},
{API_VULKAN, OS_OSX, VENDOR_APPLE, DRIVER_PORTABILITY, Family::UNKNOWN,
BUG_BROKEN_DISCARD_WITH_EARLY_Z, -1.0, -1.0, true},
+ {API_VULKAN, OS_OSX, VENDOR_INTEL, DRIVER_PORTABILITY, Family::UNKNOWN,
+ BUG_BROKEN_DYNAMIC_SAMPLER_INDEXING, -1.0, -1.0, true},
};
static std::map<Bug, BugInfo> m_bugs;
diff --git a/Source/Core/VideoCommon/DriverDetails.h b/Source/Core/VideoCommon/DriverDetails.h
index e75c4f7926..c1dbdb0a4a 100644
--- a/Source/Core/VideoCommon/DriverDetails.h
+++ b/Source/Core/VideoCommon/DriverDetails.h
@@ -320,6 +320,12 @@ enum Bug
// Started version: -1
// Ended version: -1
BUG_BROKEN_DISCARD_WITH_EARLY_Z,
+
+ // BUG: Using dynamic sampler indexing locks up the GPU
+ // Affected devices: Intel (macOS Metal)
+ // Started version: -1
+ // Ended version: -1
+ BUG_BROKEN_DYNAMIC_SAMPLER_INDEXING,
};
// Initializes our internal vendor, device family, and driver version
diff --git a/Source/Core/VideoCommon/UberShaderPixel.cpp b/Source/Core/VideoCommon/UberShaderPixel.cpp
index 01df6fe5c6..024b49ddfa 100644
--- a/Source/Core/VideoCommon/UberShaderPixel.cpp
+++ b/Source/Core/VideoCommon/UberShaderPixel.cpp
@@ -486,14 +486,6 @@ ShaderCode GenPixelShader(APIType api_type, const ShaderHostConfig& host_config,
"int4 getTevReg(in State s, uint index) {{\n");
WriteSwitch(out, api_type, "index", tev_regs_lookup_table, 2, false);
out.Write("}}\n"
- "\n"
- "void setRegColor(inout State s, uint index, int3 color) {{\n");
- WriteSwitch(out, api_type, "index", tev_c_set_table, 2, true);
- out.Write("}}\n"
- "\n"
- "void setRegAlpha(inout State s, uint index, int alpha) {{\n");
- WriteSwitch(out, api_type, "index", tev_a_set_table, 2, true);
- out.Write("}}\n"
"\n");
// Since the fixed-point texture coodinate variables aren't global, we need to pass
@@ -798,9 +790,9 @@ ShaderCode GenPixelShader(APIType api_type, const ShaderHostConfig& host_config,
" else\n"
" color = clamp(color, -1024, 1023);\n"
"\n"
- " // Write result to the correct input register of the next stage\n"
- " setRegColor(s, color_dest, color);\n"
- "\n");
+ " // Write result to the correct input register of the next stage\n");
+ WriteSwitch(out, api_type, "color_dest", tev_c_set_table, 6, true);
+ out.Write("\n");
// Alpha combiner
out.Write(" // Alpha Combiner\n");
@@ -864,11 +856,10 @@ ShaderCode GenPixelShader(APIType api_type, const ShaderHostConfig& host_config,
" else\n"
" alpha = clamp(alpha, -1024, 1023);\n"
"\n"
- " // Write result to the correct input register of the next stage\n"
- " setRegAlpha(s, alpha_dest, alpha);\n"
- " }}\n");
-
- out.Write(" }} // Main TEV loop\n"
+ " // Write result to the correct input register of the next stage\n");
+ WriteSwitch(out, api_type, "alpha_dest", tev_a_set_table, 6, true);
+ out.Write(" }}\n"
+ " }} // Main TEV loop\n"
"\n");
// Select the output color and alpha registers from the last stage.