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.numericsuffixes.frag
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:5 Function Definition: main( (temp structure{temp 4-component vector of float color})
0:5 Function Definition: @main( (temp structure{temp 4-component vector of float color})
0:5 Function Parameters:
0:? Sequence
0:7 Sequence
@ -58,15 +58,18 @@ gl_FragCoord origin is upper left
0:18 Construct vec4 (temp 4-component vector of float)
0:18 Convert int to float (temp float)
0:18 'r07' (temp int)
0:19 Sequence
0:19 Sequence
0:19 move second child to first child (temp 4-component vector of float)
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:19 color: direct index for structure (temp 4-component vector of float)
0:19 'ps_output' (temp structure{temp 4-component vector of float color})
0:19 Constant:
0:19 0 (const int)
0:19 Branch: Return
0:19 Branch: Return with expression
0:19 'ps_output' (temp structure{temp 4-component vector of float color})
0:5 Function Definition: main( (temp void)
0:5 Function Parameters:
0:? Sequence
0:5 Sequence
0:5 move second child to first child (temp 4-component vector of float)
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:5 color: direct index for structure (temp 4-component vector of float)
0:5 Function Call: @main( (temp structure{temp 4-component vector of float color})
0:5 Constant:
0:5 0 (const int)
0:? Linker Objects
0:? 'color' (layout(location=0 ) out 4-component vector of float)
@ -77,7 +80,7 @@ Linked fragment stage:
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:5 Function Definition: main( (temp structure{temp 4-component vector of float color})
0:5 Function Definition: @main( (temp structure{temp 4-component vector of float color})
0:5 Function Parameters:
0:? Sequence
0:7 Sequence
@ -133,93 +136,103 @@ gl_FragCoord origin is upper left
0:18 Construct vec4 (temp 4-component vector of float)
0:18 Convert int to float (temp float)
0:18 'r07' (temp int)
0:19 Sequence
0:19 Sequence
0:19 move second child to first child (temp 4-component vector of float)
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:19 color: direct index for structure (temp 4-component vector of float)
0:19 'ps_output' (temp structure{temp 4-component vector of float color})
0:19 Constant:
0:19 0 (const int)
0:19 Branch: Return
0:19 Branch: Return with expression
0:19 'ps_output' (temp structure{temp 4-component vector of float color})
0:5 Function Definition: main( (temp void)
0:5 Function Parameters:
0:? Sequence
0:5 Sequence
0:5 move second child to first child (temp 4-component vector of float)
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:5 color: direct index for structure (temp 4-component vector of float)
0:5 Function Call: @main( (temp structure{temp 4-component vector of float color})
0:5 Constant:
0:5 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 44
// Id's are bound by 49
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 40
EntryPoint Fragment 4 "main" 46
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 8 "r00"
Name 12 "r01"
Name 14 "r02"
Name 16 "r03"
Name 18 "r04"
Name 21 "r05"
Name 23 "r06"
Name 25 "r07"
Name 27 "r08"
Name 30 "PS_OUTPUT"
MemberName 30(PS_OUTPUT) 0 "color"
Name 32 "ps_output"
Name 40 "color"
Decorate 40(color) Location 0
Name 8 "PS_OUTPUT"
MemberName 8(PS_OUTPUT) 0 "color"
Name 10 "@main("
Name 13 "r00"
Name 17 "r01"
Name 19 "r02"
Name 21 "r03"
Name 23 "r04"
Name 26 "r05"
Name 28 "r06"
Name 30 "r07"
Name 32 "r08"
Name 35 "ps_output"
Name 46 "color"
Decorate 46(color) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypePointer Function 6(float)
9: 6(float) Constant 1065353216
10: TypeInt 32 0
11: TypePointer Function 10(int)
13: 10(int) Constant 1
15: 10(int) Constant 2
17: 10(int) Constant 2748
19: TypeInt 32 1
20: TypePointer Function 19(int)
22: 19(int) Constant 5
24: 19(int) Constant 6
26: 19(int) Constant 57
28: 10(int) Constant 58
29: TypeVector 6(float) 4
30(PS_OUTPUT): TypeStruct 29(fvec4)
31: TypePointer Function 30(PS_OUTPUT)
33: 19(int) Constant 0
37: TypePointer Function 29(fvec4)
39: TypePointer Output 29(fvec4)
40(color): 39(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 1065353216
15: TypeInt 32 0
16: TypePointer Function 15(int)
18: 15(int) Constant 1
20: 15(int) Constant 2
22: 15(int) Constant 2748
24: TypeInt 32 1
25: TypePointer Function 24(int)
27: 24(int) Constant 5
29: 24(int) Constant 6
31: 24(int) Constant 57
33: 15(int) Constant 58
34: TypePointer Function 8(PS_OUTPUT)
36: 24(int) Constant 0
40: TypePointer Function 7(fvec4)
45: TypePointer Output 7(fvec4)
46(color): 45(ptr) Variable Output
4(main): 2 Function None 3
5: Label
8(r00): 7(ptr) Variable Function
12(r01): 11(ptr) Variable Function
14(r02): 11(ptr) Variable Function
16(r03): 11(ptr) Variable Function
18(r04): 11(ptr) Variable Function
21(r05): 20(ptr) Variable Function
23(r06): 20(ptr) Variable Function
25(r07): 20(ptr) Variable Function
27(r08): 11(ptr) Variable Function
32(ps_output): 31(ptr) Variable Function
Store 8(r00) 9
Store 12(r01) 13
Store 14(r02) 15
Store 16(r03) 17
Store 18(r04) 17
Store 21(r05) 22
Store 23(r06) 24
Store 25(r07) 26
Store 27(r08) 28
34: 19(int) Load 25(r07)
35: 6(float) ConvertSToF 34
36: 29(fvec4) CompositeConstruct 35 35 35 35
38: 37(ptr) AccessChain 32(ps_output) 33
Store 38 36
41: 37(ptr) AccessChain 32(ps_output) 33
42: 29(fvec4) Load 41
Store 40(color) 42
47:8(PS_OUTPUT) FunctionCall 10(@main()
48: 7(fvec4) CompositeExtract 47 0
Store 46(color) 48
Return
FunctionEnd
10(@main():8(PS_OUTPUT) Function None 9
11: Label
13(r00): 12(ptr) Variable Function
17(r01): 16(ptr) Variable Function
19(r02): 16(ptr) Variable Function
21(r03): 16(ptr) Variable Function
23(r04): 16(ptr) Variable Function
26(r05): 25(ptr) Variable Function
28(r06): 25(ptr) Variable Function
30(r07): 25(ptr) Variable Function
32(r08): 16(ptr) Variable Function
35(ps_output): 34(ptr) Variable Function
Store 13(r00) 14
Store 17(r01) 18
Store 19(r02) 20
Store 21(r03) 22
Store 23(r04) 22
Store 26(r05) 27
Store 28(r06) 29
Store 30(r07) 31
Store 32(r08) 33
37: 24(int) Load 30(r07)
38: 6(float) ConvertSToF 37
39: 7(fvec4) CompositeConstruct 38 38 38 38
41: 40(ptr) AccessChain 35(ps_output) 36
Store 41 39
42:8(PS_OUTPUT) Load 35(ps_output)
ReturnValue 42
FunctionEnd