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

@@ -19,8 +19,11 @@ gl_FragCoord origin is upper left
0:11 1.000000
0:11 1.000000
0:11 1.000000
0:12 Branch: Return with expression
0:12 'ps_output' (temp structure{noContraction temp 4-component vector of float color})
0:12 Sequence
0:12 move second child to first child (temp structure{noContraction temp 4-component vector of float color})
0:? '@entryPointOutput' (out structure{noContraction temp 4-component vector of float color})
0:12 'ps_output' (temp structure{noContraction temp 4-component vector of float color})
0:12 Branch: Return
0:? Linker Objects
0:? 'precisefloat' (noContraction global float)
@@ -48,19 +51,22 @@ gl_FragCoord origin is upper left
0:11 1.000000
0:11 1.000000
0:11 1.000000
0:12 Branch: Return with expression
0:12 'ps_output' (temp structure{noContraction temp 4-component vector of float color})
0:12 Sequence
0:12 move second child to first child (temp structure{noContraction temp 4-component vector of float color})
0:? '@entryPointOutput' (out structure{noContraction temp 4-component vector of float color})
0:12 'ps_output' (temp structure{noContraction temp 4-component vector of float color})
0:12 Branch: Return
0:? Linker Objects
0:? 'precisefloat' (noContraction global float)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 29
// Id's are bound by 31
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main"
EntryPoint Fragment 4 "main" 26
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 13 "MyFunction(f1;vf3;"
@@ -69,7 +75,8 @@ gl_FragCoord origin is upper left
Name 16 "PS_OUTPUT"
MemberName 16(PS_OUTPUT) 0 "color"
Name 18 "ps_output"
Name 28 "precisefloat"
Name 26 "@entryPointOutput"
Name 30 "precisefloat"
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@@ -85,15 +92,18 @@ gl_FragCoord origin is upper left
21: 6(float) Constant 1065353216
22: 15(fvec4) ConstantComposite 21 21 21 21
23: TypePointer Function 15(fvec4)
27: TypePointer Private 6(float)
28(precisefloat): 27(ptr) Variable Private
25: TypePointer Output 16(PS_OUTPUT)
26(@entryPointOutput): 25(ptr) Variable Output
29: TypePointer Private 6(float)
30(precisefloat): 29(ptr) Variable Private
4(main): 2 Function None 3
5: Label
18(ps_output): 17(ptr) Variable Function
24: 23(ptr) AccessChain 18(ps_output) 20
Store 24 22
25:16(PS_OUTPUT) Load 18(ps_output)
ReturnValue 25
27:16(PS_OUTPUT) Load 18(ps_output)
Store 26(@entryPointOutput) 27
Return
FunctionEnd
13(MyFunction(f1;vf3;): 2 Function None 10
11(myfloat): 7(ptr) FunctionParameter