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

@ -55,8 +55,11 @@ gl_FragCoord origin is upper left
0:22 'inpos' (noperspective in 4-component vector of float FragCoord)
0:22 Constant:
0:22 3 (const int)
0:24 Branch: Return with expression
0:24 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:24 Sequence
0:24 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:24 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:24 Branch: Return
0:? Linker Objects
@ -119,18 +122,21 @@ gl_FragCoord origin is upper left
0:22 'inpos' (noperspective in 4-component vector of float FragCoord)
0:22 Constant:
0:22 3 (const int)
0:24 Branch: Return with expression
0:24 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:24 Sequence
0:24 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:24 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:24 Branch: Return
0:? Linker Objects
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 54
// Id's are bound by 56
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 45
EntryPoint Fragment 4 "main" 45 53
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 12 "MyFunc(f1;f1;f1;"
@ -148,6 +154,7 @@ gl_FragCoord origin is upper left
MemberName 31(PS_OUTPUT) 1 "Depth"
Name 33 "psout"
Name 45 "inpos"
Name 53 "@entryPointOutput"
MemberDecorate 31(PS_OUTPUT) 1 BuiltIn FragDepth
Decorate 45(inpos) NoPerspective
Decorate 45(inpos) BuiltIn FragCoord
@ -172,6 +179,8 @@ gl_FragCoord origin is upper left
46: TypeInt 32 0
47: 46(int) Constant 3
48: TypePointer Input 6(float)
52: TypePointer Output 31(PS_OUTPUT)
53(@entryPointOutput): 52(ptr) Variable Output
4(main): 2 Function None 3
5: Label
17(x): 7(ptr) Variable Function
@ -202,8 +211,9 @@ gl_FragCoord origin is upper left
50: 6(float) Load 49
51: 7(ptr) AccessChain 33(psout) 43
Store 51 50
52:31(PS_OUTPUT) Load 33(psout)
ReturnValue 52
54:31(PS_OUTPUT) Load 33(psout)
Store 53(@entryPointOutput) 54
Return
FunctionEnd
12(MyFunc(f1;f1;f1;): 2 Function None 8
9(x): 7(ptr) FunctionParameter