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

@ -81,9 +81,9 @@ gl_FragCoord origin is upper left
0:18 Constant:
0:18 4 (const uint)
0:18 5 (const uint)
0:21 Function Definition: ShaderFunction(vf4; (temp 4-component vector of float)
0:21 Function Definition: @ShaderFunction(vf4; (temp 4-component vector of float)
0:21 Function Parameters:
0:21 'input' (layout(location=0 ) in 4-component vector of float)
0:21 'input' (in 4-component vector of float)
0:? Sequence
0:22 Sequence
0:22 move second child to first child (temp 4-component vector of float)
@ -127,16 +127,21 @@ gl_FragCoord origin is upper left
0:33 move second child to first child (temp float)
0:33 'a9' (temp float)
0:33 'a5' (global float)
0:35 Sequence
0:35 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:35 component-wise multiply (temp 4-component vector of float)
0:35 'input' (layout(location=0 ) in 4-component vector of float)
0:35 'a1' (global 4-component vector of float)
0:35 Branch: Return
0:35 Branch: Return with expression
0:35 component-wise multiply (temp 4-component vector of float)
0:35 'input' (in 4-component vector of float)
0:35 'a1' (global 4-component vector of float)
0:21 Function Definition: ShaderFunction( (temp void)
0:21 Function Parameters:
0:? Sequence
0:21 move second child to first child (temp 4-component vector of float)
0:? 'input' (temp 4-component vector of float)
0:? 'input' (layout(location=0 ) in 4-component vector of float)
0:21 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:21 Function Call: @ShaderFunction(vf4; (temp 4-component vector of float)
0:? 'input' (temp 4-component vector of float)
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:? 'input' (layout(location=0 ) in 4-component vector of float)
0:? 'a1' (global 4-component vector of float)
0:? 'b1' (global 4-component vector of float)
0:? 'a1i' (global 4-component vector of float)
@ -155,6 +160,8 @@ gl_FragCoord origin is upper left
0:? 'single2' (global structure{temp 2-component vector of uint v})
0:? 'single3' (global structure{temp structure{temp int f} s1})
0:? 'single4' (global structure{temp structure{temp 2-component vector of uint v} s1})
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:? 'input' (layout(location=0 ) in 4-component vector of float)
0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(row_major std140 ) uniform float a, layout(row_major std140 ) uniform float b, layout(row_major std140 ) uniform float c})
@ -240,9 +247,9 @@ gl_FragCoord origin is upper left
0:18 Constant:
0:18 4 (const uint)
0:18 5 (const uint)
0:21 Function Definition: ShaderFunction(vf4; (temp 4-component vector of float)
0:21 Function Definition: @ShaderFunction(vf4; (temp 4-component vector of float)
0:21 Function Parameters:
0:21 'input' (layout(location=0 ) in 4-component vector of float)
0:21 'input' (in 4-component vector of float)
0:? Sequence
0:22 Sequence
0:22 move second child to first child (temp 4-component vector of float)
@ -286,16 +293,21 @@ gl_FragCoord origin is upper left
0:33 move second child to first child (temp float)
0:33 'a9' (temp float)
0:33 'a5' (global float)
0:35 Sequence
0:35 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:35 component-wise multiply (temp 4-component vector of float)
0:35 'input' (layout(location=0 ) in 4-component vector of float)
0:35 'a1' (global 4-component vector of float)
0:35 Branch: Return
0:35 Branch: Return with expression
0:35 component-wise multiply (temp 4-component vector of float)
0:35 'input' (in 4-component vector of float)
0:35 'a1' (global 4-component vector of float)
0:21 Function Definition: ShaderFunction( (temp void)
0:21 Function Parameters:
0:? Sequence
0:21 move second child to first child (temp 4-component vector of float)
0:? 'input' (temp 4-component vector of float)
0:? 'input' (layout(location=0 ) in 4-component vector of float)
0:21 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:21 Function Call: @ShaderFunction(vf4; (temp 4-component vector of float)
0:? 'input' (temp 4-component vector of float)
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:? 'input' (layout(location=0 ) in 4-component vector of float)
0:? 'a1' (global 4-component vector of float)
0:? 'b1' (global 4-component vector of float)
0:? 'a1i' (global 4-component vector of float)
@ -314,185 +326,204 @@ gl_FragCoord origin is upper left
0:? 'single2' (global structure{temp 2-component vector of uint v})
0:? 'single3' (global structure{temp structure{temp int f} s1})
0:? 'single4' (global structure{temp structure{temp 2-component vector of uint v} s1})
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:? 'input' (layout(location=0 ) in 4-component vector of float)
0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(row_major std140 ) uniform float a, layout(row_major std140 ) uniform float b, layout(row_major std140 ) uniform float c})
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 100
// Id's are bound by 110
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "ShaderFunction" 88 90
EntryPoint Fragment 4 "ShaderFunction" 98 101
ExecutionMode 4 OriginUpperLeft
Name 4 "ShaderFunction"
Name 9 "a1"
Name 14 "b1"
Name 20 "a1i"
Name 21 "b1i"
Name 23 "a2"
Name 25 "b3"
Name 27 "b4"
Name 29 "a5"
Name 30 "c5"
Name 33 "Single1"
MemberName 33(Single1) 0 "f"
Name 35 "single1"
Name 40 "Single2"
MemberName 40(Single2) 0 "v"
Name 42 "single2"
Name 47 "Single3"
MemberName 47(Single3) 0 "s1"
Name 49 "single3"
Name 53 "Single4"
MemberName 53(Single4) 0 "s1"
Name 55 "single4"
Name 62 "a2"
Name 64 "S1"
MemberName 64(S1) 0 "f"
MemberName 64(S1) 1 "i"
Name 65 "S2"
MemberName 65(S2) 0 "j"
MemberName 65(S2) 1 "g"
MemberName 65(S2) 2 "s1"
Name 67 "s2i"
Name 70 "a3"
Name 71 "a4"
Name 76 "s2"
Name 82 "a8"
Name 83 "b2"
Name 85 "a9"
Name 88 "@entryPointOutput"
Name 90 "input"
Name 95 "c4"
Name 96 "b5"
Name 97 "Constants"
MemberName 97(Constants) 0 "a"
MemberName 97(Constants) 1 "b"
MemberName 97(Constants) 2 "c"
Name 99 ""
Decorate 88(@entryPointOutput) Location 0
Decorate 90(input) Location 0
MemberDecorate 97(Constants) 0 Offset 0
MemberDecorate 97(Constants) 1 Offset 4
MemberDecorate 97(Constants) 2 Offset 8
Decorate 97(Constants) Block
Decorate 99 DescriptorSet 0
Name 11 "@ShaderFunction(vf4;"
Name 10 "input"
Name 14 "a1"
Name 19 "b1"
Name 25 "a1i"
Name 26 "b1i"
Name 28 "a2"
Name 30 "b3"
Name 32 "b4"
Name 34 "a5"
Name 35 "c5"
Name 38 "Single1"
MemberName 38(Single1) 0 "f"
Name 40 "single1"
Name 45 "Single2"
MemberName 45(Single2) 0 "v"
Name 47 "single2"
Name 52 "Single3"
MemberName 52(Single3) 0 "s1"
Name 54 "single3"
Name 58 "Single4"
MemberName 58(Single4) 0 "s1"
Name 60 "single4"
Name 66 "a2"
Name 68 "S1"
MemberName 68(S1) 0 "f"
MemberName 68(S1) 1 "i"
Name 69 "S2"
MemberName 69(S2) 0 "j"
MemberName 69(S2) 1 "g"
MemberName 69(S2) 2 "s1"
Name 71 "s2i"
Name 74 "a3"
Name 75 "a4"
Name 80 "s2"
Name 86 "a8"
Name 87 "b2"
Name 89 "a9"
Name 96 "input"
Name 98 "input"
Name 101 "@entryPointOutput"
Name 102 "param"
Name 105 "c4"
Name 106 "b5"
Name 107 "Constants"
MemberName 107(Constants) 0 "a"
MemberName 107(Constants) 1 "b"
MemberName 107(Constants) 2 "c"
Name 109 ""
Decorate 98(input) Location 0
Decorate 101(@entryPointOutput) Location 0
MemberDecorate 107(Constants) 0 Offset 0
MemberDecorate 107(Constants) 1 Offset 4
MemberDecorate 107(Constants) 2 Offset 8
Decorate 107(Constants) Block
Decorate 109 DescriptorSet 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypePointer Private 7(fvec4)
9(a1): 8(ptr) Variable Private
10: 6(float) Constant 1065353216
11: 6(float) Constant 1056964608
12: 6(float) Constant 0
13: 7(fvec4) ConstantComposite 10 11 12 10
14(b1): 8(ptr) Variable Private
15: 6(float) Constant 1073741824
16: 6(float) Constant 1075838976
17: 6(float) Constant 1074161254
18: 6(float) Constant 1074580685
19: 7(fvec4) ConstantComposite 15 16 17 18
20(a1i): 8(ptr) Variable Private
21(b1i): 8(ptr) Variable Private
22: TypePointer Private 6(float)
23(a2): 22(ptr) Variable Private
24: 6(float) Constant 1045220557
25(b3): 22(ptr) Variable Private
26: 6(float) Constant 1050253722
27(b4): 22(ptr) Variable Private
28: 6(float) Constant 1053609165
29(a5): 22(ptr) Variable Private
30(c5): 22(ptr) Variable Private
31: 6(float) Constant 1069547520
32: TypeInt 32 1
33(Single1): TypeStruct 32(int)
34: TypePointer Private 33(Single1)
35(single1): 34(ptr) Variable Private
36: 32(int) Constant 10
37: 33(Single1) ConstantComposite 36
38: TypeInt 32 0
39: TypeVector 38(int) 2
40(Single2): TypeStruct 39(ivec2)
41: TypePointer Private 40(Single2)
42(single2): 41(ptr) Variable Private
43: 38(int) Constant 1
44: 38(int) Constant 2
45: 39(ivec2) ConstantComposite 43 44
46: 40(Single2) ConstantComposite 45
47(Single3): TypeStruct 33(Single1)
48: TypePointer Private 47(Single3)
49(single3): 48(ptr) Variable Private
50: 32(int) Constant 3
51: 33(Single1) ConstantComposite 50
52: 47(Single3) ConstantComposite 51
53(Single4): TypeStruct 40(Single2)
54: TypePointer Private 53(Single4)
55(single4): 54(ptr) Variable Private
56: 38(int) Constant 4
57: 38(int) Constant 5
58: 39(ivec2) ConstantComposite 56 57
59: 40(Single2) ConstantComposite 58
60: 53(Single4) ConstantComposite 59
61: TypePointer Function 7(fvec4)
63: 7(fvec4) ConstantComposite 24 26 28 11
64(S1): TypeStruct 6(float) 32(int)
65(S2): TypeStruct 32(int) 6(float) 64(S1)
66: TypePointer Function 65(S2)
68: 32(int) Constant 9
70(a3): 22(ptr) Variable Private
71(a4): 22(ptr) Variable Private
73: 32(int) Constant 12
81: TypePointer Function 6(float)
83(b2): 22(ptr) Variable Private
87: TypePointer Output 7(fvec4)
88(@entryPointOutput): 87(ptr) Variable Output
89: TypePointer Input 7(fvec4)
90(input): 89(ptr) Variable Input
95(c4): 22(ptr) Variable Private
96(b5): 22(ptr) Variable Private
97(Constants): TypeStruct 6(float) 6(float) 6(float)
98: TypePointer Uniform 97(Constants)
99: 98(ptr) Variable Uniform
8: TypePointer Function 7(fvec4)
9: TypeFunction 7(fvec4) 8(ptr)
13: TypePointer Private 7(fvec4)
14(a1): 13(ptr) Variable Private
15: 6(float) Constant 1065353216
16: 6(float) Constant 1056964608
17: 6(float) Constant 0
18: 7(fvec4) ConstantComposite 15 16 17 15
19(b1): 13(ptr) Variable Private
20: 6(float) Constant 1073741824
21: 6(float) Constant 1075838976
22: 6(float) Constant 1074161254
23: 6(float) Constant 1074580685
24: 7(fvec4) ConstantComposite 20 21 22 23
25(a1i): 13(ptr) Variable Private
26(b1i): 13(ptr) Variable Private
27: TypePointer Private 6(float)
28(a2): 27(ptr) Variable Private
29: 6(float) Constant 1045220557
30(b3): 27(ptr) Variable Private
31: 6(float) Constant 1050253722
32(b4): 27(ptr) Variable Private
33: 6(float) Constant 1053609165
34(a5): 27(ptr) Variable Private
35(c5): 27(ptr) Variable Private
36: 6(float) Constant 1069547520
37: TypeInt 32 1
38(Single1): TypeStruct 37(int)
39: TypePointer Private 38(Single1)
40(single1): 39(ptr) Variable Private
41: 37(int) Constant 10
42: 38(Single1) ConstantComposite 41
43: TypeInt 32 0
44: TypeVector 43(int) 2
45(Single2): TypeStruct 44(ivec2)
46: TypePointer Private 45(Single2)
47(single2): 46(ptr) Variable Private
48: 43(int) Constant 1
49: 43(int) Constant 2
50: 44(ivec2) ConstantComposite 48 49
51: 45(Single2) ConstantComposite 50
52(Single3): TypeStruct 38(Single1)
53: TypePointer Private 52(Single3)
54(single3): 53(ptr) Variable Private
55: 37(int) Constant 3
56: 38(Single1) ConstantComposite 55
57: 52(Single3) ConstantComposite 56
58(Single4): TypeStruct 45(Single2)
59: TypePointer Private 58(Single4)
60(single4): 59(ptr) Variable Private
61: 43(int) Constant 4
62: 43(int) Constant 5
63: 44(ivec2) ConstantComposite 61 62
64: 45(Single2) ConstantComposite 63
65: 58(Single4) ConstantComposite 64
67: 7(fvec4) ConstantComposite 29 31 33 16
68(S1): TypeStruct 6(float) 37(int)
69(S2): TypeStruct 37(int) 6(float) 68(S1)
70: TypePointer Function 69(S2)
72: 37(int) Constant 9
74(a3): 27(ptr) Variable Private
75(a4): 27(ptr) Variable Private
77: 37(int) Constant 12
85: TypePointer Function 6(float)
87(b2): 27(ptr) Variable Private
97: TypePointer Input 7(fvec4)
98(input): 97(ptr) Variable Input
100: TypePointer Output 7(fvec4)
101(@entryPointOutput): 100(ptr) Variable Output
105(c4): 27(ptr) Variable Private
106(b5): 27(ptr) Variable Private
107(Constants): TypeStruct 6(float) 6(float) 6(float)
108: TypePointer Uniform 107(Constants)
109: 108(ptr) Variable Uniform
4(ShaderFunction): 2 Function None 3
5: Label
62(a2): 61(ptr) Variable Function
67(s2i): 66(ptr) Variable Function
76(s2): 66(ptr) Variable Function
82(a8): 81(ptr) Variable Function
85(a9): 81(ptr) Variable Function
Store 9(a1) 13
Store 14(b1) 19
Store 20(a1i) 13
Store 21(b1i) 19
Store 23(a2) 24
Store 25(b3) 26
Store 27(b4) 28
Store 29(a5) 11
Store 30(c5) 31
Store 35(single1) 37
Store 42(single2) 46
Store 49(single3) 52
Store 55(single4) 60
Store 62(a2) 63
69: 6(float) Load 29(a5)
72: 6(float) Load 71(a4)
74: 64(S1) CompositeConstruct 72 73
75: 65(S2) CompositeConstruct 68 69 74
Store 67(s2i) 75
77: 6(float) Load 29(a5)
78: 6(float) Load 71(a4)
79: 64(S1) CompositeConstruct 78 73
80: 65(S2) CompositeConstruct 68 77 79
Store 76(s2) 80
84: 6(float) Load 83(b2)
Store 82(a8) 84
86: 6(float) Load 29(a5)
Store 85(a9) 86
91: 7(fvec4) Load 90(input)
92: 7(fvec4) Load 9(a1)
93: 7(fvec4) FMul 91 92
Store 88(@entryPointOutput) 93
96(input): 8(ptr) Variable Function
102(param): 8(ptr) Variable Function
Store 14(a1) 18
Store 19(b1) 24
Store 25(a1i) 18
Store 26(b1i) 24
Store 28(a2) 29
Store 30(b3) 31
Store 32(b4) 33
Store 34(a5) 16
Store 35(c5) 36
Store 40(single1) 42
Store 47(single2) 51
Store 54(single3) 57
Store 60(single4) 65
99: 7(fvec4) Load 98(input)
Store 96(input) 99
103: 7(fvec4) Load 96(input)
Store 102(param) 103
104: 7(fvec4) FunctionCall 11(@ShaderFunction(vf4;) 102(param)
Store 101(@entryPointOutput) 104
Return
FunctionEnd
11(@ShaderFunction(vf4;): 7(fvec4) Function None 9
10(input): 8(ptr) FunctionParameter
12: Label
66(a2): 8(ptr) Variable Function
71(s2i): 70(ptr) Variable Function
80(s2): 70(ptr) Variable Function
86(a8): 85(ptr) Variable Function
89(a9): 85(ptr) Variable Function
Store 66(a2) 67
73: 6(float) Load 34(a5)
76: 6(float) Load 75(a4)
78: 68(S1) CompositeConstruct 76 77
79: 69(S2) CompositeConstruct 72 73 78
Store 71(s2i) 79
81: 6(float) Load 34(a5)
82: 6(float) Load 75(a4)
83: 68(S1) CompositeConstruct 82 77
84: 69(S2) CompositeConstruct 72 81 83
Store 80(s2) 84
88: 6(float) Load 87(b2)
Store 86(a8) 88
90: 6(float) Load 34(a5)
Store 89(a9) 90
91: 7(fvec4) Load 10(input)
92: 7(fvec4) Load 14(a1)
93: 7(fvec4) FMul 91 92
ReturnValue 93
FunctionEnd