HLSL: Emulate write-to-output on return-from-entry-point, for return value.

This fixes issue #487 and #480.
It also correctly handles output parameters from the entry point.
This commit is contained in:
John Kessenich 2016-08-28 15:00:23 -06:00
parent 81cd764b5f
commit 6a70eb7161
91 changed files with 5158 additions and 4130 deletions

View file

@ -148,8 +148,11 @@ gl_FragCoord origin is upper left
0:73 1 (const int)
0:73 Constant:
0:73 1.000000
0:75 Branch: Return with expression
0:75 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:75 Sequence
0:75 move second child to first child (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:? '@entryPointOutput' (out structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:75 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:75 Branch: Return
0:? Linker Objects
0:? 'g_sSamp' (layout(binding=0 ) uniform sampler)
0:? 'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
@ -335,8 +338,11 @@ gl_FragCoord origin is upper left
0:73 1 (const int)
0:73 Constant:
0:73 1.000000
0:75 Branch: Return with expression
0:75 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:75 Sequence
0:75 move second child to first child (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:? '@entryPointOutput' (out structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:75 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:75 Branch: Return
0:? Linker Objects
0:? 'g_sSamp' (layout(binding=0 ) uniform sampler)
0:? 'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
@ -371,7 +377,7 @@ gl_FragCoord origin is upper left
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 172
// Id's are bound by 174
Capability Shader
Capability ImageGatherExtended
@ -379,7 +385,7 @@ gl_FragCoord origin is upper left
Capability SampledCubeArray
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main"
EntryPoint Fragment 4 "main" 130
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 9 "g_tTex1df4"
@ -401,21 +407,22 @@ gl_FragCoord origin is upper left
MemberName 118(PS_OUTPUT) 0 "Color"
MemberName 118(PS_OUTPUT) 1 "Depth"
Name 120 "psout"
Name 133 "g_sSamp"
Name 136 "g_tTexcdf4"
Name 139 "g_tTexcdi4"
Name 142 "g_tTexcdu4"
Name 145 "g_tTex1df4a"
Name 148 "g_tTex1di4a"
Name 151 "g_tTex1du4a"
Name 154 "g_tTex2df4a"
Name 157 "g_tTex2di4a"
Name 160 "g_tTex2du4a"
Name 163 "g_tTexcdf4a"
Name 166 "g_tTexcdi4a"
Name 169 "g_tTexcdu4a"
Name 170 "c1"
Name 171 "o4"
Name 130 "@entryPointOutput"
Name 135 "g_sSamp"
Name 138 "g_tTexcdf4"
Name 141 "g_tTexcdi4"
Name 144 "g_tTexcdu4"
Name 147 "g_tTex1df4a"
Name 150 "g_tTex1di4a"
Name 153 "g_tTex1du4a"
Name 156 "g_tTex2df4a"
Name 159 "g_tTex2di4a"
Name 162 "g_tTex2du4a"
Name 165 "g_tTexcdf4a"
Name 168 "g_tTexcdi4a"
Name 171 "g_tTexcdu4a"
Name 172 "c1"
Name 173 "o4"
Decorate 9(g_tTex1df4) DescriptorSet 0
Decorate 9(g_tTex1df4) Binding 0
Decorate 29(g_tTex1di4) DescriptorSet 0
@ -427,20 +434,20 @@ gl_FragCoord origin is upper left
Decorate 100(g_tTex3di4) DescriptorSet 0
Decorate 110(g_tTex3du4) DescriptorSet 0
MemberDecorate 118(PS_OUTPUT) 1 BuiltIn FragDepth
Decorate 133(g_sSamp) DescriptorSet 0
Decorate 133(g_sSamp) Binding 0
Decorate 136(g_tTexcdf4) DescriptorSet 0
Decorate 139(g_tTexcdi4) DescriptorSet 0
Decorate 142(g_tTexcdu4) DescriptorSet 0
Decorate 145(g_tTex1df4a) DescriptorSet 0
Decorate 148(g_tTex1di4a) DescriptorSet 0
Decorate 151(g_tTex1du4a) DescriptorSet 0
Decorate 154(g_tTex2df4a) DescriptorSet 0
Decorate 157(g_tTex2di4a) DescriptorSet 0
Decorate 160(g_tTex2du4a) DescriptorSet 0
Decorate 163(g_tTexcdf4a) DescriptorSet 0
Decorate 166(g_tTexcdi4a) DescriptorSet 0
Decorate 169(g_tTexcdu4a) DescriptorSet 0
Decorate 135(g_sSamp) DescriptorSet 0
Decorate 135(g_sSamp) Binding 0
Decorate 138(g_tTexcdf4) DescriptorSet 0
Decorate 141(g_tTexcdi4) DescriptorSet 0
Decorate 144(g_tTexcdu4) DescriptorSet 0
Decorate 147(g_tTex1df4a) DescriptorSet 0
Decorate 150(g_tTex1di4a) DescriptorSet 0
Decorate 153(g_tTex1du4a) DescriptorSet 0
Decorate 156(g_tTex2df4a) DescriptorSet 0
Decorate 159(g_tTex2di4a) DescriptorSet 0
Decorate 162(g_tTex2du4a) DescriptorSet 0
Decorate 165(g_tTexcdf4a) DescriptorSet 0
Decorate 168(g_tTexcdi4a) DescriptorSet 0
Decorate 171(g_tTexcdu4a) DescriptorSet 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@ -500,47 +507,49 @@ gl_FragCoord origin is upper left
124: TypePointer Function 25(fvec4)
126: 11(int) Constant 1
127: TypePointer Function 6(float)
131: TypeSampler
132: TypePointer UniformConstant 131
133(g_sSamp): 132(ptr) Variable UniformConstant
134: TypeImage 6(float) Cube sampled format:Unknown
135: TypePointer UniformConstant 134
136(g_tTexcdf4): 135(ptr) Variable UniformConstant
137: TypeImage 11(int) Cube sampled format:Unknown
138: TypePointer UniformConstant 137
139(g_tTexcdi4): 138(ptr) Variable UniformConstant
140: TypeImage 15(int) Cube sampled format:Unknown
141: TypePointer UniformConstant 140
142(g_tTexcdu4): 141(ptr) Variable UniformConstant
143: TypeImage 6(float) 1D array sampled format:Unknown
144: TypePointer UniformConstant 143
145(g_tTex1df4a): 144(ptr) Variable UniformConstant
146: TypeImage 11(int) 1D array sampled format:Unknown
147: TypePointer UniformConstant 146
148(g_tTex1di4a): 147(ptr) Variable UniformConstant
149: TypeImage 15(int) 1D array sampled format:Unknown
150: TypePointer UniformConstant 149
151(g_tTex1du4a): 150(ptr) Variable UniformConstant
152: TypeImage 6(float) 2D array sampled format:Unknown
153: TypePointer UniformConstant 152
154(g_tTex2df4a): 153(ptr) Variable UniformConstant
155: TypeImage 11(int) 2D array sampled format:Unknown
156: TypePointer UniformConstant 155
157(g_tTex2di4a): 156(ptr) Variable UniformConstant
158: TypeImage 15(int) 2D array sampled format:Unknown
159: TypePointer UniformConstant 158
160(g_tTex2du4a): 159(ptr) Variable UniformConstant
161: TypeImage 6(float) Cube array sampled format:Unknown
162: TypePointer UniformConstant 161
163(g_tTexcdf4a): 162(ptr) Variable UniformConstant
164: TypeImage 11(int) Cube array sampled format:Unknown
165: TypePointer UniformConstant 164
166(g_tTexcdi4a): 165(ptr) Variable UniformConstant
167: TypeImage 15(int) Cube array sampled format:Unknown
168: TypePointer UniformConstant 167
169(g_tTexcdu4a): 168(ptr) Variable UniformConstant
170(c1): 17(ptr) Variable UniformConstant
171(o4): 88(ptr) Variable UniformConstant
129: TypePointer Output 118(PS_OUTPUT)
130(@entryPointOutput): 129(ptr) Variable Output
133: TypeSampler
134: TypePointer UniformConstant 133
135(g_sSamp): 134(ptr) Variable UniformConstant
136: TypeImage 6(float) Cube sampled format:Unknown
137: TypePointer UniformConstant 136
138(g_tTexcdf4): 137(ptr) Variable UniformConstant
139: TypeImage 11(int) Cube sampled format:Unknown
140: TypePointer UniformConstant 139
141(g_tTexcdi4): 140(ptr) Variable UniformConstant
142: TypeImage 15(int) Cube sampled format:Unknown
143: TypePointer UniformConstant 142
144(g_tTexcdu4): 143(ptr) Variable UniformConstant
145: TypeImage 6(float) 1D array sampled format:Unknown
146: TypePointer UniformConstant 145
147(g_tTex1df4a): 146(ptr) Variable UniformConstant
148: TypeImage 11(int) 1D array sampled format:Unknown
149: TypePointer UniformConstant 148
150(g_tTex1di4a): 149(ptr) Variable UniformConstant
151: TypeImage 15(int) 1D array sampled format:Unknown
152: TypePointer UniformConstant 151
153(g_tTex1du4a): 152(ptr) Variable UniformConstant
154: TypeImage 6(float) 2D array sampled format:Unknown
155: TypePointer UniformConstant 154
156(g_tTex2df4a): 155(ptr) Variable UniformConstant
157: TypeImage 11(int) 2D array sampled format:Unknown
158: TypePointer UniformConstant 157
159(g_tTex2di4a): 158(ptr) Variable UniformConstant
160: TypeImage 15(int) 2D array sampled format:Unknown
161: TypePointer UniformConstant 160
162(g_tTex2du4a): 161(ptr) Variable UniformConstant
163: TypeImage 6(float) Cube array sampled format:Unknown
164: TypePointer UniformConstant 163
165(g_tTexcdf4a): 164(ptr) Variable UniformConstant
166: TypeImage 11(int) Cube array sampled format:Unknown
167: TypePointer UniformConstant 166
168(g_tTexcdi4a): 167(ptr) Variable UniformConstant
169: TypeImage 15(int) Cube array sampled format:Unknown
170: TypePointer UniformConstant 169
171(g_tTexcdu4a): 170(ptr) Variable UniformConstant
172(c1): 17(ptr) Variable UniformConstant
173(o4): 88(ptr) Variable UniformConstant
4(main): 2 Function None 3
5: Label
120(psout): 119(ptr) Variable Function
@ -611,6 +620,7 @@ gl_FragCoord origin is upper left
Store 125 123
128: 127(ptr) AccessChain 120(psout) 126
Store 128 122
129:118(PS_OUTPUT) Load 120(psout)
ReturnValue 129
131:118(PS_OUTPUT) Load 120(psout)
Store 130(@entryPointOutput) 131
Return
FunctionEnd