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.constructexpr.frag
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:4 Function Definition: main( (temp structure{temp 4-component vector of float color})
0:4 Function Definition: @main( (temp structure{temp 4-component vector of float color})
0:4 Function Parameters:
0:? Sequence
0:6 Constant:
@@ -34,15 +34,18 @@ gl_FragCoord origin is upper left
0:15 1.000000
0:15 1.000000
0:15 1.000000
0:16 Sequence
0:16 Sequence
0:16 move second child to first child (temp 4-component vector of float)
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:16 color: direct index for structure (temp 4-component vector of float)
0:16 'ps_output' (temp structure{temp 4-component vector of float color})
0:16 Constant:
0:16 0 (const int)
0:16 Branch: Return
0:16 Branch: Return with expression
0:16 'ps_output' (temp structure{temp 4-component vector of float color})
0:4 Function Definition: main( (temp void)
0:4 Function Parameters:
0:? Sequence
0:4 Sequence
0:4 move second child to first child (temp 4-component vector of float)
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:4 color: direct index for structure (temp 4-component vector of float)
0:4 Function Call: @main( (temp structure{temp 4-component vector of float color})
0:4 Constant:
0:4 0 (const int)
0:? Linker Objects
0:? 'color' (layout(location=0 ) out 4-component vector of float)
@@ -53,7 +56,7 @@ Linked fragment stage:
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:4 Function Definition: main( (temp structure{temp 4-component vector of float color})
0:4 Function Definition: @main( (temp structure{temp 4-component vector of float color})
0:4 Function Parameters:
0:? Sequence
0:6 Constant:
@@ -85,66 +88,76 @@ gl_FragCoord origin is upper left
0:15 1.000000
0:15 1.000000
0:15 1.000000
0:16 Sequence
0:16 Sequence
0:16 move second child to first child (temp 4-component vector of float)
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:16 color: direct index for structure (temp 4-component vector of float)
0:16 'ps_output' (temp structure{temp 4-component vector of float color})
0:16 Constant:
0:16 0 (const int)
0:16 Branch: Return
0:16 Branch: Return with expression
0:16 'ps_output' (temp structure{temp 4-component vector of float color})
0:4 Function Definition: main( (temp void)
0:4 Function Parameters:
0:? Sequence
0:4 Sequence
0:4 move second child to first child (temp 4-component vector of float)
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:4 color: direct index for structure (temp 4-component vector of float)
0:4 Function Call: @main( (temp structure{temp 4-component vector of float color})
0:4 Constant:
0:4 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 35
// Id's are bound by 40
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 31
EntryPoint Fragment 4 "main" 37
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 22 "PS_OUTPUT"
MemberName 22(PS_OUTPUT) 0 "color"
Name 24 "ps_output"
Name 31 "color"
Decorate 31(color) Location 0
Name 8 "PS_OUTPUT"
MemberName 8(PS_OUTPUT) 0 "color"
Name 10 "@main("
Name 27 "ps_output"
Name 37 "color"
Decorate 37(color) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: 6(int) Constant 3
8: 6(int) Constant 4
9: 6(int) Constant 5
10: 6(int) Constant 6
11: 6(int) Constant 7
12: 6(int) Constant 8
13: TypeFloat 32
14: TypeVector 13(float) 2
15: 13(float) Constant 1091567616
16: 13(float) Constant 1092616192
17: 14(fvec2) ConstantComposite 15 16
18: 13(float) Constant 1093664768
19: 13(float) Constant 1094713344
20: 14(fvec2) ConstantComposite 18 19
21: TypeVector 13(float) 4
22(PS_OUTPUT): TypeStruct 21(fvec4)
23: TypePointer Function 22(PS_OUTPUT)
25: 6(int) Constant 0
26: 13(float) Constant 1065353216
27: 21(fvec4) ConstantComposite 26 26 26 26
28: TypePointer Function 21(fvec4)
30: TypePointer Output 21(fvec4)
31(color): 30(ptr) Variable Output
6: TypeFloat 32
7: TypeVector 6(float) 4
8(PS_OUTPUT): TypeStruct 7(fvec4)
9: TypeFunction 8(PS_OUTPUT)
12: TypeInt 32 1
13: 12(int) Constant 3
14: 12(int) Constant 4
15: 12(int) Constant 5
16: 12(int) Constant 6
17: 12(int) Constant 7
18: 12(int) Constant 8
19: TypeVector 6(float) 2
20: 6(float) Constant 1091567616
21: 6(float) Constant 1092616192
22: 19(fvec2) ConstantComposite 20 21
23: 6(float) Constant 1093664768
24: 6(float) Constant 1094713344
25: 19(fvec2) ConstantComposite 23 24
26: TypePointer Function 8(PS_OUTPUT)
28: 12(int) Constant 0
29: 6(float) Constant 1065353216
30: 7(fvec4) ConstantComposite 29 29 29 29
31: TypePointer Function 7(fvec4)
36: TypePointer Output 7(fvec4)
37(color): 36(ptr) Variable Output
4(main): 2 Function None 3
5: Label
24(ps_output): 23(ptr) Variable Function
29: 28(ptr) AccessChain 24(ps_output) 25
Store 29 27
32: 28(ptr) AccessChain 24(ps_output) 25
33: 21(fvec4) Load 32
Store 31(color) 33
38:8(PS_OUTPUT) FunctionCall 10(@main()
39: 7(fvec4) CompositeExtract 38 0
Store 37(color) 39
Return
FunctionEnd
10(@main():8(PS_OUTPUT) Function None 9
11: Label
27(ps_output): 26(ptr) Variable Function
32: 31(ptr) AccessChain 27(ps_output) 28
Store 32 30
33:8(PS_OUTPUT) Load 27(ps_output)
ReturnValue 33
FunctionEnd