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

@@ -18,7 +18,7 @@ gl_FragCoord origin is upper left
0:11 'x' (in float)
0:11 Constant:
0:11 -1.000000
0:15 Function Definition: main(vf4;i1; (temp structure{temp 4-component vector of float Color, temp float Depth})
0:15 Function Definition: @main(vf4;i1; (temp structure{temp 4-component vector of float Color, temp float Depth})
0:15 Function Parameters:
0:15 'inpos' (noperspective in 4-component vector of float FragCoord)
0:15 'sampleMask' (out int SampleMaskIn)
@@ -56,21 +56,35 @@ gl_FragCoord origin is upper left
0:22 'inpos' (noperspective in 4-component vector of float FragCoord)
0:22 Constant:
0:22 3 (const int)
0:24 Sequence
0:24 Sequence
0:24 move second child to first child (temp 4-component vector of float)
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
0:24 Color: direct index for structure (temp 4-component vector of float)
0:24 'psout' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:24 Constant:
0:24 0 (const int)
0:24 move second child to first child (temp float)
0:? 'Depth' (out float FragDepth)
0:24 Depth: direct index for structure (temp float)
0:24 'psout' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:24 Constant:
0:24 1 (const int)
0:24 Branch: Return
0:24 Branch: Return with expression
0:24 'psout' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:15 Function Definition: main( (temp void)
0:15 Function Parameters:
0:? Sequence
0:15 move second child to first child (temp 4-component vector of float)
0:? 'inpos' (temp 4-component vector of float)
0:? 'inpos' (noperspective in 4-component vector of float FragCoord)
0:15 Sequence
0:15 move second child to first child (temp structure{temp 4-component vector of float Color, temp float Depth})
0:15 'flattenTemp' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:15 Function Call: @main(vf4;i1; (temp structure{temp 4-component vector of float Color, temp float Depth})
0:? 'inpos' (temp 4-component vector of float)
0:? 'sampleMask' (temp int)
0:15 move second child to first child (temp 4-component vector of float)
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
0:15 Color: direct index for structure (temp 4-component vector of float)
0:15 'flattenTemp' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:15 Constant:
0:15 0 (const int)
0:15 move second child to first child (temp float)
0:? 'Depth' (out float FragDepth)
0:15 Depth: direct index for structure (temp float)
0:15 'flattenTemp' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:15 Constant:
0:15 1 (const int)
0:15 move second child to first child (temp int)
0:? 'sampleMask' (out int SampleMaskIn)
0:? 'sampleMask' (temp int)
0:? Linker Objects
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
0:? 'Depth' (out float FragDepth)
@@ -100,7 +114,7 @@ gl_FragCoord origin is upper left
0:11 'x' (in float)
0:11 Constant:
0:11 -1.000000
0:15 Function Definition: main(vf4;i1; (temp structure{temp 4-component vector of float Color, temp float Depth})
0:15 Function Definition: @main(vf4;i1; (temp structure{temp 4-component vector of float Color, temp float Depth})
0:15 Function Parameters:
0:15 'inpos' (noperspective in 4-component vector of float FragCoord)
0:15 'sampleMask' (out int SampleMaskIn)
@@ -138,21 +152,35 @@ gl_FragCoord origin is upper left
0:22 'inpos' (noperspective in 4-component vector of float FragCoord)
0:22 Constant:
0:22 3 (const int)
0:24 Sequence
0:24 Sequence
0:24 move second child to first child (temp 4-component vector of float)
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
0:24 Color: direct index for structure (temp 4-component vector of float)
0:24 'psout' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:24 Constant:
0:24 0 (const int)
0:24 move second child to first child (temp float)
0:? 'Depth' (out float FragDepth)
0:24 Depth: direct index for structure (temp float)
0:24 'psout' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:24 Constant:
0:24 1 (const int)
0:24 Branch: Return
0:24 Branch: Return with expression
0:24 'psout' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:15 Function Definition: main( (temp void)
0:15 Function Parameters:
0:? Sequence
0:15 move second child to first child (temp 4-component vector of float)
0:? 'inpos' (temp 4-component vector of float)
0:? 'inpos' (noperspective in 4-component vector of float FragCoord)
0:15 Sequence
0:15 move second child to first child (temp structure{temp 4-component vector of float Color, temp float Depth})
0:15 'flattenTemp' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:15 Function Call: @main(vf4;i1; (temp structure{temp 4-component vector of float Color, temp float Depth})
0:? 'inpos' (temp 4-component vector of float)
0:? 'sampleMask' (temp int)
0:15 move second child to first child (temp 4-component vector of float)
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
0:15 Color: direct index for structure (temp 4-component vector of float)
0:15 'flattenTemp' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:15 Constant:
0:15 0 (const int)
0:15 move second child to first child (temp float)
0:? 'Depth' (out float FragDepth)
0:15 Depth: direct index for structure (temp float)
0:15 'flattenTemp' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:15 Constant:
0:15 1 (const int)
0:15 move second child to first child (temp int)
0:? 'sampleMask' (out int SampleMaskIn)
0:? 'sampleMask' (temp int)
0:? Linker Objects
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
0:? 'Depth' (out float FragDepth)
@@ -161,101 +189,97 @@ gl_FragCoord origin is upper left
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 63
// Id's are bound by 80
Capability Shader
Capability SampleRateShading
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 45 53 57 62
EntryPoint Fragment 4 "main" 60 70 74 78
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 12 "MyFunc(f1;f1;f1;"
Name 9 "x"
Name 10 "y"
Name 11 "z"
Name 17 "x"
Name 19 "z"
Name 21 "y"
Name 22 "param"
Name 24 "param"
Name 25 "param"
Name 31 "PS_OUTPUT"
MemberName 31(PS_OUTPUT) 0 "Color"
MemberName 31(PS_OUTPUT) 1 "Depth"
Name 33 "psout"
Name 45 "inpos"
Name 53 "Color"
Name 57 "Depth"
Name 62 "sampleMask"
Decorate 45(inpos) NoPerspective
Decorate 45(inpos) BuiltIn FragCoord
Decorate 53(Color) Location 0
Decorate 57(Depth) BuiltIn FragDepth
Decorate 62(sampleMask) BuiltIn SampleMask
Name 18 "PS_OUTPUT"
MemberName 18(PS_OUTPUT) 0 "Color"
MemberName 18(PS_OUTPUT) 1 "Depth"
Name 22 "@main(vf4;i1;"
Name 20 "inpos"
Name 21 "sampleMask"
Name 27 "x"
Name 29 "z"
Name 31 "y"
Name 32 "param"
Name 34 "param"
Name 35 "param"
Name 41 "psout"
Name 58 "inpos"
Name 60 "inpos"
Name 62 "flattenTemp"
Name 63 "sampleMask"
Name 64 "param"
Name 66 "param"
Name 70 "Color"
Name 74 "Depth"
Name 78 "sampleMask"
Decorate 60(inpos) NoPerspective
Decorate 60(inpos) BuiltIn FragCoord
Decorate 70(Color) Location 0
Decorate 74(Depth) BuiltIn FragDepth
Decorate 78(sampleMask) BuiltIn SampleMask
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypePointer Function 6(float)
8: TypeFunction 2 7(ptr) 7(ptr) 7(ptr)
16: 6(float) Constant 3212836864
18: 6(float) Constant 1088421888
20: 6(float) Constant 1077936128
30: TypeVector 6(float) 4
31(PS_OUTPUT): TypeStruct 30(fvec4) 6(float)
32: TypePointer Function 31(PS_OUTPUT)
34: TypeInt 32 1
35: 34(int) Constant 0
39: 6(float) Constant 1065353216
41: TypePointer Function 30(fvec4)
43: 34(int) Constant 1
44: TypePointer Input 30(fvec4)
45(inpos): 44(ptr) Variable Input
46: TypeInt 32 0
47: 46(int) Constant 3
48: TypePointer Input 6(float)
52: TypePointer Output 30(fvec4)
53(Color): 52(ptr) Variable Output
56: TypePointer Output 6(float)
57(Depth): 56(ptr) Variable Output
61: TypePointer Output 34(int)
62(sampleMask): 61(ptr) Variable Output
14: TypeVector 6(float) 4
15: TypePointer Function 14(fvec4)
16: TypeInt 32 1
17: TypePointer Function 16(int)
18(PS_OUTPUT): TypeStruct 14(fvec4) 6(float)
19: TypeFunction 18(PS_OUTPUT) 15(ptr) 17(ptr)
26: 6(float) Constant 3212836864
28: 6(float) Constant 1088421888
30: 6(float) Constant 1077936128
40: TypePointer Function 18(PS_OUTPUT)
42: 16(int) Constant 0
46: 6(float) Constant 1065353216
49: 16(int) Constant 1
50: TypeInt 32 0
51: 50(int) Constant 3
59: TypePointer Input 14(fvec4)
60(inpos): 59(ptr) Variable Input
69: TypePointer Output 14(fvec4)
70(Color): 69(ptr) Variable Output
73: TypePointer Output 6(float)
74(Depth): 73(ptr) Variable Output
77: TypePointer Output 16(int)
78(sampleMask): 77(ptr) Variable Output
4(main): 2 Function None 3
5: Label
17(x): 7(ptr) Variable Function
19(z): 7(ptr) Variable Function
21(y): 7(ptr) Variable Function
22(param): 7(ptr) Variable Function
24(param): 7(ptr) Variable Function
25(param): 7(ptr) Variable Function
33(psout): 32(ptr) Variable Function
Store 17(x) 18
Store 19(z) 20
23: 6(float) Load 17(x)
Store 22(param) 23
26: 6(float) Load 19(z)
Store 25(param) 26
27: 2 FunctionCall 12(MyFunc(f1;f1;f1;) 22(param) 24(param) 25(param)
28: 6(float) Load 24(param)
Store 21(y) 28
29: 6(float) Load 25(param)
Store 19(z) 29
36: 6(float) Load 17(x)
37: 6(float) Load 21(y)
38: 6(float) Load 19(z)
40: 30(fvec4) CompositeConstruct 36 37 38 39
42: 41(ptr) AccessChain 33(psout) 35
Store 42 40
49: 48(ptr) AccessChain 45(inpos) 47
50: 6(float) Load 49
51: 7(ptr) AccessChain 33(psout) 43
Store 51 50
54: 41(ptr) AccessChain 33(psout) 35
55: 30(fvec4) Load 54
Store 53(Color) 55
58: 7(ptr) AccessChain 33(psout) 43
59: 6(float) Load 58
Store 57(Depth) 59
58(inpos): 15(ptr) Variable Function
62(flattenTemp): 40(ptr) Variable Function
63(sampleMask): 17(ptr) Variable Function
64(param): 15(ptr) Variable Function
66(param): 17(ptr) Variable Function
61: 14(fvec4) Load 60(inpos)
Store 58(inpos) 61
65: 14(fvec4) Load 58(inpos)
Store 64(param) 65
67:18(PS_OUTPUT) FunctionCall 22(@main(vf4;i1;) 64(param) 66(param)
68: 16(int) Load 66(param)
Store 63(sampleMask) 68
Store 62(flattenTemp) 67
71: 15(ptr) AccessChain 62(flattenTemp) 42
72: 14(fvec4) Load 71
Store 70(Color) 72
75: 7(ptr) AccessChain 62(flattenTemp) 49
76: 6(float) Load 75
Store 74(Depth) 76
79: 16(int) Load 63(sampleMask)
Store 78(sampleMask) 79
Return
FunctionEnd
12(MyFunc(f1;f1;f1;): 2 Function None 8
@@ -263,10 +287,45 @@ gl_FragCoord origin is upper left
10(y): 7(ptr) FunctionParameter
11(z): 7(ptr) FunctionParameter
13: Label
14: 6(float) Load 9(x)
Store 10(y) 14
15: 6(float) Load 10(y)
Store 11(z) 15
Store 9(x) 16
24: 6(float) Load 9(x)
Store 10(y) 24
25: 6(float) Load 10(y)
Store 11(z) 25
Store 9(x) 26
Return
FunctionEnd
22(@main(vf4;i1;):18(PS_OUTPUT) Function None 19
20(inpos): 15(ptr) FunctionParameter
21(sampleMask): 17(ptr) FunctionParameter
23: Label
27(x): 7(ptr) Variable Function
29(z): 7(ptr) Variable Function
31(y): 7(ptr) Variable Function
32(param): 7(ptr) Variable Function
34(param): 7(ptr) Variable Function
35(param): 7(ptr) Variable Function
41(psout): 40(ptr) Variable Function
Store 27(x) 28
Store 29(z) 30
33: 6(float) Load 27(x)
Store 32(param) 33
36: 6(float) Load 29(z)
Store 35(param) 36
37: 2 FunctionCall 12(MyFunc(f1;f1;f1;) 32(param) 34(param) 35(param)
38: 6(float) Load 34(param)
Store 31(y) 38
39: 6(float) Load 35(param)
Store 29(z) 39
43: 6(float) Load 27(x)
44: 6(float) Load 31(y)
45: 6(float) Load 29(z)
47: 14(fvec4) CompositeConstruct 43 44 45 46
48: 15(ptr) AccessChain 41(psout) 42
Store 48 47
52: 7(ptr) AccessChain 20(inpos) 51
53: 6(float) Load 52
54: 7(ptr) AccessChain 41(psout) 49
Store 54 53
55:18(PS_OUTPUT) Load 41(psout)
ReturnValue 55
FunctionEnd