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,59 +2,76 @@ hlsl.struct.split.assign.frag
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:7 Function Definition: main(i1;struct-S-f1-vf41[3]; (temp 4-component vector of float)
0:7 Function Definition: @main(i1;struct-S-f1-vf41[3]; (temp 4-component vector of float)
0:7 Function Parameters:
0:7 'i' (layout(location=0 ) in int)
0:7 'i' (in int)
0:7 'input' (in 3-element array of structure{temp float f, temp 4-component vector of float FragCoord pos})
0:? Sequence
0:9 Sequence
0:9 move second child to first child (temp float)
0:9 f: direct index for structure (temp float)
0:9 direct index (layout(location=1 ) in structure{temp float f})
0:9 'input' (layout(location=1 ) in 3-element array of structure{temp float f})
0:9 Constant:
0:9 0 (const int)
0:9 Constant:
0:9 0 (const int)
0:9 f: direct index for structure (temp float)
0:9 direct index (temp structure{temp float f, temp 4-component vector of float pos})
0:9 'a' (temp 3-element array of structure{temp float f, temp 4-component vector of float pos})
0:9 Constant:
0:9 0 (const int)
0:9 Constant:
0:9 0 (const int)
0:9 move second child to first child (temp float)
0:9 f: direct index for structure (temp float)
0:9 direct index (layout(location=1 ) in structure{temp float f})
0:9 'input' (layout(location=1 ) in 3-element array of structure{temp float f})
0:9 Constant:
0:9 1 (const int)
0:9 Constant:
0:9 0 (const int)
0:9 f: direct index for structure (temp float)
0:9 direct index (temp structure{temp float f, temp 4-component vector of float pos})
0:9 'a' (temp 3-element array of structure{temp float f, temp 4-component vector of float pos})
0:9 Constant:
0:9 1 (const int)
0:9 Constant:
0:9 0 (const int)
0:9 move second child to first child (temp float)
0:9 f: direct index for structure (temp float)
0:9 direct index (layout(location=1 ) in structure{temp float f})
0:9 'input' (layout(location=1 ) in 3-element array of structure{temp float f})
0:9 Constant:
0:9 2 (const int)
0:9 Constant:
0:9 0 (const int)
0:9 f: direct index for structure (temp float)
0:9 direct index (temp structure{temp float f, temp 4-component vector of float pos})
0:9 'a' (temp 3-element array of structure{temp float f, temp 4-component vector of float pos})
0:9 Constant:
0:9 2 (const int)
0:9 Constant:
0:9 0 (const int)
0:11 Sequence
0:11 Branch: Return
0:9 move second child to first child (temp 3-element array of structure{temp float f, temp 4-component vector of float FragCoord pos})
0:9 'input' (in 3-element array of structure{temp float f, temp 4-component vector of float FragCoord pos})
0:9 'a' (temp 3-element array of structure{temp float f, temp 4-component vector of float pos})
0:11 Branch: Return with expression
0:11 Constant:
0:11 1.000000
0:11 1.000000
0:11 1.000000
0:7 Function Definition: main( (temp void)
0:7 Function Parameters:
0:? Sequence
0:7 move second child to first child (temp int)
0:? 'i' (temp int)
0:? 'i' (layout(location=0 ) in int)
0:7 Sequence
0:7 move second child to first child (temp float)
0:7 f: direct index for structure (temp float)
0:7 direct index (temp structure{temp float f, temp 4-component vector of float FragCoord pos})
0:? 'input' (temp 3-element array of structure{temp float f, temp 4-component vector of float FragCoord pos})
0:7 Constant:
0:7 0 (const int)
0:7 Constant:
0:7 0 (const int)
0:7 f: direct index for structure (temp float)
0:7 direct index (layout(location=1 ) in structure{temp float f})
0:7 'input' (layout(location=1 ) in 3-element array of structure{temp float f})
0:7 Constant:
0:7 0 (const int)
0:7 Constant:
0:7 0 (const int)
0:7 move second child to first child (temp float)
0:7 f: direct index for structure (temp float)
0:7 direct index (temp structure{temp float f, temp 4-component vector of float FragCoord pos})
0:? 'input' (temp 3-element array of structure{temp float f, temp 4-component vector of float FragCoord pos})
0:7 Constant:
0:7 1 (const int)
0:7 Constant:
0:7 0 (const int)
0:7 f: direct index for structure (temp float)
0:7 direct index (layout(location=1 ) in structure{temp float f})
0:7 'input' (layout(location=1 ) in 3-element array of structure{temp float f})
0:7 Constant:
0:7 1 (const int)
0:7 Constant:
0:7 0 (const int)
0:7 move second child to first child (temp float)
0:7 f: direct index for structure (temp float)
0:7 direct index (temp structure{temp float f, temp 4-component vector of float FragCoord pos})
0:? 'input' (temp 3-element array of structure{temp float f, temp 4-component vector of float FragCoord pos})
0:7 Constant:
0:7 2 (const int)
0:7 Constant:
0:7 0 (const int)
0:7 f: direct index for structure (temp float)
0:7 direct index (layout(location=1 ) in structure{temp float f})
0:7 'input' (layout(location=1 ) in 3-element array of structure{temp float f})
0:7 Constant:
0:7 2 (const int)
0:7 Constant:
0:7 0 (const int)
0:7 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:7 Function Call: @main(i1;struct-S-f1-vf41[3]; (temp 4-component vector of float)
0:? 'i' (temp int)
0:? 'input' (temp 3-element array of structure{temp float f, temp 4-component vector of float FragCoord pos})
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:? 'i' (layout(location=0 ) in int)
@@ -68,59 +85,76 @@ Linked fragment stage:
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:7 Function Definition: main(i1;struct-S-f1-vf41[3]; (temp 4-component vector of float)
0:7 Function Definition: @main(i1;struct-S-f1-vf41[3]; (temp 4-component vector of float)
0:7 Function Parameters:
0:7 'i' (layout(location=0 ) in int)
0:7 'i' (in int)
0:7 'input' (in 3-element array of structure{temp float f, temp 4-component vector of float FragCoord pos})
0:? Sequence
0:9 Sequence
0:9 move second child to first child (temp float)
0:9 f: direct index for structure (temp float)
0:9 direct index (layout(location=1 ) in structure{temp float f})
0:9 'input' (layout(location=1 ) in 3-element array of structure{temp float f})
0:9 Constant:
0:9 0 (const int)
0:9 Constant:
0:9 0 (const int)
0:9 f: direct index for structure (temp float)
0:9 direct index (temp structure{temp float f, temp 4-component vector of float pos})
0:9 'a' (temp 3-element array of structure{temp float f, temp 4-component vector of float pos})
0:9 Constant:
0:9 0 (const int)
0:9 Constant:
0:9 0 (const int)
0:9 move second child to first child (temp float)
0:9 f: direct index for structure (temp float)
0:9 direct index (layout(location=1 ) in structure{temp float f})
0:9 'input' (layout(location=1 ) in 3-element array of structure{temp float f})
0:9 Constant:
0:9 1 (const int)
0:9 Constant:
0:9 0 (const int)
0:9 f: direct index for structure (temp float)
0:9 direct index (temp structure{temp float f, temp 4-component vector of float pos})
0:9 'a' (temp 3-element array of structure{temp float f, temp 4-component vector of float pos})
0:9 Constant:
0:9 1 (const int)
0:9 Constant:
0:9 0 (const int)
0:9 move second child to first child (temp float)
0:9 f: direct index for structure (temp float)
0:9 direct index (layout(location=1 ) in structure{temp float f})
0:9 'input' (layout(location=1 ) in 3-element array of structure{temp float f})
0:9 Constant:
0:9 2 (const int)
0:9 Constant:
0:9 0 (const int)
0:9 f: direct index for structure (temp float)
0:9 direct index (temp structure{temp float f, temp 4-component vector of float pos})
0:9 'a' (temp 3-element array of structure{temp float f, temp 4-component vector of float pos})
0:9 Constant:
0:9 2 (const int)
0:9 Constant:
0:9 0 (const int)
0:11 Sequence
0:11 Branch: Return
0:9 move second child to first child (temp 3-element array of structure{temp float f, temp 4-component vector of float FragCoord pos})
0:9 'input' (in 3-element array of structure{temp float f, temp 4-component vector of float FragCoord pos})
0:9 'a' (temp 3-element array of structure{temp float f, temp 4-component vector of float pos})
0:11 Branch: Return with expression
0:11 Constant:
0:11 1.000000
0:11 1.000000
0:11 1.000000
0:7 Function Definition: main( (temp void)
0:7 Function Parameters:
0:? Sequence
0:7 move second child to first child (temp int)
0:? 'i' (temp int)
0:? 'i' (layout(location=0 ) in int)
0:7 Sequence
0:7 move second child to first child (temp float)
0:7 f: direct index for structure (temp float)
0:7 direct index (temp structure{temp float f, temp 4-component vector of float FragCoord pos})
0:? 'input' (temp 3-element array of structure{temp float f, temp 4-component vector of float FragCoord pos})
0:7 Constant:
0:7 0 (const int)
0:7 Constant:
0:7 0 (const int)
0:7 f: direct index for structure (temp float)
0:7 direct index (layout(location=1 ) in structure{temp float f})
0:7 'input' (layout(location=1 ) in 3-element array of structure{temp float f})
0:7 Constant:
0:7 0 (const int)
0:7 Constant:
0:7 0 (const int)
0:7 move second child to first child (temp float)
0:7 f: direct index for structure (temp float)
0:7 direct index (temp structure{temp float f, temp 4-component vector of float FragCoord pos})
0:? 'input' (temp 3-element array of structure{temp float f, temp 4-component vector of float FragCoord pos})
0:7 Constant:
0:7 1 (const int)
0:7 Constant:
0:7 0 (const int)
0:7 f: direct index for structure (temp float)
0:7 direct index (layout(location=1 ) in structure{temp float f})
0:7 'input' (layout(location=1 ) in 3-element array of structure{temp float f})
0:7 Constant:
0:7 1 (const int)
0:7 Constant:
0:7 0 (const int)
0:7 move second child to first child (temp float)
0:7 f: direct index for structure (temp float)
0:7 direct index (temp structure{temp float f, temp 4-component vector of float FragCoord pos})
0:? 'input' (temp 3-element array of structure{temp float f, temp 4-component vector of float FragCoord pos})
0:7 Constant:
0:7 2 (const int)
0:7 Constant:
0:7 0 (const int)
0:7 f: direct index for structure (temp float)
0:7 direct index (layout(location=1 ) in structure{temp float f})
0:7 'input' (layout(location=1 ) in 3-element array of structure{temp float f})
0:7 Constant:
0:7 2 (const int)
0:7 Constant:
0:7 0 (const int)
0:7 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:7 Function Call: @main(i1;struct-S-f1-vf41[3]; (temp 4-component vector of float)
0:? 'i' (temp int)
0:? 'input' (temp 3-element array of structure{temp float f, temp 4-component vector of float FragCoord pos})
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:? 'i' (layout(location=0 ) in int)
@@ -129,68 +163,135 @@ gl_FragCoord origin is upper left
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 41
// Id's are bound by 85
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 12 35 37 40
EntryPoint Fragment 4 "main" 58 64 76 84
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 7 "S"
MemberName 7(S) 0 "f"
Name 12 "input"
Name 16 "S"
MemberName 16(S) 0 "f"
MemberName 16(S) 1 "pos"
Name 19 "a"
Name 35 "@entryPointOutput"
Name 37 "i"
Name 40 "input_pos"
Decorate 12(input) Location 1
Decorate 35(@entryPointOutput) Location 0
Decorate 37(i) Location 0
Decorate 40(input_pos) BuiltIn FragCoord
Name 10 "S"
MemberName 10(S) 0 "f"
MemberName 10(S) 1 "pos"
Name 18 "@main(i1;struct-S-f1-vf41[3];"
Name 16 "i"
Name 17 "input"
Name 20 "S"
MemberName 20(S) 0 "f"
MemberName 20(S) 1 "pos"
Name 23 "a"
Name 56 "i"
Name 58 "i"
Name 60 "input"
Name 61 "S"
MemberName 61(S) 0 "f"
Name 64 "input"
Name 76 "@entryPointOutput"
Name 77 "param"
Name 79 "param"
Name 84 "input_pos"
MemberDecorate 10(S) 1 BuiltIn FragCoord
Decorate 58(i) Location 0
Decorate 64(input) Location 1
Decorate 76(@entryPointOutput) Location 0
Decorate 84(input_pos) BuiltIn FragCoord
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7(S): TypeStruct 6(float)
8: TypeInt 32 0
9: 8(int) Constant 3
10: TypeArray 7(S) 9
11: TypePointer Input 10
12(input): 11(ptr) Variable Input
13: TypeInt 32 1
14: 13(int) Constant 0
15: TypeVector 6(float) 4
16(S): TypeStruct 6(float) 15(fvec4)
17: TypeArray 16(S) 9
18: TypePointer Function 17
20: TypePointer Function 6(float)
23: TypePointer Input 6(float)
25: 13(int) Constant 1
29: 13(int) Constant 2
34: TypePointer Output 15(fvec4)
35(@entryPointOutput): 34(ptr) Variable Output
36: TypePointer Input 13(int)
37(i): 36(ptr) Variable Input
38: TypeArray 15(fvec4) 9
39: TypePointer Input 38
40(input_pos): 39(ptr) Variable Input
6: TypeInt 32 1
7: TypePointer Function 6(int)
8: TypeFloat 32
9: TypeVector 8(float) 4
10(S): TypeStruct 8(float) 9(fvec4)
11: TypeInt 32 0
12: 11(int) Constant 3
13: TypeArray 10(S) 12
14: TypePointer Function 13
15: TypeFunction 9(fvec4) 7(ptr) 14(ptr)
20(S): TypeStruct 8(float) 9(fvec4)
21: TypeArray 20(S) 12
22: TypePointer Function 21
26: 6(int) Constant 0
27: TypePointer Function 10(S)
30: TypePointer Function 8(float)
33: 6(int) Constant 1
34: TypePointer Function 9(fvec4)
43: 6(int) Constant 2
49: TypeVector 8(float) 3
50: 8(float) Constant 1065353216
51: 49(fvec3) ConstantComposite 50 50 50
57: TypePointer Input 6(int)
58(i): 57(ptr) Variable Input
61(S): TypeStruct 8(float)
62: TypeArray 61(S) 12
63: TypePointer Input 62
64(input): 63(ptr) Variable Input
65: TypePointer Input 8(float)
75: TypePointer Output 9(fvec4)
76(@entryPointOutput): 75(ptr) Variable Output
82: TypeArray 9(fvec4) 12
83: TypePointer Input 82
84(input_pos): 83(ptr) Variable Input
4(main): 2 Function None 3
5: Label
19(a): 18(ptr) Variable Function
21: 20(ptr) AccessChain 19(a) 14 14
22: 6(float) Load 21
24: 23(ptr) AccessChain 12(input) 14 14
Store 24 22
26: 20(ptr) AccessChain 19(a) 25 14
27: 6(float) Load 26
28: 23(ptr) AccessChain 12(input) 25 14
Store 28 27
30: 20(ptr) AccessChain 19(a) 29 14
31: 6(float) Load 30
32: 23(ptr) AccessChain 12(input) 29 14
Store 32 31
56(i): 7(ptr) Variable Function
60(input): 14(ptr) Variable Function
77(param): 7(ptr) Variable Function
79(param): 14(ptr) Variable Function
59: 6(int) Load 58(i)
Store 56(i) 59
66: 65(ptr) AccessChain 64(input) 26 26
67: 8(float) Load 66
68: 30(ptr) AccessChain 60(input) 26 26
Store 68 67
69: 65(ptr) AccessChain 64(input) 33 26
70: 8(float) Load 69
71: 30(ptr) AccessChain 60(input) 33 26
Store 71 70
72: 65(ptr) AccessChain 64(input) 43 26
73: 8(float) Load 72
74: 30(ptr) AccessChain 60(input) 43 26
Store 74 73
78: 6(int) Load 56(i)
Store 77(param) 78
80: 13 Load 60(input)
Store 79(param) 80
81: 9(fvec4) FunctionCall 18(@main(i1;struct-S-f1-vf41[3];) 77(param) 79(param)
Store 76(@entryPointOutput) 81
Return
FunctionEnd
18(@main(i1;struct-S-f1-vf41[3];): 9(fvec4) Function None 15
16(i): 7(ptr) FunctionParameter
17(input): 14(ptr) FunctionParameter
19: Label
23(a): 22(ptr) Variable Function
52: 34(ptr) Variable Function
24: 21 Load 23(a)
25: 20(S) CompositeExtract 24 0
28: 27(ptr) AccessChain 17(input) 26
29: 8(float) CompositeExtract 25 0
31: 30(ptr) AccessChain 28 26
Store 31 29
32: 9(fvec4) CompositeExtract 25 1
35: 34(ptr) AccessChain 28 33
Store 35 32
36: 20(S) CompositeExtract 24 1
37: 27(ptr) AccessChain 17(input) 33
38: 8(float) CompositeExtract 36 0
39: 30(ptr) AccessChain 37 26
Store 39 38
40: 9(fvec4) CompositeExtract 36 1
41: 34(ptr) AccessChain 37 33
Store 41 40
42: 20(S) CompositeExtract 24 2
44: 27(ptr) AccessChain 17(input) 43
45: 8(float) CompositeExtract 42 0
46: 30(ptr) AccessChain 44 26
Store 46 45
47: 9(fvec4) CompositeExtract 42 1
48: 34(ptr) AccessChain 44 33
Store 48 47
Store 52 51
53: 9(fvec4) Load 52
ReturnValue 53
FunctionEnd