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.samplegrad.array.dx10.frag
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:24 Function Definition: main( (temp structure{temp 4-component vector of float Color, temp float Depth})
0:24 Function Definition: @main( (temp structure{temp 4-component vector of float Color, temp float Depth})
0:24 Function Parameters:
0:? Sequence
0:27 Sequence
@@ -175,24 +175,28 @@ gl_FragCoord origin is upper left
0:40 1 (const int)
0:40 Constant:
0:40 1.000000
0:42 Sequence
0:42 Sequence
0:42 move second child to first child (temp 4-component vector of float)
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
0:42 Color: direct index for structure (temp 4-component vector of float)
0:42 'psout' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:42 Constant:
0:42 0 (const int)
0:42 move second child to first child (temp float)
0:? 'Depth' (out float FragDepth)
0:42 Depth: direct index for structure (temp float)
0:42 'psout' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:42 Constant:
0:42 1 (const int)
0:42 Branch: Return
0:42 Branch: Return with expression
0:42 'psout' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:24 Function Definition: main( (temp void)
0:24 Function Parameters:
0:? Sequence
0:24 Sequence
0:24 move second child to first child (temp structure{temp 4-component vector of float Color, temp float Depth})
0:24 'flattenTemp' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:24 Function Call: @main( (temp structure{temp 4-component vector of float Color, temp float Depth})
0:24 move second child to first child (temp 4-component vector of float)
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
0:24 Color: direct index for structure (temp 4-component vector of float)
0:24 'flattenTemp' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:24 Constant:
0:24 0 (const int)
0:24 move second child to first child (temp float)
0:? 'Depth' (out float FragDepth)
0:24 Depth: direct index for structure (temp float)
0:24 'flattenTemp' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:24 Constant:
0:24 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)
@@ -204,6 +208,8 @@ gl_FragCoord origin is upper left
0:? 'g_tTexcdf4' (uniform textureCubeArray)
0:? 'g_tTexcdi4' (uniform itextureCubeArray)
0:? 'g_tTexcdu4' (uniform utextureCubeArray)
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
0:? 'Depth' (out float FragDepth)
Linked fragment stage:
@@ -212,7 +218,7 @@ Linked fragment stage:
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:24 Function Definition: main( (temp structure{temp 4-component vector of float Color, temp float Depth})
0:24 Function Definition: @main( (temp structure{temp 4-component vector of float Color, temp float Depth})
0:24 Function Parameters:
0:? Sequence
0:27 Sequence
@@ -385,24 +391,28 @@ gl_FragCoord origin is upper left
0:40 1 (const int)
0:40 Constant:
0:40 1.000000
0:42 Sequence
0:42 Sequence
0:42 move second child to first child (temp 4-component vector of float)
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
0:42 Color: direct index for structure (temp 4-component vector of float)
0:42 'psout' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:42 Constant:
0:42 0 (const int)
0:42 move second child to first child (temp float)
0:? 'Depth' (out float FragDepth)
0:42 Depth: direct index for structure (temp float)
0:42 'psout' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:42 Constant:
0:42 1 (const int)
0:42 Branch: Return
0:42 Branch: Return with expression
0:42 'psout' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:24 Function Definition: main( (temp void)
0:24 Function Parameters:
0:? Sequence
0:24 Sequence
0:24 move second child to first child (temp structure{temp 4-component vector of float Color, temp float Depth})
0:24 'flattenTemp' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:24 Function Call: @main( (temp structure{temp 4-component vector of float Color, temp float Depth})
0:24 move second child to first child (temp 4-component vector of float)
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
0:24 Color: direct index for structure (temp 4-component vector of float)
0:24 'flattenTemp' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:24 Constant:
0:24 0 (const int)
0:24 move second child to first child (temp float)
0:? 'Depth' (out float FragDepth)
0:24 Depth: direct index for structure (temp float)
0:24 'flattenTemp' (temp structure{temp 4-component vector of float Color, temp float Depth})
0:24 Constant:
0:24 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)
@@ -414,203 +424,216 @@ gl_FragCoord origin is upper left
0:? 'g_tTexcdf4' (uniform textureCubeArray)
0:? 'g_tTexcdi4' (uniform itextureCubeArray)
0:? 'g_tTexcdu4' (uniform utextureCubeArray)
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 133
// Id's are bound by 140
Capability Shader
Capability Sampled1D
Capability SampledCubeArray
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 124 128
EntryPoint Fragment 4 "main" 132 136
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 9 "txval10"
Name 12 "g_tTex1df4"
Name 16 "g_sSamp"
Name 30 "txval11"
Name 33 "g_tTex1di4"
Name 42 "txval12"
Name 45 "g_tTex1du4"
Name 51 "txval20"
Name 54 "g_tTex2df4"
Name 64 "txval21"
Name 67 "g_tTex2di4"
Name 73 "txval22"
Name 76 "g_tTex2du4"
Name 82 "txval40"
Name 85 "g_tTexcdf4"
Name 95 "txval41"
Name 98 "g_tTexcdi4"
Name 104 "txval42"
Name 107 "g_tTexcdu4"
Name 113 "PS_OUTPUT"
MemberName 113(PS_OUTPUT) 0 "Color"
MemberName 113(PS_OUTPUT) 1 "Depth"
Name 115 "psout"
Name 124 "Color"
Name 128 "Depth"
Name 132 "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 33(g_tTex1di4) DescriptorSet 0
Decorate 45(g_tTex1du4) DescriptorSet 0
Decorate 54(g_tTex2df4) DescriptorSet 0
Decorate 67(g_tTex2di4) DescriptorSet 0
Decorate 76(g_tTex2du4) DescriptorSet 0
Decorate 85(g_tTexcdf4) DescriptorSet 0
Decorate 98(g_tTexcdi4) DescriptorSet 0
Decorate 107(g_tTexcdu4) DescriptorSet 0
Decorate 124(Color) Location 0
Decorate 128(Depth) BuiltIn FragDepth
Decorate 132(g_tTex1df4a) DescriptorSet 0
Decorate 132(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 34 "txval11"
Name 37 "g_tTex1di4"
Name 46 "txval12"
Name 49 "g_tTex1du4"
Name 55 "txval20"
Name 58 "g_tTex2df4"
Name 68 "txval21"
Name 71 "g_tTex2di4"
Name 77 "txval22"
Name 80 "g_tTex2du4"
Name 86 "txval40"
Name 89 "g_tTexcdf4"
Name 99 "txval41"
Name 102 "g_tTexcdi4"
Name 108 "txval42"
Name 111 "g_tTexcdu4"
Name 118 "psout"
Name 129 "flattenTemp"
Name 132 "Color"
Name 136 "Depth"
Name 139 "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 37(g_tTex1di4) DescriptorSet 0
Decorate 49(g_tTex1du4) DescriptorSet 0
Decorate 58(g_tTex2df4) DescriptorSet 0
Decorate 71(g_tTex2di4) DescriptorSet 0
Decorate 80(g_tTex2du4) DescriptorSet 0
Decorate 89(g_tTexcdf4) DescriptorSet 0
Decorate 102(g_tTexcdi4) DescriptorSet 0
Decorate 111(g_tTexcdu4) DescriptorSet 0
Decorate 132(Color) Location 0
Decorate 136(Depth) BuiltIn FragDepth
Decorate 139(g_tTex1df4a) DescriptorSet 0
Decorate 139(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: 6(float) Constant 1066192077
25: 6(float) Constant 1067030938
27: TypeInt 32 1
28: TypeVector 27(int) 4
29: TypePointer Function 28(ivec4)
31: TypeImage 27(int) 1D array sampled format:Unknown
32: TypePointer UniformConstant 31
33(g_tTex1di4): 32(ptr) Variable UniformConstant
36: TypeSampledImage 31
39: TypeInt 32 0
40: TypeVector 39(int) 4
41: TypePointer Function 40(ivec4)
43: TypeImage 39(int) 1D array sampled format:Unknown
44: TypePointer UniformConstant 43
45(g_tTex1du4): 44(ptr) Variable UniformConstant
48: TypeSampledImage 43
52: TypeImage 6(float) 2D array sampled format:Unknown
53: TypePointer UniformConstant 52
54(g_tTex2df4): 53(ptr) Variable UniformConstant
57: TypeSampledImage 52
59: TypeVector 6(float) 3
60: 6(float) Constant 1050253722
61: 59(fvec3) ConstantComposite 21 22 60
62: 20(fvec2) ConstantComposite 24 25
65: TypeImage 27(int) 2D array sampled format:Unknown
66: TypePointer UniformConstant 65
67(g_tTex2di4): 66(ptr) Variable UniformConstant
70: TypeSampledImage 65
74: TypeImage 39(int) 2D array sampled format:Unknown
75: TypePointer UniformConstant 74
76(g_tTex2du4): 75(ptr) Variable UniformConstant
79: TypeSampledImage 74
83: TypeImage 6(float) Cube array sampled format:Unknown
84: TypePointer UniformConstant 83
85(g_tTexcdf4): 84(ptr) Variable UniformConstant
88: TypeSampledImage 83
90: 6(float) Constant 1053609165
91: 7(fvec4) ConstantComposite 21 22 60 90
92: 6(float) Constant 1067869798
93: 59(fvec3) ConstantComposite 24 25 92
96: TypeImage 27(int) Cube array sampled format:Unknown
97: TypePointer UniformConstant 96
98(g_tTexcdi4): 97(ptr) Variable UniformConstant
101: TypeSampledImage 96
105: TypeImage 39(int) Cube array sampled format:Unknown
106: TypePointer UniformConstant 105
107(g_tTexcdu4): 106(ptr) Variable UniformConstant
110: TypeSampledImage 105
113(PS_OUTPUT): TypeStruct 7(fvec4) 6(float)
114: TypePointer Function 113(PS_OUTPUT)
116: 27(int) Constant 0
117: 6(float) Constant 1065353216
118: 7(fvec4) ConstantComposite 117 117 117 117
120: 27(int) Constant 1
121: TypePointer Function 6(float)
123: TypePointer Output 7(fvec4)
124(Color): 123(ptr) Variable Output
127: TypePointer Output 6(float)
128(Depth): 127(ptr) Variable Output
132(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: 6(float) Constant 1066192077
29: 6(float) Constant 1067030938
31: TypeInt 32 1
32: TypeVector 31(int) 4
33: TypePointer Function 32(ivec4)
35: TypeImage 31(int) 1D array sampled format:Unknown
36: TypePointer UniformConstant 35
37(g_tTex1di4): 36(ptr) Variable UniformConstant
40: TypeSampledImage 35
43: TypeInt 32 0
44: TypeVector 43(int) 4
45: TypePointer Function 44(ivec4)
47: TypeImage 43(int) 1D array sampled format:Unknown
48: TypePointer UniformConstant 47
49(g_tTex1du4): 48(ptr) Variable UniformConstant
52: TypeSampledImage 47
56: TypeImage 6(float) 2D array sampled format:Unknown
57: TypePointer UniformConstant 56
58(g_tTex2df4): 57(ptr) Variable UniformConstant
61: TypeSampledImage 56
63: TypeVector 6(float) 3
64: 6(float) Constant 1050253722
65: 63(fvec3) ConstantComposite 25 26 64
66: 24(fvec2) ConstantComposite 28 29
69: TypeImage 31(int) 2D array sampled format:Unknown
70: TypePointer UniformConstant 69
71(g_tTex2di4): 70(ptr) Variable UniformConstant
74: TypeSampledImage 69
78: TypeImage 43(int) 2D array sampled format:Unknown
79: TypePointer UniformConstant 78
80(g_tTex2du4): 79(ptr) Variable UniformConstant
83: TypeSampledImage 78
87: TypeImage 6(float) Cube array sampled format:Unknown
88: TypePointer UniformConstant 87
89(g_tTexcdf4): 88(ptr) Variable UniformConstant
92: TypeSampledImage 87
94: 6(float) Constant 1053609165
95: 7(fvec4) ConstantComposite 25 26 64 94
96: 6(float) Constant 1067869798
97: 63(fvec3) ConstantComposite 28 29 96
100: TypeImage 31(int) Cube array sampled format:Unknown
101: TypePointer UniformConstant 100
102(g_tTexcdi4): 101(ptr) Variable UniformConstant
105: TypeSampledImage 100
109: TypeImage 43(int) Cube array sampled format:Unknown
110: TypePointer UniformConstant 109
111(g_tTexcdu4): 110(ptr) Variable UniformConstant
114: TypeSampledImage 109
117: TypePointer Function 8(PS_OUTPUT)
119: 31(int) Constant 0
120: 6(float) Constant 1065353216
121: 7(fvec4) ConstantComposite 120 120 120 120
123: 31(int) Constant 1
124: TypePointer Function 6(float)
131: TypePointer Output 7(fvec4)
132(Color): 131(ptr) Variable Output
135: TypePointer Output 6(float)
136(Depth): 135(ptr) Variable Output
139(g_tTex1df4a): 15(ptr) Variable UniformConstant
4(main): 2 Function None 3
5: Label
9(txval10): 8(ptr) Variable Function
30(txval11): 29(ptr) Variable Function
42(txval12): 41(ptr) Variable Function
51(txval20): 8(ptr) Variable Function
64(txval21): 29(ptr) Variable Function
73(txval22): 41(ptr) Variable Function
82(txval40): 8(ptr) Variable Function
95(txval41): 29(ptr) Variable Function
104(txval42): 41(ptr) Variable Function
115(psout): 114(ptr) Variable Function
13: 10 Load 12(g_tTex1df4)
17: 14 Load 16(g_sSamp)
19: 18 SampledImage 13 17
26: 7(fvec4) ImageSampleExplicitLod 19 23 Grad 24 25
Store 9(txval10) 26
34: 31 Load 33(g_tTex1di4)
35: 14 Load 16(g_sSamp)
37: 36 SampledImage 34 35
38: 28(ivec4) ImageSampleExplicitLod 37 23 Grad 24 25
Store 30(txval11) 38
46: 43 Load 45(g_tTex1du4)
47: 14 Load 16(g_sSamp)
49: 48 SampledImage 46 47
50: 40(ivec4) ImageSampleExplicitLod 49 23 Grad 24 25
Store 42(txval12) 50
55: 52 Load 54(g_tTex2df4)
56: 14 Load 16(g_sSamp)
58: 57 SampledImage 55 56
63: 7(fvec4) ImageSampleExplicitLod 58 61 Grad 62 62
Store 51(txval20) 63
68: 65 Load 67(g_tTex2di4)
69: 14 Load 16(g_sSamp)
71: 70 SampledImage 68 69
72: 28(ivec4) ImageSampleExplicitLod 71 61 Grad 62 62
Store 64(txval21) 72
77: 74 Load 76(g_tTex2du4)
78: 14 Load 16(g_sSamp)
80: 79 SampledImage 77 78
81: 40(ivec4) ImageSampleExplicitLod 80 61 Grad 62 62
Store 73(txval22) 81
86: 83 Load 85(g_tTexcdf4)
87: 14 Load 16(g_sSamp)
89: 88 SampledImage 86 87
94: 7(fvec4) ImageSampleExplicitLod 89 91 Grad 93 93
Store 82(txval40) 94
99: 96 Load 98(g_tTexcdi4)
100: 14 Load 16(g_sSamp)
102: 101 SampledImage 99 100
103: 28(ivec4) ImageSampleExplicitLod 102 91 Grad 93 93
Store 95(txval41) 103
108: 105 Load 107(g_tTexcdu4)
109: 14 Load 16(g_sSamp)
111: 110 SampledImage 108 109
112: 40(ivec4) ImageSampleExplicitLod 111 91 Grad 93 93
Store 104(txval42) 112
119: 8(ptr) AccessChain 115(psout) 116
Store 119 118
122: 121(ptr) AccessChain 115(psout) 120
Store 122 117
125: 8(ptr) AccessChain 115(psout) 116
126: 7(fvec4) Load 125
Store 124(Color) 126
129: 121(ptr) AccessChain 115(psout) 120
130: 6(float) Load 129
Store 128(Depth) 130
129(flattenTemp): 117(ptr) Variable Function
130:8(PS_OUTPUT) FunctionCall 10(@main()
Store 129(flattenTemp) 130
133: 12(ptr) AccessChain 129(flattenTemp) 119
134: 7(fvec4) Load 133
Store 132(Color) 134
137: 124(ptr) AccessChain 129(flattenTemp) 123
138: 6(float) Load 137
Store 136(Depth) 138
Return
FunctionEnd
10(@main():8(PS_OUTPUT) Function None 9
11: Label
13(txval10): 12(ptr) Variable Function
34(txval11): 33(ptr) Variable Function
46(txval12): 45(ptr) Variable Function
55(txval20): 12(ptr) Variable Function
68(txval21): 33(ptr) Variable Function
77(txval22): 45(ptr) Variable Function
86(txval40): 12(ptr) Variable Function
99(txval41): 33(ptr) Variable Function
108(txval42): 45(ptr) Variable Function
118(psout): 117(ptr) Variable Function
17: 14 Load 16(g_tTex1df4)
21: 18 Load 20(g_sSamp)
23: 22 SampledImage 17 21
30: 7(fvec4) ImageSampleExplicitLod 23 27 Grad 28 29
Store 13(txval10) 30
38: 35 Load 37(g_tTex1di4)
39: 18 Load 20(g_sSamp)
41: 40 SampledImage 38 39
42: 32(ivec4) ImageSampleExplicitLod 41 27 Grad 28 29
Store 34(txval11) 42
50: 47 Load 49(g_tTex1du4)
51: 18 Load 20(g_sSamp)
53: 52 SampledImage 50 51
54: 44(ivec4) ImageSampleExplicitLod 53 27 Grad 28 29
Store 46(txval12) 54
59: 56 Load 58(g_tTex2df4)
60: 18 Load 20(g_sSamp)
62: 61 SampledImage 59 60
67: 7(fvec4) ImageSampleExplicitLod 62 65 Grad 66 66
Store 55(txval20) 67
72: 69 Load 71(g_tTex2di4)
73: 18 Load 20(g_sSamp)
75: 74 SampledImage 72 73
76: 32(ivec4) ImageSampleExplicitLod 75 65 Grad 66 66
Store 68(txval21) 76
81: 78 Load 80(g_tTex2du4)
82: 18 Load 20(g_sSamp)
84: 83 SampledImage 81 82
85: 44(ivec4) ImageSampleExplicitLod 84 65 Grad 66 66
Store 77(txval22) 85
90: 87 Load 89(g_tTexcdf4)
91: 18 Load 20(g_sSamp)
93: 92 SampledImage 90 91
98: 7(fvec4) ImageSampleExplicitLod 93 95 Grad 97 97
Store 86(txval40) 98
103: 100 Load 102(g_tTexcdi4)
104: 18 Load 20(g_sSamp)
106: 105 SampledImage 103 104
107: 32(ivec4) ImageSampleExplicitLod 106 95 Grad 97 97
Store 99(txval41) 107
112: 109 Load 111(g_tTexcdu4)
113: 18 Load 20(g_sSamp)
115: 114 SampledImage 112 113
116: 44(ivec4) ImageSampleExplicitLod 115 95 Grad 97 97
Store 108(txval42) 116
122: 12(ptr) AccessChain 118(psout) 119
Store 122 121
125: 124(ptr) AccessChain 118(psout) 123
Store 125 120
126:8(PS_OUTPUT) Load 118(psout)
ReturnValue 126
FunctionEnd