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,32 +2,51 @@ hlsl.precedence2.frag
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:7 Function Definition: PixelShaderFunction(i1;i1;i1;i1; (temp int)
0:7 Function Definition: @PixelShaderFunction(i1;i1;i1;i1; (temp int)
0:7 Function Parameters:
0:7 'a1' (layout(location=0 ) in int)
0:7 'a2' (layout(location=1 ) in int)
0:7 'a3' (layout(location=2 ) in int)
0:7 'a4' (layout(location=3 ) in int)
0:7 'a1' (in int)
0:7 'a2' (in int)
0:7 'a3' (in int)
0:7 'a4' (in int)
0:? Sequence
0:8 Sequence
0:8 move second child to first child (temp int)
0:? '@entryPointOutput' (layout(location=0 ) out int)
0:8 add (temp int)
0:8 left-shift (temp int)
0:8 add (temp int)
0:8 component-wise multiply (temp int)
0:8 'a1' (layout(location=0 ) in int)
0:8 'a2' (layout(location=1 ) in int)
0:8 'a3' (layout(location=2 ) in int)
0:8 'a4' (layout(location=3 ) in int)
0:8 left-shift (temp int)
0:8 'a1' (layout(location=0 ) in int)
0:8 add (temp int)
0:8 'a2' (layout(location=1 ) in int)
0:8 component-wise multiply (temp int)
0:8 'a3' (layout(location=2 ) in int)
0:8 'a4' (layout(location=3 ) in int)
0:8 Branch: Return
0:8 Branch: Return with expression
0:8 add (temp int)
0:8 left-shift (temp int)
0:8 add (temp int)
0:8 component-wise multiply (temp int)
0:8 'a1' (in int)
0:8 'a2' (in int)
0:8 'a3' (in int)
0:8 'a4' (in int)
0:8 left-shift (temp int)
0:8 'a1' (in int)
0:8 add (temp int)
0:8 'a2' (in int)
0:8 component-wise multiply (temp int)
0:8 'a3' (in int)
0:8 'a4' (in int)
0:7 Function Definition: PixelShaderFunction( (temp void)
0:7 Function Parameters:
0:? Sequence
0:7 move second child to first child (temp int)
0:? 'a1' (temp int)
0:? 'a1' (layout(location=0 ) in int)
0:7 move second child to first child (temp int)
0:? 'a2' (temp int)
0:? 'a2' (layout(location=1 ) in int)
0:7 move second child to first child (temp int)
0:? 'a3' (temp int)
0:? 'a3' (layout(location=2 ) in int)
0:7 move second child to first child (temp int)
0:? 'a4' (temp int)
0:? 'a4' (layout(location=3 ) in int)
0:7 move second child to first child (temp int)
0:? '@entryPointOutput' (layout(location=0 ) out int)
0:7 Function Call: @PixelShaderFunction(i1;i1;i1;i1; (temp int)
0:? 'a1' (temp int)
0:? 'a2' (temp int)
0:? 'a3' (temp int)
0:? 'a4' (temp int)
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out int)
0:? 'a1' (layout(location=0 ) in int)
@ -42,32 +61,51 @@ Linked fragment stage:
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:7 Function Definition: PixelShaderFunction(i1;i1;i1;i1; (temp int)
0:7 Function Definition: @PixelShaderFunction(i1;i1;i1;i1; (temp int)
0:7 Function Parameters:
0:7 'a1' (layout(location=0 ) in int)
0:7 'a2' (layout(location=1 ) in int)
0:7 'a3' (layout(location=2 ) in int)
0:7 'a4' (layout(location=3 ) in int)
0:7 'a1' (in int)
0:7 'a2' (in int)
0:7 'a3' (in int)
0:7 'a4' (in int)
0:? Sequence
0:8 Sequence
0:8 move second child to first child (temp int)
0:? '@entryPointOutput' (layout(location=0 ) out int)
0:8 add (temp int)
0:8 left-shift (temp int)
0:8 add (temp int)
0:8 component-wise multiply (temp int)
0:8 'a1' (layout(location=0 ) in int)
0:8 'a2' (layout(location=1 ) in int)
0:8 'a3' (layout(location=2 ) in int)
0:8 'a4' (layout(location=3 ) in int)
0:8 left-shift (temp int)
0:8 'a1' (layout(location=0 ) in int)
0:8 add (temp int)
0:8 'a2' (layout(location=1 ) in int)
0:8 component-wise multiply (temp int)
0:8 'a3' (layout(location=2 ) in int)
0:8 'a4' (layout(location=3 ) in int)
0:8 Branch: Return
0:8 Branch: Return with expression
0:8 add (temp int)
0:8 left-shift (temp int)
0:8 add (temp int)
0:8 component-wise multiply (temp int)
0:8 'a1' (in int)
0:8 'a2' (in int)
0:8 'a3' (in int)
0:8 'a4' (in int)
0:8 left-shift (temp int)
0:8 'a1' (in int)
0:8 add (temp int)
0:8 'a2' (in int)
0:8 component-wise multiply (temp int)
0:8 'a3' (in int)
0:8 'a4' (in int)
0:7 Function Definition: PixelShaderFunction( (temp void)
0:7 Function Parameters:
0:? Sequence
0:7 move second child to first child (temp int)
0:? 'a1' (temp int)
0:? 'a1' (layout(location=0 ) in int)
0:7 move second child to first child (temp int)
0:? 'a2' (temp int)
0:? 'a2' (layout(location=1 ) in int)
0:7 move second child to first child (temp int)
0:? 'a3' (temp int)
0:? 'a3' (layout(location=2 ) in int)
0:7 move second child to first child (temp int)
0:? 'a4' (temp int)
0:? 'a4' (layout(location=3 ) in int)
0:7 move second child to first child (temp int)
0:? '@entryPointOutput' (layout(location=0 ) out int)
0:7 Function Call: @PixelShaderFunction(i1;i1;i1;i1; (temp int)
0:? 'a1' (temp int)
0:? 'a2' (temp int)
0:? 'a3' (temp int)
0:? 'a4' (temp int)
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out int)
0:? 'a1' (layout(location=0 ) in int)
@ -77,51 +115,99 @@ gl_FragCoord origin is upper left
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 30
// Id's are bound by 56
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "PixelShaderFunction" 8 10 12 15 18
EntryPoint Fragment 4 "PixelShaderFunction" 34 37 40 43 46
ExecutionMode 4 OriginUpperLeft
Name 4 "PixelShaderFunction"
Name 8 "@entryPointOutput"
Name 10 "a1"
Name 12 "a2"
Name 15 "a3"
Name 18 "a4"
Decorate 8(@entryPointOutput) Location 0
Decorate 10(a1) Location 0
Decorate 12(a2) Location 1
Decorate 15(a3) Location 2
Decorate 18(a4) Location 3
Name 13 "@PixelShaderFunction(i1;i1;i1;i1;"
Name 9 "a1"
Name 10 "a2"
Name 11 "a3"
Name 12 "a4"
Name 32 "a1"
Name 34 "a1"
Name 36 "a2"
Name 37 "a2"
Name 39 "a3"
Name 40 "a3"
Name 42 "a4"
Name 43 "a4"
Name 46 "@entryPointOutput"
Name 47 "param"
Name 49 "param"
Name 51 "param"
Name 53 "param"
Decorate 34(a1) Location 0
Decorate 37(a2) Location 1
Decorate 40(a3) Location 2
Decorate 43(a4) Location 3
Decorate 46(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypePointer Output 6(int)
8(@entryPointOutput): 7(ptr) Variable Output
9: TypePointer Input 6(int)
10(a1): 9(ptr) Variable Input
12(a2): 9(ptr) Variable Input
15(a3): 9(ptr) Variable Input
18(a4): 9(ptr) Variable Input
7: TypePointer Function 6(int)
8: TypeFunction 6(int) 7(ptr) 7(ptr) 7(ptr) 7(ptr)
33: TypePointer Input 6(int)
34(a1): 33(ptr) Variable Input
37(a2): 33(ptr) Variable Input
40(a3): 33(ptr) Variable Input
43(a4): 33(ptr) Variable Input
45: TypePointer Output 6(int)
46(@entryPointOutput): 45(ptr) Variable Output
4(PixelShaderFunction): 2 Function None 3
5: Label
11: 6(int) Load 10(a1)
13: 6(int) Load 12(a2)
14: 6(int) IMul 11 13
16: 6(int) Load 15(a3)
17: 6(int) IAdd 14 16
19: 6(int) Load 18(a4)
20: 6(int) ShiftLeftLogical 17 19
21: 6(int) Load 10(a1)
22: 6(int) Load 12(a2)
23: 6(int) Load 15(a3)
24: 6(int) Load 18(a4)
25: 6(int) IMul 23 24
26: 6(int) IAdd 22 25
27: 6(int) ShiftLeftLogical 21 26
28: 6(int) IAdd 20 27
Store 8(@entryPointOutput) 28
32(a1): 7(ptr) Variable Function
36(a2): 7(ptr) Variable Function
39(a3): 7(ptr) Variable Function
42(a4): 7(ptr) Variable Function
47(param): 7(ptr) Variable Function
49(param): 7(ptr) Variable Function
51(param): 7(ptr) Variable Function
53(param): 7(ptr) Variable Function
35: 6(int) Load 34(a1)
Store 32(a1) 35
38: 6(int) Load 37(a2)
Store 36(a2) 38
41: 6(int) Load 40(a3)
Store 39(a3) 41
44: 6(int) Load 43(a4)
Store 42(a4) 44
48: 6(int) Load 32(a1)
Store 47(param) 48
50: 6(int) Load 36(a2)
Store 49(param) 50
52: 6(int) Load 39(a3)
Store 51(param) 52
54: 6(int) Load 42(a4)
Store 53(param) 54
55: 6(int) FunctionCall 13(@PixelShaderFunction(i1;i1;i1;i1;) 47(param) 49(param) 51(param) 53(param)
Store 46(@entryPointOutput) 55
Return
FunctionEnd
13(@PixelShaderFunction(i1;i1;i1;i1;): 6(int) Function None 8
9(a1): 7(ptr) FunctionParameter
10(a2): 7(ptr) FunctionParameter
11(a3): 7(ptr) FunctionParameter
12(a4): 7(ptr) FunctionParameter
14: Label
15: 6(int) Load 9(a1)
16: 6(int) Load 10(a2)
17: 6(int) IMul 15 16
18: 6(int) Load 11(a3)
19: 6(int) IAdd 17 18
20: 6(int) Load 12(a4)
21: 6(int) ShiftLeftLogical 19 20
22: 6(int) Load 9(a1)
23: 6(int) Load 10(a2)
24: 6(int) Load 11(a3)
25: 6(int) Load 12(a4)
26: 6(int) IMul 24 25
27: 6(int) IAdd 23 26
28: 6(int) ShiftLeftLogical 22 27
29: 6(int) IAdd 21 28
ReturnValue 29
FunctionEnd