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

@@ -98,13 +98,16 @@ gl_FragCoord origin is upper left
0:14 Convert int to float (temp float)
0:14 'd' (temp int)
0:14 'input' (in 4-component vector of float)
0:15 Branch: Return with expression
0:15 add (temp 4-component vector of float)
0:15 vector-scale (temp 4-component vector of float)
0:15 Convert int to float (temp float)
0:15 'e' (temp int)
0:15 'ret' (temp 4-component vector of float)
0:15 'f' (temp 4-component vector of float)
0:15 Sequence
0:15 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (out 4-component vector of float)
0:15 add (temp 4-component vector of float)
0:15 vector-scale (temp 4-component vector of float)
0:15 Convert int to float (temp float)
0:15 'e' (temp int)
0:15 'ret' (temp 4-component vector of float)
0:15 'f' (temp 4-component vector of float)
0:15 Branch: Return
0:? Linker Objects
@@ -210,23 +213,26 @@ gl_FragCoord origin is upper left
0:14 Convert int to float (temp float)
0:14 'd' (temp int)
0:14 'input' (in 4-component vector of float)
0:15 Branch: Return with expression
0:15 add (temp 4-component vector of float)
0:15 vector-scale (temp 4-component vector of float)
0:15 Convert int to float (temp float)
0:15 'e' (temp int)
0:15 'ret' (temp 4-component vector of float)
0:15 'f' (temp 4-component vector of float)
0:15 Sequence
0:15 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (out 4-component vector of float)
0:15 add (temp 4-component vector of float)
0:15 vector-scale (temp 4-component vector of float)
0:15 Convert int to float (temp float)
0:15 'e' (temp int)
0:15 'ret' (temp 4-component vector of float)
0:15 'f' (temp 4-component vector of float)
0:15 Branch: Return
0:? Linker Objects
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 89
// Id's are bound by 91
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "PixelShaderFunction" 22
EntryPoint Fragment 4 "PixelShaderFunction" 22 83
ExecutionMode 4 OriginUpperLeft
Name 4 "PixelShaderFunction"
Name 8 "a"
@@ -237,6 +243,7 @@ gl_FragCoord origin is upper left
Name 22 "input"
Name 40 "e"
Name 57 "f"
Name 83 "@entryPointOutput"
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
@@ -257,6 +264,8 @@ gl_FragCoord origin is upper left
64: 59(int) Constant 1
65: TypePointer Input 15(float)
68: TypeBool
82: TypePointer Output 16(fvec4)
83(@entryPointOutput): 82(ptr) Variable Output
4(PixelShaderFunction): 2 Function None 3
5: Label
8(a): 7(ptr) Variable Function
@@ -346,11 +355,12 @@ gl_FragCoord origin is upper left
71: Label
81: 16(fvec4) Load 58
Store 57(f) 81
82: 6(int) Load 40(e)
83: 15(float) ConvertSToF 82
84: 16(fvec4) Load 18(ret)
85: 16(fvec4) VectorTimesScalar 84 83
86: 16(fvec4) Load 57(f)
87: 16(fvec4) FAdd 85 86
ReturnValue 87
84: 6(int) Load 40(e)
85: 15(float) ConvertSToF 84
86: 16(fvec4) Load 18(ret)
87: 16(fvec4) VectorTimesScalar 86 85
88: 16(fvec4) Load 57(f)
89: 16(fvec4) FAdd 87 88
Store 83(@entryPointOutput) 89
Return
FunctionEnd