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

@ -31,8 +31,11 @@ gl_FragCoord origin is upper left
0:127 1 (const int)
0:127 Constant:
0:127 1.000000
0:129 Branch: Return with expression
0:129 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:129 Sequence
0:129 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:129 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:129 Branch: Return
0:? Linker Objects
@ -71,18 +74,21 @@ gl_FragCoord origin is upper left
0:127 1 (const int)
0:127 Constant:
0:127 1.000000
0:129 Branch: Return with expression
0:129 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:129 Sequence
0:129 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:129 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:129 Branch: Return
0:? Linker Objects
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 28
// Id's are bound by 30
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main"
EntryPoint Fragment 4 "main" 27
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 8 "thisLineIs"
@ -90,6 +96,7 @@ gl_FragCoord origin is upper left
MemberName 12(PS_OUTPUT) 0 "Color"
MemberName 12(PS_OUTPUT) 1 "Depth"
Name 14 "psout"
Name 27 "@entryPointOutput"
MemberDecorate 12(PS_OUTPUT) 1 BuiltIn FragDepth
2: TypeVoid
3: TypeFunction 2
@ -106,6 +113,8 @@ gl_FragCoord origin is upper left
21: TypePointer Function 11(fvec4)
23: 6(int) Constant 1
24: TypePointer Function 10(float)
26: TypePointer Output 12(PS_OUTPUT)
27(@entryPointOutput): 26(ptr) Variable Output
4(main): 2 Function None 3
5: Label
8(thisLineIs): 7(ptr) Variable Function
@ -118,6 +127,7 @@ gl_FragCoord origin is upper left
Store 22 20
25: 24(ptr) AccessChain 14(psout) 23
Store 25 19
26:12(PS_OUTPUT) Load 14(psout)
ReturnValue 26
28:12(PS_OUTPUT) Load 14(psout)
Store 27(@entryPointOutput) 28
Return
FunctionEnd