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

@ -14,39 +14,42 @@ gl_FragCoord origin is upper left
0:? 2.000000
0:? 3.000000
0:? 4.000000
0:16 Function Definition: main( (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
0:16 Function Definition: @main( (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
0:16 Function Parameters:
0:? Sequence
0:17 Sequence
0:17 Sequence
0:17 move second child to first child (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
0:17 'flattenTemp' (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
0:17 Function Call: Func1( (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
0:17 move second child to first child (temp 4-component vector of float)
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:17 color: direct index for structure (temp 4-component vector of float)
0:17 'flattenTemp' (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
0:17 Constant:
0:17 0 (const int)
0:17 move second child to first child (temp float)
0:? 'other_struct_member1' (layout(location=1 ) out float)
0:17 other_struct_member1: direct index for structure (temp float)
0:17 'flattenTemp' (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
0:17 Constant:
0:17 1 (const int)
0:17 move second child to first child (temp float)
0:? 'other_struct_member2' (layout(location=2 ) out float)
0:17 other_struct_member2: direct index for structure (temp float)
0:17 'flattenTemp' (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
0:17 Constant:
0:17 2 (const int)
0:17 move second child to first child (temp float)
0:? 'other_struct_member3' (layout(location=3 ) out float)
0:17 other_struct_member3: direct index for structure (temp float)
0:17 'flattenTemp' (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
0:17 Constant:
0:17 3 (const int)
0:17 Branch: Return
0:17 Branch: Return with expression
0:17 Function Call: Func1( (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
0:16 Function Definition: main( (temp void)
0:16 Function Parameters:
0:? Sequence
0:16 Sequence
0:16 move second child to first child (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
0:16 'flattenTemp' (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
0:16 Function Call: @main( (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
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 'flattenTemp' (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
0:16 Constant:
0:16 0 (const int)
0:16 move second child to first child (temp float)
0:? 'other_struct_member1' (layout(location=1 ) out float)
0:16 other_struct_member1: direct index for structure (temp float)
0:16 'flattenTemp' (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
0:16 Constant:
0:16 1 (const int)
0:16 move second child to first child (temp float)
0:? 'other_struct_member2' (layout(location=2 ) out float)
0:16 other_struct_member2: direct index for structure (temp float)
0:16 'flattenTemp' (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
0:16 Constant:
0:16 2 (const int)
0:16 move second child to first child (temp float)
0:? 'other_struct_member3' (layout(location=3 ) out float)
0:16 other_struct_member3: direct index for structure (temp float)
0:16 'flattenTemp' (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
0:16 Constant:
0:16 3 (const int)
0:? Linker Objects
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:? 'other_struct_member1' (layout(location=1 ) out float)
@ -72,39 +75,42 @@ gl_FragCoord origin is upper left
0:? 2.000000
0:? 3.000000
0:? 4.000000
0:16 Function Definition: main( (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
0:16 Function Definition: @main( (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
0:16 Function Parameters:
0:? Sequence
0:17 Sequence
0:17 Sequence
0:17 move second child to first child (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
0:17 'flattenTemp' (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
0:17 Function Call: Func1( (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
0:17 move second child to first child (temp 4-component vector of float)
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:17 color: direct index for structure (temp 4-component vector of float)
0:17 'flattenTemp' (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
0:17 Constant:
0:17 0 (const int)
0:17 move second child to first child (temp float)
0:? 'other_struct_member1' (layout(location=1 ) out float)
0:17 other_struct_member1: direct index for structure (temp float)
0:17 'flattenTemp' (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
0:17 Constant:
0:17 1 (const int)
0:17 move second child to first child (temp float)
0:? 'other_struct_member2' (layout(location=2 ) out float)
0:17 other_struct_member2: direct index for structure (temp float)
0:17 'flattenTemp' (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
0:17 Constant:
0:17 2 (const int)
0:17 move second child to first child (temp float)
0:? 'other_struct_member3' (layout(location=3 ) out float)
0:17 other_struct_member3: direct index for structure (temp float)
0:17 'flattenTemp' (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
0:17 Constant:
0:17 3 (const int)
0:17 Branch: Return
0:17 Branch: Return with expression
0:17 Function Call: Func1( (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
0:16 Function Definition: main( (temp void)
0:16 Function Parameters:
0:? Sequence
0:16 Sequence
0:16 move second child to first child (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
0:16 'flattenTemp' (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
0:16 Function Call: @main( (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
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 'flattenTemp' (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
0:16 Constant:
0:16 0 (const int)
0:16 move second child to first child (temp float)
0:? 'other_struct_member1' (layout(location=1 ) out float)
0:16 other_struct_member1: direct index for structure (temp float)
0:16 'flattenTemp' (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
0:16 Constant:
0:16 1 (const int)
0:16 move second child to first child (temp float)
0:? 'other_struct_member2' (layout(location=2 ) out float)
0:16 other_struct_member2: direct index for structure (temp float)
0:16 'flattenTemp' (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
0:16 Constant:
0:16 2 (const int)
0:16 move second child to first child (temp float)
0:? 'other_struct_member3' (layout(location=3 ) out float)
0:16 other_struct_member3: direct index for structure (temp float)
0:16 'flattenTemp' (temp structure{temp 4-component vector of float color, temp float other_struct_member1, temp float other_struct_member2, temp float other_struct_member3})
0:16 Constant:
0:16 3 (const int)
0:? Linker Objects
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:? 'other_struct_member1' (layout(location=1 ) out float)
@ -113,12 +119,12 @@ gl_FragCoord origin is upper left
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 45
// Id's are bound by 49
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 24 31 36 40
EntryPoint Fragment 4 "main" 29 36 41 45
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 8 "PS_OUTPUT"
@ -127,61 +133,67 @@ gl_FragCoord origin is upper left
MemberName 8(PS_OUTPUT) 2 "other_struct_member2"
MemberName 8(PS_OUTPUT) 3 "other_struct_member3"
Name 10 "Func1("
Name 21 "flattenTemp"
Name 24 "color"
Name 31 "other_struct_member1"
Name 36 "other_struct_member2"
Name 40 "other_struct_member3"
Decorate 24(color) Location 0
Decorate 31(other_struct_member1) Location 1
Decorate 36(other_struct_member2) Location 2
Decorate 40(other_struct_member3) Location 3
Name 12 "@main("
Name 26 "flattenTemp"
Name 29 "color"
Name 36 "other_struct_member1"
Name 41 "other_struct_member2"
Name 45 "other_struct_member3"
Decorate 29(color) Location 0
Decorate 36(other_struct_member1) Location 1
Decorate 41(other_struct_member2) Location 2
Decorate 45(other_struct_member3) Location 3
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8(PS_OUTPUT): TypeStruct 7(fvec4) 6(float) 6(float) 6(float)
9: TypeFunction 8(PS_OUTPUT)
12: 6(float) Constant 1065353216
13: 7(fvec4) ConstantComposite 12 12 12 12
14: 6(float) Constant 1073741824
15: 6(float) Constant 1077936128
16: 6(float) Constant 1082130432
17:8(PS_OUTPUT) ConstantComposite 13 14 15 16
20: TypePointer Function 8(PS_OUTPUT)
23: TypePointer Output 7(fvec4)
24(color): 23(ptr) Variable Output
25: TypeInt 32 1
26: 25(int) Constant 0
27: TypePointer Function 7(fvec4)
30: TypePointer Output 6(float)
31(other_struct_member1): 30(ptr) Variable Output
32: 25(int) Constant 1
33: TypePointer Function 6(float)
36(other_struct_member2): 30(ptr) Variable Output
37: 25(int) Constant 2
40(other_struct_member3): 30(ptr) Variable Output
41: 25(int) Constant 3
14: 6(float) Constant 1065353216
15: 7(fvec4) ConstantComposite 14 14 14 14
16: 6(float) Constant 1073741824
17: 6(float) Constant 1077936128
18: 6(float) Constant 1082130432
19:8(PS_OUTPUT) ConstantComposite 15 16 17 18
25: TypePointer Function 8(PS_OUTPUT)
28: TypePointer Output 7(fvec4)
29(color): 28(ptr) Variable Output
30: TypeInt 32 1
31: 30(int) Constant 0
32: TypePointer Function 7(fvec4)
35: TypePointer Output 6(float)
36(other_struct_member1): 35(ptr) Variable Output
37: 30(int) Constant 1
38: TypePointer Function 6(float)
41(other_struct_member2): 35(ptr) Variable Output
42: 30(int) Constant 2
45(other_struct_member3): 35(ptr) Variable Output
46: 30(int) Constant 3
4(main): 2 Function None 3
5: Label
21(flattenTemp): 20(ptr) Variable Function
22:8(PS_OUTPUT) FunctionCall 10(Func1()
Store 21(flattenTemp) 22
28: 27(ptr) AccessChain 21(flattenTemp) 26
29: 7(fvec4) Load 28
Store 24(color) 29
34: 33(ptr) AccessChain 21(flattenTemp) 32
35: 6(float) Load 34
Store 31(other_struct_member1) 35
38: 33(ptr) AccessChain 21(flattenTemp) 37
39: 6(float) Load 38
Store 36(other_struct_member2) 39
42: 33(ptr) AccessChain 21(flattenTemp) 41
43: 6(float) Load 42
Store 40(other_struct_member3) 43
26(flattenTemp): 25(ptr) Variable Function
27:8(PS_OUTPUT) FunctionCall 12(@main()
Store 26(flattenTemp) 27
33: 32(ptr) AccessChain 26(flattenTemp) 31
34: 7(fvec4) Load 33
Store 29(color) 34
39: 38(ptr) AccessChain 26(flattenTemp) 37
40: 6(float) Load 39
Store 36(other_struct_member1) 40
43: 38(ptr) AccessChain 26(flattenTemp) 42
44: 6(float) Load 43
Store 41(other_struct_member2) 44
47: 38(ptr) AccessChain 26(flattenTemp) 46
48: 6(float) Load 47
Store 45(other_struct_member3) 48
Return
FunctionEnd
10(Func1():8(PS_OUTPUT) Function None 9
11: Label
ReturnValue 17
ReturnValue 19
FunctionEnd
12(@main():8(PS_OUTPUT) Function None 9
13: Label
22:8(PS_OUTPUT) FunctionCall 10(Func1()
ReturnValue 22
FunctionEnd