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:
parent
471bfed062
commit
dc005fb083
18 changed files with 1610 additions and 1419 deletions
|
|
@ -8,32 +8,34 @@ gl_FragCoord origin is upper left
|
|||
0:30 'vpos' ( in 4-component vector of float)
|
||||
0:? Sequence
|
||||
0:33 move second child to first child ( temp sampler)
|
||||
0:? 's1.s0.ss' ( temp sampler)
|
||||
0:33 ss: direct index for structure ( temp sampler)
|
||||
0:33 s0: direct index for structure ( temp structure{ temp int x, temp int y, temp sampler ss})
|
||||
0:33 's1' ( temp structure{ temp float b, temp sampler samplerState, temp structure{ temp int x, temp int y, temp sampler ss} s0, temp int a})
|
||||
0:33 Constant:
|
||||
0:33 2 (const int)
|
||||
0:33 Constant:
|
||||
0:33 2 (const int)
|
||||
0:33 'samp' ( uniform sampler)
|
||||
0:34 Sequence
|
||||
0:34 move second child to first child ( temp float)
|
||||
0:? 's2.resources.b' ( temp float)
|
||||
0:? 's1.b' ( temp float)
|
||||
0:34 move second child to first child ( temp sampler)
|
||||
0:? 's2.resources.samplerState' ( temp sampler)
|
||||
0:? 's1.samplerState' ( temp sampler)
|
||||
0:34 move second child to first child ( temp int)
|
||||
0:? 's2.resources.s0.x' ( temp int)
|
||||
0:? 's1.s0.x' ( temp int)
|
||||
0:34 move second child to first child ( temp int)
|
||||
0:? 's2.resources.s0.y' ( temp int)
|
||||
0:? 's1.s0.y' ( temp int)
|
||||
0:34 move second child to first child ( temp sampler)
|
||||
0:? 's2.resources.s0.ss' ( temp sampler)
|
||||
0:? 's1.s0.ss' ( temp sampler)
|
||||
0:34 move second child to first child ( temp int)
|
||||
0:? 's2.resources.a' ( temp int)
|
||||
0:? 's1.a' ( temp int)
|
||||
0:34 move second child to first child ( temp structure{ temp float b, temp sampler samplerState, temp structure{ temp int x, temp int y, temp sampler ss} s0, temp int a})
|
||||
0:34 resources: direct index for structure ( temp structure{ temp float b, temp sampler samplerState, temp structure{ temp int x, temp int y, temp sampler ss} s0, temp int a})
|
||||
0:34 's2' ( temp structure{ temp int a1, temp int a2, temp int a3, temp int a4, temp int a5, temp structure{ temp float b, temp sampler samplerState, temp structure{ temp int x, temp int y, temp sampler ss} s0, temp int a} resources})
|
||||
0:34 Constant:
|
||||
0:34 5 (const int)
|
||||
0:34 's1' ( temp structure{ temp float b, temp sampler samplerState, temp structure{ temp int x, temp int y, temp sampler ss} s0, temp int a})
|
||||
0:35 Branch: Return with expression
|
||||
0:35 texture ( temp 4-component vector of float)
|
||||
0:35 Construct combined texture-sampler ( temp sampler2D)
|
||||
0:35 'tex' ( uniform texture2D)
|
||||
0:? 's2.resources.s0.ss' ( temp sampler)
|
||||
0:35 ss: direct index for structure ( temp sampler)
|
||||
0:35 s0: direct index for structure ( temp structure{ temp int x, temp int y, temp sampler ss})
|
||||
0:35 resources: direct index for structure ( temp structure{ temp float b, temp sampler samplerState, temp structure{ temp int x, temp int y, temp sampler ss} s0, temp int a})
|
||||
0:35 's2' ( temp structure{ temp int a1, temp int a2, temp int a3, temp int a4, temp int a5, temp structure{ temp float b, temp sampler samplerState, temp structure{ temp int x, temp int y, temp sampler ss} s0, temp int a} resources})
|
||||
0:35 Constant:
|
||||
0:35 5 (const int)
|
||||
0:35 Constant:
|
||||
0:35 2 (const int)
|
||||
0:35 Constant:
|
||||
0:35 2 (const int)
|
||||
0:35 Constant:
|
||||
0:35 0.500000
|
||||
0:35 0.500000
|
||||
|
|
@ -65,32 +67,34 @@ gl_FragCoord origin is upper left
|
|||
0:30 'vpos' ( in 4-component vector of float)
|
||||
0:? Sequence
|
||||
0:33 move second child to first child ( temp sampler)
|
||||
0:? 's1.s0.ss' ( temp sampler)
|
||||
0:33 ss: direct index for structure ( temp sampler)
|
||||
0:33 s0: direct index for structure ( temp structure{ temp int x, temp int y, temp sampler ss})
|
||||
0:33 's1' ( temp structure{ temp float b, temp sampler samplerState, temp structure{ temp int x, temp int y, temp sampler ss} s0, temp int a})
|
||||
0:33 Constant:
|
||||
0:33 2 (const int)
|
||||
0:33 Constant:
|
||||
0:33 2 (const int)
|
||||
0:33 'samp' ( uniform sampler)
|
||||
0:34 Sequence
|
||||
0:34 move second child to first child ( temp float)
|
||||
0:? 's2.resources.b' ( temp float)
|
||||
0:? 's1.b' ( temp float)
|
||||
0:34 move second child to first child ( temp sampler)
|
||||
0:? 's2.resources.samplerState' ( temp sampler)
|
||||
0:? 's1.samplerState' ( temp sampler)
|
||||
0:34 move second child to first child ( temp int)
|
||||
0:? 's2.resources.s0.x' ( temp int)
|
||||
0:? 's1.s0.x' ( temp int)
|
||||
0:34 move second child to first child ( temp int)
|
||||
0:? 's2.resources.s0.y' ( temp int)
|
||||
0:? 's1.s0.y' ( temp int)
|
||||
0:34 move second child to first child ( temp sampler)
|
||||
0:? 's2.resources.s0.ss' ( temp sampler)
|
||||
0:? 's1.s0.ss' ( temp sampler)
|
||||
0:34 move second child to first child ( temp int)
|
||||
0:? 's2.resources.a' ( temp int)
|
||||
0:? 's1.a' ( temp int)
|
||||
0:34 move second child to first child ( temp structure{ temp float b, temp sampler samplerState, temp structure{ temp int x, temp int y, temp sampler ss} s0, temp int a})
|
||||
0:34 resources: direct index for structure ( temp structure{ temp float b, temp sampler samplerState, temp structure{ temp int x, temp int y, temp sampler ss} s0, temp int a})
|
||||
0:34 's2' ( temp structure{ temp int a1, temp int a2, temp int a3, temp int a4, temp int a5, temp structure{ temp float b, temp sampler samplerState, temp structure{ temp int x, temp int y, temp sampler ss} s0, temp int a} resources})
|
||||
0:34 Constant:
|
||||
0:34 5 (const int)
|
||||
0:34 's1' ( temp structure{ temp float b, temp sampler samplerState, temp structure{ temp int x, temp int y, temp sampler ss} s0, temp int a})
|
||||
0:35 Branch: Return with expression
|
||||
0:35 texture ( temp 4-component vector of float)
|
||||
0:35 Construct combined texture-sampler ( temp sampler2D)
|
||||
0:35 'tex' ( uniform texture2D)
|
||||
0:? 's2.resources.s0.ss' ( temp sampler)
|
||||
0:35 ss: direct index for structure ( temp sampler)
|
||||
0:35 s0: direct index for structure ( temp structure{ temp int x, temp int y, temp sampler ss})
|
||||
0:35 resources: direct index for structure ( temp structure{ temp float b, temp sampler samplerState, temp structure{ temp int x, temp int y, temp sampler ss} s0, temp int a})
|
||||
0:35 's2' ( temp structure{ temp int a1, temp int a2, temp int a3, temp int a4, temp int a5, temp structure{ temp float b, temp sampler samplerState, temp structure{ temp int x, temp int y, temp sampler ss} s0, temp int a} resources})
|
||||
0:35 Constant:
|
||||
0:35 5 (const int)
|
||||
0:35 Constant:
|
||||
0:35 2 (const int)
|
||||
0:35 Constant:
|
||||
0:35 2 (const int)
|
||||
0:35 Constant:
|
||||
0:35 0.500000
|
||||
0:35 0.500000
|
||||
|
|
@ -112,39 +116,45 @@ gl_FragCoord origin is upper left
|
|||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80002
|
||||
// Id's are bound by 61
|
||||
// Id's are bound by 54
|
||||
|
||||
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 11 "@main(vf4;"
|
||||
Name 10 "vpos"
|
||||
Name 15 "s1.s0.ss"
|
||||
Name 17 "samp"
|
||||
Name 20 "s2.resources.b"
|
||||
Name 21 "s1.b"
|
||||
Name 23 "s2.resources.samplerState"
|
||||
Name 24 "s1.samplerState"
|
||||
Name 28 "s2.resources.s0.x"
|
||||
Name 29 "s1.s0.x"
|
||||
Name 31 "s2.resources.s0.y"
|
||||
Name 32 "s1.s0.y"
|
||||
Name 34 "s2.resources.s0.ss"
|
||||
Name 36 "s2.resources.a"
|
||||
Name 37 "s1.a"
|
||||
Name 41 "tex"
|
||||
Name 52 "vpos"
|
||||
Name 54 "vpos"
|
||||
Name 57 "@entryPointOutput"
|
||||
Name 58 "param"
|
||||
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 18 "s1"
|
||||
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 27 "s2"
|
||||
Name 33 "tex"
|
||||
Name 45 "vpos"
|
||||
Name 47 "vpos"
|
||||
Name 50 "@entryPointOutput"
|
||||
Name 51 "param"
|
||||
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
|
||||
|
|
@ -152,67 +162,55 @@ gl_FragCoord origin is upper left
|
|||
8: TypePointer Function 7(fvec4)
|
||||
9: TypeFunction 7(fvec4) 8(ptr)
|
||||
13: TypeSampler
|
||||
14: TypePointer Function 13
|
||||
16: TypePointer UniformConstant 13
|
||||
17(samp): 16(ptr) Variable UniformConstant
|
||||
19: TypePointer Function 6(float)
|
||||
26: TypeInt 32 1
|
||||
27: TypePointer Function 26(int)
|
||||
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)
|
||||
17: TypePointer Function 16(S1)
|
||||
19: 14(int) Constant 2
|
||||
20: TypePointer UniformConstant 13
|
||||
21(samp): 20(ptr) Variable UniformConstant
|
||||
23: TypePointer Function 13
|
||||
25(S2): TypeStruct 14(int) 14(int) 14(int) 14(int) 14(int) 16(S1)
|
||||
26: TypePointer Function 25(S2)
|
||||
28: 14(int) Constant 5
|
||||
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
|
||||
52(vpos): 8(ptr) Variable Function
|
||||
58(param): 8(ptr) Variable Function
|
||||
55: 7(fvec4) Load 54(vpos)
|
||||
Store 52(vpos) 55
|
||||
59: 7(fvec4) Load 52(vpos)
|
||||
Store 58(param) 59
|
||||
60: 7(fvec4) FunctionCall 11(@main(vf4;) 58(param)
|
||||
Store 57(@entryPointOutput) 60
|
||||
45(vpos): 8(ptr) Variable Function
|
||||
51(param): 8(ptr) Variable Function
|
||||
48: 7(fvec4) Load 47(vpos)
|
||||
Store 45(vpos) 48
|
||||
52: 7(fvec4) Load 45(vpos)
|
||||
Store 51(param) 52
|
||||
53: 7(fvec4) FunctionCall 11(@main(vf4;) 51(param)
|
||||
Store 50(@entryPointOutput) 53
|
||||
Return
|
||||
FunctionEnd
|
||||
11(@main(vf4;): 7(fvec4) Function None 9
|
||||
10(vpos): 8(ptr) FunctionParameter
|
||||
12: Label
|
||||
15(s1.s0.ss): 14(ptr) Variable Function
|
||||
20(s2.resources.b): 19(ptr) Variable Function
|
||||
21(s1.b): 19(ptr) Variable Function
|
||||
23(s2.resources.samplerState): 14(ptr) Variable Function
|
||||
24(s1.samplerState): 14(ptr) Variable Function
|
||||
28(s2.resources.s0.x): 27(ptr) Variable Function
|
||||
29(s1.s0.x): 27(ptr) Variable Function
|
||||
31(s2.resources.s0.y): 27(ptr) Variable Function
|
||||
32(s1.s0.y): 27(ptr) Variable Function
|
||||
34(s2.resources.s0.ss): 14(ptr) Variable Function
|
||||
36(s2.resources.a): 27(ptr) Variable Function
|
||||
37(s1.a): 27(ptr) Variable Function
|
||||
18: 13 Load 17(samp)
|
||||
Store 15(s1.s0.ss) 18
|
||||
22: 6(float) Load 21(s1.b)
|
||||
Store 20(s2.resources.b) 22
|
||||
25: 13 Load 24(s1.samplerState)
|
||||
Store 23(s2.resources.samplerState) 25
|
||||
30: 26(int) Load 29(s1.s0.x)
|
||||
Store 28(s2.resources.s0.x) 30
|
||||
33: 26(int) Load 32(s1.s0.y)
|
||||
Store 31(s2.resources.s0.y) 33
|
||||
35: 13 Load 15(s1.s0.ss)
|
||||
Store 34(s2.resources.s0.ss) 35
|
||||
38: 26(int) Load 37(s1.a)
|
||||
Store 36(s2.resources.a) 38
|
||||
42: 39 Load 41(tex)
|
||||
43: 13 Load 34(s2.resources.s0.ss)
|
||||
45: 44 SampledImage 42 43
|
||||
49: 7(fvec4) ImageSampleImplicitLod 45 48
|
||||
ReturnValue 49
|
||||
18(s1): 17(ptr) Variable Function
|
||||
27(s2): 26(ptr) Variable Function
|
||||
22: 13 Load 21(samp)
|
||||
24: 23(ptr) AccessChain 18(s1) 19 19
|
||||
Store 24 22
|
||||
29: 16(S1) Load 18(s1)
|
||||
30: 17(ptr) AccessChain 27(s2) 28
|
||||
Store 30 29
|
||||
34: 31 Load 33(tex)
|
||||
35: 23(ptr) AccessChain 27(s2) 28 19 19
|
||||
36: 13 Load 35
|
||||
38: 37 SampledImage 34 36
|
||||
42: 7(fvec4) ImageSampleImplicitLod 38 41
|
||||
ReturnValue 42
|
||||
FunctionEnd
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue