From cc23ed3c7e8b5df7dd264a785fd1ce6ce097d4e1 Mon Sep 17 00:00:00 2001 From: Swung0x48 Date: Mon, 12 Oct 2026 07:58:34 -0400 Subject: [PATCH] [Fix] (Shader): reject a location qualifier on an atomic counter instead of dropping it with a warning --- 3rdparty/glslang | 2 +- MobileGL/MG_Test/Program/ProgramInterfaceTest.cpp | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/3rdparty/glslang b/3rdparty/glslang index 5f9f0ad9..d3c70bb6 160000 --- a/3rdparty/glslang +++ b/3rdparty/glslang @@ -1 +1 @@ -Subproject commit 5f9f0ad9acb1d009f8a44163dce5b39b4536fb95 +Subproject commit d3c70bb6a167c25ff23dcdf1f5c736d760cab3b2 diff --git a/MobileGL/MG_Test/Program/ProgramInterfaceTest.cpp b/MobileGL/MG_Test/Program/ProgramInterfaceTest.cpp index 6621de4b..bbc9f66c 100644 --- a/MobileGL/MG_Test/Program/ProgramInterfaceTest.cpp +++ b/MobileGL/MG_Test/Program/ProgramInterfaceTest.cpp @@ -879,7 +879,9 @@ void main() { // 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 - // 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) { const auto compiles = [](const char* source) { 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]; void main() { color = vec4(float(atomicCounterIncrement(a) + atomicCounterIncrement(b[1]))); } )")) << "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 out vec4 color; layout(binding = 0, offset = 0) uniform atomic_uint a;