summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2018-09-01 05:32:56 +0200
committerGitHub <noreply@github.com>2018-09-01 05:32:56 +0200
commit95c2a92f26542dba3512b95243b3fcff8fb34324 (patch)
tree0dc6dfe920502fb93fe2e308cdb4bcadeda49f3d /Source/Core
parent4a34dba00137ec9d9456e2f500ffd88731112909 (diff)
Revert "ShaderGen: Drop broken fragment shader index workaround for Vulkan"
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/VideoCommon/DriverDetails.cpp2
-rw-r--r--Source/Core/VideoCommon/DriverDetails.h8
-rw-r--r--Source/Core/VideoCommon/PixelShaderGen.cpp21
-rw-r--r--Source/Core/VideoCommon/UberShaderPixel.cpp21
4 files changed, 46 insertions, 6 deletions
diff --git a/Source/Core/VideoCommon/DriverDetails.cpp b/Source/Core/VideoCommon/DriverDetails.cpp
index aa186181cb..301c73d89f 100644
--- a/Source/Core/VideoCommon/DriverDetails.cpp
+++ b/Source/Core/VideoCommon/DriverDetails.cpp
@@ -88,6 +88,8 @@ static BugInfo m_known_bugs[] = {
-1.0, true},
{API_OPENGL, OS_ALL, VENDOR_MESA, DRIVER_I965, Family::UNKNOWN, BUG_BROKEN_CLIP_DISTANCE, -1.0,
-1.0, true},
+ {API_VULKAN, OS_ALL, VENDOR_ATI, DRIVER_ATI, Family::UNKNOWN,
+ BUG_BROKEN_FRAGMENT_SHADER_INDEX_DECORATION, -1.0, -1.0, true},
{API_OPENGL, OS_WINDOWS, VENDOR_ATI, DRIVER_ATI, Family::UNKNOWN,
BUG_BROKEN_DUAL_SOURCE_BLENDING, -1.0, -1.0, true},
{API_OPENGL, OS_OSX, VENDOR_INTEL, DRIVER_INTEL, Family::UNKNOWN,
diff --git a/Source/Core/VideoCommon/DriverDetails.h b/Source/Core/VideoCommon/DriverDetails.h
index f3673a26f2..9ace5f83b4 100644
--- a/Source/Core/VideoCommon/DriverDetails.h
+++ b/Source/Core/VideoCommon/DriverDetails.h
@@ -220,6 +220,14 @@ enum Bug
// the gl_ClipDistance inputs from the vertex shader.
BUG_BROKEN_CLIP_DISTANCE,
+ // Bug: Dual-source outputs from fragment shaders are broken on AMD Vulkan drivers
+ // Started Version: -1
+ // Ended Version: -1
+ // Fragment shaders that specify dual-source outputs, via layout(location = 0, index = ...) cause
+ // the driver to fail to create graphics pipelines. The workaround for this is to specify the
+ // 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
// Started Version: -1
// Ended Version: -1
diff --git a/Source/Core/VideoCommon/PixelShaderGen.cpp b/Source/Core/VideoCommon/PixelShaderGen.cpp
index 115d42f14c..7ba5edba7f 100644
--- a/Source/Core/VideoCommon/PixelShaderGen.cpp
+++ b/Source/Core/VideoCommon/PixelShaderGen.cpp
@@ -553,8 +553,16 @@ ShaderCode GeneratePixelShaderCode(APIType ApiType, const ShaderHostConfig& host
{
if (use_dual_source)
{
- out.Write("FRAGMENT_OUTPUT_LOCATION_INDEXED(0, 0) out vec4 ocol0;\n");
- out.Write("FRAGMENT_OUTPUT_LOCATION_INDEXED(0, 1) out vec4 ocol1;\n");
+ if (DriverDetails::HasBug(DriverDetails::BUG_BROKEN_FRAGMENT_SHADER_INDEX_DECORATION))
+ {
+ out.Write("FRAGMENT_OUTPUT_LOCATION(0) out vec4 ocol0;\n");
+ out.Write("FRAGMENT_OUTPUT_LOCATION(1) out vec4 ocol1;\n");
+ }
+ else
+ {
+ out.Write("FRAGMENT_OUTPUT_LOCATION_INDEXED(0, 0) out vec4 ocol0;\n");
+ out.Write("FRAGMENT_OUTPUT_LOCATION_INDEXED(0, 1) out vec4 ocol1;\n");
+ }
}
else if (use_shader_blend)
{
@@ -562,7 +570,14 @@ ShaderCode GeneratePixelShaderCode(APIType ApiType, const ShaderHostConfig& host
// intermediate value with multiple reads & modifications, so pull out the "real" output value
// and use a temporary for calculations, then set the output value once at the end of the
// shader
- out.Write("FRAGMENT_OUTPUT_LOCATION_INDEXED(0, 0) FRAGMENT_INOUT vec4 real_ocol0;\n");
+ if (DriverDetails::HasBug(DriverDetails::BUG_BROKEN_FRAGMENT_SHADER_INDEX_DECORATION))
+ {
+ out.Write("FRAGMENT_OUTPUT_LOCATION(0) FRAGMENT_INOUT vec4 real_ocol0;\n");
+ }
+ else
+ {
+ out.Write("FRAGMENT_OUTPUT_LOCATION_INDEXED(0, 0) FRAGMENT_INOUT vec4 real_ocol0;\n");
+ }
}
else
{
diff --git a/Source/Core/VideoCommon/UberShaderPixel.cpp b/Source/Core/VideoCommon/UberShaderPixel.cpp
index cd188d4de9..9c9630886a 100644
--- a/Source/Core/VideoCommon/UberShaderPixel.cpp
+++ b/Source/Core/VideoCommon/UberShaderPixel.cpp
@@ -69,8 +69,16 @@ ShaderCode GenPixelShader(APIType ApiType, const ShaderHostConfig& host_config,
{
if (use_dual_source)
{
- out.Write("FRAGMENT_OUTPUT_LOCATION_INDEXED(0, 0) out vec4 ocol0;\n");
- out.Write("FRAGMENT_OUTPUT_LOCATION_INDEXED(0, 1) out vec4 ocol1;\n");
+ if (DriverDetails::HasBug(DriverDetails::BUG_BROKEN_FRAGMENT_SHADER_INDEX_DECORATION))
+ {
+ out.Write("FRAGMENT_OUTPUT_LOCATION(0) out vec4 ocol0;\n");
+ out.Write("FRAGMENT_OUTPUT_LOCATION(1) out vec4 ocol1;\n");
+ }
+ else
+ {
+ out.Write("FRAGMENT_OUTPUT_LOCATION_INDEXED(0, 0) out vec4 ocol0;\n");
+ out.Write("FRAGMENT_OUTPUT_LOCATION_INDEXED(0, 1) out vec4 ocol1;\n");
+ }
}
else if (use_shader_blend)
{
@@ -78,7 +86,14 @@ ShaderCode GenPixelShader(APIType ApiType, const ShaderHostConfig& host_config,
// intermediate value with multiple reads & modifications, so pull out the "real" output value
// and use a temporary for calculations, then set the output value once at the end of the
// shader
- out.Write("FRAGMENT_OUTPUT_LOCATION_INDEXED(0, 0) FRAGMENT_INOUT vec4 real_ocol0;\n");
+ if (DriverDetails::HasBug(DriverDetails::BUG_BROKEN_FRAGMENT_SHADER_INDEX_DECORATION))
+ {
+ out.Write("FRAGMENT_OUTPUT_LOCATION(0) FRAGMENT_INOUT vec4 real_ocol0;\n");
+ }
+ else
+ {
+ out.Write("FRAGMENT_OUTPUT_LOCATION_INDEXED(0, 0) FRAGMENT_INOUT vec4 real_ocol0;\n");
+ }
}
else
{