GLSL/SPV: no location on atomic_uint; Fix #1339.

This commit is contained in:
John Kessenich 2018-04-09 17:21:30 -06:00
parent b92ce60fc7
commit 1dcd162399
3 changed files with 19 additions and 9 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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;