SPV: Add auto location mapping of non-opaque non-block uniform variables.

Fix #1019.
This commit is contained in:
John Kessenich
2017-08-26 15:47:25 -06:00
parent 8268a35504
commit 82e95a3aa5
9 changed files with 93 additions and 12 deletions

View File

@@ -1,10 +1,9 @@
glspv.frag
ERROR: 0:4: '#error' : GL_SPIRV is set ( correct , not an error )
ERROR: 0:6: '#error' : GL_SPIR is 100
ERROR: 0:14: 'f' : non-opaque uniform variables need a layout(location=L)
ERROR: 0:19: 'input_attachment_index' : only allowed when using GLSL for Vulkan
ERROR: 0:19: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON
ERROR: 5 compilation errors. No code generated.
ERROR: 4 compilation errors. No code generated.
SPIR-V is not generated for failed compile or link

View File

@@ -0,0 +1,8 @@
spv.looseUniformNoLoc.vert
ERROR: spv.looseUniformNoLoc.vert:9: 'uv' : non-opaque uniform variables need a layout(location=L)
ERROR: 1 compilation errors. No code generated.
ERROR: Linking vertex stage: Missing entry point: Each stage requires one entry point
SPIR-V is not generated for failed compile or link

View File

@@ -1,12 +1,12 @@
spv.noBuiltInLoc.vert
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 23
// Id's are bound by 33
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 9 11 18
EntryPoint Vertex 4 "main" 9 11 18 31 32
Source GLSL 450
Name 4 "main"
Name 9 "bar"
@@ -17,6 +17,11 @@ spv.noBuiltInLoc.vert
MemberName 16(gl_PerVertex) 2 "gl_ClipDistance"
MemberName 16(gl_PerVertex) 3 "gl_CullDistance"
Name 18 ""
Name 24 "uv1"
Name 26 "uv2"
Name 29 "uv3"
Name 31 "gl_VertexID"
Name 32 "gl_InstanceID"
Decorate 9(bar) Location 0
Decorate 11(foo) Location 0
MemberDecorate 16(gl_PerVertex) 0 BuiltIn Position
@@ -24,6 +29,14 @@ spv.noBuiltInLoc.vert
MemberDecorate 16(gl_PerVertex) 2 BuiltIn ClipDistance
MemberDecorate 16(gl_PerVertex) 3 BuiltIn CullDistance
Decorate 16(gl_PerVertex) Block
Decorate 24(uv1) Location 0
Decorate 24(uv1) DescriptorSet 0
Decorate 26(uv2) Location 1
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
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@@ -40,6 +53,16 @@ spv.noBuiltInLoc.vert
18: 17(ptr) Variable Output
19: TypeInt 32 1
20: 19(int) Constant 0
23: TypePointer UniformConstant 7(fvec4)
24(uv1): 23(ptr) Variable UniformConstant
25: TypePointer UniformConstant 6(float)
26(uv2): 25(ptr) Variable UniformConstant
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
4(main): 2 Function None 3
5: Label
12: 7(fvec4) Load 11(foo)