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

@@ -43,8 +43,11 @@ gl_FragCoord origin is upper left
0:30 1.000000
0:30 1.000000
0:30 1.000000
0:31 Branch: Return with expression
0:31 'ps_output' (temp structure{temp 4-component vector of float color})
0:31 Sequence
0:31 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:31 'ps_output' (temp structure{temp 4-component vector of float color})
0:31 Branch: Return
0:? Linker Objects
@@ -95,18 +98,21 @@ gl_FragCoord origin is upper left
0:30 1.000000
0:30 1.000000
0:30 1.000000
0:31 Branch: Return with expression
0:31 'ps_output' (temp structure{temp 4-component vector of float color})
0:31 Sequence
0:31 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:31 'ps_output' (temp structure{temp 4-component vector of float color})
0:31 Branch: Return
0:? Linker Objects
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 44
// Id's are bound by 46
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main"
EntryPoint Fragment 4 "main" 43
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 6 "Test1("
@@ -123,6 +129,7 @@ gl_FragCoord origin is upper left
Name 34 "PS_OUTPUT"
MemberName 34(PS_OUTPUT) 0 "color"
Name 36 "ps_output"
Name 43 "@entryPointOutput"
2: TypeVoid
3: TypeFunction 2
8: TypeFloat 32
@@ -152,14 +159,17 @@ gl_FragCoord origin is upper left
38: 37(int) Constant 0
39: 33(fvec4) ConstantComposite 13 13 13 13
40: TypePointer Function 33(fvec4)
42: TypePointer Output 34(PS_OUTPUT)
43(@entryPointOutput): 42(ptr) Variable Output
4(main): 2 Function None 3
5: Label
36(ps_output): 35(ptr) Variable Function
32: 2 FunctionCall 6(Test1()
41: 40(ptr) AccessChain 36(ps_output) 38
Store 41 39
42:34(PS_OUTPUT) Load 36(ps_output)
ReturnValue 42
44:34(PS_OUTPUT) Load 36(ps_output)
Store 43(@entryPointOutput) 44
Return
FunctionEnd
6(Test1(): 2 Function None 3
7: Label