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

@ -2,7 +2,7 @@ hlsl.matrixindex.frag
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:10 Function Definition: main( (temp structure{temp 4-component vector of float Color})
0:10 Function Definition: @main( (temp structure{temp 4-component vector of float Color})
0:10 Function Parameters:
0:? Sequence
0:22 Sequence
@ -117,15 +117,18 @@ gl_FragCoord origin is upper left
0:47 0 (const int)
0:47 Construct vec4 (temp 4-component vector of float)
0:47 'e2_11' (temp float)
0:48 Sequence
0:48 Sequence
0:48 move second child to first child (temp 4-component vector of float)
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
0:48 Color: direct index for structure (temp 4-component vector of float)
0:48 'psout' (temp structure{temp 4-component vector of float Color})
0:48 Constant:
0:48 0 (const int)
0:48 Branch: Return
0:48 Branch: Return with expression
0:48 'psout' (temp structure{temp 4-component vector of float Color})
0:10 Function Definition: main( (temp void)
0:10 Function Parameters:
0:? Sequence
0:10 Sequence
0:10 move second child to first child (temp 4-component vector of float)
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
0:10 Color: direct index for structure (temp 4-component vector of float)
0:10 Function Call: @main( (temp structure{temp 4-component vector of float Color})
0:10 Constant:
0:10 0 (const int)
0:? Linker Objects
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int idx, layout(offset=16 ) uniform 3X2 matrix of float um})
@ -137,7 +140,7 @@ Linked fragment stage:
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:10 Function Definition: main( (temp structure{temp 4-component vector of float Color})
0:10 Function Definition: @main( (temp structure{temp 4-component vector of float Color})
0:10 Function Parameters:
0:? Sequence
0:22 Sequence
@ -252,156 +255,166 @@ gl_FragCoord origin is upper left
0:47 0 (const int)
0:47 Construct vec4 (temp 4-component vector of float)
0:47 'e2_11' (temp float)
0:48 Sequence
0:48 Sequence
0:48 move second child to first child (temp 4-component vector of float)
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
0:48 Color: direct index for structure (temp 4-component vector of float)
0:48 'psout' (temp structure{temp 4-component vector of float Color})
0:48 Constant:
0:48 0 (const int)
0:48 Branch: Return
0:48 Branch: Return with expression
0:48 'psout' (temp structure{temp 4-component vector of float Color})
0:10 Function Definition: main( (temp void)
0:10 Function Parameters:
0:? Sequence
0:10 Sequence
0:10 move second child to first child (temp 4-component vector of float)
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
0:10 Color: direct index for structure (temp 4-component vector of float)
0:10 Function Call: @main( (temp structure{temp 4-component vector of float Color})
0:10 Constant:
0:10 0 (const int)
0:? Linker Objects
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int idx, layout(offset=16 ) uniform 3X2 matrix of float um})
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 78
// Id's are bound by 83
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 74
EntryPoint Fragment 4 "main" 80
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 8 "e1_00"
Name 10 "e1_01"
Name 12 "e1_10"
Name 14 "e1_11"
Name 16 "e1_20"
Name 18 "e1_21"
Name 20 "e2_00"
Name 22 "e2_01"
Name 24 "e2_10"
Name 26 "e2_11"
Name 28 "e2_20"
Name 30 "e2_21"
Name 34 "r0a"
Name 36 "r1a"
Name 38 "r2a"
Name 40 "r0b"
Name 47 "$Global"
MemberName 47($Global) 0 "idx"
MemberName 47($Global) 1 "um"
Name 49 ""
Name 55 "indexable"
Name 58 "r0c"
Name 66 "PS_OUTPUT"
MemberName 66(PS_OUTPUT) 0 "Color"
Name 68 "psout"
Name 74 "Color"
MemberDecorate 47($Global) 0 Offset 0
MemberDecorate 47($Global) 1 RowMajor
MemberDecorate 47($Global) 1 Offset 16
MemberDecorate 47($Global) 1 MatrixStride 16
Decorate 47($Global) Block
Decorate 49 DescriptorSet 0
Decorate 74(Color) Location 0
Name 8 "PS_OUTPUT"
MemberName 8(PS_OUTPUT) 0 "Color"
Name 10 "@main("
Name 13 "e1_00"
Name 15 "e1_01"
Name 17 "e1_10"
Name 19 "e1_11"
Name 21 "e1_20"
Name 23 "e1_21"
Name 25 "e2_00"
Name 27 "e2_01"
Name 29 "e2_10"
Name 31 "e2_11"
Name 33 "e2_20"
Name 35 "e2_21"
Name 39 "r0a"
Name 41 "r1a"
Name 43 "r2a"
Name 45 "r0b"
Name 52 "$Global"
MemberName 52($Global) 0 "idx"
MemberName 52($Global) 1 "um"
Name 54 ""
Name 60 "indexable"
Name 63 "r0c"
Name 71 "psout"
Name 80 "Color"
MemberDecorate 52($Global) 0 Offset 0
MemberDecorate 52($Global) 1 RowMajor
MemberDecorate 52($Global) 1 Offset 16
MemberDecorate 52($Global) 1 MatrixStride 16
Decorate 52($Global) Block
Decorate 54 DescriptorSet 0
Decorate 80(Color) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypePointer Function 6(float)
9: 6(float) Constant 1092616192
11: 6(float) Constant 1093664768
13: 6(float) Constant 1094713344
15: 6(float) Constant 1095761920
17: 6(float) Constant 1096810496
19: 6(float) Constant 1097859072
21: 6(float) Constant 1101004800
23: 6(float) Constant 1101529088
25: 6(float) Constant 1102053376
27: 6(float) Constant 1102577664
29: 6(float) Constant 1103101952
31: 6(float) Constant 1103626240
32: TypeVector 6(float) 2
33: TypePointer Function 32(fvec2)
35: 32(fvec2) ConstantComposite 9 11
37: 32(fvec2) ConstantComposite 13 15
39: 32(fvec2) ConstantComposite 17 19
41: TypeMatrix 32(fvec2) 3
42: 32(fvec2) ConstantComposite 21 23
43: 32(fvec2) ConstantComposite 25 27
44: 32(fvec2) ConstantComposite 29 31
45: 41 ConstantComposite 42 43 44
46: TypeInt 32 1
47($Global): TypeStruct 46(int) 41
48: TypePointer Uniform 47($Global)
49: 48(ptr) Variable Uniform
50: 46(int) Constant 0
51: TypePointer Uniform 46(int)
54: TypePointer Function 41
59: 46(int) Constant 1
62: TypePointer Uniform 32(fvec2)
65: TypeVector 6(float) 4
66(PS_OUTPUT): TypeStruct 65(fvec4)
67: TypePointer Function 66(PS_OUTPUT)
71: TypePointer Function 65(fvec4)
73: TypePointer Output 65(fvec4)
74(Color): 73(ptr) Variable Output
7: TypeVector 6(float) 4
8(PS_OUTPUT): TypeStruct 7(fvec4)
9: TypeFunction 8(PS_OUTPUT)
12: TypePointer Function 6(float)
14: 6(float) Constant 1092616192
16: 6(float) Constant 1093664768
18: 6(float) Constant 1094713344
20: 6(float) Constant 1095761920
22: 6(float) Constant 1096810496
24: 6(float) Constant 1097859072
26: 6(float) Constant 1101004800
28: 6(float) Constant 1101529088
30: 6(float) Constant 1102053376
32: 6(float) Constant 1102577664
34: 6(float) Constant 1103101952
36: 6(float) Constant 1103626240
37: TypeVector 6(float) 2
38: TypePointer Function 37(fvec2)
40: 37(fvec2) ConstantComposite 14 16
42: 37(fvec2) ConstantComposite 18 20
44: 37(fvec2) ConstantComposite 22 24
46: TypeMatrix 37(fvec2) 3
47: 37(fvec2) ConstantComposite 26 28
48: 37(fvec2) ConstantComposite 30 32
49: 37(fvec2) ConstantComposite 34 36
50: 46 ConstantComposite 47 48 49
51: TypeInt 32 1
52($Global): TypeStruct 51(int) 46
53: TypePointer Uniform 52($Global)
54: 53(ptr) Variable Uniform
55: 51(int) Constant 0
56: TypePointer Uniform 51(int)
59: TypePointer Function 46
64: 51(int) Constant 1
67: TypePointer Uniform 37(fvec2)
70: TypePointer Function 8(PS_OUTPUT)
74: TypePointer Function 7(fvec4)
79: TypePointer Output 7(fvec4)
80(Color): 79(ptr) Variable Output
4(main): 2 Function None 3
5: Label
8(e1_00): 7(ptr) Variable Function
10(e1_01): 7(ptr) Variable Function
12(e1_10): 7(ptr) Variable Function
14(e1_11): 7(ptr) Variable Function
16(e1_20): 7(ptr) Variable Function
18(e1_21): 7(ptr) Variable Function
20(e2_00): 7(ptr) Variable Function
22(e2_01): 7(ptr) Variable Function
24(e2_10): 7(ptr) Variable Function
26(e2_11): 7(ptr) Variable Function
28(e2_20): 7(ptr) Variable Function
30(e2_21): 7(ptr) Variable Function
34(r0a): 33(ptr) Variable Function
36(r1a): 33(ptr) Variable Function
38(r2a): 33(ptr) Variable Function
40(r0b): 33(ptr) Variable Function
55(indexable): 54(ptr) Variable Function
58(r0c): 33(ptr) Variable Function
68(psout): 67(ptr) Variable Function
Store 8(e1_00) 9
Store 10(e1_01) 11
Store 12(e1_10) 13
Store 14(e1_11) 15
Store 16(e1_20) 17
Store 18(e1_21) 19
Store 20(e2_00) 21
Store 22(e2_01) 23
Store 24(e2_10) 25
Store 26(e2_11) 27
Store 28(e2_20) 29
Store 30(e2_21) 31
Store 34(r0a) 35
Store 36(r1a) 37
Store 38(r2a) 39
52: 51(ptr) AccessChain 49 50
53: 46(int) Load 52
Store 55(indexable) 45
56: 33(ptr) AccessChain 55(indexable) 53
57: 32(fvec2) Load 56
Store 40(r0b) 57
60: 51(ptr) AccessChain 49 50
61: 46(int) Load 60
63: 62(ptr) AccessChain 49 59 61
64: 32(fvec2) Load 63
Store 58(r0c) 64
69: 6(float) Load 26(e2_11)
70: 65(fvec4) CompositeConstruct 69 69 69 69
72: 71(ptr) AccessChain 68(psout) 50
Store 72 70
75: 71(ptr) AccessChain 68(psout) 50
76: 65(fvec4) Load 75
Store 74(Color) 76
81:8(PS_OUTPUT) FunctionCall 10(@main()
82: 7(fvec4) CompositeExtract 81 0
Store 80(Color) 82
Return
FunctionEnd
10(@main():8(PS_OUTPUT) Function None 9
11: Label
13(e1_00): 12(ptr) Variable Function
15(e1_01): 12(ptr) Variable Function
17(e1_10): 12(ptr) Variable Function
19(e1_11): 12(ptr) Variable Function
21(e1_20): 12(ptr) Variable Function
23(e1_21): 12(ptr) Variable Function
25(e2_00): 12(ptr) Variable Function
27(e2_01): 12(ptr) Variable Function
29(e2_10): 12(ptr) Variable Function
31(e2_11): 12(ptr) Variable Function
33(e2_20): 12(ptr) Variable Function
35(e2_21): 12(ptr) Variable Function
39(r0a): 38(ptr) Variable Function
41(r1a): 38(ptr) Variable Function
43(r2a): 38(ptr) Variable Function
45(r0b): 38(ptr) Variable Function
60(indexable): 59(ptr) Variable Function
63(r0c): 38(ptr) Variable Function
71(psout): 70(ptr) Variable Function
Store 13(e1_00) 14
Store 15(e1_01) 16
Store 17(e1_10) 18
Store 19(e1_11) 20
Store 21(e1_20) 22
Store 23(e1_21) 24
Store 25(e2_00) 26
Store 27(e2_01) 28
Store 29(e2_10) 30
Store 31(e2_11) 32
Store 33(e2_20) 34
Store 35(e2_21) 36
Store 39(r0a) 40
Store 41(r1a) 42
Store 43(r2a) 44
57: 56(ptr) AccessChain 54 55
58: 51(int) Load 57
Store 60(indexable) 50
61: 38(ptr) AccessChain 60(indexable) 58
62: 37(fvec2) Load 61
Store 45(r0b) 62
65: 56(ptr) AccessChain 54 55
66: 51(int) Load 65
68: 67(ptr) AccessChain 54 64 66
69: 37(fvec2) Load 68
Store 63(r0c) 69
72: 6(float) Load 31(e2_11)
73: 7(fvec4) CompositeConstruct 72 72 72 72
75: 74(ptr) AccessChain 71(psout) 55
Store 75 73
76:8(PS_OUTPUT) Load 71(psout)
ReturnValue 76
FunctionEnd