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

@ -38,13 +38,13 @@ Shader version: 450
0:? 0.000000
0:26 Sequence
0:26 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:26 'vsout' (temp structure{temp 4-component vector of float Position Pos})
0:26 Branch: Return
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{temp 4-component vector of float Position Pos})
0:? 'Pos' (out 4-component vector of float Position)
Linked vertex stage:
@ -89,24 +89,24 @@ Shader version: 450
0:? 0.000000
0:26 Sequence
0:26 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:26 'vsout' (temp structure{temp 4-component vector of float Position Pos})
0:26 Branch: Return
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{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 42
// Id's are bound by 44
Capability Shader
Capability Sampled1D
Capability ImageQuery
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 36
EntryPoint Vertex 4 "main" 36 43
Name 4 "main"
Name 8 "sizeQueryTemp"
Name 12 "g_tTex1df4"
@ -118,12 +118,13 @@ Shader version: 450
Name 29 "vsout"
Name 36 "@entryPointOutput"
Name 41 "g_sSamp"
Name 43 "Pos"
Decorate 12(g_tTex1df4) DescriptorSet 0
Decorate 12(g_tTex1df4) Binding 0
MemberDecorate 27(VS_OUTPUT) 0 BuiltIn Position
Decorate 36(@entryPointOutput) Location 0
Decorate 41(g_sSamp) DescriptorSet 0
Decorate 41(g_sSamp) Binding 0
Decorate 43(Pos) BuiltIn Position
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
@ -146,6 +147,8 @@ Shader version: 450
39: TypeSampler
40: TypePointer UniformConstant 39
41(g_sSamp): 40(ptr) Variable UniformConstant
42: TypePointer Output 26(fvec4)
43(Pos): 42(ptr) Variable Output
4(main): 2 Function None 3
5: Label
8(sizeQueryTemp): 7(ptr) Variable Function