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

@@ -6,7 +6,7 @@ gl_FragCoord origin is upper left
0:6 Function Parameters:
0:6 'myfloat' (noContraction in float)
0:6 'myfloat3' (noContraction out 3-component vector of float)
0:9 Function Definition: main( (temp structure{noContraction temp 4-component vector of float color})
0:9 Function Definition: @main( (temp structure{noContraction temp 4-component vector of float color})
0:9 Function Parameters:
0:? Sequence
0:11 move second child to first child (noContraction temp 4-component vector of float)
@@ -19,18 +19,21 @@ gl_FragCoord origin is upper left
0:11 1.000000
0:11 1.000000
0:11 1.000000
0:12 Sequence
0:12 Sequence
0:12 move second child to first child (noContraction temp 4-component vector of float)
0:? 'color' (layout(location=0 ) noContraction out 4-component vector of float)
0:12 color: direct index for structure (noContraction temp 4-component vector of float)
0:12 'ps_output' (temp structure{noContraction temp 4-component vector of float color})
0:12 Constant:
0:12 0 (const int)
0:12 Branch: Return
0:12 Branch: Return with expression
0:12 'ps_output' (temp structure{noContraction temp 4-component vector of float color})
0:9 Function Definition: main( (temp void)
0:9 Function Parameters:
0:? Sequence
0:9 Sequence
0:9 move second child to first child (noContraction temp 4-component vector of float)
0:? 'color' (layout(location=0 ) noContraction out 4-component vector of float)
0:9 color: direct index for structure (noContraction temp 4-component vector of float)
0:9 Function Call: @main( (temp structure{noContraction temp 4-component vector of float color})
0:9 Constant:
0:9 0 (const int)
0:? Linker Objects
0:? 'color' (layout(location=0 ) noContraction out 4-component vector of float)
0:? 'precisefloat' (noContraction global float)
0:? 'color' (layout(location=0 ) noContraction out 4-component vector of float)
Linked fragment stage:
@@ -43,7 +46,7 @@ gl_FragCoord origin is upper left
0:6 Function Parameters:
0:6 'myfloat' (noContraction in float)
0:6 'myfloat3' (noContraction out 3-component vector of float)
0:9 Function Definition: main( (temp structure{noContraction temp 4-component vector of float color})
0:9 Function Definition: @main( (temp structure{noContraction temp 4-component vector of float color})
0:9 Function Parameters:
0:? Sequence
0:11 move second child to first child (noContraction temp 4-component vector of float)
@@ -56,27 +59,30 @@ gl_FragCoord origin is upper left
0:11 1.000000
0:11 1.000000
0:11 1.000000
0:12 Sequence
0:12 Sequence
0:12 move second child to first child (noContraction temp 4-component vector of float)
0:? 'color' (layout(location=0 ) noContraction out 4-component vector of float)
0:12 color: direct index for structure (noContraction temp 4-component vector of float)
0:12 'ps_output' (temp structure{noContraction temp 4-component vector of float color})
0:12 Constant:
0:12 0 (const int)
0:12 Branch: Return
0:12 Branch: Return with expression
0:12 'ps_output' (temp structure{noContraction temp 4-component vector of float color})
0:9 Function Definition: main( (temp void)
0:9 Function Parameters:
0:? Sequence
0:9 Sequence
0:9 move second child to first child (noContraction temp 4-component vector of float)
0:? 'color' (layout(location=0 ) noContraction out 4-component vector of float)
0:9 color: direct index for structure (noContraction temp 4-component vector of float)
0:9 Function Call: @main( (temp structure{noContraction temp 4-component vector of float color})
0:9 Constant:
0:9 0 (const int)
0:? Linker Objects
0:? 'color' (layout(location=0 ) noContraction out 4-component vector of float)
0:? 'precisefloat' (noContraction global float)
0:? 'color' (layout(location=0 ) noContraction out 4-component vector of float)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 32
// Id's are bound by 37
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 26
EntryPoint Fragment 4 "main" 32
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 13 "MyFunction(f1;vf3;"
@@ -84,10 +90,11 @@ gl_FragCoord origin is upper left
Name 12 "myfloat3"
Name 16 "PS_OUTPUT"
MemberName 16(PS_OUTPUT) 0 "color"
Name 18 "ps_output"
Name 26 "color"
Name 31 "precisefloat"
Decorate 26(color) Location 0
Name 18 "@main("
Name 21 "ps_output"
Name 32 "color"
Name 36 "precisefloat"
Decorate 32(color) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@@ -97,24 +104,22 @@ gl_FragCoord origin is upper left
10: TypeFunction 2 7(ptr) 9(ptr)
15: TypeVector 6(float) 4
16(PS_OUTPUT): TypeStruct 15(fvec4)
17: TypePointer Function 16(PS_OUTPUT)
19: TypeInt 32 1
20: 19(int) Constant 0
21: 6(float) Constant 1065353216
22: 15(fvec4) ConstantComposite 21 21 21 21
23: TypePointer Function 15(fvec4)
25: TypePointer Output 15(fvec4)
26(color): 25(ptr) Variable Output
30: TypePointer Private 6(float)
31(precisefloat): 30(ptr) Variable Private
17: TypeFunction 16(PS_OUTPUT)
20: TypePointer Function 16(PS_OUTPUT)
22: TypeInt 32 1
23: 22(int) Constant 0
24: 6(float) Constant 1065353216
25: 15(fvec4) ConstantComposite 24 24 24 24
26: TypePointer Function 15(fvec4)
31: TypePointer Output 15(fvec4)
32(color): 31(ptr) Variable Output
35: TypePointer Private 6(float)
36(precisefloat): 35(ptr) Variable Private
4(main): 2 Function None 3
5: Label
18(ps_output): 17(ptr) Variable Function
24: 23(ptr) AccessChain 18(ps_output) 20
Store 24 22
27: 23(ptr) AccessChain 18(ps_output) 20
28: 15(fvec4) Load 27
Store 26(color) 28
33:16(PS_OUTPUT) FunctionCall 18(@main()
34: 15(fvec4) CompositeExtract 33 0
Store 32(color) 34
Return
FunctionEnd
13(MyFunction(f1;vf3;): 2 Function None 10
@@ -123,3 +128,11 @@ gl_FragCoord origin is upper left
14: Label
Return
FunctionEnd
18(@main():16(PS_OUTPUT) Function None 17
19: Label
21(ps_output): 20(ptr) Variable Function
27: 26(ptr) AccessChain 21(ps_output) 23
Store 27 25
28:16(PS_OUTPUT) Load 21(ps_output)
ReturnValue 28
FunctionEnd