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:16 1.000000
0:16 1.000000
0:16 1.000000
0:17 Branch: Return with expression
0:17 'ps_output' (temp structure{temp 4-component vector of float color})
0:17 Sequence
0:17 move second child to first child (temp structure{temp 4-component vector of float color})
0:? '@entryPointOutput' (out structure{temp 4-component vector of float color})
0:17 'ps_output' (temp structure{temp 4-component vector of float color})
0:17 Branch: Return
0:? Linker Objects
@ -47,18 +50,21 @@ gl_FragCoord origin is upper left
0:16 1.000000
0:16 1.000000
0:16 1.000000
0:17 Branch: Return with expression
0:17 'ps_output' (temp structure{temp 4-component vector of float color})
0:17 Sequence
0:17 move second child to first child (temp structure{temp 4-component vector of float color})
0:? '@entryPointOutput' (out structure{temp 4-component vector of float color})
0:17 'ps_output' (temp structure{temp 4-component vector of float color})
0:17 Branch: Return
0:? Linker Objects
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 23
// Id's are bound by 25
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main"
EntryPoint Fragment 4 "main" 22
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 6 "MyFunc("
@ -66,6 +72,7 @@ gl_FragCoord origin is upper left
Name 12 "PS_OUTPUT"
MemberName 12(PS_OUTPUT) 0 "color"
Name 14 "ps_output"
Name 22 "@entryPointOutput"
2: TypeVoid
3: TypeFunction 2
10: TypeFloat 32
@ -77,13 +84,16 @@ gl_FragCoord origin is upper left
17: 10(float) Constant 1065353216
18: 11(fvec4) ConstantComposite 17 17 17 17
19: TypePointer Function 11(fvec4)
21: TypePointer Output 12(PS_OUTPUT)
22(@entryPointOutput): 21(ptr) Variable Output
4(main): 2 Function None 3
5: Label
14(ps_output): 13(ptr) Variable Function
20: 19(ptr) AccessChain 14(ps_output) 16
Store 20 18
21:12(PS_OUTPUT) Load 14(ps_output)
ReturnValue 21
23:12(PS_OUTPUT) Load 14(ps_output)
Store 22(@entryPointOutput) 23
Return
FunctionEnd
6(MyFunc(): 2 Function None 3
7: Label