HLSL: Stop flattening non-IO structs containing opaques.

This makes struct returns from functions work, but breaks
structs containing arrays, due to limitations in subsequent
transforms in spirv-opt. This is expected to be fixed soon.
This commit is contained in:
John Kessenich 2017-11-16 16:03:18 -07:00
parent 471bfed062
commit dc005fb083
18 changed files with 1610 additions and 1419 deletions

View file

@ -2,90 +2,108 @@ hlsl.partialFlattenLocal.vert
WARNING: AST will form illegal SPIR-V; need to transform to legalize
// Module Version 10000
// Generated by (magic number): 80002
// Id's are bound by 148
// Id's are bound by 132
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 90 93
EntryPoint Vertex 4 "main" 83 86
Source HLSL 500
Name 4 "main"
Name 17 "tex"
Name 90 "pos"
Name 93 "@entryPointOutput"
Decorate 17(tex) DescriptorSet 0
Decorate 90(pos) Location 0
Decorate 93(@entryPointOutput) BuiltIn Position
Name 22 "Packed"
MemberName 22(Packed) 0 "tex"
MemberName 22(Packed) 1 "pos"
MemberName 22(Packed) 2 "uv"
MemberName 22(Packed) 3 "x"
MemberName 22(Packed) 4 "n"
Name 27 "tex"
Name 83 "pos"
Name 86 "@entryPointOutput"
Decorate 27(tex) DescriptorSet 0
Decorate 83(pos) Location 0
Decorate 86(@entryPointOutput) BuiltIn Position
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
13: TypeImage 6(float) 2D sampled format:Unknown
16: TypePointer UniformConstant 13
17(tex): 16(ptr) Variable UniformConstant
19: TypeVector 6(float) 3
20: TypeInt 32 0
21: 20(int) Constant 3
22: TypeArray 19(fvec3) 21
23: TypePointer Function 22
25: TypeInt 32 1
26: 25(int) Constant 0
27: 6(float) Constant 0
28: 19(fvec3) ConstantComposite 27 27 27
29: TypePointer Function 19(fvec3)
31: TypeVector 6(float) 2
32: 20(int) Constant 2
33: TypeArray 31(fvec2) 32
34: TypePointer Function 33
36: 6(float) Constant 1065353216
37: 31(fvec2) ConstantComposite 27 36
38: TypePointer Function 31(fvec2)
52: 25(int) Constant 1
53: TypeBool
89: TypePointer Input 7(fvec4)
90(pos): 89(ptr) Variable Input
92: TypePointer Output 7(fvec4)
93(@entryPointOutput): 92(ptr) Variable Output
14: TypeVector 6(float) 3
15: TypeInt 32 0
16: 15(int) Constant 3
17: TypeArray 14(fvec3) 16
18: TypeVector 6(float) 2
19: 15(int) Constant 2
20: TypeArray 18(fvec2) 19
21: TypeInt 32 1
22(Packed): TypeStruct 13 17 20 6(float) 21(int)
23: TypePointer Function 22(Packed)
25: 21(int) Constant 0
26: TypePointer UniformConstant 13
27(tex): 26(ptr) Variable UniformConstant
29: TypePointer Function 13
31: 21(int) Constant 1
32: 6(float) Constant 0
33: 14(fvec3) ConstantComposite 32 32 32
34: TypePointer Function 14(fvec3)
36: 21(int) Constant 2
37: 6(float) Constant 1065353216
38: 18(fvec2) ConstantComposite 32 37
39: TypePointer Function 18(fvec2)
41: 21(int) Constant 3
42: TypePointer Function 6(float)
44: 21(int) Constant 4
45: TypePointer Function 21(int)
54: TypeBool
82: TypePointer Input 7(fvec4)
83(pos): 82(ptr) Variable Input
85: TypePointer Output 7(fvec4)
86(@entryPointOutput): 85(ptr) Variable Output
4(main): 2 Function None 3
5: Label
98: 23(ptr) Variable Function
99: 34(ptr) Variable Function
91: 7(fvec4) Load 90(pos)
110: 29(ptr) AccessChain 98 26
Store 110 28
111: 38(ptr) AccessChain 99 26
Store 111 37
Branch 112
112: Label
147: 25(int) Phi 26 5 131 114
LoopMerge 113 114 None
Branch 115
115: Label
117: 53(bool) SLessThan 147 52
BranchConditional 117 118 113
118: Label
121: 38(ptr) AccessChain 99 147
122: 31(fvec2) Load 121
123: 29(ptr) AccessChain 98 147
124: 19(fvec3) Load 123
125: 31(fvec2) VectorShuffle 124 124 0 1
126: 31(fvec2) FAdd 125 122
127: 29(ptr) AccessChain 98 147
128: 19(fvec3) Load 127
129: 19(fvec3) VectorShuffle 128 126 3 4 2
Store 127 129
Branch 114
114: Label
131: 25(int) IAdd 147 52
Branch 112
113: Label
133: 22 Load 98
146: 19(fvec3) CompositeExtract 133 0
140: 6(float) CompositeExtract 146 0
141: 6(float) CompositeExtract 146 1
142: 6(float) CompositeExtract 146 2
143: 7(fvec4) CompositeConstruct 140 141 142 27
144: 7(fvec4) FAdd 91 143
Store 93(@entryPointOutput) 144
90: 23(ptr) Variable Function
84: 7(fvec4) Load 83(pos)
94: 13 Load 27(tex)
95: 29(ptr) AccessChain 90 25
Store 95 94
96: 34(ptr) AccessChain 90 31 25
Store 96 33
97: 39(ptr) AccessChain 90 36 25
Store 97 38
98: 42(ptr) AccessChain 90 41
Store 98 37
99: 45(ptr) AccessChain 90 44
Store 99 41
Branch 100
100: Label
131: 21(int) Phi 25 5 119 102
LoopMerge 101 102 None
Branch 103
103: Label
105: 54(bool) SLessThan 131 31
BranchConditional 105 106 101
106: Label
109: 39(ptr) AccessChain 90 36 131
110: 18(fvec2) Load 109
111: 34(ptr) AccessChain 90 31 131
112: 14(fvec3) Load 111
113: 18(fvec2) VectorShuffle 112 112 0 1
114: 18(fvec2) FAdd 113 110
115: 34(ptr) AccessChain 90 31 131
116: 14(fvec3) Load 115
117: 14(fvec3) VectorShuffle 116 114 3 4 2
Store 115 117
Branch 102
102: Label
119: 21(int) IAdd 131 31
Branch 100
101: Label
120: 22(Packed) Load 90
130: 14(fvec3) CompositeExtract 120 1 0
124: 6(float) CompositeExtract 130 0
125: 6(float) CompositeExtract 130 1
126: 6(float) CompositeExtract 130 2
127: 7(fvec4) CompositeConstruct 124 125 126 32
128: 7(fvec4) FAdd 84 127
Store 86(@entryPointOutput) 128
Return
FunctionEnd