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.sample.offsetarray.dx10.frag
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:20 Function Definition: main( (temp structure{temp 4-component vector of float Color, temp float Depth})
0:20 Function Definition: @main( (temp structure{temp 4-component vector of float Color, temp float Depth})
0:20 Function Parameters:
0:? Sequence
0:23 Sequence
@@ -100,24 +100,28 @@ gl_FragCoord origin is upper left
0:34 1 (const int)
0:34 Constant:
0:34 1.000000
0:36 Sequence
0:36 Sequence
0:36 move second child to first child (temp 4-component vector of float)
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
0:36 Color: direct index for structure (temp 4-component vector of float)
0:36 'psout' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:36 Constant:
0:36 0 (const int)
0:36 move second child to first child (temp float)
0:? 'Depth' (out float FragDepth)
0:36 Depth: direct index for structure (temp float)
0:36 'psout' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:36 Constant:
0:36 1 (const int)
0:36 Branch: Return
0:36 Branch: Return with expression
0:36 'psout' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:20 Function Definition: main( (temp void)
0:20 Function Parameters:
0:? Sequence
0:20 Sequence
0:20 move second child to first child (temp structure{temp 4-component vector of float Color, temp float Depth})
0:20 'flattenTemp' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:20 Function Call: @main( (temp structure{temp 4-component vector of float Color, temp float Depth})
0:20 move second child to first child (temp 4-component vector of float)
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
0:20 Color: direct index for structure (temp 4-component vector of float)
0:20 'flattenTemp' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:20 Constant:
0:20 0 (const int)
0:20 move second child to first child (temp float)
0:? 'Depth' (out float FragDepth)
0:20 Depth: direct index for structure (temp float)
0:20 'flattenTemp' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:20 Constant:
0:20 1 (const int)
0:? Linker Objects
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
0:? 'Depth' (out float FragDepth)
0:? 'g_sSamp' (layout(binding=0 ) uniform sampler)
0:? 'g_tTex1df4a' (layout(binding=1 ) uniform texture1DArray)
0:? 'g_tTex1df4' (layout(binding=0 ) uniform texture1DArray)
@@ -126,6 +130,8 @@ gl_FragCoord origin is upper left
0:? 'g_tTex2df4' (uniform texture2DArray)
0:? 'g_tTex2di4' (uniform itexture2DArray)
0:? 'g_tTex2du4' (uniform utexture2DArray)
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
0:? 'Depth' (out float FragDepth)
Linked fragment stage:
@@ -134,7 +140,7 @@ Linked fragment stage:
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:20 Function Definition: main( (temp structure{temp 4-component vector of float Color, temp float Depth})
0:20 Function Definition: @main( (temp structure{temp 4-component vector of float Color, temp float Depth})
0:20 Function Parameters:
0:? Sequence
0:23 Sequence
@@ -232,24 +238,28 @@ gl_FragCoord origin is upper left
0:34 1 (const int)
0:34 Constant:
0:34 1.000000
0:36 Sequence
0:36 Sequence
0:36 move second child to first child (temp 4-component vector of float)
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
0:36 Color: direct index for structure (temp 4-component vector of float)
0:36 'psout' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:36 Constant:
0:36 0 (const int)
0:36 move second child to first child (temp float)
0:? 'Depth' (out float FragDepth)
0:36 Depth: direct index for structure (temp float)
0:36 'psout' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:36 Constant:
0:36 1 (const int)
0:36 Branch: Return
0:36 Branch: Return with expression
0:36 'psout' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:20 Function Definition: main( (temp void)
0:20 Function Parameters:
0:? Sequence
0:20 Sequence
0:20 move second child to first child (temp structure{temp 4-component vector of float Color, temp float Depth})
0:20 'flattenTemp' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:20 Function Call: @main( (temp structure{temp 4-component vector of float Color, temp float Depth})
0:20 move second child to first child (temp 4-component vector of float)
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
0:20 Color: direct index for structure (temp 4-component vector of float)
0:20 'flattenTemp' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:20 Constant:
0:20 0 (const int)
0:20 move second child to first child (temp float)
0:? 'Depth' (out float FragDepth)
0:20 Depth: direct index for structure (temp float)
0:20 'flattenTemp' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:20 Constant:
0:20 1 (const int)
0:? Linker Objects
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
0:? 'Depth' (out float FragDepth)
0:? 'g_sSamp' (layout(binding=0 ) uniform sampler)
0:? 'g_tTex1df4a' (layout(binding=1 ) uniform texture1DArray)
0:? 'g_tTex1df4' (layout(binding=0 ) uniform texture1DArray)
@@ -258,168 +268,181 @@ gl_FragCoord origin is upper left
0:? 'g_tTex2df4' (uniform texture2DArray)
0:? 'g_tTex2di4' (uniform itexture2DArray)
0:? 'g_tTex2du4' (uniform utexture2DArray)
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
0:? 'Depth' (out float FragDepth)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 111
// Id's are bound by 118
Capability Shader
Capability Sampled1D
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 102 106
EntryPoint Fragment 4 "main" 110 114
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 9 "txval10"
Name 12 "g_tTex1df4"
Name 16 "g_sSamp"
Name 29 "txval11"
Name 32 "g_tTex1di4"
Name 44 "txval12"
Name 47 "g_tTex1du4"
Name 56 "txval20"
Name 59 "g_tTex2df4"
Name 69 "txval21"
Name 72 "g_tTex2di4"
Name 80 "txval22"
Name 83 "g_tTex2du4"
Name 93 "PS_OUTPUT"
MemberName 93(PS_OUTPUT) 0 "Color"
MemberName 93(PS_OUTPUT) 1 "Depth"
Name 95 "psout"
Name 102 "Color"
Name 106 "Depth"
Name 110 "g_tTex1df4a"
Decorate 12(g_tTex1df4) DescriptorSet 0
Decorate 12(g_tTex1df4) Binding 0
Decorate 16(g_sSamp) DescriptorSet 0
Decorate 16(g_sSamp) Binding 0
Decorate 32(g_tTex1di4) DescriptorSet 0
Decorate 47(g_tTex1du4) DescriptorSet 0
Decorate 59(g_tTex2df4) DescriptorSet 0
Decorate 72(g_tTex2di4) DescriptorSet 0
Decorate 83(g_tTex2du4) DescriptorSet 0
Decorate 102(Color) Location 0
Decorate 106(Depth) BuiltIn FragDepth
Decorate 110(g_tTex1df4a) DescriptorSet 0
Decorate 110(g_tTex1df4a) Binding 1
Name 8 "PS_OUTPUT"
MemberName 8(PS_OUTPUT) 0 "Color"
MemberName 8(PS_OUTPUT) 1 "Depth"
Name 10 "@main("
Name 13 "txval10"
Name 16 "g_tTex1df4"
Name 20 "g_sSamp"
Name 33 "txval11"
Name 36 "g_tTex1di4"
Name 48 "txval12"
Name 51 "g_tTex1du4"
Name 60 "txval20"
Name 63 "g_tTex2df4"
Name 73 "txval21"
Name 76 "g_tTex2di4"
Name 84 "txval22"
Name 87 "g_tTex2du4"
Name 98 "psout"
Name 107 "flattenTemp"
Name 110 "Color"
Name 114 "Depth"
Name 117 "g_tTex1df4a"
Decorate 16(g_tTex1df4) DescriptorSet 0
Decorate 16(g_tTex1df4) Binding 0
Decorate 20(g_sSamp) DescriptorSet 0
Decorate 20(g_sSamp) Binding 0
Decorate 36(g_tTex1di4) DescriptorSet 0
Decorate 51(g_tTex1du4) DescriptorSet 0
Decorate 63(g_tTex2df4) DescriptorSet 0
Decorate 76(g_tTex2di4) DescriptorSet 0
Decorate 87(g_tTex2du4) DescriptorSet 0
Decorate 110(Color) Location 0
Decorate 114(Depth) BuiltIn FragDepth
Decorate 117(g_tTex1df4a) DescriptorSet 0
Decorate 117(g_tTex1df4a) Binding 1
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypePointer Function 7(fvec4)
10: TypeImage 6(float) 1D array sampled format:Unknown
11: TypePointer UniformConstant 10
12(g_tTex1df4): 11(ptr) Variable UniformConstant
14: TypeSampler
8(PS_OUTPUT): TypeStruct 7(fvec4) 6(float)
9: TypeFunction 8(PS_OUTPUT)
12: TypePointer Function 7(fvec4)
14: TypeImage 6(float) 1D array sampled format:Unknown
15: TypePointer UniformConstant 14
16(g_sSamp): 15(ptr) Variable UniformConstant
18: TypeSampledImage 10
20: TypeVector 6(float) 2
21: 6(float) Constant 1036831949
22: 6(float) Constant 1045220557
23: 20(fvec2) ConstantComposite 21 22
24: TypeInt 32 1
25: 24(int) Constant 0
27: TypeVector 24(int) 4
28: TypePointer Function 27(ivec4)
30: TypeImage 24(int) 1D array sampled format:Unknown
31: TypePointer UniformConstant 30
32(g_tTex1di4): 31(ptr) Variable UniformConstant
35: TypeSampledImage 30
37: 6(float) Constant 1050253722
38: 20(fvec2) ConstantComposite 22 37
39: 24(int) Constant 1
41: TypeInt 32 0
42: TypeVector 41(int) 4
43: TypePointer Function 42(ivec4)
45: TypeImage 41(int) 1D array sampled format:Unknown
46: TypePointer UniformConstant 45
47(g_tTex1du4): 46(ptr) Variable UniformConstant
50: TypeSampledImage 45
52: 6(float) Constant 1053609165
53: 20(fvec2) ConstantComposite 37 52
54: 24(int) Constant 2
57: TypeImage 6(float) 2D array sampled format:Unknown
58: TypePointer UniformConstant 57
59(g_tTex2df4): 58(ptr) Variable UniformConstant
62: TypeSampledImage 57
64: TypeVector 6(float) 3
65: 64(fvec3) ConstantComposite 21 22 37
66: TypeVector 24(int) 2
67: 66(ivec2) ConstantComposite 25 25
70: TypeImage 24(int) 2D array sampled format:Unknown
71: TypePointer UniformConstant 70
72(g_tTex2di4): 71(ptr) Variable UniformConstant
75: TypeSampledImage 70
77: 6(float) Constant 1056964608
78: 64(fvec3) ConstantComposite 37 52 77
81: TypeImage 41(int) 2D array sampled format:Unknown
82: TypePointer UniformConstant 81
83(g_tTex2du4): 82(ptr) Variable UniformConstant
86: TypeSampledImage 81
88: 6(float) Constant 1058642330
89: 6(float) Constant 1060320051
90: 64(fvec3) ConstantComposite 77 88 89
91: 66(ivec2) ConstantComposite 25 39
93(PS_OUTPUT): TypeStruct 7(fvec4) 6(float)
94: TypePointer Function 93(PS_OUTPUT)
96: 6(float) Constant 1065353216
97: 7(fvec4) ConstantComposite 96 96 96 96
99: TypePointer Function 6(float)
101: TypePointer Output 7(fvec4)
102(Color): 101(ptr) Variable Output
105: TypePointer Output 6(float)
106(Depth): 105(ptr) Variable Output
110(g_tTex1df4a): 11(ptr) Variable UniformConstant
16(g_tTex1df4): 15(ptr) Variable UniformConstant
18: TypeSampler
19: TypePointer UniformConstant 18
20(g_sSamp): 19(ptr) Variable UniformConstant
22: TypeSampledImage 14
24: TypeVector 6(float) 2
25: 6(float) Constant 1036831949
26: 6(float) Constant 1045220557
27: 24(fvec2) ConstantComposite 25 26
28: TypeInt 32 1
29: 28(int) Constant 0
31: TypeVector 28(int) 4
32: TypePointer Function 31(ivec4)
34: TypeImage 28(int) 1D array sampled format:Unknown
35: TypePointer UniformConstant 34
36(g_tTex1di4): 35(ptr) Variable UniformConstant
39: TypeSampledImage 34
41: 6(float) Constant 1050253722
42: 24(fvec2) ConstantComposite 26 41
43: 28(int) Constant 1
45: TypeInt 32 0
46: TypeVector 45(int) 4
47: TypePointer Function 46(ivec4)
49: TypeImage 45(int) 1D array sampled format:Unknown
50: TypePointer UniformConstant 49
51(g_tTex1du4): 50(ptr) Variable UniformConstant
54: TypeSampledImage 49
56: 6(float) Constant 1053609165
57: 24(fvec2) ConstantComposite 41 56
58: 28(int) Constant 2
61: TypeImage 6(float) 2D array sampled format:Unknown
62: TypePointer UniformConstant 61
63(g_tTex2df4): 62(ptr) Variable UniformConstant
66: TypeSampledImage 61
68: TypeVector 6(float) 3
69: 68(fvec3) ConstantComposite 25 26 41
70: TypeVector 28(int) 2
71: 70(ivec2) ConstantComposite 29 29
74: TypeImage 28(int) 2D array sampled format:Unknown
75: TypePointer UniformConstant 74
76(g_tTex2di4): 75(ptr) Variable UniformConstant
79: TypeSampledImage 74
81: 6(float) Constant 1056964608
82: 68(fvec3) ConstantComposite 41 56 81
85: TypeImage 45(int) 2D array sampled format:Unknown
86: TypePointer UniformConstant 85
87(g_tTex2du4): 86(ptr) Variable UniformConstant
90: TypeSampledImage 85
92: 6(float) Constant 1058642330
93: 6(float) Constant 1060320051
94: 68(fvec3) ConstantComposite 81 92 93
95: 70(ivec2) ConstantComposite 29 43
97: TypePointer Function 8(PS_OUTPUT)
99: 6(float) Constant 1065353216
100: 7(fvec4) ConstantComposite 99 99 99 99
102: TypePointer Function 6(float)
109: TypePointer Output 7(fvec4)
110(Color): 109(ptr) Variable Output
113: TypePointer Output 6(float)
114(Depth): 113(ptr) Variable Output
117(g_tTex1df4a): 15(ptr) Variable UniformConstant
4(main): 2 Function None 3
5: Label
9(txval10): 8(ptr) Variable Function
29(txval11): 28(ptr) Variable Function
44(txval12): 43(ptr) Variable Function
56(txval20): 8(ptr) Variable Function
69(txval21): 28(ptr) Variable Function
80(txval22): 43(ptr) Variable Function
95(psout): 94(ptr) Variable Function
13: 10 Load 12(g_tTex1df4)
17: 14 Load 16(g_sSamp)
19: 18 SampledImage 13 17
26: 7(fvec4) ImageSampleImplicitLod 19 23 ConstOffset 25
Store 9(txval10) 26
33: 30 Load 32(g_tTex1di4)
34: 14 Load 16(g_sSamp)
36: 35 SampledImage 33 34
40: 27(ivec4) ImageSampleImplicitLod 36 38 ConstOffset 39
Store 29(txval11) 40
48: 45 Load 47(g_tTex1du4)
49: 14 Load 16(g_sSamp)
51: 50 SampledImage 48 49
55: 42(ivec4) ImageSampleImplicitLod 51 53 ConstOffset 54
Store 44(txval12) 55
60: 57 Load 59(g_tTex2df4)
61: 14 Load 16(g_sSamp)
63: 62 SampledImage 60 61
68: 7(fvec4) ImageSampleImplicitLod 63 65 ConstOffset 67
Store 56(txval20) 68
73: 70 Load 72(g_tTex2di4)
74: 14 Load 16(g_sSamp)
76: 75 SampledImage 73 74
79: 27(ivec4) ImageSampleImplicitLod 76 78 ConstOffset 67
Store 69(txval21) 79
84: 81 Load 83(g_tTex2du4)
85: 14 Load 16(g_sSamp)
87: 86 SampledImage 84 85
92: 42(ivec4) ImageSampleImplicitLod 87 90 ConstOffset 91
Store 80(txval22) 92
98: 8(ptr) AccessChain 95(psout) 25
Store 98 97
100: 99(ptr) AccessChain 95(psout) 39
Store 100 96
103: 8(ptr) AccessChain 95(psout) 25
104: 7(fvec4) Load 103
Store 102(Color) 104
107: 99(ptr) AccessChain 95(psout) 39
108: 6(float) Load 107
Store 106(Depth) 108
107(flattenTemp): 97(ptr) Variable Function
108:8(PS_OUTPUT) FunctionCall 10(@main()
Store 107(flattenTemp) 108
111: 12(ptr) AccessChain 107(flattenTemp) 29
112: 7(fvec4) Load 111
Store 110(Color) 112
115: 102(ptr) AccessChain 107(flattenTemp) 43
116: 6(float) Load 115
Store 114(Depth) 116
Return
FunctionEnd
10(@main():8(PS_OUTPUT) Function None 9
11: Label
13(txval10): 12(ptr) Variable Function
33(txval11): 32(ptr) Variable Function
48(txval12): 47(ptr) Variable Function
60(txval20): 12(ptr) Variable Function
73(txval21): 32(ptr) Variable Function
84(txval22): 47(ptr) Variable Function
98(psout): 97(ptr) Variable Function
17: 14 Load 16(g_tTex1df4)
21: 18 Load 20(g_sSamp)
23: 22 SampledImage 17 21
30: 7(fvec4) ImageSampleImplicitLod 23 27 ConstOffset 29
Store 13(txval10) 30
37: 34 Load 36(g_tTex1di4)
38: 18 Load 20(g_sSamp)
40: 39 SampledImage 37 38
44: 31(ivec4) ImageSampleImplicitLod 40 42 ConstOffset 43
Store 33(txval11) 44
52: 49 Load 51(g_tTex1du4)
53: 18 Load 20(g_sSamp)
55: 54 SampledImage 52 53
59: 46(ivec4) ImageSampleImplicitLod 55 57 ConstOffset 58
Store 48(txval12) 59
64: 61 Load 63(g_tTex2df4)
65: 18 Load 20(g_sSamp)
67: 66 SampledImage 64 65
72: 7(fvec4) ImageSampleImplicitLod 67 69 ConstOffset 71
Store 60(txval20) 72
77: 74 Load 76(g_tTex2di4)
78: 18 Load 20(g_sSamp)
80: 79 SampledImage 77 78
83: 31(ivec4) ImageSampleImplicitLod 80 82 ConstOffset 71
Store 73(txval21) 83
88: 85 Load 87(g_tTex2du4)
89: 18 Load 20(g_sSamp)
91: 90 SampledImage 88 89
96: 46(ivec4) ImageSampleImplicitLod 91 94 ConstOffset 95
Store 84(txval22) 96
101: 12(ptr) AccessChain 98(psout) 29
Store 101 100
103: 102(ptr) AccessChain 98(psout) 43
Store 103 99
104:8(PS_OUTPUT) Load 98(psout)
ReturnValue 104
FunctionEnd