From 1dcd16239918b50a20fbcea13bf10a2fa0bd948c Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Mon, 9 Apr 2018 17:21:30 -0600 Subject: [PATCH] GLSL/SPV: no location on atomic_uint; Fix #1339. --- Test/baseResults/spv.noBuiltInLoc.vert.out | 25 ++++++++++++++-------- Test/spv.noBuiltInLoc.vert | 2 ++ glslang/MachineIndependent/iomapper.cpp | 1 + 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/Test/baseResults/spv.noBuiltInLoc.vert.out b/Test/baseResults/spv.noBuiltInLoc.vert.out index b8d43f2b0..61554bd8d 100644 --- a/Test/baseResults/spv.noBuiltInLoc.vert.out +++ b/Test/baseResults/spv.noBuiltInLoc.vert.out @@ -1,12 +1,13 @@ spv.noBuiltInLoc.vert // Module Version 10000 // Generated by (magic number): 80006 -// Id's are bound by 33 +// Id's are bound by 35 Capability Shader + Capability AtomicStorage 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Vertex 4 "main" 9 11 18 31 32 + EntryPoint Vertex 4 "main" 9 11 18 33 34 Source GLSL 450 Name 4 "main" Name 9 "bar" @@ -20,8 +21,9 @@ spv.noBuiltInLoc.vert Name 24 "uv1" Name 26 "uv2" Name 29 "uv3" - Name 31 "gl_VertexID" - Name 32 "gl_InstanceID" + Name 31 "a_uint" + Name 33 "gl_VertexID" + Name 34 "gl_InstanceID" Decorate 9(bar) Location 0 Decorate 11(foo) Location 0 MemberDecorate 16(gl_PerVertex) 0 BuiltIn Position @@ -35,8 +37,11 @@ spv.noBuiltInLoc.vert Decorate 26(uv2) DescriptorSet 0 Decorate 29(uv3) Location 2 Decorate 29(uv3) DescriptorSet 0 - Decorate 31(gl_VertexID) BuiltIn VertexId - Decorate 32(gl_InstanceID) BuiltIn InstanceId + Decorate 31(a_uint) Offset 0 + Decorate 31(a_uint) DescriptorSet 0 + Decorate 31(a_uint) Binding 0 + Decorate 33(gl_VertexID) BuiltIn VertexId + Decorate 34(gl_InstanceID) BuiltIn InstanceId 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -60,9 +65,11 @@ spv.noBuiltInLoc.vert 27: TypeVector 6(float) 3 28: TypePointer UniformConstant 27(fvec3) 29(uv3): 28(ptr) Variable UniformConstant - 30: TypePointer Input 19(int) - 31(gl_VertexID): 30(ptr) Variable Input -32(gl_InstanceID): 30(ptr) Variable Input + 30: TypePointer AtomicCounter 13(int) + 31(a_uint): 30(ptr) Variable AtomicCounter + 32: TypePointer Input 19(int) + 33(gl_VertexID): 32(ptr) Variable Input +34(gl_InstanceID): 32(ptr) Variable Input 4(main): 2 Function None 3 5: Label 12: 7(fvec4) Load 11(foo) diff --git a/Test/spv.noBuiltInLoc.vert b/Test/spv.noBuiltInLoc.vert index 5fbe25219..4087ab363 100644 --- a/Test/spv.noBuiltInLoc.vert +++ b/Test/spv.noBuiltInLoc.vert @@ -10,6 +10,8 @@ uniform vec4 uv1; uniform float uv2; uniform vec3 uv3; +layout(binding = 0) uniform atomic_uint a_uint; + void main() { bar = foo; diff --git a/glslang/MachineIndependent/iomapper.cpp b/glslang/MachineIndependent/iomapper.cpp index 68172538d..ad22353b4 100644 --- a/glslang/MachineIndependent/iomapper.cpp +++ b/glslang/MachineIndependent/iomapper.cpp @@ -432,6 +432,7 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver // no locations added if already present, a built-in variable, a block, or an opaque if (type.getQualifier().hasLocation() || type.isBuiltIn() || type.getBasicType() == EbtBlock || + type.getBasicType() == EbtAtomicUint || (type.containsOpaque() && intermediate.getSpv().openGl == 0)) return -1;