Commit dc005fb0 by John Kessenich

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.
parent 471bfed0
...@@ -2,49 +2,54 @@ hlsl.aliasOpaque.frag ...@@ -2,49 +2,54 @@ hlsl.aliasOpaque.frag
WARNING: AST will form illegal SPIR-V; need to transform to legalize WARNING: AST will form illegal SPIR-V; need to transform to legalize
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80002 // Generated by (magic number): 80002
// Id's are bound by 81 // Id's are bound by 87
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 57 EntryPoint Fragment 4 "main" 62
ExecutionMode 4 OriginUpperLeft ExecutionMode 4 OriginUpperLeft
Source HLSL 500 Source HLSL 500
Name 4 "main" Name 4 "main"
Name 37 "gss2" Name 9 "OS"
Name 39 "gss" MemberName 9(OS) 0 "ss"
Name 43 "gtex" MemberName 9(OS) 1 "a"
Name 57 "@entryPointOutput" MemberName 9(OS) 2 "tex"
Decorate 37(gss2) DescriptorSet 0 Name 44 "gss2"
Decorate 39(gss) DescriptorSet 0 Name 47 "gss"
Decorate 43(gtex) DescriptorSet 0 Name 51 "gtex"
Decorate 57(@entryPointOutput) Location 0 Name 62 "@entryPointOutput"
Decorate 44(gss2) DescriptorSet 0
Decorate 47(gss) DescriptorSet 0
Decorate 51(gtex) DescriptorSet 0
Decorate 62(@entryPointOutput) Location 0
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeSampler 6: TypeSampler
8: TypeFloat 32 7: TypeFloat 32
10: TypeImage 8(float) 2D sampled format:Unknown 8: TypeImage 7(float) 2D sampled format:Unknown
12: TypeVector 8(float) 4 9(OS): TypeStruct 6 7(float) 8
25: TypeSampledImage 10 11: TypeVector 7(float) 4
27: TypeVector 8(float) 2 32: TypeSampledImage 8
28: 8(float) Constant 1045220557 34: TypeVector 7(float) 2
29: 8(float) Constant 1050253722 35: 7(float) Constant 1045220557
30: 27(fvec2) ConstantComposite 28 29 36: 7(float) Constant 1050253722
36: TypePointer UniformConstant 6 37: 34(fvec2) ConstantComposite 35 36
37(gss2): 36(ptr) Variable UniformConstant 43: TypePointer UniformConstant 6
39(gss): 36(ptr) Variable UniformConstant 44(gss2): 43(ptr) Variable UniformConstant
42: TypePointer UniformConstant 10 47(gss): 43(ptr) Variable UniformConstant
43(gtex): 42(ptr) Variable UniformConstant 50: TypePointer UniformConstant 8
46: 8(float) Constant 1077936128 51(gtex): 50(ptr) Variable UniformConstant
56: TypePointer Output 12(fvec4) 54: 7(float) Constant 1077936128
57(@entryPointOutput): 56(ptr) Variable Output 61: TypePointer Output 11(fvec4)
62(@entryPointOutput): 61(ptr) Variable Output
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
68: 6 Load 39(gss) 70: 6 Load 47(gss)
69: 10 Load 43(gtex) 72: 8 Load 51(gtex)
78: 25 SampledImage 69 68 84: 32 SampledImage 72 70
79: 12(fvec4) ImageSampleImplicitLod 78 30 85: 11(fvec4) ImageSampleImplicitLod 84 37
80: 12(fvec4) VectorTimesScalar 79 46 86: 11(fvec4) VectorTimesScalar 85 54
Store 57(@entryPointOutput) 80 Store 62(@entryPointOutput) 86
Return Return
FunctionEnd FunctionEnd
hlsl.flattenOpaque.frag hlsl.flattenOpaque.frag
WARNING: AST will form illegal SPIR-V; need to transform to legalize
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80002 // Generated by (magic number): 80002
// Id's are bound by 144 // Id's are bound by 185
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 97 EntryPoint Fragment 4 "main" 120
ExecutionMode 4 OriginUpperLeft ExecutionMode 4 OriginUpperLeft
Source HLSL 500 Source HLSL 500
Name 4 "main" Name 4 "main"
Name 7 "os"
MemberName 7(os) 0 "s2D"
Name 23 "os2"
MemberName 23(os2) 0 "s2D"
MemberName 23(os2) 1 "tex"
Name 38 "tex" Name 38 "tex"
Name 70 "s.s2D" Name 82 "s.s2D"
Name 79 "s2.s2D" Name 97 "s2.s2D"
Name 80 "s2.tex" Name 100 "s2.tex"
Name 97 "@entryPointOutput" Name 120 "@entryPointOutput"
Decorate 38(tex) DescriptorSet 0 Decorate 38(tex) DescriptorSet 0
Decorate 70(s.s2D) DescriptorSet 0 Decorate 82(s.s2D) DescriptorSet 0
Decorate 79(s2.s2D) DescriptorSet 0 Decorate 97(s2.s2D) DescriptorSet 0
Decorate 80(s2.tex) DescriptorSet 0 Decorate 100(s2.tex) DescriptorSet 0
Decorate 97(@entryPointOutput) Location 0 Decorate 120(@entryPointOutput) Location 0
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeSampler 6: TypeSampler
8: TypeFloat 32 7(os): TypeStruct 6
9: TypeVector 8(float) 4 9: TypeFloat 32
14: TypeVector 8(float) 2 10: TypeVector 9(float) 4
21: TypeImage 8(float) 2D sampled format:Unknown 15: TypeVector 9(float) 2
37: TypePointer UniformConstant 21 22: TypeImage 9(float) 2D sampled format:Unknown
23(os2): TypeStruct 6 22
37: TypePointer UniformConstant 22
38(tex): 37(ptr) Variable UniformConstant 38(tex): 37(ptr) Variable UniformConstant
41: TypeSampledImage 21 45: TypeSampledImage 22
43: 8(float) Constant 1045220557 47: 9(float) Constant 1045220557
44: 8(float) Constant 1050253722 48: 9(float) Constant 1050253722
45: 14(fvec2) ConstantComposite 43 44 49: 15(fvec2) ConstantComposite 47 48
69: TypePointer UniformConstant 6 81: TypePointer UniformConstant 6
70(s.s2D): 69(ptr) Variable UniformConstant 82(s.s2D): 81(ptr) Variable UniformConstant
79(s2.s2D): 69(ptr) Variable UniformConstant 97(s2.s2D): 81(ptr) Variable UniformConstant
80(s2.tex): 37(ptr) Variable UniformConstant 100(s2.tex): 37(ptr) Variable UniformConstant
96: TypePointer Output 9(fvec4) 119: TypePointer Output 10(fvec4)
97(@entryPointOutput): 96(ptr) Variable Output 120(@entryPointOutput): 119(ptr) Variable Output
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
109: 6 Load 70(s.s2D) 134: 6 Load 82(s.s2D)
123: 21 Load 38(tex) 158: 22 Load 38(tex)
125: 41 SampledImage 123 109 161: 45 SampledImage 158 134
126: 9(fvec4) ImageSampleImplicitLod 125 45 162: 10(fvec4) ImageSampleImplicitLod 161 49
111: 6 Load 70(s.s2D) 138: 6 Load 82(s.s2D)
128: 21 Load 38(tex) 164: 22 Load 38(tex)
130: 41 SampledImage 128 111 167: 45 SampledImage 164 138
132: 9(fvec4) ImageSampleImplicitLod 130 45 169: 10(fvec4) ImageSampleImplicitLod 167 49
113: 9(fvec4) FAdd 126 132 142: 10(fvec4) FAdd 162 169
114: 6 Load 79(s2.s2D) 143: 6 Load 97(s2.s2D)
115: 21 Load 80(s2.tex) 145: 22 Load 100(s2.tex)
136: 41 SampledImage 115 114 175: 45 SampledImage 145 143
137: 9(fvec4) ImageSampleImplicitLod 136 45 176: 10(fvec4) ImageSampleImplicitLod 175 49
117: 9(fvec4) FAdd 113 137 149: 10(fvec4) FAdd 142 176
118: 6 Load 79(s2.s2D) 150: 6 Load 97(s2.s2D)
119: 21 Load 80(s2.tex) 152: 22 Load 100(s2.tex)
141: 41 SampledImage 119 118 182: 45 SampledImage 152 150
143: 9(fvec4) ImageSampleImplicitLod 141 45 184: 10(fvec4) ImageSampleImplicitLod 182 49
121: 9(fvec4) FAdd 117 143 156: 10(fvec4) FAdd 149 184
Store 97(@entryPointOutput) 121 Store 120(@entryPointOutput) 156
Return Return
FunctionEnd FunctionEnd
...@@ -2,57 +2,56 @@ hlsl.flattenOpaqueInit.vert ...@@ -2,57 +2,56 @@ hlsl.flattenOpaqueInit.vert
WARNING: AST will form illegal SPIR-V; need to transform to legalize WARNING: AST will form illegal SPIR-V; need to transform to legalize
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80002 // Generated by (magic number): 80002
// Id's are bound by 176 // Id's are bound by 134
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 99 EntryPoint Vertex 4 "main" 80
Source HLSL 500 Source HLSL 500
Name 4 "main" Name 4 "main"
Name 17 "FxaaTex" Name 9 "FxaaTex"
MemberName 17(FxaaTex) 0 "smpl" MemberName 9(FxaaTex) 0 "smpl"
MemberName 17(FxaaTex) 1 "tex" MemberName 9(FxaaTex) 1 "tex"
Name 38 "g_tInputTexture_sampler" Name 43 "g_tInputTexture_sampler"
Name 42 "g_tInputTexture" Name 47 "g_tInputTexture"
Name 99 "@entryPointOutput" Name 80 "@entryPointOutput"
Decorate 38(g_tInputTexture_sampler) DescriptorSet 0 Decorate 43(g_tInputTexture_sampler) DescriptorSet 0
Decorate 42(g_tInputTexture) DescriptorSet 0 Decorate 47(g_tInputTexture) DescriptorSet 0
Decorate 99(@entryPointOutput) Location 0 Decorate 80(@entryPointOutput) Location 0
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeSampler 6: TypeSampler
8: TypeFloat 32 7: TypeFloat 32
9: TypeImage 8(float) 2D sampled format:Unknown 8: TypeImage 7(float) 2D sampled format:Unknown
11: TypeVector 8(float) 4 9(FxaaTex): TypeStruct 6 8
17(FxaaTex): TypeStruct 6 9 11: TypeVector 7(float) 4
26: TypeSampledImage 9 31: TypeSampledImage 8
28: TypeVector 8(float) 2 33: TypeVector 7(float) 2
29: 8(float) Constant 1050253722 34: 7(float) Constant 1050253722
30: 8(float) Constant 1053609165 35: 7(float) Constant 1053609165
31: 28(fvec2) ConstantComposite 29 30 36: 33(fvec2) ConstantComposite 34 35
32: 8(float) Constant 0 37: 7(float) Constant 0
37: TypePointer UniformConstant 6 42: TypePointer UniformConstant 6
38(g_tInputTexture_sampler): 37(ptr) Variable UniformConstant 43(g_tInputTexture_sampler): 42(ptr) Variable UniformConstant
41: TypePointer UniformConstant 9 46: TypePointer UniformConstant 8
42(g_tInputTexture): 41(ptr) Variable UniformConstant 47(g_tInputTexture): 46(ptr) Variable UniformConstant
98: TypePointer Output 11(fvec4) 79: TypePointer Output 11(fvec4)
99(@entryPointOutput): 98(ptr) Variable Output 80(@entryPointOutput): 79(ptr) Variable Output
175: 17(FxaaTex) Undef
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
117: 6 Load 38(g_tInputTexture_sampler) 90: 6 Load 43(g_tInputTexture_sampler)
118: 9 Load 42(g_tInputTexture) 91: 8 Load 47(g_tInputTexture)
148: 26 SampledImage 118 117 111: 31 SampledImage 91 90
149: 11(fvec4) ImageSampleExplicitLod 148 31 Lod 32 112: 11(fvec4) ImageSampleExplicitLod 111 36 Lod 37
172: 6 CompositeExtract 175 0 115: 6 Load 43(g_tInputTexture_sampler)
174: 9 CompositeExtract 175 1 117: 8 Load 47(g_tInputTexture)
160: 26 SampledImage 174 172 125: 31 SampledImage 117 115
161: 11(fvec4) ImageSampleExplicitLod 160 31 Lod 32 126: 11(fvec4) ImageSampleExplicitLod 125 36 Lod 37
136: 11(fvec4) FAdd 149 161 99: 11(fvec4) FAdd 112 126
165: 26 SampledImage 118 117 132: 31 SampledImage 91 90
166: 11(fvec4) ImageSampleExplicitLod 165 31 Lod 32 133: 11(fvec4) ImageSampleExplicitLod 132 36 Lod 37
143: 11(fvec4) FAdd 136 166 104: 11(fvec4) FAdd 99 133
Store 99(@entryPointOutput) 143 Store 80(@entryPointOutput) 104
Return Return
FunctionEnd FunctionEnd
...@@ -2,48 +2,48 @@ hlsl.flattenOpaqueInitMix.vert ...@@ -2,48 +2,48 @@ hlsl.flattenOpaqueInitMix.vert
WARNING: AST will form illegal SPIR-V; need to transform to legalize WARNING: AST will form illegal SPIR-V; need to transform to legalize
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80002 // Generated by (magic number): 80002
// Id's are bound by 100 // Id's are bound by 80
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 68 EntryPoint Vertex 4 "main" 57
Source HLSL 500 Source HLSL 500
Name 4 "main" Name 4 "main"
Name 34 "FxaaTex" Name 9 "FxaaTex"
MemberName 34(FxaaTex) 0 "smpl" MemberName 9(FxaaTex) 0 "smpl"
MemberName 34(FxaaTex) 1 "tex" MemberName 9(FxaaTex) 1 "tex"
MemberName 34(FxaaTex) 2 "f" MemberName 9(FxaaTex) 2 "f"
Name 38 "g_tInputTexture_sampler" Name 44 "g_tInputTexture_sampler"
Name 41 "g_tInputTexture" Name 47 "g_tInputTexture"
Name 68 "@entryPointOutput" Name 57 "@entryPointOutput"
Decorate 38(g_tInputTexture_sampler) DescriptorSet 0 Decorate 44(g_tInputTexture_sampler) DescriptorSet 0
Decorate 41(g_tInputTexture) DescriptorSet 0 Decorate 47(g_tInputTexture) DescriptorSet 0
Decorate 68(@entryPointOutput) Location 0 Decorate 57(@entryPointOutput) Location 0
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeSampler 6: TypeSampler
8: TypeFloat 32 7: TypeFloat 32
9: TypeImage 8(float) 2D sampled format:Unknown 8: TypeImage 7(float) 2D sampled format:Unknown
12: TypeVector 8(float) 4 9(FxaaTex): TypeStruct 6 8 7(float)
24: TypeSampledImage 9 11: TypeVector 7(float) 4
28: TypeVector 8(float) 2 28: TypeSampledImage 8
30: 8(float) Constant 0 36: TypeVector 7(float) 2
34(FxaaTex): TypeStruct 6 9 8(float) 38: 7(float) Constant 0
37: TypePointer UniformConstant 6 43: TypePointer UniformConstant 6
38(g_tInputTexture_sampler): 37(ptr) Variable UniformConstant 44(g_tInputTexture_sampler): 43(ptr) Variable UniformConstant
40: TypePointer UniformConstant 9 46: TypePointer UniformConstant 8
41(g_tInputTexture): 40(ptr) Variable UniformConstant 47(g_tInputTexture): 46(ptr) Variable UniformConstant
43: 8(float) Constant 1056964608 49: 7(float) Constant 1056964608
67: TypePointer Output 12(fvec4) 56: TypePointer Output 11(fvec4)
68(@entryPointOutput): 67(ptr) Variable Output 57(@entryPointOutput): 56(ptr) Variable Output
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
79: 6 Load 38(g_tInputTexture_sampler) 63: 6 Load 44(g_tInputTexture_sampler)
80: 9 Load 41(g_tInputTexture) 64: 8 Load 47(g_tInputTexture)
95: 24 SampledImage 80 79 73: 28 SampledImage 64 63
98: 28(fvec2) CompositeConstruct 43 43 78: 36(fvec2) CompositeConstruct 49 49
99: 12(fvec4) ImageSampleExplicitLod 95 98 Lod 30 79: 11(fvec4) ImageSampleExplicitLod 73 78 Lod 38
Store 68(@entryPointOutput) 99 Store 57(@entryPointOutput) 79
Return Return
FunctionEnd FunctionEnd
...@@ -2,47 +2,67 @@ hlsl.flattenSubset.frag ...@@ -2,47 +2,67 @@ hlsl.flattenSubset.frag
WARNING: AST will form illegal SPIR-V; need to transform to legalize WARNING: AST will form illegal SPIR-V; need to transform to legalize
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80002 // Generated by (magic number): 80002
// Id's are bound by 85 // Id's are bound by 66
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 54 57 EntryPoint Fragment 4 "main" 47 50
ExecutionMode 4 OriginUpperLeft ExecutionMode 4 OriginUpperLeft
Source HLSL 500 Source HLSL 500
Name 4 "main" Name 4 "main"
Name 17 "samp" Name 15 "S0"
Name 41 "tex" MemberName 15(S0) 0 "x"
Name 54 "vpos" MemberName 15(S0) 1 "y"
Name 57 "@entryPointOutput" MemberName 15(S0) 2 "ss"
Decorate 17(samp) DescriptorSet 0 Name 16 "S1"
Decorate 41(tex) DescriptorSet 0 MemberName 16(S1) 0 "b"
Decorate 54(vpos) Location 0 MemberName 16(S1) 1 "samplerState"
Decorate 57(@entryPointOutput) Location 0 MemberName 16(S1) 2 "s0"
MemberName 16(S1) 3 "a"
Name 21 "samp"
Name 25 "S2"
MemberName 25(S2) 0 "a1"
MemberName 25(S2) 1 "a2"
MemberName 25(S2) 2 "a3"
MemberName 25(S2) 3 "a4"
MemberName 25(S2) 4 "a5"
MemberName 25(S2) 5 "resources"
Name 33 "tex"
Name 47 "vpos"
Name 50 "@entryPointOutput"
Decorate 21(samp) DescriptorSet 0
Decorate 33(tex) DescriptorSet 0
Decorate 47(vpos) Location 0
Decorate 50(@entryPointOutput) Location 0
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
7: TypeVector 6(float) 4 7: TypeVector 6(float) 4
13: TypeSampler 13: TypeSampler
16: TypePointer UniformConstant 13 14: TypeInt 32 1
17(samp): 16(ptr) Variable UniformConstant 15(S0): TypeStruct 14(int) 14(int) 13
39: TypeImage 6(float) 2D sampled format:Unknown 16(S1): TypeStruct 6(float) 13 15(S0) 14(int)
40: TypePointer UniformConstant 39 20: TypePointer UniformConstant 13
41(tex): 40(ptr) Variable UniformConstant 21(samp): 20(ptr) Variable UniformConstant
44: TypeSampledImage 39 25(S2): TypeStruct 14(int) 14(int) 14(int) 14(int) 14(int) 16(S1)
46: TypeVector 6(float) 2 31: TypeImage 6(float) 2D sampled format:Unknown
47: 6(float) Constant 1056964608 32: TypePointer UniformConstant 31
48: 46(fvec2) ConstantComposite 47 47 33(tex): 32(ptr) Variable UniformConstant
53: TypePointer Input 7(fvec4) 37: TypeSampledImage 31
54(vpos): 53(ptr) Variable Input 39: TypeVector 6(float) 2
56: TypePointer Output 7(fvec4) 40: 6(float) Constant 1056964608
57(@entryPointOutput): 56(ptr) Variable Output 41: 39(fvec2) ConstantComposite 40 40
46: TypePointer Input 7(fvec4)
47(vpos): 46(ptr) Variable Input
49: TypePointer Output 7(fvec4)
50(@entryPointOutput): 49(ptr) Variable Output
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
74: 13 Load 17(samp) 57: 13 Load 21(samp)
81: 39 Load 41(tex) 61: 31 Load 33(tex)
83: 44 SampledImage 81 74 64: 37 SampledImage 61 57
84: 7(fvec4) ImageSampleImplicitLod 83 48 65: 7(fvec4) ImageSampleImplicitLod 64 41
Store 57(@entryPointOutput) 84 Store 50(@entryPointOutput) 65
Return Return
FunctionEnd FunctionEnd
...@@ -2,36 +2,48 @@ hlsl.flattenSubset2.frag ...@@ -2,36 +2,48 @@ hlsl.flattenSubset2.frag
WARNING: AST will form illegal SPIR-V; need to transform to legalize WARNING: AST will form illegal SPIR-V; need to transform to legalize
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80002 // Generated by (magic number): 80002
// Id's are bound by 44 // Id's are bound by 53
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 40 43 EntryPoint Fragment 4 "main" 49 52
ExecutionMode 4 OriginUpperLeft ExecutionMode 4 OriginUpperLeft
Source HLSL 500 Source HLSL 500
Name 4 "main" Name 4 "main"
Name 31 "someTex" Name 14 "Nested"
Name 40 "vpos" MemberName 14(Nested) 0 "y"
Name 43 "@entryPointOutput" MemberName 14(Nested) 1 "texNested"
Decorate 31(someTex) DescriptorSet 0 Name 15 "A"
Decorate 40(vpos) Location 0 MemberName 15(A) 0 "n"
Decorate 43(@entryPointOutput) Location 0 MemberName 15(A) 1 "x"
Name 25 "B"
MemberName 25(B) 0 "n"
MemberName 25(B) 1 "tex"
Name 36 "someTex"
Name 49 "vpos"
Name 52 "@entryPointOutput"
Decorate 36(someTex) DescriptorSet 0
Decorate 49(vpos) Location 0
Decorate 52(@entryPointOutput) Location 0
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
7: TypeVector 6(float) 4 7: TypeVector 6(float) 4
17: TypeImage 6(float) 2D sampled format:Unknown 13: TypeImage 6(float) 2D sampled format:Unknown
30: TypePointer UniformConstant 17 14(Nested): TypeStruct 6(float) 13
31(someTex): 30(ptr) Variable UniformConstant 15(A): TypeStruct 14(Nested) 6(float)
34: 6(float) Constant 0 25(B): TypeStruct 14(Nested) 13
35: 7(fvec4) ConstantComposite 34 34 34 34 35: TypePointer UniformConstant 13
39: TypePointer Input 7(fvec4) 36(someTex): 35(ptr) Variable UniformConstant
40(vpos): 39(ptr) Variable Input 43: 6(float) Constant 0
42: TypePointer Output 7(fvec4) 44: 7(fvec4) ConstantComposite 43 43 43 43
43(@entryPointOutput): 42(ptr) Variable Output 48: TypePointer Input 7(fvec4)
49(vpos): 48(ptr) Variable Input
51: TypePointer Output 7(fvec4)
52(@entryPointOutput): 51(ptr) Variable Output
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
Store 43(@entryPointOutput) 35 Store 52(@entryPointOutput) 44
Return Return
FunctionEnd FunctionEnd
...@@ -2,90 +2,108 @@ hlsl.partialFlattenLocal.vert ...@@ -2,90 +2,108 @@ hlsl.partialFlattenLocal.vert
WARNING: AST will form illegal SPIR-V; need to transform to legalize WARNING: AST will form illegal SPIR-V; need to transform to legalize
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80002 // Generated by (magic number): 80002
// Id's are bound by 148 // Id's are bound by 132
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 90 93 EntryPoint Vertex 4 "main" 83 86
Source HLSL 500 Source HLSL 500
Name 4 "main" Name 4 "main"
Name 17 "tex" Name 22 "Packed"
Name 90 "pos" MemberName 22(Packed) 0 "tex"
Name 93 "@entryPointOutput" MemberName 22(Packed) 1 "pos"
Decorate 17(tex) DescriptorSet 0 MemberName 22(Packed) 2 "uv"
Decorate 90(pos) Location 0 MemberName 22(Packed) 3 "x"
Decorate 93(@entryPointOutput) BuiltIn Position 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 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
7: TypeVector 6(float) 4 7: TypeVector 6(float) 4
13: TypeImage 6(float) 2D sampled format:Unknown 13: TypeImage 6(float) 2D sampled format:Unknown
16: TypePointer UniformConstant 13 14: TypeVector 6(float) 3
17(tex): 16(ptr) Variable UniformConstant 15: TypeInt 32 0
19: TypeVector 6(float) 3 16: 15(int) Constant 3
20: TypeInt 32 0 17: TypeArray 14(fvec3) 16
21: 20(int) Constant 3 18: TypeVector 6(float) 2
22: TypeArray 19(fvec3) 21 19: 15(int) Constant 2
23: TypePointer Function 22 20: TypeArray 18(fvec2) 19
25: TypeInt 32 1 21: TypeInt 32 1
26: 25(int) Constant 0 22(Packed): TypeStruct 13 17 20 6(float) 21(int)
27: 6(float) Constant 0 23: TypePointer Function 22(Packed)
28: 19(fvec3) ConstantComposite 27 27 27 25: 21(int) Constant 0
29: TypePointer Function 19(fvec3) 26: TypePointer UniformConstant 13
31: TypeVector 6(float) 2 27(tex): 26(ptr) Variable UniformConstant
32: 20(int) Constant 2 29: TypePointer Function 13
33: TypeArray 31(fvec2) 32 31: 21(int) Constant 1
34: TypePointer Function 33 32: 6(float) Constant 0
36: 6(float) Constant 1065353216 33: 14(fvec3) ConstantComposite 32 32 32
37: 31(fvec2) ConstantComposite 27 36 34: TypePointer Function 14(fvec3)
38: TypePointer Function 31(fvec2) 36: 21(int) Constant 2
52: 25(int) Constant 1 37: 6(float) Constant 1065353216
53: TypeBool 38: 18(fvec2) ConstantComposite 32 37
89: TypePointer Input 7(fvec4) 39: TypePointer Function 18(fvec2)
90(pos): 89(ptr) Variable Input 41: 21(int) Constant 3
92: TypePointer Output 7(fvec4) 42: TypePointer Function 6(float)
93(@entryPointOutput): 92(ptr) Variable Output 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 4(main): 2 Function None 3
5: Label 5: Label
98: 23(ptr) Variable Function 90: 23(ptr) Variable Function
99: 34(ptr) Variable Function 84: 7(fvec4) Load 83(pos)
91: 7(fvec4) Load 90(pos) 94: 13 Load 27(tex)
110: 29(ptr) AccessChain 98 26 95: 29(ptr) AccessChain 90 25
Store 110 28 Store 95 94
111: 38(ptr) AccessChain 99 26 96: 34(ptr) AccessChain 90 31 25
Store 111 37 Store 96 33
Branch 112 97: 39(ptr) AccessChain 90 36 25
112: Label Store 97 38
147: 25(int) Phi 26 5 131 114 98: 42(ptr) AccessChain 90 41
LoopMerge 113 114 None Store 98 37
Branch 115 99: 45(ptr) AccessChain 90 44
115: Label Store 99 41
117: 53(bool) SLessThan 147 52 Branch 100
BranchConditional 117 118 113 100: Label
118: Label 131: 21(int) Phi 25 5 119 102
121: 38(ptr) AccessChain 99 147 LoopMerge 101 102 None
122: 31(fvec2) Load 121 Branch 103
123: 29(ptr) AccessChain 98 147 103: Label
124: 19(fvec3) Load 123 105: 54(bool) SLessThan 131 31
125: 31(fvec2) VectorShuffle 124 124 0 1 BranchConditional 105 106 101
126: 31(fvec2) FAdd 125 122 106: Label
127: 29(ptr) AccessChain 98 147 109: 39(ptr) AccessChain 90 36 131
128: 19(fvec3) Load 127 110: 18(fvec2) Load 109
129: 19(fvec3) VectorShuffle 128 126 3 4 2 111: 34(ptr) AccessChain 90 31 131
Store 127 129 112: 14(fvec3) Load 111
Branch 114 113: 18(fvec2) VectorShuffle 112 112 0 1
114: Label 114: 18(fvec2) FAdd 113 110
131: 25(int) IAdd 147 52 115: 34(ptr) AccessChain 90 31 131
Branch 112 116: 14(fvec3) Load 115
113: Label 117: 14(fvec3) VectorShuffle 116 114 3 4 2
133: 22 Load 98 Store 115 117
146: 19(fvec3) CompositeExtract 133 0 Branch 102
140: 6(float) CompositeExtract 146 0 102: Label
141: 6(float) CompositeExtract 146 1 119: 21(int) IAdd 131 31
142: 6(float) CompositeExtract 146 2 Branch 100
143: 7(fvec4) CompositeConstruct 140 141 142 27 101: Label
144: 7(fvec4) FAdd 91 143 120: 22(Packed) Load 90
Store 93(@entryPointOutput) 144 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 Return
FunctionEnd FunctionEnd
...@@ -2,37 +2,43 @@ hlsl.partialFlattenMixed.vert ...@@ -2,37 +2,43 @@ hlsl.partialFlattenMixed.vert
WARNING: AST will form illegal SPIR-V; need to transform to legalize WARNING: AST will form illegal SPIR-V; need to transform to legalize
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80002 // Generated by (magic number): 80002
// Id's are bound by 31 // Id's are bound by 36
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 27 30 EntryPoint Vertex 4 "main" 32 35
Source HLSL 500 Source HLSL 500
Name 4 "main" Name 4 "main"
Name 20 "tex" Name 18 "Packed"
Name 27 "pos" MemberName 18(Packed) 0 "a"
Name 30 "@entryPointOutput" MemberName 18(Packed) 1 "membTex"
Decorate 20(tex) DescriptorSet 0 MemberName 18(Packed) 2 "b"
Decorate 27(pos) Location 0 Name 23 "tex"
Decorate 30(@entryPointOutput) BuiltIn Position Name 32 "pos"
Name 35 "@entryPointOutput"
Decorate 23(tex) DescriptorSet 0
Decorate 32(pos) Location 0
Decorate 35(@entryPointOutput) BuiltIn Position
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
7: TypeVector 6(float) 4 7: TypeVector 6(float) 4
13: TypeImage 6(float) 2D sampled format:Unknown 13: TypeInt 32 1
14: TypeInt 32 0 14: TypeImage 6(float) 2D sampled format:Unknown
15: 14(int) Constant 2 15: TypeInt 32 0
16: TypeArray 13 15 16: 15(int) Constant 2
19: TypePointer UniformConstant 16 17: TypeArray 14 16
20(tex): 19(ptr) Variable UniformConstant 18(Packed): TypeStruct 13(int) 17 13(int)
26: TypePointer Input 7(fvec4) 22: TypePointer UniformConstant 17
27(pos): 26(ptr) Variable Input 23(tex): 22(ptr) Variable UniformConstant
29: TypePointer Output 7(fvec4) 31: TypePointer Input 7(fvec4)
30(@entryPointOutput): 29(ptr) Variable Output 32(pos): 31(ptr) Variable Input
34: TypePointer Output 7(fvec4)
35(@entryPointOutput): 34(ptr) Variable Output
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
28: 7(fvec4) Load 27(pos) 33: 7(fvec4) Load 32(pos)
Store 30(@entryPointOutput) 28 Store 35(@entryPointOutput) 33
Return Return
FunctionEnd FunctionEnd
...@@ -9,13 +9,19 @@ Shader version: 500 ...@@ -9,13 +9,19 @@ Shader version: 500
0:13 Sequence 0:13 Sequence
0:13 move second child to first child ( temp texture2D) 0:13 move second child to first child ( temp texture2D)
0:13 direct index ( temp texture2D) 0:13 direct index ( temp texture2D)
0:? 'packed.membTex' ( temp 2-element array of texture2D) 0:13 membTex: direct index for structure ( temp 2-element array of texture2D)
0:13 'packed' ( temp structure{ temp int a, temp 2-element array of texture2D membTex, temp int b})
0:13 Constant:
0:13 1 (const int)
0:13 Constant: 0:13 Constant:
0:13 0 (const int) 0:13 0 (const int)
0:? 'tex[0]' ( uniform texture2D) 0:? 'tex[0]' ( uniform texture2D)
0:13 move second child to first child ( temp texture2D) 0:13 move second child to first child ( temp texture2D)
0:13 direct index ( temp texture2D) 0:13 direct index ( temp texture2D)
0:? 'packed.membTex' ( temp 2-element array of texture2D) 0:13 membTex: direct index for structure ( temp 2-element array of texture2D)
0:13 'packed' ( temp structure{ temp int a, temp 2-element array of texture2D membTex, temp int b})
0:13 Constant:
0:13 1 (const int)
0:13 Constant: 0:13 Constant:
0:13 1 (const int) 0:13 1 (const int)
0:? 'tex[1]' ( uniform texture2D) 0:? 'tex[1]' ( uniform texture2D)
...@@ -50,13 +56,19 @@ Shader version: 500 ...@@ -50,13 +56,19 @@ Shader version: 500
0:13 Sequence 0:13 Sequence
0:13 move second child to first child ( temp texture2D) 0:13 move second child to first child ( temp texture2D)
0:13 direct index ( temp texture2D) 0:13 direct index ( temp texture2D)
0:? 'packed.membTex' ( temp 2-element array of texture2D) 0:13 membTex: direct index for structure ( temp 2-element array of texture2D)
0:13 'packed' ( temp structure{ temp int a, temp 2-element array of texture2D membTex, temp int b})
0:13 Constant:
0:13 1 (const int)
0:13 Constant: 0:13 Constant:
0:13 0 (const int) 0:13 0 (const int)
0:? 'tex[0]' ( uniform texture2D) 0:? 'tex[0]' ( uniform texture2D)
0:13 move second child to first child ( temp texture2D) 0:13 move second child to first child ( temp texture2D)
0:13 direct index ( temp texture2D) 0:13 direct index ( temp texture2D)
0:? 'packed.membTex' ( temp 2-element array of texture2D) 0:13 membTex: direct index for structure ( temp 2-element array of texture2D)
0:13 'packed' ( temp structure{ temp int a, temp 2-element array of texture2D membTex, temp int b})
0:13 Constant:
0:13 1 (const int)
0:13 Constant: 0:13 Constant:
0:13 1 (const int) 0:13 1 (const int)
0:? 'tex[1]' ( uniform texture2D) 0:? 'tex[1]' ( uniform texture2D)
...@@ -80,71 +92,76 @@ Shader version: 500 ...@@ -80,71 +92,76 @@ Shader version: 500
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80002 // Generated by (magic number): 80002
// Id's are bound by 42 // Id's are bound by 43
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 35 38 EntryPoint Vertex 4 "main" 36 39
Source HLSL 500 Source HLSL 500
Name 4 "main" Name 4 "main"
Name 11 "@main(vf4;" Name 11 "@main(vf4;"
Name 10 "pos" Name 10 "pos"
Name 18 "packed.membTex" Name 18 "Packed"
Name 22 "tex[0]" MemberName 18(Packed) 0 "a"
Name 27 "tex[1]" MemberName 18(Packed) 1 "membTex"
Name 33 "pos" MemberName 18(Packed) 2 "b"
Name 35 "pos" Name 20 "packed"
Name 38 "@entryPointOutput" Name 24 "tex[0]"
Name 39 "param" Name 28 "tex[1]"
Decorate 22(tex[0]) DescriptorSet 0 Name 34 "pos"
Decorate 27(tex[1]) DescriptorSet 0 Name 36 "pos"
Decorate 35(pos) Location 0 Name 39 "@entryPointOutput"
Decorate 38(@entryPointOutput) BuiltIn Position Name 40 "param"
Decorate 24(tex[0]) DescriptorSet 0
Decorate 28(tex[1]) DescriptorSet 0
Decorate 36(pos) Location 0
Decorate 39(@entryPointOutput) BuiltIn Position
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
7: TypeVector 6(float) 4 7: TypeVector 6(float) 4
8: TypePointer Function 7(fvec4) 8: TypePointer Function 7(fvec4)
9: TypeFunction 7(fvec4) 8(ptr) 9: TypeFunction 7(fvec4) 8(ptr)
13: TypeImage 6(float) 2D sampled format:Unknown 13: TypeInt 32 1
14: TypeInt 32 0 14: TypeImage 6(float) 2D sampled format:Unknown
15: 14(int) Constant 2 15: TypeInt 32 0
16: TypeArray 13 15 16: 15(int) Constant 2
17: TypePointer Function 16 17: TypeArray 14 16
19: TypeInt 32 1 18(Packed): TypeStruct 13(int) 17 13(int)
20: 19(int) Constant 0 19: TypePointer Function 18(Packed)
21: TypePointer UniformConstant 13 21: 13(int) Constant 1
22(tex[0]): 21(ptr) Variable UniformConstant 22: 13(int) Constant 0
24: TypePointer Function 13 23: TypePointer UniformConstant 14
26: 19(int) Constant 1 24(tex[0]): 23(ptr) Variable UniformConstant
27(tex[1]): 21(ptr) Variable UniformConstant 26: TypePointer Function 14
34: TypePointer Input 7(fvec4) 28(tex[1]): 23(ptr) Variable UniformConstant
35(pos): 34(ptr) Variable Input 35: TypePointer Input 7(fvec4)
37: TypePointer Output 7(fvec4) 36(pos): 35(ptr) Variable Input
38(@entryPointOutput): 37(ptr) Variable Output 38: TypePointer Output 7(fvec4)
39(@entryPointOutput): 38(ptr) Variable Output
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
33(pos): 8(ptr) Variable Function 34(pos): 8(ptr) Variable Function
39(param): 8(ptr) Variable Function 40(param): 8(ptr) Variable Function
36: 7(fvec4) Load 35(pos) 37: 7(fvec4) Load 36(pos)
Store 33(pos) 36 Store 34(pos) 37
40: 7(fvec4) Load 33(pos) 41: 7(fvec4) Load 34(pos)
Store 39(param) 40 Store 40(param) 41
41: 7(fvec4) FunctionCall 11(@main(vf4;) 39(param) 42: 7(fvec4) FunctionCall 11(@main(vf4;) 40(param)
Store 38(@entryPointOutput) 41 Store 39(@entryPointOutput) 42
Return Return
FunctionEnd FunctionEnd
11(@main(vf4;): 7(fvec4) Function None 9 11(@main(vf4;): 7(fvec4) Function None 9
10(pos): 8(ptr) FunctionParameter 10(pos): 8(ptr) FunctionParameter
12: Label 12: Label
18(packed.membTex): 17(ptr) Variable Function 20(packed): 19(ptr) Variable Function
23: 13 Load 22(tex[0]) 25: 14 Load 24(tex[0])
25: 24(ptr) AccessChain 18(packed.membTex) 20 27: 26(ptr) AccessChain 20(packed) 21 22
Store 25 23 Store 27 25
28: 13 Load 27(tex[1]) 29: 14 Load 28(tex[1])
29: 24(ptr) AccessChain 18(packed.membTex) 26 30: 26(ptr) AccessChain 20(packed) 21 21
Store 29 28 Store 30 29
30: 7(fvec4) Load 10(pos) 31: 7(fvec4) Load 10(pos)
ReturnValue 30 ReturnValue 31
FunctionEnd FunctionEnd
...@@ -22,5 +22,6 @@ float4 main() : SV_TARGET0 ...@@ -22,5 +22,6 @@ float4 main() : SV_TARGET0
res += lookUp(tex2); res += lookUp(tex2);
FxaaTex tex3 = tex1; FxaaTex tex3 = tex1;
res += lookUp(tex3); res += lookUp(tex3);
return res; return res;
} }
...@@ -1160,7 +1160,7 @@ bool HlslParseContext::shouldFlatten(const TType& type, TStorageQualifier qualif ...@@ -1160,7 +1160,7 @@ bool HlslParseContext::shouldFlatten(const TType& type, TStorageQualifier qualif
return (type.isArray() && intermediate.getFlattenUniformArrays() && topLevel) || return (type.isArray() && intermediate.getFlattenUniformArrays() && topLevel) ||
(type.isStruct() && type.containsOpaque()); (type.isStruct() && type.containsOpaque());
default: default:
return type.isStruct() && type.containsOpaque(); return false;
}; };
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment