HLSL: Build IO types bottom up, as parsed, and cache the original (IO).

Previously, this was done recursively, per object, and the nonIO version
was cached. This reverses both those approaches.
This commit is contained in:
John Kessenich 2017-02-03 17:57:55 -07:00
parent 88c4464df5
commit 727b374fd3
7 changed files with 295 additions and 324 deletions

View file

@ -153,12 +153,12 @@ output primitive = triangle_strip
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 97
// Id's are bound by 88
Capability Geometry
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Geometry 4 "main" 90
EntryPoint Geometry 4 "main" 81
ExecutionMode 4 InputPoints
ExecutionMode 4 Invocations 1
ExecutionMode 4 OutputTriangleStrip
@ -173,26 +173,20 @@ output primitive = triangle_strip
Name 17 "v"
Name 18 "OutputStream"
Name 21 "Out"
Name 22 "PSInput"
MemberName 22(PSInput) 0 "Pos"
MemberName 22(PSInput) 1 "TexCoord"
MemberName 22(PSInput) 2 "TerrainPos"
MemberName 22(PSInput) 3 "VertexID"
Name 47 "x"
Name 56 "y"
Name 64 "PSInput"
MemberName 64(PSInput) 0 "Pos"
MemberName 64(PSInput) 1 "TexCoord"
MemberName 64(PSInput) 2 "TerrainPos"
MemberName 64(PSInput) 3 "VertexID"
Name 70 "Verts"
Name 88 "v"
Name 90 "v"
Name 92 "OutputStream"
Name 93 "param"
Name 95 "param"
MemberDecorate 22(PSInput) 0 BuiltIn Position
Decorate 90(v) Location 0
Name 30 "x"
Name 41 "y"
Name 49 "PSInput"
MemberName 49(PSInput) 0 "Pos"
MemberName 49(PSInput) 1 "TexCoord"
MemberName 49(PSInput) 2 "TerrainPos"
MemberName 49(PSInput) 3 "VertexID"
Name 55 "Verts"
Name 79 "v"
Name 81 "v"
Name 83 "OutputStream"
Name 84 "param"
Name 86 "param"
Decorate 81(v) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
@ -206,44 +200,43 @@ output primitive = triangle_strip
14(PSInput): TypeStruct 11(fvec4) 12(fvec2) 13(fvec3) 6(int)
15: TypePointer Function 14(PSInput)
16: TypeFunction 2 9(ptr) 15(ptr)
22(PSInput): TypeStruct 11(fvec4) 12(fvec2) 13(fvec3) 6(int)
23: 10(float) Constant 0
24: 11(fvec4) ConstantComposite 23 23 23 23
25: 12(fvec2) ConstantComposite 23 23
26: 13(fvec3) ConstantComposite 23 23 23
27: 6(int) Constant 0
28: 22(PSInput) ConstantComposite 24 25 26 27
30: TypeInt 32 1
31: 30(int) Constant 0
32: TypePointer Function 11(fvec4)
35: 30(int) Constant 1
36: TypePointer Function 12(fvec2)
39: 30(int) Constant 2
40: TypePointer Function 13(fvec3)
43: 30(int) Constant 3
44: TypePointer Function 6(int)
46: TypePointer Function 30(int)
54: TypeBool
64(PSInput): TypeStruct 11(fvec4) 12(fvec2) 13(fvec3) 6(int)
65: 6(int) Constant 3
66: TypeArray 64(PSInput) 65
67: 6(int) Constant 2
68: TypeArray 66 67
69: TypePointer Function 68
74: TypePointer Function 64(PSInput)
89: TypePointer Input 8
90(v): 89(ptr) Variable Input
22: 10(float) Constant 0
23: 11(fvec4) ConstantComposite 22 22 22 22
24: 12(fvec2) ConstantComposite 22 22
25: 13(fvec3) ConstantComposite 22 22 22
26: 6(int) Constant 0
27: 14(PSInput) ConstantComposite 23 24 25 26
28: TypeInt 32 1
29: TypePointer Function 28(int)
31: 28(int) Constant 0
38: 28(int) Constant 2
39: TypeBool
49(PSInput): TypeStruct 11(fvec4) 12(fvec2) 13(fvec3) 6(int)
50: 6(int) Constant 3
51: TypeArray 49(PSInput) 50
52: 6(int) Constant 2
53: TypeArray 51 52
54: TypePointer Function 53
59: TypePointer Function 49(PSInput)
62: TypePointer Function 11(fvec4)
65: 28(int) Constant 1
66: TypePointer Function 12(fvec2)
69: TypePointer Function 13(fvec3)
72: 28(int) Constant 3
73: TypePointer Function 6(int)
80: TypePointer Input 8
81(v): 80(ptr) Variable Input
4(main): 2 Function None 3
5: Label
88(v): 9(ptr) Variable Function
92(OutputStream): 15(ptr) Variable Function
93(param): 9(ptr) Variable Function
95(param): 15(ptr) Variable Function
91: 8 Load 90(v)
Store 88(v) 91
94: 8 Load 88(v)
Store 93(param) 94
96: 2 FunctionCall 19(@main(u1[1];struct-PSInput-vf4-vf2-vf3-u11;) 93(param) 95(param)
79(v): 9(ptr) Variable Function
83(OutputStream): 15(ptr) Variable Function
84(param): 9(ptr) Variable Function
86(param): 15(ptr) Variable Function
82: 8 Load 81(v)
Store 79(v) 82
85: 8 Load 79(v)
Store 84(param) 85
87: 2 FunctionCall 19(@main(u1[1];struct-PSInput-vf4-vf2-vf3-u11;) 84(param) 86(param)
Return
FunctionEnd
19(@main(u1[1];struct-PSInput-vf4-vf2-vf3-u11;): 2 Function None 16
@ -251,70 +244,59 @@ output primitive = triangle_strip
18(OutputStream): 15(ptr) FunctionParameter
20: Label
21(Out): 15(ptr) Variable Function
47(x): 46(ptr) Variable Function
56(y): 46(ptr) Variable Function
70(Verts): 69(ptr) Variable Function
29: 11(fvec4) CompositeExtract 28 0
33: 32(ptr) AccessChain 21(Out) 31
Store 33 29
34: 12(fvec2) CompositeExtract 28 1
37: 36(ptr) AccessChain 21(Out) 35
Store 37 34
38: 13(fvec3) CompositeExtract 28 2
41: 40(ptr) AccessChain 21(Out) 39
Store 41 38
42: 6(int) CompositeExtract 28 3
45: 44(ptr) AccessChain 21(Out) 43
Store 45 42
Store 47(x) 31
Branch 48
48: Label
LoopMerge 50 51 None
Branch 52
52: Label
53: 30(int) Load 47(x)
55: 54(bool) SLessThan 53 39
BranchConditional 55 49 50
49: Label
Store 56(y) 31
Branch 57
57: Label
LoopMerge 59 60 None
Branch 61
61: Label
62: 30(int) Load 56(y)
63: 54(bool) SLessThan 62 39
BranchConditional 63 58 59
58: Label
71: 30(int) Load 47(x)
72: 30(int) Load 56(y)
73: 14(PSInput) Load 21(Out)
75: 74(ptr) AccessChain 70(Verts) 71 72
76: 11(fvec4) CompositeExtract 73 0
77: 32(ptr) AccessChain 75 31
Store 77 76
78: 12(fvec2) CompositeExtract 73 1
79: 36(ptr) AccessChain 75 35
Store 79 78
80: 13(fvec3) CompositeExtract 73 2
81: 40(ptr) AccessChain 75 39
Store 81 80
82: 6(int) CompositeExtract 73 3
83: 44(ptr) AccessChain 75 43
Store 83 82
Branch 60
60: Label
84: 30(int) Load 56(y)
85: 30(int) IAdd 84 35
Store 56(y) 85
Branch 57
59: Label
Branch 51
51: Label
86: 30(int) Load 47(x)
87: 30(int) IAdd 86 35
Store 47(x) 87
Branch 48
50: Label
30(x): 29(ptr) Variable Function
41(y): 29(ptr) Variable Function
55(Verts): 54(ptr) Variable Function
Store 21(Out) 27
Store 30(x) 31
Branch 32
32: Label
LoopMerge 34 35 None
Branch 36
36: Label
37: 28(int) Load 30(x)
40: 39(bool) SLessThan 37 38
BranchConditional 40 33 34
33: Label
Store 41(y) 31
Branch 42
42: Label
LoopMerge 44 45 None
Branch 46
46: Label
47: 28(int) Load 41(y)
48: 39(bool) SLessThan 47 38
BranchConditional 48 43 44
43: Label
56: 28(int) Load 30(x)
57: 28(int) Load 41(y)
58: 14(PSInput) Load 21(Out)
60: 59(ptr) AccessChain 55(Verts) 56 57
61: 11(fvec4) CompositeExtract 58 0
63: 62(ptr) AccessChain 60 31
Store 63 61
64: 12(fvec2) CompositeExtract 58 1
67: 66(ptr) AccessChain 60 65
Store 67 64
68: 13(fvec3) CompositeExtract 58 2
70: 69(ptr) AccessChain 60 38
Store 70 68
71: 6(int) CompositeExtract 58 3
74: 73(ptr) AccessChain 60 72
Store 74 71
Branch 45
45: Label
75: 28(int) Load 41(y)
76: 28(int) IAdd 75 65
Store 41(y) 76
Branch 42
44: Label
Branch 35
35: Label
77: 28(int) Load 30(x)
78: 28(int) IAdd 77 65
Store 30(x) 78
Branch 32
34: Label
Return
FunctionEnd

View file

@ -267,12 +267,12 @@ output primitive = triangle_strip
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 76
// Id's are bound by 75
Capability Geometry
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Geometry 4 "main" 45 53
EntryPoint Geometry 4 "main" 44 52
ExecutionMode 4 Triangles
ExecutionMode 4 Invocations 1
ExecutionMode 4 OutputTriangleStrip
@ -281,29 +281,26 @@ output primitive = triangle_strip
Name 9 "PS_IN"
MemberName 9(PS_IN) 0 "pos"
MemberName 9(PS_IN) 1 "tc"
Name 14 "PS_IN"
MemberName 14(PS_IN) 0 "pos"
MemberName 14(PS_IN) 1 "tc"
Name 18 "STRUCT_WITH_NO_BUILTIN_INTERSTAGE_IO"
MemberName 18(STRUCT_WITH_NO_BUILTIN_INTERSTAGE_IO) 0 "m0_array"
MemberName 18(STRUCT_WITH_NO_BUILTIN_INTERSTAGE_IO) 1 "m1"
Name 19 "GS_OUT"
MemberName 19(GS_OUT) 0 "psIn"
MemberName 19(GS_OUT) 1 "contains_no_builtin_io"
Name 24 "@main(struct-PS_IN-vf4-vf21[3];struct-GS_OUT-struct-PS_IN-vf4-vf21-struct-STRUCT_WITH_NO_BUILTIN_INTERSTAGE_IO-f1[2]-i111;"
Name 22 "tin"
Name 23 "ts"
Name 26 "o"
Name 42 "tin"
Name 45 "tin_pos"
Name 50 "PS_IN"
MemberName 50(PS_IN) 0 "tc"
Name 53 "tin"
Name 71 "ts"
Name 72 "param"
Name 74 "param"
Decorate 45(tin_pos) BuiltIn Position
Decorate 53(tin) Location 0
Name 17 "STRUCT_WITH_NO_BUILTIN_INTERSTAGE_IO"
MemberName 17(STRUCT_WITH_NO_BUILTIN_INTERSTAGE_IO) 0 "m0_array"
MemberName 17(STRUCT_WITH_NO_BUILTIN_INTERSTAGE_IO) 1 "m1"
Name 18 "GS_OUT"
MemberName 18(GS_OUT) 0 "psIn"
MemberName 18(GS_OUT) 1 "contains_no_builtin_io"
Name 23 "@main(struct-PS_IN-vf4-vf21[3];struct-GS_OUT-struct-PS_IN-vf4-vf21-struct-STRUCT_WITH_NO_BUILTIN_INTERSTAGE_IO-f1[2]-i111;"
Name 21 "tin"
Name 22 "ts"
Name 25 "o"
Name 41 "tin"
Name 44 "tin_pos"
Name 49 "PS_IN"
MemberName 49(PS_IN) 0 "tc"
Name 52 "tin"
Name 70 "ts"
Name 71 "param"
Name 73 "param"
Decorate 44(tin_pos) BuiltIn Position
Decorate 52(tin) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@ -314,82 +311,81 @@ output primitive = triangle_strip
11: 10(int) Constant 3
12: TypeArray 9(PS_IN) 11
13: TypePointer Function 12
14(PS_IN): TypeStruct 7(fvec4) 8(fvec2)
15: 10(int) Constant 2
16: TypeArray 6(float) 15
17: TypeInt 32 1
18(STRUCT_WITH_NO_BUILTIN_INTERSTAGE_IO): TypeStruct 16 17(int)
19(GS_OUT): TypeStruct 14(PS_IN) 18(STRUCT_WITH_NO_BUILTIN_INTERSTAGE_IO)
20: TypePointer Function 19(GS_OUT)
21: TypeFunction 2 13(ptr) 20(ptr)
27: 17(int) Constant 0
28: 6(float) Constant 1065353216
29: 6(float) Constant 1073741824
30: 6(float) Constant 1077936128
31: 6(float) Constant 1082130432
32: 7(fvec4) ConstantComposite 28 29 30 31
33: TypePointer Function 7(fvec4)
35: 17(int) Constant 1
36: 6(float) Constant 1084227584
37: 6(float) Constant 1086324736
38: 8(fvec2) ConstantComposite 36 37
39: TypePointer Function 8(fvec2)
43: TypeArray 7(fvec4) 11
44: TypePointer Input 43
45(tin_pos): 44(ptr) Variable Input
46: TypePointer Input 7(fvec4)
50(PS_IN): TypeStruct 8(fvec2)
51: TypeArray 50(PS_IN) 11
52: TypePointer Input 51
53(tin): 52(ptr) Variable Input
54: TypePointer Input 8(fvec2)
64: 17(int) Constant 2
14: 10(int) Constant 2
15: TypeArray 6(float) 14
16: TypeInt 32 1
17(STRUCT_WITH_NO_BUILTIN_INTERSTAGE_IO): TypeStruct 15 16(int)
18(GS_OUT): TypeStruct 9(PS_IN) 17(STRUCT_WITH_NO_BUILTIN_INTERSTAGE_IO)
19: TypePointer Function 18(GS_OUT)
20: TypeFunction 2 13(ptr) 19(ptr)
26: 16(int) Constant 0
27: 6(float) Constant 1065353216
28: 6(float) Constant 1073741824
29: 6(float) Constant 1077936128
30: 6(float) Constant 1082130432
31: 7(fvec4) ConstantComposite 27 28 29 30
32: TypePointer Function 7(fvec4)
34: 16(int) Constant 1
35: 6(float) Constant 1084227584
36: 6(float) Constant 1086324736
37: 8(fvec2) ConstantComposite 35 36
38: TypePointer Function 8(fvec2)
42: TypeArray 7(fvec4) 11
43: TypePointer Input 42
44(tin_pos): 43(ptr) Variable Input
45: TypePointer Input 7(fvec4)
49(PS_IN): TypeStruct 8(fvec2)
50: TypeArray 49(PS_IN) 11
51: TypePointer Input 50
52(tin): 51(ptr) Variable Input
53: TypePointer Input 8(fvec2)
63: 16(int) Constant 2
4(main): 2 Function None 3
5: Label
42(tin): 13(ptr) Variable Function
71(ts): 20(ptr) Variable Function
72(param): 13(ptr) Variable Function
74(param): 20(ptr) Variable Function
47: 46(ptr) AccessChain 45(tin_pos) 27
48: 7(fvec4) Load 47
49: 33(ptr) AccessChain 42(tin) 27 27
Store 49 48
55: 54(ptr) AccessChain 53(tin) 27 27
56: 8(fvec2) Load 55
57: 39(ptr) AccessChain 42(tin) 27 35
Store 57 56
58: 46(ptr) AccessChain 45(tin_pos) 35
59: 7(fvec4) Load 58
60: 33(ptr) AccessChain 42(tin) 35 27
Store 60 59
61: 54(ptr) AccessChain 53(tin) 35 27
62: 8(fvec2) Load 61
63: 39(ptr) AccessChain 42(tin) 35 35
Store 63 62
65: 46(ptr) AccessChain 45(tin_pos) 64
66: 7(fvec4) Load 65
67: 33(ptr) AccessChain 42(tin) 64 27
Store 67 66
68: 54(ptr) AccessChain 53(tin) 64 27
69: 8(fvec2) Load 68
70: 39(ptr) AccessChain 42(tin) 64 35
Store 70 69
73: 12 Load 42(tin)
Store 72(param) 73
75: 2 FunctionCall 24(@main(struct-PS_IN-vf4-vf21[3];struct-GS_OUT-struct-PS_IN-vf4-vf21-struct-STRUCT_WITH_NO_BUILTIN_INTERSTAGE_IO-f1[2]-i111;) 72(param) 74(param)
41(tin): 13(ptr) Variable Function
70(ts): 19(ptr) Variable Function
71(param): 13(ptr) Variable Function
73(param): 19(ptr) Variable Function
46: 45(ptr) AccessChain 44(tin_pos) 26
47: 7(fvec4) Load 46
48: 32(ptr) AccessChain 41(tin) 26 26
Store 48 47
54: 53(ptr) AccessChain 52(tin) 26 26
55: 8(fvec2) Load 54
56: 38(ptr) AccessChain 41(tin) 26 34
Store 56 55
57: 45(ptr) AccessChain 44(tin_pos) 34
58: 7(fvec4) Load 57
59: 32(ptr) AccessChain 41(tin) 34 26
Store 59 58
60: 53(ptr) AccessChain 52(tin) 34 26
61: 8(fvec2) Load 60
62: 38(ptr) AccessChain 41(tin) 34 34
Store 62 61
64: 45(ptr) AccessChain 44(tin_pos) 63
65: 7(fvec4) Load 64
66: 32(ptr) AccessChain 41(tin) 63 26
Store 66 65
67: 53(ptr) AccessChain 52(tin) 63 26
68: 8(fvec2) Load 67
69: 38(ptr) AccessChain 41(tin) 63 34
Store 69 68
72: 12 Load 41(tin)
Store 71(param) 72
74: 2 FunctionCall 23(@main(struct-PS_IN-vf4-vf21[3];struct-GS_OUT-struct-PS_IN-vf4-vf21-struct-STRUCT_WITH_NO_BUILTIN_INTERSTAGE_IO-f1[2]-i111;) 71(param) 73(param)
Return
FunctionEnd
24(@main(struct-PS_IN-vf4-vf21[3];struct-GS_OUT-struct-PS_IN-vf4-vf21-struct-STRUCT_WITH_NO_BUILTIN_INTERSTAGE_IO-f1[2]-i111;): 2 Function None 21
22(tin): 13(ptr) FunctionParameter
23(ts): 20(ptr) FunctionParameter
25: Label
26(o): 20(ptr) Variable Function
34: 33(ptr) AccessChain 26(o) 27 27
Store 34 32
40: 39(ptr) AccessChain 26(o) 27 35
Store 40 38
41: 19(GS_OUT) Load 26(o)
Store 23(ts) 41
23(@main(struct-PS_IN-vf4-vf21[3];struct-GS_OUT-struct-PS_IN-vf4-vf21-struct-STRUCT_WITH_NO_BUILTIN_INTERSTAGE_IO-f1[2]-i111;): 2 Function None 20
21(tin): 13(ptr) FunctionParameter
22(ts): 19(ptr) FunctionParameter
24: Label
25(o): 19(ptr) Variable Function
33: 32(ptr) AccessChain 25(o) 26 26
Store 33 31
39: 38(ptr) AccessChain 25(o) 26 34
Store 39 37
40: 18(GS_OUT) Load 25(o)
Store 22(ts) 40
EmitVertex
Return
FunctionEnd