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,47 +2,67 @@ hlsl.flattenSubset.frag
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 85
// Id's are bound by 66
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 54 57
EntryPoint Fragment 4 "main" 47 50
ExecutionMode 4 OriginUpperLeft
Source HLSL 500
Name 4 "main"
Name 17 "samp"
Name 41 "tex"
Name 54 "vpos"
Name 57 "@entryPointOutput"
Decorate 17(samp) DescriptorSet 0
Decorate 41(tex) DescriptorSet 0
Decorate 54(vpos) Location 0
Decorate 57(@entryPointOutput) Location 0
Name 15 "S0"
MemberName 15(S0) 0 "x"
MemberName 15(S0) 1 "y"
MemberName 15(S0) 2 "ss"
Name 16 "S1"
MemberName 16(S1) 0 "b"
MemberName 16(S1) 1 "samplerState"
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
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
13: TypeSampler
16: TypePointer UniformConstant 13
17(samp): 16(ptr) Variable UniformConstant
39: TypeImage 6(float) 2D sampled format:Unknown
40: TypePointer UniformConstant 39
41(tex): 40(ptr) Variable UniformConstant
44: TypeSampledImage 39
46: TypeVector 6(float) 2
47: 6(float) Constant 1056964608
48: 46(fvec2) ConstantComposite 47 47
53: TypePointer Input 7(fvec4)
54(vpos): 53(ptr) Variable Input
56: TypePointer Output 7(fvec4)
57(@entryPointOutput): 56(ptr) Variable Output
14: TypeInt 32 1
15(S0): TypeStruct 14(int) 14(int) 13
16(S1): TypeStruct 6(float) 13 15(S0) 14(int)
20: TypePointer UniformConstant 13
21(samp): 20(ptr) Variable UniformConstant
25(S2): TypeStruct 14(int) 14(int) 14(int) 14(int) 14(int) 16(S1)
31: TypeImage 6(float) 2D sampled format:Unknown
32: TypePointer UniformConstant 31
33(tex): 32(ptr) Variable UniformConstant
37: TypeSampledImage 31
39: TypeVector 6(float) 2
40: 6(float) Constant 1056964608
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
5: Label
74: 13 Load 17(samp)
81: 39 Load 41(tex)
83: 44 SampledImage 81 74
84: 7(fvec4) ImageSampleImplicitLod 83 48
Store 57(@entryPointOutput) 84
57: 13 Load 21(samp)
61: 31 Load 33(tex)
64: 37 SampledImage 61 57
65: 7(fvec4) ImageSampleImplicitLod 64 41
Store 50(@entryPointOutput) 65
Return
FunctionEnd