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

@@ -334,8 +334,11 @@ gl_FragCoord origin is upper left
0:113 1 (const int)
0:113 Constant:
0:113 1.000000
0:115 Branch: Return with expression
0:115 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:115 Sequence
0:115 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:115 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:115 Branch: Return
0:? Linker Objects
0:? 'g_sSamp' (layout(binding=0 ) uniform sampler)
0:? 'g_sSamp2d' (uniform sampler)
@@ -700,8 +703,11 @@ gl_FragCoord origin is upper left
0:113 1 (const int)
0:113 Constant:
0:113 1.000000
0:115 Branch: Return with expression
0:115 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:115 Sequence
0:115 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:115 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:115 Branch: Return
0:? Linker Objects
0:? 'g_sSamp' (layout(binding=0 ) uniform sampler)
0:? 'g_sSamp2d' (uniform sampler)
@@ -729,14 +735,14 @@ gl_FragCoord origin is upper left
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 311
// Id's are bound by 313
Capability Shader
Capability ImageGatherExtended
Capability Sampled1D
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main"
EntryPoint Fragment 4 "main" 267
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 9 "txval001"
@@ -773,42 +779,43 @@ gl_FragCoord origin is upper left
MemberName 258(PS_OUTPUT) 0 "Color"
MemberName 258(PS_OUTPUT) 1 "Depth"
Name 260 "psout"
Name 268 "g_sSamp2d"
Name 271 "g_tTex1df4a"
Name 272 "g_tTex1df4"
Name 275 "g_tTex1di4"
Name 278 "g_tTex1du4"
Name 281 "g_tTex3df4"
Name 284 "g_tTex3di4"
Name 287 "g_tTex3du4"
Name 290 "g_tTexcdf4"
Name 293 "g_tTexcdi4"
Name 296 "g_tTexcdu4"
Name 298 "c1"
Name 301 "c3"
Name 303 "c4"
Name 305 "o1"
Name 308 "o3"
Name 310 "o4"
Name 267 "@entryPointOutput"
Name 270 "g_sSamp2d"
Name 273 "g_tTex1df4a"
Name 274 "g_tTex1df4"
Name 277 "g_tTex1di4"
Name 280 "g_tTex1du4"
Name 283 "g_tTex3df4"
Name 286 "g_tTex3di4"
Name 289 "g_tTex3du4"
Name 292 "g_tTexcdf4"
Name 295 "g_tTexcdi4"
Name 298 "g_tTexcdu4"
Name 300 "c1"
Name 303 "c3"
Name 305 "c4"
Name 307 "o1"
Name 310 "o3"
Name 312 "o4"
Decorate 12(g_tTex2df4) DescriptorSet 0
Decorate 16(g_sSamp) DescriptorSet 0
Decorate 16(g_sSamp) Binding 0
Decorate 36(g_tTex2di4) DescriptorSet 0
Decorate 50(g_tTex2du4) DescriptorSet 0
MemberDecorate 258(PS_OUTPUT) 1 BuiltIn FragDepth
Decorate 268(g_sSamp2d) DescriptorSet 0
Decorate 271(g_tTex1df4a) DescriptorSet 0
Decorate 271(g_tTex1df4a) Binding 1
Decorate 272(g_tTex1df4) DescriptorSet 0
Decorate 272(g_tTex1df4) Binding 0
Decorate 275(g_tTex1di4) DescriptorSet 0
Decorate 278(g_tTex1du4) DescriptorSet 0
Decorate 281(g_tTex3df4) DescriptorSet 0
Decorate 284(g_tTex3di4) DescriptorSet 0
Decorate 287(g_tTex3du4) DescriptorSet 0
Decorate 290(g_tTexcdf4) DescriptorSet 0
Decorate 293(g_tTexcdi4) DescriptorSet 0
Decorate 296(g_tTexcdu4) DescriptorSet 0
Decorate 270(g_sSamp2d) DescriptorSet 0
Decorate 273(g_tTex1df4a) DescriptorSet 0
Decorate 273(g_tTex1df4a) Binding 1
Decorate 274(g_tTex1df4) DescriptorSet 0
Decorate 274(g_tTex1df4) Binding 0
Decorate 277(g_tTex1di4) DescriptorSet 0
Decorate 280(g_tTex1du4) DescriptorSet 0
Decorate 283(g_tTex3df4) DescriptorSet 0
Decorate 286(g_tTex3di4) DescriptorSet 0
Decorate 289(g_tTex3du4) DescriptorSet 0
Decorate 292(g_tTexcdf4) DescriptorSet 0
Decorate 295(g_tTexcdi4) DescriptorSet 0
Decorate 298(g_tTexcdu4) DescriptorSet 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@@ -852,49 +859,51 @@ gl_FragCoord origin is upper left
261: 6(float) Constant 1065353216
262: 7(fvec4) ConstantComposite 261 261 261 261
264: TypePointer Function 6(float)
268(g_sSamp2d): 15(ptr) Variable UniformConstant
269: TypeImage 6(float) 1D sampled format:Unknown
270: TypePointer UniformConstant 269
271(g_tTex1df4a): 270(ptr) Variable UniformConstant
272(g_tTex1df4): 270(ptr) Variable UniformConstant
273: TypeImage 24(int) 1D sampled format:Unknown
274: TypePointer UniformConstant 273
275(g_tTex1di4): 274(ptr) Variable UniformConstant
276: TypeImage 44(int) 1D sampled format:Unknown
277: TypePointer UniformConstant 276
278(g_tTex1du4): 277(ptr) Variable UniformConstant
279: TypeImage 6(float) 3D sampled format:Unknown
280: TypePointer UniformConstant 279
281(g_tTex3df4): 280(ptr) Variable UniformConstant
282: TypeImage 24(int) 3D sampled format:Unknown
283: TypePointer UniformConstant 282
284(g_tTex3di4): 283(ptr) Variable UniformConstant
285: TypeImage 44(int) 3D sampled format:Unknown
286: TypePointer UniformConstant 285
287(g_tTex3du4): 286(ptr) Variable UniformConstant
288: TypeImage 6(float) Cube sampled format:Unknown
289: TypePointer UniformConstant 288
290(g_tTexcdf4): 289(ptr) Variable UniformConstant
291: TypeImage 24(int) Cube sampled format:Unknown
292: TypePointer UniformConstant 291
293(g_tTexcdi4): 292(ptr) Variable UniformConstant
294: TypeImage 44(int) Cube sampled format:Unknown
295: TypePointer UniformConstant 294
296(g_tTexcdu4): 295(ptr) Variable UniformConstant
297: TypePointer UniformConstant 6(float)
298(c1): 297(ptr) Variable UniformConstant
299: TypeVector 6(float) 3
300: TypePointer UniformConstant 299(fvec3)
301(c3): 300(ptr) Variable UniformConstant
302: TypePointer UniformConstant 7(fvec4)
303(c4): 302(ptr) Variable UniformConstant
304: TypePointer UniformConstant 24(int)
305(o1): 304(ptr) Variable UniformConstant
306: TypeVector 24(int) 3
307: TypePointer UniformConstant 306(ivec3)
308(o3): 307(ptr) Variable UniformConstant
309: TypePointer UniformConstant 31(ivec4)
310(o4): 309(ptr) Variable UniformConstant
266: TypePointer Output 258(PS_OUTPUT)
267(@entryPointOutput): 266(ptr) Variable Output
270(g_sSamp2d): 15(ptr) Variable UniformConstant
271: TypeImage 6(float) 1D sampled format:Unknown
272: TypePointer UniformConstant 271
273(g_tTex1df4a): 272(ptr) Variable UniformConstant
274(g_tTex1df4): 272(ptr) Variable UniformConstant
275: TypeImage 24(int) 1D sampled format:Unknown
276: TypePointer UniformConstant 275
277(g_tTex1di4): 276(ptr) Variable UniformConstant
278: TypeImage 44(int) 1D sampled format:Unknown
279: TypePointer UniformConstant 278
280(g_tTex1du4): 279(ptr) Variable UniformConstant
281: TypeImage 6(float) 3D sampled format:Unknown
282: TypePointer UniformConstant 281
283(g_tTex3df4): 282(ptr) Variable UniformConstant
284: TypeImage 24(int) 3D sampled format:Unknown
285: TypePointer UniformConstant 284
286(g_tTex3di4): 285(ptr) Variable UniformConstant
287: TypeImage 44(int) 3D sampled format:Unknown
288: TypePointer UniformConstant 287
289(g_tTex3du4): 288(ptr) Variable UniformConstant
290: TypeImage 6(float) Cube sampled format:Unknown
291: TypePointer UniformConstant 290
292(g_tTexcdf4): 291(ptr) Variable UniformConstant
293: TypeImage 24(int) Cube sampled format:Unknown
294: TypePointer UniformConstant 293
295(g_tTexcdi4): 294(ptr) Variable UniformConstant
296: TypeImage 44(int) Cube sampled format:Unknown
297: TypePointer UniformConstant 296
298(g_tTexcdu4): 297(ptr) Variable UniformConstant
299: TypePointer UniformConstant 6(float)
300(c1): 299(ptr) Variable UniformConstant
301: TypeVector 6(float) 3
302: TypePointer UniformConstant 301(fvec3)
303(c3): 302(ptr) Variable UniformConstant
304: TypePointer UniformConstant 7(fvec4)
305(c4): 304(ptr) Variable UniformConstant
306: TypePointer UniformConstant 24(int)
307(o1): 306(ptr) Variable UniformConstant
308: TypeVector 24(int) 3
309: TypePointer UniformConstant 308(ivec3)
310(o3): 309(ptr) Variable UniformConstant
311: TypePointer UniformConstant 31(ivec4)
312(o4): 311(ptr) Variable UniformConstant
4(main): 2 Function None 3
5: Label
9(txval001): 8(ptr) Variable Function
@@ -1142,6 +1151,7 @@ gl_FragCoord origin is upper left
Store 263 262
265: 264(ptr) AccessChain 260(psout) 99
Store 265 261
266:258(PS_OUTPUT) Load 260(psout)
ReturnValue 266
268:258(PS_OUTPUT) Load 260(psout)
Store 267(@entryPointOutput) 268
Return
FunctionEnd