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

@@ -45,7 +45,7 @@ gl_FragCoord origin is upper left
0:21 'r13' (temp 4X1 matrix of float)
0:21 transpose (temp 4X1 matrix of float)
0:21 'f1x4' (temp 1X4 matrix of float)
0:27 Function Definition: main( (temp structure{temp 4-component vector of float color})
0:27 Function Definition: @main( (temp structure{temp 4-component vector of float color})
0:27 Function Parameters:
0:? Sequence
0:29 move second child to first child (temp 4-component vector of float)
@@ -58,15 +58,18 @@ gl_FragCoord origin is upper left
0:29 1.000000
0:29 1.000000
0:29 1.000000
0:30 Sequence
0:30 Sequence
0:30 move second child to first child (temp 4-component vector of float)
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:30 color: direct index for structure (temp 4-component vector of float)
0:30 'ps_output' (temp structure{temp 4-component vector of float color})
0:30 Constant:
0:30 0 (const int)
0:30 Branch: Return
0:30 Branch: Return with expression
0:30 'ps_output' (temp structure{temp 4-component vector of float color})
0:27 Function Definition: main( (temp void)
0:27 Function Parameters:
0:? Sequence
0:27 Sequence
0:27 move second child to first child (temp 4-component vector of float)
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:27 color: direct index for structure (temp 4-component vector of float)
0:27 Function Call: @main( (temp structure{temp 4-component vector of float color})
0:27 Constant:
0:27 0 (const int)
0:? Linker Objects
0:? 'color' (layout(location=0 ) out 4-component vector of float)
@@ -120,7 +123,7 @@ gl_FragCoord origin is upper left
0:21 'r13' (temp 4X1 matrix of float)
0:21 transpose (temp 4X1 matrix of float)
0:21 'f1x4' (temp 1X4 matrix of float)
0:27 Function Definition: main( (temp structure{temp 4-component vector of float color})
0:27 Function Definition: @main( (temp structure{temp 4-component vector of float color})
0:27 Function Parameters:
0:? Sequence
0:29 move second child to first child (temp 4-component vector of float)
@@ -133,129 +136,139 @@ gl_FragCoord origin is upper left
0:29 1.000000
0:29 1.000000
0:29 1.000000
0:30 Sequence
0:30 Sequence
0:30 move second child to first child (temp 4-component vector of float)
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:30 color: direct index for structure (temp 4-component vector of float)
0:30 'ps_output' (temp structure{temp 4-component vector of float color})
0:30 Constant:
0:30 0 (const int)
0:30 Branch: Return
0:30 Branch: Return with expression
0:30 'ps_output' (temp structure{temp 4-component vector of float color})
0:27 Function Definition: main( (temp void)
0:27 Function Parameters:
0:? Sequence
0:27 Sequence
0:27 move second child to first child (temp 4-component vector of float)
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:27 color: direct index for structure (temp 4-component vector of float)
0:27 Function Call: @main( (temp structure{temp 4-component vector of float color})
0:27 Constant:
0:27 0 (const int)
0:? Linker Objects
0:? 'color' (layout(location=0 ) out 4-component vector of float)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 72
// Id's are bound by 77
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 68
EntryPoint Fragment 4 "main" 74
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 6 "TestMatNx1("
Name 12 "r00"
Name 13 "f1x1"
Name 19 "r01"
Name 22 "f2x1"
Name 28 "r02"
Name 31 "f3x1"
Name 37 "r03"
Name 40 "f4x1"
Name 43 "r10"
Name 46 "r11"
Name 47 "f1x2"
Name 50 "r12"
Name 51 "f1x3"
Name 54 "r13"
Name 55 "f1x4"
Name 58 "PS_OUTPUT"
MemberName 58(PS_OUTPUT) 0 "color"
Name 60 "ps_output"
Name 68 "color"
Decorate 68(color) Location 0
Name 10 "PS_OUTPUT"
MemberName 10(PS_OUTPUT) 0 "color"
Name 12 "@main("
Name 17 "r00"
Name 18 "f1x1"
Name 24 "r01"
Name 27 "f2x1"
Name 33 "r02"
Name 36 "f3x1"
Name 41 "r03"
Name 44 "f4x1"
Name 47 "r10"
Name 50 "r11"
Name 51 "f1x2"
Name 54 "r12"
Name 55 "f1x3"
Name 58 "r13"
Name 59 "f1x4"
Name 63 "ps_output"
Name 74 "color"
Decorate 74(color) Location 0
2: TypeVoid
3: TypeFunction 2
8: TypeFloat 32
9: TypeVector 8(float) 1
10: TypeMatrix 9(fvec) 1
11: TypePointer Function 10
16: TypeVector 8(float) 2
17: TypeMatrix 16(fvec2) 1
18: TypePointer Function 17
20: TypeMatrix 9(fvec) 2
21: TypePointer Function 20
25: TypeVector 8(float) 3
26: TypeMatrix 25(fvec3) 1
27: TypePointer Function 26
29: TypeMatrix 9(fvec) 3
30: TypePointer Function 29
34: TypeVector 8(float) 4
35: TypeMatrix 34(fvec4) 1
36: TypePointer Function 35
38: TypeMatrix 9(fvec) 4
39: TypePointer Function 38
58(PS_OUTPUT): TypeStruct 34(fvec4)
59: TypePointer Function 58(PS_OUTPUT)
61: TypeInt 32 1
62: 61(int) Constant 0
63: 8(float) Constant 1065353216
64: 34(fvec4) ConstantComposite 63 63 63 63
65: TypePointer Function 34(fvec4)
67: TypePointer Output 34(fvec4)
68(color): 67(ptr) Variable Output
9: TypeVector 8(float) 4
10(PS_OUTPUT): TypeStruct 9(fvec4)
11: TypeFunction 10(PS_OUTPUT)
14: TypeVector 8(float) 1
15: TypeMatrix 14(fvec) 1
16: TypePointer Function 15
21: TypeVector 8(float) 2
22: TypeMatrix 21(fvec2) 1
23: TypePointer Function 22
25: TypeMatrix 14(fvec) 2
26: TypePointer Function 25
30: TypeVector 8(float) 3
31: TypeMatrix 30(fvec3) 1
32: TypePointer Function 31
34: TypeMatrix 14(fvec) 3
35: TypePointer Function 34
39: TypeMatrix 9(fvec4) 1
40: TypePointer Function 39
42: TypeMatrix 14(fvec) 4
43: TypePointer Function 42
62: TypePointer Function 10(PS_OUTPUT)
64: TypeInt 32 1
65: 64(int) Constant 0
66: 8(float) Constant 1065353216
67: 9(fvec4) ConstantComposite 66 66 66 66
68: TypePointer Function 9(fvec4)
73: TypePointer Output 9(fvec4)
74(color): 73(ptr) Variable Output
4(main): 2 Function None 3
5: Label
60(ps_output): 59(ptr) Variable Function
66: 65(ptr) AccessChain 60(ps_output) 62
Store 66 64
69: 65(ptr) AccessChain 60(ps_output) 62
70: 34(fvec4) Load 69
Store 68(color) 70
75:10(PS_OUTPUT) FunctionCall 12(@main()
76: 9(fvec4) CompositeExtract 75 0
Store 74(color) 76
Return
FunctionEnd
6(TestMatNx1(): 2 Function None 3
7: Label
12(r00): 11(ptr) Variable Function
13(f1x1): 11(ptr) Variable Function
19(r01): 18(ptr) Variable Function
22(f2x1): 21(ptr) Variable Function
28(r02): 27(ptr) Variable Function
31(f3x1): 30(ptr) Variable Function
37(r03): 36(ptr) Variable Function
40(f4x1): 39(ptr) Variable Function
43(r10): 11(ptr) Variable Function
46(r11): 21(ptr) Variable Function
47(f1x2): 18(ptr) Variable Function
50(r12): 30(ptr) Variable Function
51(f1x3): 27(ptr) Variable Function
54(r13): 39(ptr) Variable Function
55(f1x4): 36(ptr) Variable Function
14: 10 Load 13(f1x1)
15: 10 Transpose 14
Store 12(r00) 15
23: 20 Load 22(f2x1)
24: 17 Transpose 23
Store 19(r01) 24
32: 29 Load 31(f3x1)
33: 26 Transpose 32
Store 28(r02) 33
41: 38 Load 40(f4x1)
42: 35 Transpose 41
Store 37(r03) 42
44: 10 Load 13(f1x1)
45: 10 Transpose 44
Store 43(r10) 45
48: 17 Load 47(f1x2)
49: 20 Transpose 48
Store 46(r11) 49
52: 26 Load 51(f1x3)
53: 29 Transpose 52
Store 50(r12) 53
56: 35 Load 55(f1x4)
57: 38 Transpose 56
Store 54(r13) 57
17(r00): 16(ptr) Variable Function
18(f1x1): 16(ptr) Variable Function
24(r01): 23(ptr) Variable Function
27(f2x1): 26(ptr) Variable Function
33(r02): 32(ptr) Variable Function
36(f3x1): 35(ptr) Variable Function
41(r03): 40(ptr) Variable Function
44(f4x1): 43(ptr) Variable Function
47(r10): 16(ptr) Variable Function
50(r11): 26(ptr) Variable Function
51(f1x2): 23(ptr) Variable Function
54(r12): 35(ptr) Variable Function
55(f1x3): 32(ptr) Variable Function
58(r13): 43(ptr) Variable Function
59(f1x4): 40(ptr) Variable Function
19: 15 Load 18(f1x1)
20: 15 Transpose 19
Store 17(r00) 20
28: 25 Load 27(f2x1)
29: 22 Transpose 28
Store 24(r01) 29
37: 34 Load 36(f3x1)
38: 31 Transpose 37
Store 33(r02) 38
45: 42 Load 44(f4x1)
46: 39 Transpose 45
Store 41(r03) 46
48: 15 Load 18(f1x1)
49: 15 Transpose 48
Store 47(r10) 49
52: 22 Load 51(f1x2)
53: 25 Transpose 52
Store 50(r11) 53
56: 31 Load 55(f1x3)
57: 34 Transpose 56
Store 54(r12) 57
60: 39 Load 59(f1x4)
61: 42 Transpose 60
Store 58(r13) 61
Return
FunctionEnd
12(@main():10(PS_OUTPUT) Function None 11
13: Label
63(ps_output): 62(ptr) Variable Function
69: 68(ptr) AccessChain 63(ps_output) 65
Store 69 67
70:10(PS_OUTPUT) Load 63(ps_output)
ReturnValue 70
FunctionEnd