mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-07 01:53:24 +09:00
[Fix] (Shader): reject a location qualifier on an atomic counter instead of dropping it with a warning
This commit is contained in:
Vendored
+1
-1
Submodule 3rdparty/glslang updated: 5f9f0ad9ac...d3c70bb6a1
@@ -879,7 +879,9 @@ void main() {
|
|||||||
|
|
||||||
// The rest of fixOffset()'s rules, raised where the relaxed parse folds the counter: an
|
// The rest of fixOffset()'s rules, raised where the relaxed parse folds the counter: an
|
||||||
// unsized counter array, a counter with no binding (there is no default binding - only a
|
// unsized counter array, a counter with no binding (there is no default binding - only a
|
||||||
// default offset), and a counter placed on top of an earlier one.
|
// default offset), and a counter placed on top of an earlier one. Plus a location qualifier,
|
||||||
|
// which an atomic counter cannot take (KHR-GL4x.layout_location.invalid_cases) and which the
|
||||||
|
// relaxed parse used to drop with only a warning.
|
||||||
TEST_F(ProgramInterfaceTest, IllegalAtomicCounterDeclarationsFailToCompile) {
|
TEST_F(ProgramInterfaceTest, IllegalAtomicCounterDeclarationsFailToCompile) {
|
||||||
const auto compiles = [](const char* source) {
|
const auto compiles = [](const char* source) {
|
||||||
const GLuint sh = CreateShader(GL_FRAGMENT_SHADER);
|
const GLuint sh = CreateShader(GL_FRAGMENT_SHADER);
|
||||||
@@ -907,6 +909,11 @@ layout(binding = 0, offset = 4) uniform atomic_uint a;
|
|||||||
layout(binding = 0, offset = 0) uniform atomic_uint b[2];
|
layout(binding = 0, offset = 0) uniform atomic_uint b[2];
|
||||||
void main() { color = vec4(float(atomicCounterIncrement(a) + atomicCounterIncrement(b[1]))); }
|
void main() { color = vec4(float(atomicCounterIncrement(a) + atomicCounterIncrement(b[1]))); }
|
||||||
)")) << "array overlapping an earlier counter";
|
)")) << "array overlapping an earlier counter";
|
||||||
|
EXPECT_FALSE(compiles(R"(#version 430
|
||||||
|
out vec4 color;
|
||||||
|
layout(location = 2, binding = 0) uniform atomic_uint ac;
|
||||||
|
void main() { color = vec4(float(atomicCounterIncrement(ac))); }
|
||||||
|
)")) << "location on an atomic counter";
|
||||||
EXPECT_TRUE(compiles(R"(#version 430
|
EXPECT_TRUE(compiles(R"(#version 430
|
||||||
out vec4 color;
|
out vec4 color;
|
||||||
layout(binding = 0, offset = 0) uniform atomic_uint a;
|
layout(binding = 0, offset = 0) uniform atomic_uint a;
|
||||||
|
|||||||
Reference in New Issue
Block a user