WIP: HLSL: preserve empty structures after splitting

This commit is contained in:
steve-lunarg 2017-03-09 19:10:57 -07:00
parent 6e1d50a7a2
commit 4198b8bfc4
8 changed files with 72 additions and 20 deletions

View File

@ -105,6 +105,7 @@ Shader version: 450
0:? 'g_tTexcdf4' (uniform textureCube)
0:? 'g_tTexcdi4' (uniform itextureCube)
0:? 'g_tTexcdu4' (uniform utextureCube)
0:? '@entryPointOutput' (layout(location=0 ) out structure{})
Linked vertex stage:
@ -216,16 +217,17 @@ Shader version: 450
0:? 'g_tTexcdf4' (uniform textureCube)
0:? 'g_tTexcdi4' (uniform itextureCube)
0:? 'g_tTexcdu4' (uniform utextureCube)
0:? '@entryPointOutput' (layout(location=0 ) out structure{})
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 126
// Id's are bound by 129
Capability Shader
Capability Sampled1D
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 103
EntryPoint Vertex 4 "main" 103 128
Name 4 "main"
Name 8 "VS_OUTPUT"
MemberName 8(VS_OUTPUT) 0 "Pos"
@ -253,6 +255,8 @@ Shader version: 450
Name 119 "g_tTex3df4"
Name 122 "g_tTex3di4"
Name 125 "g_tTex3du4"
Name 126 "VS_OUTPUT"
Name 128 "@entryPointOutput"
Decorate 16(g_tTex2df4) DescriptorSet 0
Decorate 20(g_sSamp) DescriptorSet 0
Decorate 20(g_sSamp) Binding 0
@ -272,6 +276,7 @@ Shader version: 450
Decorate 119(g_tTex3df4) DescriptorSet 0
Decorate 122(g_tTex3di4) DescriptorSet 0
Decorate 125(g_tTex3du4) DescriptorSet 0
Decorate 128(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@ -355,6 +360,9 @@ Shader version: 450
123: TypeImage 45(int) 3D sampled format:Unknown
124: TypePointer UniformConstant 123
125(g_tTex3du4): 124(ptr) Variable UniformConstant
126(VS_OUTPUT): TypeStruct
127: TypePointer Output 126(VS_OUTPUT)
128(@entryPointOutput): 127(ptr) Variable Output
4(main): 2 Function None 3
5: Label
104:8(VS_OUTPUT) FunctionCall 10(@main()

View File

@ -53,6 +53,7 @@ Shader version: 450
0:? Linker Objects
0:? 'g_sSamp' (layout(binding=0 ) uniform sampler)
0:? 'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
0:? '@entryPointOutput' (layout(location=0 ) out structure{})
Linked vertex stage:
@ -112,17 +113,18 @@ Shader version: 450
0:? Linker Objects
0:? 'g_sSamp' (layout(binding=0 ) uniform sampler)
0:? 'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
0:? '@entryPointOutput' (layout(location=0 ) out structure{})
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 48
// Id's are bound by 51
Capability Shader
Capability Sampled1D
Capability ImageQuery
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 42
EntryPoint Vertex 4 "main" 42 50
Name 4 "main"
Name 8 "VS_OUTPUT"
MemberName 8(VS_OUTPUT) 0 "Pos"
@ -135,11 +137,14 @@ Shader version: 450
Name 33 "vsout"
Name 42 "@entryPointOutput_Pos"
Name 47 "g_sSamp"
Name 48 "VS_OUTPUT"
Name 50 "@entryPointOutput"
Decorate 17(g_tTex1df4) DescriptorSet 0
Decorate 17(g_tTex1df4) Binding 0
Decorate 42(@entryPointOutput_Pos) BuiltIn Position
Decorate 47(g_sSamp) DescriptorSet 0
Decorate 47(g_sSamp) Binding 0
Decorate 50(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@ -163,6 +168,9 @@ Shader version: 450
45: TypeSampler
46: TypePointer UniformConstant 45
47(g_sSamp): 46(ptr) Variable UniformConstant
48(VS_OUTPUT): TypeStruct
49: TypePointer Output 48(VS_OUTPUT)
50(@entryPointOutput): 49(ptr) Variable Output
4(main): 2 Function None 3
5: Label
43:8(VS_OUTPUT) FunctionCall 10(@main()

View File

@ -220,6 +220,7 @@ Shader version: 450
0:? 'g_tTexcdf4a' (uniform textureCubeArray)
0:? 'g_tTexcdi4a' (uniform itextureCubeArray)
0:? 'g_tTexcdu4a' (uniform utextureCubeArray)
0:? '@entryPointOutput' (layout(location=0 ) out structure{})
0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
@ -447,18 +448,19 @@ Shader version: 450
0:? 'g_tTexcdf4a' (uniform textureCubeArray)
0:? 'g_tTexcdi4a' (uniform itextureCubeArray)
0:? 'g_tTexcdu4a' (uniform utextureCubeArray)
0:? '@entryPointOutput' (layout(location=0 ) out structure{})
0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 171
// Id's are bound by 174
Capability Shader
Capability Sampled1D
Capability SampledCubeArray
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 129
EntryPoint Vertex 4 "main" 129 173
Name 4 "main"
Name 8 "VS_OUTPUT"
MemberName 8(VS_OUTPUT) 0 "Pos"
@ -497,6 +499,8 @@ Shader version: 450
Name 164 "g_tTexcdf4a"
Name 167 "g_tTexcdi4a"
Name 170 "g_tTexcdu4a"
Name 171 "VS_OUTPUT"
Name 173 "@entryPointOutput"
Decorate 14(g_tTex1df4) DescriptorSet 0
Decorate 14(g_tTex1df4) Binding 0
MemberDecorate 20($Global) 0 Offset 0
@ -532,6 +536,7 @@ Shader version: 450
Decorate 164(g_tTexcdf4a) DescriptorSet 0
Decorate 167(g_tTexcdi4a) DescriptorSet 0
Decorate 170(g_tTexcdu4a) DescriptorSet 0
Decorate 173(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@ -630,6 +635,9 @@ Shader version: 450
168: TypeImage 24(int) Cube array sampled format:Unknown
169: TypePointer UniformConstant 168
170(g_tTexcdu4a): 169(ptr) Variable UniformConstant
171(VS_OUTPUT): TypeStruct
172: TypePointer Output 171(VS_OUTPUT)
173(@entryPointOutput): 172(ptr) Variable Output
4(main): 2 Function None 3
5: Label
130:8(VS_OUTPUT) FunctionCall 10(@main()

View File

@ -242,6 +242,7 @@ Shader version: 450
0:? 'g_tTexcdf4' (uniform textureCube)
0:? 'g_tTexcdi4' (uniform itextureCube)
0:? 'g_tTexcdu4' (uniform utextureCube)
0:? '@entryPointOutput' (layout(location=0 ) out structure{})
Linked vertex stage:
@ -490,16 +491,17 @@ Shader version: 450
0:? 'g_tTexcdf4' (uniform textureCube)
0:? 'g_tTexcdi4' (uniform itextureCube)
0:? 'g_tTexcdu4' (uniform utextureCube)
0:? '@entryPointOutput' (layout(location=0 ) out structure{})
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 166
// Id's are bound by 169
Capability Shader
Capability Sampled1D
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 162
EntryPoint Vertex 4 "main" 162 168
Name 4 "main"
Name 8 "VS_OUTPUT"
MemberName 8(VS_OUTPUT) 0 "Pos"
@ -532,6 +534,8 @@ Shader version: 450
Name 153 "vsout"
Name 162 "@entryPointOutput_Pos"
Name 165 "g_tTex1df4a"
Name 166 "VS_OUTPUT"
Name 168 "@entryPointOutput"
Decorate 16(g_tTex1df4) DescriptorSet 0
Decorate 16(g_tTex1df4) Binding 0
Decorate 20(g_sSamp) DescriptorSet 0
@ -550,6 +554,7 @@ Shader version: 450
Decorate 162(@entryPointOutput_Pos) BuiltIn Position
Decorate 165(g_tTex1df4a) DescriptorSet 0
Decorate 165(g_tTex1df4a) Binding 1
Decorate 168(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@ -643,6 +648,9 @@ Shader version: 450
161: TypePointer Output 7(fvec4)
162(@entryPointOutput_Pos): 161(ptr) Variable Output
165(g_tTex1df4a): 15(ptr) Variable UniformConstant
166(VS_OUTPUT): TypeStruct
167: TypePointer Output 166(VS_OUTPUT)
168(@entryPointOutput): 167(ptr) Variable Output
4(main): 2 Function None 3
5: Label
163:8(VS_OUTPUT) FunctionCall 10(@main()

View File

@ -188,6 +188,7 @@ Shader version: 450
0:? 'g_tTexcdf4' (uniform textureCube)
0:? 'g_tTexcdi4' (uniform itextureCube)
0:? 'g_tTexcdu4' (uniform utextureCube)
0:? '@entryPointOutput' (layout(location=0 ) out structure{})
Linked vertex stage:
@ -382,16 +383,17 @@ Shader version: 450
0:? 'g_tTexcdf4' (uniform textureCube)
0:? 'g_tTexcdi4' (uniform itextureCube)
0:? 'g_tTexcdu4' (uniform utextureCube)
0:? '@entryPointOutput' (layout(location=0 ) out structure{})
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 162
// Id's are bound by 165
Capability Shader
Capability Sampled1D
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 158
EntryPoint Vertex 4 "main" 158 164
Name 4 "main"
Name 8 "VS_OUTPUT"
MemberName 8(VS_OUTPUT) 0 "Pos"
@ -424,6 +426,8 @@ Shader version: 450
Name 149 "vsout"
Name 158 "@entryPointOutput_Pos"
Name 161 "g_tTex1df4a"
Name 162 "VS_OUTPUT"
Name 164 "@entryPointOutput"
Decorate 16(g_tTex1df4) DescriptorSet 0
Decorate 16(g_tTex1df4) Binding 0
Decorate 20(g_sSamp) DescriptorSet 0
@ -442,6 +446,7 @@ Shader version: 450
Decorate 158(@entryPointOutput_Pos) BuiltIn Position
Decorate 161(g_tTex1df4a) DescriptorSet 0
Decorate 161(g_tTex1df4a) Binding 1
Decorate 164(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@ -531,6 +536,9 @@ Shader version: 450
157: TypePointer Output 7(fvec4)
158(@entryPointOutput_Pos): 157(ptr) Variable Output
161(g_tTex1df4a): 15(ptr) Variable UniformConstant
162(VS_OUTPUT): TypeStruct
163: TypePointer Output 162(VS_OUTPUT)
164(@entryPointOutput): 163(ptr) Variable Output
4(main): 2 Function None 3
5: Label
159:8(VS_OUTPUT) FunctionCall 10(@main()

View File

@ -86,6 +86,7 @@ output primitive = triangle_strip
0:? 'i' (temp 3-element array of structure{temp 4-component vector of float pos})
0:? 'ts' (temp structure{temp 4-component vector of float pos})
0:? Linker Objects
0:? 'i' (layout(location=0 ) in 3-element array of structure{})
Linked geometry stage:
@ -178,15 +179,16 @@ output primitive = triangle_strip
0:? 'i' (temp 3-element array of structure{temp 4-component vector of float pos})
0:? 'ts' (temp structure{temp 4-component vector of float pos})
0:? Linker Objects
0:? 'i' (layout(location=0 ) in 3-element array of structure{})
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 63
// Id's are bound by 67
Capability Geometry
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Geometry 4 "main" 46
EntryPoint Geometry 4 "main" 46 66
ExecutionMode 4 Triangles
ExecutionMode 4 Invocations 1
ExecutionMode 4 OutputTriangleStrip
@ -206,7 +208,10 @@ output primitive = triangle_strip
Name 58 "ts"
Name 59 "param"
Name 61 "param"
Name 63 "PS_IN"
Name 66 "i"
Decorate 46(i_pos) BuiltIn Position
Decorate 66(i) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@ -231,6 +236,10 @@ output primitive = triangle_strip
46(i_pos): 45(ptr) Variable Input
47: TypePointer Input 7(fvec4)
54: 20(int) Constant 2
63(PS_IN): TypeStruct
64: TypeArray 63(PS_IN) 10
65: TypePointer Input 64
66(i): 65(ptr) Variable Input
4(main): 2 Function None 3
5: Label
43(i): 12(ptr) Variable Function

View File

@ -42,6 +42,7 @@ Shader version: 450
0:16 Constant:
0:16 0 (const int)
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out structure{})
0:? 'Pos_in' (layout(location=0 ) in 4-component vector of float)
0:? 'Pos_loose' (layout(location=1 ) in 4-component vector of float)
@ -92,17 +93,18 @@ Shader version: 450
0:16 Constant:
0:16 0 (const int)
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out structure{})
0:? 'Pos_in' (layout(location=0 ) in 4-component vector of float)
0:? 'Pos_loose' (layout(location=1 ) in 4-component vector of float)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 45
// Id's are bound by 48
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 31 35 38
EntryPoint Vertex 4 "main" 31 35 38 47
Name 4 "main"
Name 8 "VS_INPUT"
MemberName 8(VS_INPUT) 0 "Pos_in"
@ -119,9 +121,12 @@ Shader version: 450
Name 38 "@entryPointOutput_Pos"
Name 39 "param"
Name 41 "param"
Name 45 "VS_OUTPUT"
Name 47 "@entryPointOutput"
Decorate 31(Pos_in) Location 0
Decorate 35(Pos_loose) Location 1
Decorate 38(@entryPointOutput_Pos) BuiltIn Position
Decorate 47(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@ -139,6 +144,9 @@ Shader version: 450
35(Pos_loose): 30(ptr) Variable Input
37: TypePointer Output 7(fvec4)
38(@entryPointOutput_Pos): 37(ptr) Variable Output
45(VS_OUTPUT): TypeStruct
46: TypePointer Output 45(VS_OUTPUT)
47(@entryPointOutput): 46(ptr) Variable Output
4(main): 2 Function None 3
5: Label
29(vsin): 9(ptr) Variable Function

View File

@ -1444,12 +1444,7 @@ void HlslParseContext::assignLocations(TVariable& variable)
assignLocation(**member);
} else if (wasSplit(variable.getUniqueId())) {
TVariable* splitIoVar = getSplitIoVar(&variable);
const TTypeList* structure = splitIoVar->getType().getStruct();
// Struct splitting can produce empty structures if the only members of the
// struct were builtin interstage IO types. Only assign locations if it
// isn't a struct, or is a non-empty struct.
if (structure == nullptr || !structure->empty())
assignLocation(*splitIoVar);
assignLocation(*splitIoVar);
} else {
assignLocation(variable);
}