HLSL: Wrap the entry-point; need to write 'in' args, and support 'inout' args.

This needs some render testing, but is destined to be part of master.

This also leads to a variety of other simplifications.
 - IO are global symbols, so only need one list of linkage nodes (deferred)
 - no longer need parse-context-wide 'inEntryPoint' state, entry-point is localized
 - several parts of splitting/flattening are now localized
This commit is contained in:
John Kessenich
2017-01-19 15:41:47 -07:00
parent 18adbdbbb8
commit 02467d8d94
171 changed files with 37604 additions and 32679 deletions

View File

@@ -8,7 +8,7 @@ gl_FragCoord origin is upper left
0:? Sequence
0:6 Branch: Return with expression
0:6 'float' (in float)
0:9 Function Definition: main( (temp 4-component vector of float)
0:9 Function Definition: @main( (temp 4-component vector of float)
0:9 Function Parameters:
0:? Sequence
0:10 Sequence
@@ -99,12 +99,15 @@ gl_FragCoord origin is upper left
0:25 'float' (temp mediump float)
0:25 Function Call: fn(f1; (temp mediump float)
0:25 'float' (temp mediump float)
0:27 Sequence
0:27 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:27 Construct vec4 (temp 4-component vector of float)
0:27 'float' (temp float)
0:27 Branch: Return
0:27 Branch: Return with expression
0:27 Construct vec4 (temp 4-component vector of float)
0:27 'float' (temp float)
0:9 Function Definition: main( (temp void)
0:9 Function Parameters:
0:? Sequence
0:9 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:9 Function Call: @main( (temp 4-component vector of float)
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
@@ -121,7 +124,7 @@ gl_FragCoord origin is upper left
0:? Sequence
0:6 Branch: Return with expression
0:6 'float' (in float)
0:9 Function Definition: main( (temp 4-component vector of float)
0:9 Function Definition: @main( (temp 4-component vector of float)
0:9 Function Parameters:
0:? Sequence
0:10 Sequence
@@ -212,49 +215,49 @@ gl_FragCoord origin is upper left
0:25 'float' (temp mediump float)
0:25 Function Call: fn(f1; (temp mediump float)
0:25 'float' (temp mediump float)
0:27 Sequence
0:27 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:27 Construct vec4 (temp 4-component vector of float)
0:27 'float' (temp float)
0:27 Branch: Return
0:27 Branch: Return with expression
0:27 Construct vec4 (temp 4-component vector of float)
0:27 'float' (temp float)
0:9 Function Definition: main( (temp void)
0:9 Function Parameters:
0:? Sequence
0:9 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:9 Function Call: @main( (temp 4-component vector of float)
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 92
// Id's are bound by 97
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 88
EntryPoint Fragment 4 "main" 95
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 10 "fn(f1;"
Name 9 "float"
Name 15 "float"
Name 22 "bool"
Name 31 "int"
Name 39 "uint"
Name 45 "min16float"
Name 48 "min10float"
Name 50 "half"
Name 52 "foo_t"
MemberName 52(foo_t) 0 "float"
Name 54 "float"
Name 82 "param"
Name 88 "@entryPointOutput"
Decorate 45(min16float) RelaxedPrecision
Decorate 46 RelaxedPrecision
Decorate 47 RelaxedPrecision
Decorate 48(min10float) RelaxedPrecision
Decorate 49 RelaxedPrecision
Decorate 50(half) RelaxedPrecision
Decorate 60 RelaxedPrecision
Decorate 61 RelaxedPrecision
Decorate 62 RelaxedPrecision
Decorate 63 RelaxedPrecision
Name 14 "@main("
Name 19 "float"
Name 26 "bool"
Name 35 "int"
Name 43 "uint"
Name 49 "min16float"
Name 52 "min10float"
Name 54 "half"
Name 56 "foo_t"
MemberName 56(foo_t) 0 "float"
Name 58 "float"
Name 86 "param"
Name 95 "@entryPointOutput"
Decorate 49(min16float) RelaxedPrecision
Decorate 50 RelaxedPrecision
Decorate 51 RelaxedPrecision
Decorate 52(min10float) RelaxedPrecision
Decorate 53 RelaxedPrecision
Decorate 54(half) RelaxedPrecision
Decorate 64 RelaxedPrecision
Decorate 65 RelaxedPrecision
Decorate 66 RelaxedPrecision
@@ -262,121 +265,131 @@ gl_FragCoord origin is upper left
Decorate 68 RelaxedPrecision
Decorate 69 RelaxedPrecision
Decorate 70 RelaxedPrecision
Decorate 76 RelaxedPrecision
Decorate 77 RelaxedPrecision
Decorate 79 RelaxedPrecision
Decorate 71 RelaxedPrecision
Decorate 72 RelaxedPrecision
Decorate 73 RelaxedPrecision
Decorate 74 RelaxedPrecision
Decorate 80 RelaxedPrecision
Decorate 81 RelaxedPrecision
Decorate 83 RelaxedPrecision
Decorate 84 RelaxedPrecision
Decorate 85 RelaxedPrecision
Decorate 88(@entryPointOutput) Location 0
Decorate 87 RelaxedPrecision
Decorate 88 RelaxedPrecision
Decorate 89 RelaxedPrecision
Decorate 95(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypePointer Function 6(float)
8: TypeFunction 6(float) 7(ptr)
16: 6(float) Constant 1088421888
17: TypeBool
18: TypeInt 32 0
19: 18(int) Constant 2
20: TypeArray 17(bool) 19
21: TypePointer Function 20
24: 6(float) Constant 0
29: TypeInt 32 1
30: TypePointer Function 29(int)
32: 29(int) Constant 1
33: TypePointer Function 17(bool)
36: 29(int) Constant 0
38: TypePointer Function 18(int)
51: 6(float) Constant 1056964608
52(foo_t): TypeStruct 6(float)
53: TypePointer Function 52(foo_t)
55: 6(float) Constant 1109917696
86: TypeVector 6(float) 4
87: TypePointer Output 86(fvec4)
88(@entryPointOutput): 87(ptr) Variable Output
12: TypeVector 6(float) 4
13: TypeFunction 12(fvec4)
20: 6(float) Constant 1088421888
21: TypeBool
22: TypeInt 32 0
23: 22(int) Constant 2
24: TypeArray 21(bool) 23
25: TypePointer Function 24
28: 6(float) Constant 0
33: TypeInt 32 1
34: TypePointer Function 33(int)
36: 33(int) Constant 1
37: TypePointer Function 21(bool)
40: 33(int) Constant 0
42: TypePointer Function 22(int)
55: 6(float) Constant 1056964608
56(foo_t): TypeStruct 6(float)
57: TypePointer Function 56(foo_t)
59: 6(float) Constant 1109917696
94: TypePointer Output 12(fvec4)
95(@entryPointOutput): 94(ptr) Variable Output
4(main): 2 Function None 3
5: Label
15(float): 7(ptr) Variable Function
22(bool): 21(ptr) Variable Function
31(int): 30(ptr) Variable Function
39(uint): 38(ptr) Variable Function
45(min16float): 7(ptr) Variable Function
48(min10float): 7(ptr) Variable Function
50(half): 7(ptr) Variable Function
54(float): 53(ptr) Variable Function
71: 7(ptr) Variable Function
82(param): 7(ptr) Variable Function
Store 15(float) 16
23: 6(float) Load 15(float)
25: 17(bool) FOrdNotEqual 23 24
26: 6(float) Load 15(float)
27: 17(bool) FOrdNotEqual 26 24
28: 20 CompositeConstruct 25 27
Store 22(bool) 28
34: 33(ptr) AccessChain 22(bool) 32
35: 17(bool) Load 34
37: 29(int) Select 35 32 36
Store 31(int) 37
40: 6(float) Load 15(float)
41: 29(int) Load 31(int)
42: 6(float) ConvertSToF 41
43: 6(float) FAdd 40 42
44: 18(int) ConvertFToU 43
Store 39(uint) 44
46: 18(int) Load 39(uint)
47: 6(float) ConvertUToF 46
Store 45(min16float) 47
49: 6(float) Load 45(min16float)
Store 48(min10float) 49
Store 50(half) 51
56: 7(ptr) AccessChain 54(float) 36
Store 56 55
57: 33(ptr) AccessChain 22(bool) 32
58: 17(bool) Load 57
59: 33(ptr) AccessChain 22(bool) 36
Store 59 58
60: 6(float) Load 15(float)
61: 29(int) Load 31(int)
62: 6(float) ConvertSToF 61
63: 6(float) FAdd 60 62
64: 18(int) Load 39(uint)
65: 6(float) ConvertUToF 64
66: 6(float) FAdd 63 65
67: 6(float) Load 45(min16float)
68: 6(float) FAdd 66 67
69: 6(float) Load 48(min10float)
70: 6(float) FAdd 68 69
72: 33(ptr) AccessChain 22(bool) 36
73: 17(bool) Load 72
SelectionMerge 75 None
BranchConditional 73 74 78
74: Label
76: 29(int) Load 31(int)
77: 6(float) ConvertSToF 76
Store 71 77
Branch 75
78: Label
79: 6(float) Load 15(float)
Store 71 79
Branch 75
75: Label
80: 6(float) Load 71
81: 6(float) FAdd 70 80
83: 6(float) Load 15(float)
Store 82(param) 83
84: 6(float) FunctionCall 10(fn(f1;) 82(param)
85: 6(float) FAdd 81 84
Store 15(float) 85
89: 6(float) Load 15(float)
90: 86(fvec4) CompositeConstruct 89 89 89 89
Store 88(@entryPointOutput) 90
96: 12(fvec4) FunctionCall 14(@main()
Store 95(@entryPointOutput) 96
Return
FunctionEnd
10(fn(f1;): 6(float) Function None 8
9(float): 7(ptr) FunctionParameter
11: Label
12: 6(float) Load 9(float)
ReturnValue 12
16: 6(float) Load 9(float)
ReturnValue 16
FunctionEnd
14(@main(): 12(fvec4) Function None 13
15: Label
19(float): 7(ptr) Variable Function
26(bool): 25(ptr) Variable Function
35(int): 34(ptr) Variable Function
43(uint): 42(ptr) Variable Function
49(min16float): 7(ptr) Variable Function
52(min10float): 7(ptr) Variable Function
54(half): 7(ptr) Variable Function
58(float): 57(ptr) Variable Function
75: 7(ptr) Variable Function
86(param): 7(ptr) Variable Function
Store 19(float) 20
27: 6(float) Load 19(float)
29: 21(bool) FOrdNotEqual 27 28
30: 6(float) Load 19(float)
31: 21(bool) FOrdNotEqual 30 28
32: 24 CompositeConstruct 29 31
Store 26(bool) 32
38: 37(ptr) AccessChain 26(bool) 36
39: 21(bool) Load 38
41: 33(int) Select 39 36 40
Store 35(int) 41
44: 6(float) Load 19(float)
45: 33(int) Load 35(int)
46: 6(float) ConvertSToF 45
47: 6(float) FAdd 44 46
48: 22(int) ConvertFToU 47
Store 43(uint) 48
50: 22(int) Load 43(uint)
51: 6(float) ConvertUToF 50
Store 49(min16float) 51
53: 6(float) Load 49(min16float)
Store 52(min10float) 53
Store 54(half) 55
60: 7(ptr) AccessChain 58(float) 40
Store 60 59
61: 37(ptr) AccessChain 26(bool) 36
62: 21(bool) Load 61
63: 37(ptr) AccessChain 26(bool) 40
Store 63 62
64: 6(float) Load 19(float)
65: 33(int) Load 35(int)
66: 6(float) ConvertSToF 65
67: 6(float) FAdd 64 66
68: 22(int) Load 43(uint)
69: 6(float) ConvertUToF 68
70: 6(float) FAdd 67 69
71: 6(float) Load 49(min16float)
72: 6(float) FAdd 70 71
73: 6(float) Load 52(min10float)
74: 6(float) FAdd 72 73
76: 37(ptr) AccessChain 26(bool) 40
77: 21(bool) Load 76
SelectionMerge 79 None
BranchConditional 77 78 82
78: Label
80: 33(int) Load 35(int)
81: 6(float) ConvertSToF 80
Store 75 81
Branch 79
82: Label
83: 6(float) Load 19(float)
Store 75 83
Branch 79
79: Label
84: 6(float) Load 75
85: 6(float) FAdd 74 84
87: 6(float) Load 19(float)
Store 86(param) 87
88: 6(float) FunctionCall 10(fn(f1;) 86(param)
89: 6(float) FAdd 85 88
Store 19(float) 89
90: 6(float) Load 19(float)
91: 12(fvec4) CompositeConstruct 90 90 90 90
ReturnValue 91
FunctionEnd