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:107 1 (const int)
0:107 Constant:
0:107 1.000000
0:109 Branch: Return with expression
0:109 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:109 Sequence
0:109 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:109 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:109 Branch: Return
0:? Linker Objects
0:? 'g_sSamp' (layout(binding=0 ) uniform sampler)
0:? 'g_sSamp2d' (uniform sampler)
@@ -696,8 +699,11 @@ gl_FragCoord origin is upper left
0:107 1 (const int)
0:107 Constant:
0:107 1.000000
0:109 Branch: Return with expression
0:109 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:109 Sequence
0:109 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:109 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:109 Branch: Return
0:? Linker Objects
0:? 'g_sSamp' (layout(binding=0 ) uniform sampler)
0:? 'g_sSamp2d' (uniform sampler)
@@ -721,7 +727,7 @@ gl_FragCoord origin is upper left
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 301
// Id's are bound by 303
Capability Shader
Capability ImageGatherExtended
@@ -729,7 +735,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" 267
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 9 "txval001"
@@ -766,33 +772,34 @@ 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 274 "g_tTex1di4a"
Name 277 "g_tTex1du4a"
Name 280 "g_tTexcdf4a"
Name 283 "g_tTexcdi4a"
Name 286 "g_tTexcdu4a"
Name 288 "c1"
Name 291 "c2"
Name 293 "c4"
Name 295 "o1"
Name 298 "o3"
Name 300 "o4"
Name 267 "@entryPointOutput"
Name 270 "g_sSamp2d"
Name 273 "g_tTex1df4a"
Name 276 "g_tTex1di4a"
Name 279 "g_tTex1du4a"
Name 282 "g_tTexcdf4a"
Name 285 "g_tTexcdi4a"
Name 288 "g_tTexcdu4a"
Name 290 "c1"
Name 293 "c2"
Name 295 "c4"
Name 297 "o1"
Name 300 "o3"
Name 302 "o4"
Decorate 12(g_tTex2df4a) DescriptorSet 0
Decorate 16(g_sSamp) DescriptorSet 0
Decorate 16(g_sSamp) Binding 0
Decorate 36(g_tTex2di4a) DescriptorSet 0
Decorate 50(g_tTex2du4a) 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 0
Decorate 274(g_tTex1di4a) DescriptorSet 0
Decorate 277(g_tTex1du4a) DescriptorSet 0
Decorate 280(g_tTexcdf4a) DescriptorSet 0
Decorate 283(g_tTexcdi4a) DescriptorSet 0
Decorate 286(g_tTexcdu4a) DescriptorSet 0
Decorate 270(g_sSamp2d) DescriptorSet 0
Decorate 273(g_tTex1df4a) DescriptorSet 0
Decorate 273(g_tTex1df4a) Binding 0
Decorate 276(g_tTex1di4a) DescriptorSet 0
Decorate 279(g_tTex1du4a) DescriptorSet 0
Decorate 282(g_tTexcdf4a) DescriptorSet 0
Decorate 285(g_tTexcdi4a) DescriptorSet 0
Decorate 288(g_tTexcdu4a) DescriptorSet 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@@ -836,39 +843,41 @@ 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 array sampled format:Unknown
270: TypePointer UniformConstant 269
271(g_tTex1df4a): 270(ptr) Variable UniformConstant
272: TypeImage 24(int) 1D array sampled format:Unknown
273: TypePointer UniformConstant 272
274(g_tTex1di4a): 273(ptr) Variable UniformConstant
275: TypeImage 44(int) 1D array sampled format:Unknown
276: TypePointer UniformConstant 275
277(g_tTex1du4a): 276(ptr) Variable UniformConstant
278: TypeImage 6(float) Cube array sampled format:Unknown
279: TypePointer UniformConstant 278
280(g_tTexcdf4a): 279(ptr) Variable UniformConstant
281: TypeImage 24(int) Cube array sampled format:Unknown
282: TypePointer UniformConstant 281
283(g_tTexcdi4a): 282(ptr) Variable UniformConstant
284: TypeImage 44(int) Cube array sampled format:Unknown
285: TypePointer UniformConstant 284
286(g_tTexcdu4a): 285(ptr) Variable UniformConstant
287: TypePointer UniformConstant 6(float)
288(c1): 287(ptr) Variable UniformConstant
289: TypeVector 6(float) 2
290: TypePointer UniformConstant 289(fvec2)
291(c2): 290(ptr) Variable UniformConstant
292: TypePointer UniformConstant 7(fvec4)
293(c4): 292(ptr) Variable UniformConstant
294: TypePointer UniformConstant 24(int)
295(o1): 294(ptr) Variable UniformConstant
296: TypeVector 24(int) 3
297: TypePointer UniformConstant 296(ivec3)
298(o3): 297(ptr) Variable UniformConstant
299: TypePointer UniformConstant 31(ivec4)
300(o4): 299(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 array sampled format:Unknown
272: TypePointer UniformConstant 271
273(g_tTex1df4a): 272(ptr) Variable UniformConstant
274: TypeImage 24(int) 1D array sampled format:Unknown
275: TypePointer UniformConstant 274
276(g_tTex1di4a): 275(ptr) Variable UniformConstant
277: TypeImage 44(int) 1D array sampled format:Unknown
278: TypePointer UniformConstant 277
279(g_tTex1du4a): 278(ptr) Variable UniformConstant
280: TypeImage 6(float) Cube array sampled format:Unknown
281: TypePointer UniformConstant 280
282(g_tTexcdf4a): 281(ptr) Variable UniformConstant
283: TypeImage 24(int) Cube array sampled format:Unknown
284: TypePointer UniformConstant 283
285(g_tTexcdi4a): 284(ptr) Variable UniformConstant
286: TypeImage 44(int) Cube array sampled format:Unknown
287: TypePointer UniformConstant 286
288(g_tTexcdu4a): 287(ptr) Variable UniformConstant
289: TypePointer UniformConstant 6(float)
290(c1): 289(ptr) Variable UniformConstant
291: TypeVector 6(float) 2
292: TypePointer UniformConstant 291(fvec2)
293(c2): 292(ptr) Variable UniformConstant
294: TypePointer UniformConstant 7(fvec4)
295(c4): 294(ptr) Variable UniformConstant
296: TypePointer UniformConstant 24(int)
297(o1): 296(ptr) Variable UniformConstant
298: TypeVector 24(int) 3
299: TypePointer UniformConstant 298(ivec3)
300(o3): 299(ptr) Variable UniformConstant
301: TypePointer UniformConstant 31(ivec4)
302(o4): 301(ptr) Variable UniformConstant
4(main): 2 Function None 3
5: Label
9(txval001): 8(ptr) Variable Function
@@ -1116,6 +1125,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