HLSL: Flatten all input/output structs, regardless of stage.

This is needed because an output structure can contain embedded built-ins
(like SV_Position) which should not get locations assigned.
This commit is contained in:
John Kessenich
2016-09-16 01:52:14 -06:00
parent 7dc630f3da
commit f8e494c18c
7 changed files with 53 additions and 38 deletions

View File

@@ -133,7 +133,7 @@ Shader version: 450
0:? 0.000000
0:69 Sequence
0:69 move second child to first child (temp structure{temp 4-component vector of float Position Pos})
0:? '@entryPointOutput' (layout(location=0 ) out structure{temp 4-component vector of float Position Pos})
0:? '@entryPointOutput' (out structure{temp 4-component vector of float Position Pos})
0:69 'vsout' (temp structure{temp 4-component vector of float Position Pos})
0:69 Branch: Return
0:? Linker Objects
@@ -167,7 +167,7 @@ Shader version: 450
0:? 'o2' (uniform 2-component vector of int)
0:? 'o3' (uniform 3-component vector of int)
0:? 'o4' (uniform 4-component vector of int)
0:? '@entryPointOutput' (layout(location=0 ) out structure{temp 4-component vector of float Position Pos})
0:? 'Pos' (out 4-component vector of float Position)
Linked vertex stage:
@@ -307,7 +307,7 @@ Shader version: 450
0:? 0.000000
0:69 Sequence
0:69 move second child to first child (temp structure{temp 4-component vector of float Position Pos})
0:? '@entryPointOutput' (layout(location=0 ) out structure{temp 4-component vector of float Position Pos})
0:? '@entryPointOutput' (out structure{temp 4-component vector of float Position Pos})
0:69 'vsout' (temp structure{temp 4-component vector of float Position Pos})
0:69 Branch: Return
0:? Linker Objects
@@ -341,18 +341,18 @@ Shader version: 450
0:? 'o2' (uniform 2-component vector of int)
0:? 'o3' (uniform 3-component vector of int)
0:? 'o4' (uniform 4-component vector of int)
0:? '@entryPointOutput' (layout(location=0 ) out structure{temp 4-component vector of float Position Pos})
0:? 'Pos' (out 4-component vector of float Position)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 162
// Id's are bound by 164
Capability Shader
Capability Sampled1D
Capability SampledCubeArray
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 115
EntryPoint Vertex 4 "main" 115 163
Name 4 "main"
Name 9 "g_tTex1df4"
Name 14 "c2"
@@ -388,6 +388,7 @@ Shader version: 450
Name 159 "o2"
Name 160 "o3"
Name 161 "o4"
Name 163 "Pos"
Decorate 9(g_tTex1df4) DescriptorSet 0
Decorate 9(g_tTex1df4) Binding 0
Decorate 27(g_tTex1di4) DescriptorSet 0
@@ -399,7 +400,6 @@ Shader version: 450
Decorate 90(g_tTex3di4) DescriptorSet 0
Decorate 99(g_tTex3du4) DescriptorSet 0
MemberDecorate 106(VS_OUTPUT) 0 BuiltIn Position
Decorate 115(@entryPointOutput) Location 0
Decorate 120(g_sSamp) DescriptorSet 0
Decorate 120(g_sSamp) Binding 0
Decorate 123(g_tTexcdf4) DescriptorSet 0
@@ -414,6 +414,7 @@ Shader version: 450
Decorate 150(g_tTexcdf4a) DescriptorSet 0
Decorate 153(g_tTexcdi4a) DescriptorSet 0
Decorate 156(g_tTexcdu4a) DescriptorSet 0
Decorate 163(Pos) BuiltIn Position
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@@ -514,6 +515,8 @@ Shader version: 450
159(o2): 13(ptr) Variable UniformConstant
160(o3): 50(ptr) Variable UniformConstant
161(o4): 80(ptr) Variable UniformConstant
162: TypePointer Output 23(fvec4)
163(Pos): 162(ptr) Variable Output
4(main): 2 Function None 3
5: Label
108(vsout): 107(ptr) Variable Function