HLSL: Flatten more I/O: non-arrayed user-only structures.

The goal is to flatten all I/O, but there are multiple categories and
steps to complete, likely including a final unification of splitting
and flattening.
This commit is contained in:
John Kessenich 2017-08-04 12:04:44 -06:00
parent cca42a8ea6
commit b6be80f44e
12 changed files with 693 additions and 374 deletions

View file

@ -12,9 +12,31 @@ using depth_greater
0:15 Function Definition: main( ( temp void)
0:15 Function Parameters:
0:? Sequence
0:15 move second child to first child ( temp structure{ temp float f, temp float g, temp float d, temp 4-component vector of float normal})
0:? 't' ( temp structure{ temp float f, temp float g, temp float d, temp 4-component vector of float normal})
0:? 't' (layout( location=0) in structure{ temp float f, centroid temp float g, temp float d, temp 4-component vector of float normal})
0:15 Sequence
0:15 move second child to first child ( temp float)
0:15 f: direct index for structure ( temp float)
0:? 't' ( temp structure{ temp float f, temp float g, temp float d, temp 4-component vector of float normal})
0:15 Constant:
0:15 0 (const int)
0:? 'f' (layout( location=0) in float)
0:15 move second child to first child ( temp float)
0:15 g: direct index for structure ( temp float)
0:? 't' ( temp structure{ temp float f, temp float g, temp float d, temp 4-component vector of float normal})
0:15 Constant:
0:15 1 (const int)
0:? 'g' (layout( location=1) centroid in float)
0:15 move second child to first child ( temp float)
0:15 d: direct index for structure ( temp float)
0:? 't' ( temp structure{ temp float f, temp float g, temp float d, temp 4-component vector of float normal})
0:15 Constant:
0:15 2 (const int)
0:? 'd' (layout( location=2) in float)
0:15 move second child to first child ( temp 4-component vector of float)
0:15 normal: direct index for structure ( temp 4-component vector of float)
0:? 't' ( temp structure{ temp float f, temp float g, temp float d, temp 4-component vector of float normal})
0:15 Constant:
0:15 3 (const int)
0:? 'normal' (layout( location=3) in 4-component vector of float)
0:15 Sequence
0:15 move second child to first child ( temp structure{ temp float f, temp float g, temp float d, temp 4-component vector of float normal})
0:15 'flattenTemp' ( temp structure{ temp float f, temp float g, temp float d, temp 4-component vector of float normal})
@ -51,7 +73,10 @@ using depth_greater
0:? 'g' (layout( location=1) out float)
0:? 'd' ( out float FragDepth)
0:? 'normal' (layout( location=2) out 4-component vector of float)
0:? 't' (layout( location=0) in structure{ temp float f, centroid temp float g, temp float d, temp 4-component vector of float normal})
0:? 'f' (layout( location=0) in float)
0:? 'g' (layout( location=1) centroid in float)
0:? 'd' (layout( location=2) in float)
0:? 'normal' (layout( location=3) in 4-component vector of float)
Linked fragment stage:
@ -70,9 +95,31 @@ using depth_greater
0:15 Function Definition: main( ( temp void)
0:15 Function Parameters:
0:? Sequence
0:15 move second child to first child ( temp structure{ temp float f, temp float g, temp float d, temp 4-component vector of float normal})
0:? 't' ( temp structure{ temp float f, temp float g, temp float d, temp 4-component vector of float normal})
0:? 't' (layout( location=0) in structure{ temp float f, centroid temp float g, temp float d, temp 4-component vector of float normal})
0:15 Sequence
0:15 move second child to first child ( temp float)
0:15 f: direct index for structure ( temp float)
0:? 't' ( temp structure{ temp float f, temp float g, temp float d, temp 4-component vector of float normal})
0:15 Constant:
0:15 0 (const int)
0:? 'f' (layout( location=0) in float)
0:15 move second child to first child ( temp float)
0:15 g: direct index for structure ( temp float)
0:? 't' ( temp structure{ temp float f, temp float g, temp float d, temp 4-component vector of float normal})
0:15 Constant:
0:15 1 (const int)
0:? 'g' (layout( location=1) centroid in float)
0:15 move second child to first child ( temp float)
0:15 d: direct index for structure ( temp float)
0:? 't' ( temp structure{ temp float f, temp float g, temp float d, temp 4-component vector of float normal})
0:15 Constant:
0:15 2 (const int)
0:? 'd' (layout( location=2) in float)
0:15 move second child to first child ( temp 4-component vector of float)
0:15 normal: direct index for structure ( temp 4-component vector of float)
0:? 't' ( temp structure{ temp float f, temp float g, temp float d, temp 4-component vector of float normal})
0:15 Constant:
0:15 3 (const int)
0:? 'normal' (layout( location=3) in 4-component vector of float)
0:15 Sequence
0:15 move second child to first child ( temp structure{ temp float f, temp float g, temp float d, temp 4-component vector of float normal})
0:15 'flattenTemp' ( temp structure{ temp float f, temp float g, temp float d, temp 4-component vector of float normal})
@ -109,16 +156,19 @@ using depth_greater
0:? 'g' (layout( location=1) out float)
0:? 'd' ( out float FragDepth)
0:? 'normal' (layout( location=2) out 4-component vector of float)
0:? 't' (layout( location=0) in structure{ temp float f, centroid temp float g, temp float d, temp 4-component vector of float normal})
0:? 'f' (layout( location=0) in float)
0:? 'g' (layout( location=1) centroid in float)
0:? 'd' (layout( location=2) in float)
0:? 'normal' (layout( location=3) in 4-component vector of float)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 64
// Id's are bound by 66
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 21 43 46 49 53
EntryPoint Fragment 4 "main" 22 27 31 36 45 48 51 55
ExecutionMode 4 OriginUpperLeft
ExecutionMode 4 DepthGreater
Source HLSL 500
@ -132,54 +182,55 @@ using depth_greater
Name 11 "t"
Name 14 "local"
Name 18 "t"
Name 19 "T"
MemberName 19(T) 0 "f"
MemberName 19(T) 1 "g"
MemberName 19(T) 2 "d"
MemberName 19(T) 3 "normal"
Name 21 "t"
Name 38 "flattenTemp"
Name 39 "param"
Name 43 "f"
Name 46 "g"
Name 49 "d"
Name 53 "normal"
Name 56 "T"
MemberName 56(T) 0 "f"
MemberName 56(T) 1 "g"
MemberName 56(T) 2 "d"
MemberName 56(T) 3 "normal"
Name 57 "$Global"
MemberName 57($Global) 0 "s"
Name 59 ""
Name 60 "T"
MemberName 60(T) 0 "f"
MemberName 60(T) 1 "g"
MemberName 60(T) 2 "d"
MemberName 60(T) 3 "normal"
Name 61 "buff"
MemberName 61(buff) 0 "t"
Name 63 ""
MemberDecorate 19(T) 1 Centroid
Decorate 21(t) Location 0
Decorate 43(f) Location 0
Decorate 46(g) Location 1
Decorate 49(d) BuiltIn FragDepth
Decorate 53(normal) Location 2
MemberDecorate 56(T) 0 Offset 68
MemberDecorate 56(T) 1 Offset 72
MemberDecorate 56(T) 2 Offset 76
MemberDecorate 56(T) 3 Offset 80
MemberDecorate 57($Global) 0 Offset 0
Decorate 57($Global) Block
Decorate 59 DescriptorSet 0
MemberDecorate 60(T) 0 Offset 0
MemberDecorate 60(T) 1 Offset 4
MemberDecorate 60(T) 2 Offset 8
MemberDecorate 60(T) 3 Offset 16
MemberDecorate 61(buff) 0 Offset 96
Decorate 61(buff) Block
Decorate 63 DescriptorSet 0
Name 22 "f"
Name 27 "g"
Name 31 "d"
Name 36 "normal"
Name 40 "flattenTemp"
Name 41 "param"
Name 45 "f"
Name 48 "g"
Name 51 "d"
Name 55 "normal"
Name 58 "T"
MemberName 58(T) 0 "f"
MemberName 58(T) 1 "g"
MemberName 58(T) 2 "d"
MemberName 58(T) 3 "normal"
Name 59 "$Global"
MemberName 59($Global) 0 "s"
Name 61 ""
Name 62 "T"
MemberName 62(T) 0 "f"
MemberName 62(T) 1 "g"
MemberName 62(T) 2 "d"
MemberName 62(T) 3 "normal"
Name 63 "buff"
MemberName 63(buff) 0 "t"
Name 65 ""
Decorate 22(f) Location 0
Decorate 27(g) Centroid
Decorate 27(g) Location 1
Decorate 31(d) Location 2
Decorate 36(normal) Location 3
Decorate 45(f) Location 0
Decorate 48(g) Location 1
Decorate 51(d) BuiltIn FragDepth
Decorate 55(normal) Location 2
MemberDecorate 58(T) 0 Offset 68
MemberDecorate 58(T) 1 Offset 72
MemberDecorate 58(T) 2 Offset 76
MemberDecorate 58(T) 3 Offset 80
MemberDecorate 59($Global) 0 Offset 0
Decorate 59($Global) Block
Decorate 61 DescriptorSet 0
MemberDecorate 62(T) 0 Offset 0
MemberDecorate 62(T) 1 Offset 4
MemberDecorate 62(T) 2 Offset 8
MemberDecorate 62(T) 3 Offset 16
MemberDecorate 63(buff) 0 Offset 96
Decorate 63(buff) Block
Decorate 65 DescriptorSet 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@ -187,64 +238,66 @@ using depth_greater
8(T): TypeStruct 6(float) 6(float) 6(float) 7(fvec4)
9: TypePointer Function 8(T)
10: TypeFunction 8(T) 9(ptr)
19(T): TypeStruct 6(float) 6(float) 6(float) 7(fvec4)
20: TypePointer Input 19(T)
21(t): 20(ptr) Variable Input
24: TypeInt 32 1
25: 24(int) Constant 0
26: TypePointer Function 6(float)
29: 24(int) Constant 1
32: 24(int) Constant 2
35: 24(int) Constant 3
36: TypePointer Function 7(fvec4)
42: TypePointer Output 6(float)
43(f): 42(ptr) Variable Output
46(g): 42(ptr) Variable Output
49(d): 42(ptr) Variable Output
52: TypePointer Output 7(fvec4)
53(normal): 52(ptr) Variable Output
56(T): TypeStruct 6(float) 6(float) 6(float) 7(fvec4)
57($Global): TypeStruct 56(T)
58: TypePointer Uniform 57($Global)
59: 58(ptr) Variable Uniform
60(T): TypeStruct 6(float) 6(float) 6(float) 7(fvec4)
61(buff): TypeStruct 60(T)
62: TypePointer Uniform 61(buff)
63: 62(ptr) Variable Uniform
19: TypeInt 32 1
20: 19(int) Constant 0
21: TypePointer Input 6(float)
22(f): 21(ptr) Variable Input
24: TypePointer Function 6(float)
26: 19(int) Constant 1
27(g): 21(ptr) Variable Input
30: 19(int) Constant 2
31(d): 21(ptr) Variable Input
34: 19(int) Constant 3
35: TypePointer Input 7(fvec4)
36(normal): 35(ptr) Variable Input
38: TypePointer Function 7(fvec4)
44: TypePointer Output 6(float)
45(f): 44(ptr) Variable Output
48(g): 44(ptr) Variable Output
51(d): 44(ptr) Variable Output
54: TypePointer Output 7(fvec4)
55(normal): 54(ptr) Variable Output
58(T): TypeStruct 6(float) 6(float) 6(float) 7(fvec4)
59($Global): TypeStruct 58(T)
60: TypePointer Uniform 59($Global)
61: 60(ptr) Variable Uniform
62(T): TypeStruct 6(float) 6(float) 6(float) 7(fvec4)
63(buff): TypeStruct 62(T)
64: TypePointer Uniform 63(buff)
65: 64(ptr) Variable Uniform
4(main): 2 Function None 3
5: Label
18(t): 9(ptr) Variable Function
38(flattenTemp): 9(ptr) Variable Function
39(param): 9(ptr) Variable Function
22: 19(T) Load 21(t)
23: 6(float) CompositeExtract 22 0
27: 26(ptr) AccessChain 18(t) 25
Store 27 23
28: 6(float) CompositeExtract 22 1
30: 26(ptr) AccessChain 18(t) 29
Store 30 28
31: 6(float) CompositeExtract 22 2
33: 26(ptr) AccessChain 18(t) 32
Store 33 31
34: 7(fvec4) CompositeExtract 22 3
37: 36(ptr) AccessChain 18(t) 35
Store 37 34
40: 8(T) Load 18(t)
Store 39(param) 40
41: 8(T) FunctionCall 12(@main(struct-T-f1-f1-f1-vf41;) 39(param)
Store 38(flattenTemp) 41
44: 26(ptr) AccessChain 38(flattenTemp) 25
45: 6(float) Load 44
Store 43(f) 45
47: 26(ptr) AccessChain 38(flattenTemp) 29
48: 6(float) Load 47
Store 46(g) 48
50: 26(ptr) AccessChain 38(flattenTemp) 32
51: 6(float) Load 50
Store 49(d) 51
54: 36(ptr) AccessChain 38(flattenTemp) 35
55: 7(fvec4) Load 54
Store 53(normal) 55
40(flattenTemp): 9(ptr) Variable Function
41(param): 9(ptr) Variable Function
23: 6(float) Load 22(f)
25: 24(ptr) AccessChain 18(t) 20
Store 25 23
28: 6(float) Load 27(g)
29: 24(ptr) AccessChain 18(t) 26
Store 29 28
32: 6(float) Load 31(d)
33: 24(ptr) AccessChain 18(t) 30
Store 33 32
37: 7(fvec4) Load 36(normal)
39: 38(ptr) AccessChain 18(t) 34
Store 39 37
42: 8(T) Load 18(t)
Store 41(param) 42
43: 8(T) FunctionCall 12(@main(struct-T-f1-f1-f1-vf41;) 41(param)
Store 40(flattenTemp) 43
46: 24(ptr) AccessChain 40(flattenTemp) 20
47: 6(float) Load 46
Store 45(f) 47
49: 24(ptr) AccessChain 40(flattenTemp) 26
50: 6(float) Load 49
Store 48(g) 50
52: 24(ptr) AccessChain 40(flattenTemp) 30
53: 6(float) Load 52
Store 51(d) 53
56: 38(ptr) AccessChain 40(flattenTemp) 34
57: 7(fvec4) Load 56
Store 55(normal) 57
Return
FunctionEnd
12(@main(struct-T-f1-f1-f1-vf41;): 8(T) Function None 10