Vulkan: Work around indexed fragment output bug on AMD drivers

This commit is contained in:
Stenzek 2016-09-24 23:13:17 +10:00
parent f6cdc38c8b
commit bac8c2d441
3 changed files with 20 additions and 2 deletions

View file

@ -84,6 +84,8 @@ static BugInfo m_known_bugs[] = {
-1.0, true},
{API_OPENGL, OS_ALL, VENDOR_MESA, DRIVER_I965, Family::UNKNOWN, BUG_BROKENCLIPDISTANCE, -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},
};
static std::map<Bug, BugInfo> m_bugs;

View file

@ -222,6 +222,14 @@ enum Bug
// the geometry shader. Current workaround is to make sure the geometry shader always consumes
// the gl_ClipDistance inputs from the vertex shader.
BUG_BROKENCLIPDISTANCE,
// 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,
};
// Initializes our internal vendor, device family, and driver version

View file

@ -517,8 +517,16 @@ ShaderCode GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, APIType ApiType,
{
if (dstAlphaMode == DSTALPHA_DUAL_SOURCE_BLEND)
{
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
{