Merge pull request #10760 from tellowkrinkle/std430
VideoCommon: Fix SSBO layout and remove associated "bug"
This commit is contained in:
commit
ffa3bf86fb
|
@ -790,7 +790,7 @@ void ProgramShaderCache::CreateHeader()
|
||||||
"#define UBO_BINDING(packing, x) layout(packing, binding = x)\n"
|
"#define UBO_BINDING(packing, x) layout(packing, binding = x)\n"
|
||||||
"#define SAMPLER_BINDING(x) layout(binding = x)\n"
|
"#define SAMPLER_BINDING(x) layout(binding = x)\n"
|
||||||
"#define TEXEL_BUFFER_BINDING(x) layout(binding = x)\n"
|
"#define TEXEL_BUFFER_BINDING(x) layout(binding = x)\n"
|
||||||
"#define SSBO_BINDING(x) layout(binding = x)\n"
|
"#define SSBO_BINDING(x) layout(std430, binding = x)\n"
|
||||||
"#define IMAGE_BINDING(format, x) layout(format, binding = x)\n" :
|
"#define IMAGE_BINDING(format, x) layout(format, binding = x)\n" :
|
||||||
"#define ATTRIBUTE_LOCATION(x)\n"
|
"#define ATTRIBUTE_LOCATION(x)\n"
|
||||||
"#define FRAGMENT_OUTPUT_LOCATION(x)\n"
|
"#define FRAGMENT_OUTPUT_LOCATION(x)\n"
|
||||||
|
@ -798,7 +798,7 @@ void ProgramShaderCache::CreateHeader()
|
||||||
"#define UBO_BINDING(packing, x) layout(packing)\n"
|
"#define UBO_BINDING(packing, x) layout(packing)\n"
|
||||||
"#define SAMPLER_BINDING(x)\n"
|
"#define SAMPLER_BINDING(x)\n"
|
||||||
"#define TEXEL_BUFFER_BINDING(x)\n"
|
"#define TEXEL_BUFFER_BINDING(x)\n"
|
||||||
"#define SSBO_BINDING(x)\n"
|
"#define SSBO_BINDING(x) layout(std430)\n"
|
||||||
"#define IMAGE_BINDING(format, x) layout(format)\n",
|
"#define IMAGE_BINDING(format, x) layout(format)\n",
|
||||||
// Input/output blocks are matched by name during program linking
|
// Input/output blocks are matched by name during program linking
|
||||||
"#define VARYING_LOCATION(x)\n",
|
"#define VARYING_LOCATION(x)\n",
|
||||||
|
|
|
@ -49,7 +49,7 @@ static const char SHADER_HEADER[] = R"(
|
||||||
#define UBO_BINDING(packing, x) layout(packing, set = 0, binding = (x - 1))
|
#define UBO_BINDING(packing, x) layout(packing, set = 0, binding = (x - 1))
|
||||||
#define SAMPLER_BINDING(x) layout(set = 1, binding = x)
|
#define SAMPLER_BINDING(x) layout(set = 1, binding = x)
|
||||||
#define TEXEL_BUFFER_BINDING(x) layout(set = 1, binding = (x + 8))
|
#define TEXEL_BUFFER_BINDING(x) layout(set = 1, binding = (x + 8))
|
||||||
#define SSBO_BINDING(x) layout(set = 2, binding = x)
|
#define SSBO_BINDING(x) layout(std430, set = 2, binding = x)
|
||||||
#define INPUT_ATTACHMENT_BINDING(x, y, z) layout(set = x, binding = y, input_attachment_index = z)
|
#define INPUT_ATTACHMENT_BINDING(x, y, z) layout(set = x, binding = y, input_attachment_index = z)
|
||||||
#define VARYING_LOCATION(x) layout(location = x)
|
#define VARYING_LOCATION(x) layout(location = x)
|
||||||
#define FORCE_EARLY_Z layout(early_fragment_tests) in
|
#define FORCE_EARLY_Z layout(early_fragment_tests) in
|
||||||
|
|
|
@ -128,8 +128,6 @@ constexpr BugInfo m_known_bugs[] = {
|
||||||
-1.0, -1.0, true},
|
-1.0, -1.0, true},
|
||||||
{API_VULKAN, OS_ALL, VENDOR_ARM, DRIVER_ARM, Family::UNKNOWN, BUG_BROKEN_VECTOR_BITWISE_AND,
|
{API_VULKAN, OS_ALL, VENDOR_ARM, DRIVER_ARM, Family::UNKNOWN, BUG_BROKEN_VECTOR_BITWISE_AND,
|
||||||
-1.0, -1.0, true},
|
-1.0, -1.0, true},
|
||||||
{API_OPENGL, OS_WINDOWS, VENDOR_ATI, DRIVER_ATI, Family::UNKNOWN, BUG_BROKEN_SSBO_FIELD_ATOMICS,
|
|
||||||
-1.0, -1.0, true},
|
|
||||||
{API_VULKAN, OS_OSX, VENDOR_ATI, DRIVER_PORTABILITY, Family::UNKNOWN,
|
{API_VULKAN, OS_OSX, VENDOR_ATI, DRIVER_PORTABILITY, Family::UNKNOWN,
|
||||||
BUG_BROKEN_SUBGROUP_INVOCATION_ID, -1.0, -1.0, true},
|
BUG_BROKEN_SUBGROUP_INVOCATION_ID, -1.0, -1.0, true},
|
||||||
{API_OPENGL, OS_ANDROID, VENDOR_ALL, DRIVER_ALL, Family::UNKNOWN,
|
{API_OPENGL, OS_ANDROID, VENDOR_ALL, DRIVER_ALL, Family::UNKNOWN,
|
||||||
|
|
|
@ -302,14 +302,6 @@ enum Bug
|
||||||
// Ended version: -1
|
// Ended version: -1
|
||||||
BUG_BROKEN_VECTOR_BITWISE_AND,
|
BUG_BROKEN_VECTOR_BITWISE_AND,
|
||||||
|
|
||||||
// BUG: Atomic writes to different fields or array elements of an SSBO have no effect, only
|
|
||||||
// writing to the first field/element works. This causes bounding box emulation to give garbage
|
|
||||||
// values under OpenGL.
|
|
||||||
// Affected devices: AMD (Windows)
|
|
||||||
// Started version: -1
|
|
||||||
// Ended version: -1
|
|
||||||
BUG_BROKEN_SSBO_FIELD_ATOMICS,
|
|
||||||
|
|
||||||
// BUG: Accessing gl_SubgroupInvocationID causes the Metal shader compiler to crash.
|
// BUG: Accessing gl_SubgroupInvocationID causes the Metal shader compiler to crash.
|
||||||
// Affected devices: AMD (macOS)
|
// Affected devices: AMD (macOS)
|
||||||
// Started version: -1
|
// Started version: -1
|
||||||
|
|
|
@ -464,22 +464,9 @@ void WritePixelShaderCommonHeader(ShaderCode& out, APIType api_type,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
out.Write("SSBO_BINDING(0) buffer BBox {{\n");
|
out.Write("SSBO_BINDING(0) buffer BBox {{\n"
|
||||||
|
" int bbox_data[4];\n"
|
||||||
if (DriverDetails::HasBug(DriverDetails::BUG_BROKEN_SSBO_FIELD_ATOMICS))
|
"}};");
|
||||||
{
|
|
||||||
// AMD drivers on Windows seemingly ignore atomic writes to fields or array elements of an
|
|
||||||
// SSBO other than the first one, but using an int4 seems to work fine
|
|
||||||
out.Write(" int4 bbox_data;\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// The Metal shader compiler fails to compile the atomic instructions when operating on
|
|
||||||
// individual components of a vector
|
|
||||||
out.Write(" int bbox_data[4];\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
out.Write("}};");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
out.Write(R"(
|
out.Write(R"(
|
||||||
|
|
Loading…
Reference in New Issue