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

@@ -15,8 +15,11 @@ gl_FragCoord origin is upper left
0:? 0.000000
0:? 0.000000
0:? 1.000000
0:19 Branch: Return with expression
0:19 'psout' (temp structure{temp 4-component vector of float Color})
0:19 Sequence
0:19 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:19 'psout' (temp structure{temp 4-component vector of float Color})
0:19 Branch: Return
0:? Linker Objects
0:? 'TestTexture' (uniform texture2D)
0:? 'TestUF' (uniform 4-component vector of float)
@@ -41,28 +44,32 @@ gl_FragCoord origin is upper left
0:? 0.000000
0:? 0.000000
0:? 1.000000
0:19 Branch: Return with expression
0:19 'psout' (temp structure{temp 4-component vector of float Color})
0:19 Sequence
0:19 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:19 'psout' (temp structure{temp 4-component vector of float Color})
0:19 Branch: Return
0:? Linker Objects
0:? 'TestTexture' (uniform texture2D)
0:? 'TestUF' (uniform 4-component vector of float)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 25
// Id's are bound by 27
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main"
EntryPoint Fragment 4 "main" 19
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 8 "PS_OUTPUT"
MemberName 8(PS_OUTPUT) 0 "Color"
Name 10 "psout"
Name 22 "TestTexture"
Name 24 "TestUF"
Decorate 22(TestTexture) DescriptorSet 0
Name 19 "@entryPointOutput"
Name 24 "TestTexture"
Name 26 "TestUF"
Decorate 24(TestTexture) DescriptorSet 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@@ -75,16 +82,19 @@ gl_FragCoord origin is upper left
14: 6(float) Constant 1065353216
15: 7(fvec4) ConstantComposite 13 13 13 14
16: TypePointer Function 7(fvec4)
20: TypeImage 6(float) 2D sampled format:Unknown
21: TypePointer UniformConstant 20
22(TestTexture): 21(ptr) Variable UniformConstant
23: TypePointer UniformConstant 7(fvec4)
24(TestUF): 23(ptr) Variable UniformConstant
18: TypePointer Output 8(PS_OUTPUT)
19(@entryPointOutput): 18(ptr) Variable Output
22: TypeImage 6(float) 2D sampled format:Unknown
23: TypePointer UniformConstant 22
24(TestTexture): 23(ptr) Variable UniformConstant
25: TypePointer UniformConstant 7(fvec4)
26(TestUF): 25(ptr) Variable UniformConstant
4(main): 2 Function None 3
5: Label
10(psout): 9(ptr) Variable Function
17: 16(ptr) AccessChain 10(psout) 12
Store 17 15
18:8(PS_OUTPUT) Load 10(psout)
ReturnValue 18
20:8(PS_OUTPUT) Load 10(psout)
Store 19(@entryPointOutput) 20
Return
FunctionEnd