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,11 +2,11 @@ hlsl.intrinsics.lit.frag
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:2 Function Definition: PixelShaderFunction(f1;f1;f1; (temp void)
0:2 Function Definition: @PixelShaderFunction(f1;f1;f1; (temp void)
0:2 Function Parameters:
0:2 'n_dot_l' (layout(location=0 ) in float)
0:2 'n_dot_h' (layout(location=1 ) in float)
0:2 'm' (layout(location=2 ) in float)
0:2 'n_dot_l' (in float)
0:2 'n_dot_h' (in float)
0:2 'm' (in float)
0:? Sequence
0:3 Sequence
0:3 move second child to first child (temp 4-component vector of float)
@@ -15,15 +15,15 @@ gl_FragCoord origin is upper left
0:3 Constant:
0:3 1.000000
0:3 max (temp float)
0:3 'n_dot_l' (layout(location=0 ) in float)
0:3 'n_dot_l' (in float)
0:3 Constant:
0:3 0.000000
0:3 Test condition and select (temp float)
0:3 Condition
0:3 Compare Less Than (temp bool)
0:3 min (temp float)
0:3 'n_dot_l' (layout(location=0 ) in float)
0:3 'n_dot_h' (layout(location=1 ) in float)
0:3 'n_dot_l' (in float)
0:3 'n_dot_h' (in float)
0:3 Constant:
0:3 0.000000
0:3 true case
@@ -31,10 +31,26 @@ gl_FragCoord origin is upper left
0:3 0.000000
0:3 false case
0:3 component-wise multiply (temp float)
0:3 'n_dot_h' (layout(location=1 ) in float)
0:3 'm' (layout(location=2 ) in float)
0:3 'n_dot_h' (in float)
0:3 'm' (in float)
0:3 Constant:
0:3 1.000000
0:2 Function Definition: PixelShaderFunction( (temp void)
0:2 Function Parameters:
0:? Sequence
0:2 move second child to first child (temp float)
0:? 'n_dot_l' (temp float)
0:? 'n_dot_l' (layout(location=0 ) in float)
0:2 move second child to first child (temp float)
0:? 'n_dot_h' (temp float)
0:? 'n_dot_h' (layout(location=1 ) in float)
0:2 move second child to first child (temp float)
0:? 'm' (temp float)
0:? 'm' (layout(location=2 ) in float)
0:2 Function Call: @PixelShaderFunction(f1;f1;f1; (temp void)
0:? 'n_dot_l' (temp float)
0:? 'n_dot_h' (temp float)
0:? 'm' (temp float)
0:? Linker Objects
0:? 'n_dot_l' (layout(location=0 ) in float)
0:? 'n_dot_h' (layout(location=1 ) in float)
@@ -47,11 +63,11 @@ Linked fragment stage:
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:2 Function Definition: PixelShaderFunction(f1;f1;f1; (temp void)
0:2 Function Definition: @PixelShaderFunction(f1;f1;f1; (temp void)
0:2 Function Parameters:
0:2 'n_dot_l' (layout(location=0 ) in float)
0:2 'n_dot_h' (layout(location=1 ) in float)
0:2 'm' (layout(location=2 ) in float)
0:2 'n_dot_l' (in float)
0:2 'n_dot_h' (in float)
0:2 'm' (in float)
0:? Sequence
0:3 Sequence
0:3 move second child to first child (temp 4-component vector of float)
@@ -60,15 +76,15 @@ gl_FragCoord origin is upper left
0:3 Constant:
0:3 1.000000
0:3 max (temp float)
0:3 'n_dot_l' (layout(location=0 ) in float)
0:3 'n_dot_l' (in float)
0:3 Constant:
0:3 0.000000
0:3 Test condition and select (temp float)
0:3 Condition
0:3 Compare Less Than (temp bool)
0:3 min (temp float)
0:3 'n_dot_l' (layout(location=0 ) in float)
0:3 'n_dot_h' (layout(location=1 ) in float)
0:3 'n_dot_l' (in float)
0:3 'n_dot_h' (in float)
0:3 Constant:
0:3 0.000000
0:3 true case
@@ -76,10 +92,26 @@ gl_FragCoord origin is upper left
0:3 0.000000
0:3 false case
0:3 component-wise multiply (temp float)
0:3 'n_dot_h' (layout(location=1 ) in float)
0:3 'm' (layout(location=2 ) in float)
0:3 'n_dot_h' (in float)
0:3 'm' (in float)
0:3 Constant:
0:3 1.000000
0:2 Function Definition: PixelShaderFunction( (temp void)
0:2 Function Parameters:
0:? Sequence
0:2 move second child to first child (temp float)
0:? 'n_dot_l' (temp float)
0:? 'n_dot_l' (layout(location=0 ) in float)
0:2 move second child to first child (temp float)
0:? 'n_dot_h' (temp float)
0:? 'n_dot_h' (layout(location=1 ) in float)
0:2 move second child to first child (temp float)
0:? 'm' (temp float)
0:? 'm' (layout(location=2 ) in float)
0:2 Function Call: @PixelShaderFunction(f1;f1;f1; (temp void)
0:? 'n_dot_l' (temp float)
0:? 'n_dot_h' (temp float)
0:? 'm' (temp float)
0:? Linker Objects
0:? 'n_dot_l' (layout(location=0 ) in float)
0:? 'n_dot_h' (layout(location=1 ) in float)
@@ -87,58 +119,95 @@ gl_FragCoord origin is upper left
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 33
// Id's are bound by 52
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "PixelShaderFunction" 12 19 28
EntryPoint Fragment 4 "PixelShaderFunction" 37 40 43
ExecutionMode 4 OriginUpperLeft
Name 4 "PixelShaderFunction"
Name 9 "r0"
Name 12 "n_dot_l"
Name 19 "n_dot_h"
Name 28 "m"
Decorate 12(n_dot_l) Location 0
Decorate 19(n_dot_h) Location 1
Decorate 28(m) Location 2
Name 12 "@PixelShaderFunction(f1;f1;f1;"
Name 9 "n_dot_l"
Name 10 "n_dot_h"
Name 11 "m"
Name 16 "r0"
Name 35 "n_dot_l"
Name 37 "n_dot_l"
Name 39 "n_dot_h"
Name 40 "n_dot_h"
Name 42 "m"
Name 43 "m"
Name 45 "param"
Name 47 "param"
Name 49 "param"
Decorate 37(n_dot_l) Location 0
Decorate 40(n_dot_h) Location 1
Decorate 43(m) Location 2
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypePointer Function 7(fvec4)
10: 6(float) Constant 1065353216
11: TypePointer Input 6(float)
12(n_dot_l): 11(ptr) Variable Input
14: 6(float) Constant 0
16: TypePointer Function 6(float)
19(n_dot_h): 11(ptr) Variable Input
22: TypeBool
28(m): 11(ptr) Variable Input
7: TypePointer Function 6(float)
8: TypeFunction 2 7(ptr) 7(ptr) 7(ptr)
14: TypeVector 6(float) 4
15: TypePointer Function 14(fvec4)
17: 6(float) Constant 1065353216
19: 6(float) Constant 0
25: TypeBool
36: TypePointer Input 6(float)
37(n_dot_l): 36(ptr) Variable Input
40(n_dot_h): 36(ptr) Variable Input
43(m): 36(ptr) Variable Input
4(PixelShaderFunction): 2 Function None 3
5: Label
9(r0): 8(ptr) Variable Function
17: 16(ptr) Variable Function
13: 6(float) Load 12(n_dot_l)
15: 6(float) ExtInst 1(GLSL.std.450) 40(FMax) 13 14
18: 6(float) Load 12(n_dot_l)
20: 6(float) Load 19(n_dot_h)
21: 6(float) ExtInst 1(GLSL.std.450) 37(FMin) 18 20
23: 22(bool) FOrdLessThan 21 14
SelectionMerge 25 None
BranchConditional 23 24 26
24: Label
Store 17 14
Branch 25
26: Label
27: 6(float) Load 19(n_dot_h)
29: 6(float) Load 28(m)
30: 6(float) FMul 27 29
Store 17 30
Branch 25
25: Label
31: 6(float) Load 17
32: 7(fvec4) CompositeConstruct 10 15 31 10
Store 9(r0) 32
35(n_dot_l): 7(ptr) Variable Function
39(n_dot_h): 7(ptr) Variable Function
42(m): 7(ptr) Variable Function
45(param): 7(ptr) Variable Function
47(param): 7(ptr) Variable Function
49(param): 7(ptr) Variable Function
38: 6(float) Load 37(n_dot_l)
Store 35(n_dot_l) 38
41: 6(float) Load 40(n_dot_h)
Store 39(n_dot_h) 41
44: 6(float) Load 43(m)
Store 42(m) 44
46: 6(float) Load 35(n_dot_l)
Store 45(param) 46
48: 6(float) Load 39(n_dot_h)
Store 47(param) 48
50: 6(float) Load 42(m)
Store 49(param) 50
51: 2 FunctionCall 12(@PixelShaderFunction(f1;f1;f1;) 45(param) 47(param) 49(param)
Return
FunctionEnd
12(@PixelShaderFunction(f1;f1;f1;): 2 Function None 8
9(n_dot_l): 7(ptr) FunctionParameter
10(n_dot_h): 7(ptr) FunctionParameter
11(m): 7(ptr) FunctionParameter
13: Label
16(r0): 15(ptr) Variable Function
21: 7(ptr) Variable Function
18: 6(float) Load 9(n_dot_l)
20: 6(float) ExtInst 1(GLSL.std.450) 40(FMax) 18 19
22: 6(float) Load 9(n_dot_l)
23: 6(float) Load 10(n_dot_h)
24: 6(float) ExtInst 1(GLSL.std.450) 37(FMin) 22 23
26: 25(bool) FOrdLessThan 24 19
SelectionMerge 28 None
BranchConditional 26 27 29
27: Label
Store 21 19
Branch 28
29: Label
30: 6(float) Load 10(n_dot_h)
31: 6(float) Load 11(m)
32: 6(float) FMul 30 31
Store 21 32
Branch 28
28: Label
33: 6(float) Load 21
34: 14(fvec4) CompositeConstruct 17 20 33 17
Store 16(r0) 34
Return
FunctionEnd