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

@@ -31,9 +31,12 @@ gl_FragCoord origin is upper left
0:6 'input' (in 4-component vector of float)
0:6 Loop Body
0:? Sequence
0:6 Branch: Return with expression
0:6 Negate value (temp 4-component vector of float)
0:6 'input' (in 4-component vector of float)
0:6 Sequence
0:6 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (out 4-component vector of float)
0:6 Negate value (temp 4-component vector of float)
0:6 'input' (in 4-component vector of float)
0:6 Branch: Return
0:7 Sequence
0:7 Pre-Decrement (temp 4-component vector of float)
0:7 'input' (in 4-component vector of float)
@@ -44,9 +47,12 @@ gl_FragCoord origin is upper left
0:7 'input' (in 4-component vector of float)
0:7 Loop Body
0:? Sequence
0:7 Branch: Return with expression
0:7 Negate value (temp 4-component vector of float)
0:7 'input' (in 4-component vector of float)
0:7 Sequence
0:7 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (out 4-component vector of float)
0:7 Negate value (temp 4-component vector of float)
0:7 'input' (in 4-component vector of float)
0:7 Branch: Return
0:7 Loop Terminal Expression
0:7 add second child into first child (temp 4-component vector of float)
0:7 'input' (in 4-component vector of float)
@@ -145,9 +151,12 @@ gl_FragCoord origin is upper left
0:6 'input' (in 4-component vector of float)
0:6 Loop Body
0:? Sequence
0:6 Branch: Return with expression
0:6 Negate value (temp 4-component vector of float)
0:6 'input' (in 4-component vector of float)
0:6 Sequence
0:6 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (out 4-component vector of float)
0:6 Negate value (temp 4-component vector of float)
0:6 'input' (in 4-component vector of float)
0:6 Branch: Return
0:7 Sequence
0:7 Pre-Decrement (temp 4-component vector of float)
0:7 'input' (in 4-component vector of float)
@@ -158,9 +167,12 @@ gl_FragCoord origin is upper left
0:7 'input' (in 4-component vector of float)
0:7 Loop Body
0:? Sequence
0:7 Branch: Return with expression
0:7 Negate value (temp 4-component vector of float)
0:7 'input' (in 4-component vector of float)
0:7 Sequence
0:7 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (out 4-component vector of float)
0:7 Negate value (temp 4-component vector of float)
0:7 'input' (in 4-component vector of float)
0:7 Branch: Return
0:7 Loop Terminal Expression
0:7 add second child into first child (temp 4-component vector of float)
0:7 'input' (in 4-component vector of float)
@@ -225,17 +237,18 @@ gl_FragCoord origin is upper left
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 112
// Id's are bound by 114
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "PixelShaderFunction" 13
EntryPoint Fragment 4 "PixelShaderFunction" 13 43
ExecutionMode 4 OriginUpperLeft
Name 4 "PixelShaderFunction"
Name 13 "input"
Name 89 "ii"
Name 109 "ii"
Name 43 "@entryPointOutput"
Name 91 "ii"
Name 111 "ii"
2: TypeVoid
3: TypeFunction 2
10: TypeFloat 32
@@ -245,21 +258,23 @@ gl_FragCoord origin is upper left
15: 10(float) Constant 1065353216
29: TypeBool
30: TypeVector 29(bool) 4
60: 10(float) Constant 1073741824
68: TypeInt 32 0
69: 68(int) Constant 0
70: TypePointer Input 10(float)
87: TypeInt 32 1
88: TypePointer Function 87(int)
90: 87(int) Constant 4294967295
97: 87(int) Constant 3
100: 87(int) Constant 2
106: 87(int) Constant 1
108: TypePointer Function 10(float)
42: TypePointer Output 11(fvec4)
43(@entryPointOutput): 42(ptr) Variable Output
62: 10(float) Constant 1073741824
70: TypeInt 32 0
71: 70(int) Constant 0
72: TypePointer Input 10(float)
89: TypeInt 32 1
90: TypePointer Function 89(int)
92: 89(int) Constant 4294967295
99: 89(int) Constant 3
102: 89(int) Constant 2
108: 89(int) Constant 1
110: TypePointer Function 10(float)
4(PixelShaderFunction): 2 Function None 3
5: Label
89(ii): 88(ptr) Variable Function
109(ii): 108(ptr) Variable Function
91(ii): 90(ptr) Variable Function
111(ii): 110(ptr) Variable Function
Branch 6
6: Label
LoopMerge 8 9 None
@@ -308,97 +323,99 @@ gl_FragCoord origin is upper left
41: 29(bool) Any 40
BranchConditional 41 34 35
34: Label
42: 11(fvec4) Load 13(input)
43: 11(fvec4) FNegate 42
ReturnValue 43
44: 11(fvec4) Load 13(input)
45: 11(fvec4) FNegate 44
Store 43(@entryPointOutput) 45
Return
36: Label
Branch 33
35: Label
45: 11(fvec4) Load 13(input)
46: 11(fvec4) CompositeConstruct 15 15 15 15
47: 11(fvec4) FSub 45 46
Store 13(input) 47
Branch 48
48: Label
LoopMerge 50 51 None
Branch 52
52: Label
53: 11(fvec4) Load 13(input)
54: 11(fvec4) Load 13(input)
55: 30(bvec4) FOrdNotEqual 53 54
56: 29(bool) Any 55
BranchConditional 56 49 50
49: Label
57: 11(fvec4) Load 13(input)
58: 11(fvec4) FNegate 57
ReturnValue 58
51: Label
61: 11(fvec4) Load 13(input)
62: 11(fvec4) CompositeConstruct 60 60 60 60
63: 11(fvec4) FAdd 61 62
Store 13(input) 63
Branch 48
47: 11(fvec4) Load 13(input)
48: 11(fvec4) CompositeConstruct 15 15 15 15
49: 11(fvec4) FSub 47 48
Store 13(input) 49
Branch 50
50: Label
Branch 64
64: Label
LoopMerge 66 67 None
Branch 65
65: Label
71: 70(ptr) AccessChain 13(input) 69
72: 10(float) Load 71
73: 29(bool) FOrdGreaterThan 72 60
SelectionMerge 75 None
BranchConditional 73 74 75
74: Label
Branch 66
75: Label
LoopMerge 52 53 None
Branch 54
54: Label
55: 11(fvec4) Load 13(input)
56: 11(fvec4) Load 13(input)
57: 30(bvec4) FOrdNotEqual 55 56
58: 29(bool) Any 57
BranchConditional 58 51 52
51: Label
59: 11(fvec4) Load 13(input)
60: 11(fvec4) FNegate 59
Store 43(@entryPointOutput) 60
Return
53: Label
63: 11(fvec4) Load 13(input)
64: 11(fvec4) CompositeConstruct 62 62 62 62
65: 11(fvec4) FAdd 63 64
Store 13(input) 65
Branch 50
52: Label
Branch 66
66: Label
LoopMerge 68 69 None
Branch 67
67: Label
Branch 64
66: Label
Branch 77
73: 72(ptr) AccessChain 13(input) 71
74: 10(float) Load 73
75: 29(bool) FOrdGreaterThan 74 62
SelectionMerge 77 None
BranchConditional 75 76 77
76: Label
Branch 68
77: Label
LoopMerge 79 80 None
Branch 78
78: Label
81: 70(ptr) AccessChain 13(input) 69
82: 10(float) Load 81
83: 29(bool) FOrdGreaterThan 82 60
SelectionMerge 85 None
BranchConditional 83 84 85
84: Label
Branch 80
85: Label
Branch 69
69: Label
Branch 66
68: Label
Branch 79
79: Label
LoopMerge 81 82 None
Branch 80
80: Label
Branch 77
79: Label
Store 89(ii) 90
Branch 91
91: Label
LoopMerge 93 94 None
Branch 95
95: Label
96: 87(int) Load 89(ii)
98: 29(bool) SLessThan 96 97
BranchConditional 98 92 93
92: Label
99: 87(int) Load 89(ii)
101: 29(bool) IEqual 99 100
SelectionMerge 103 None
BranchConditional 101 102 103
102: Label
Branch 94
103: Label
Branch 94
94: Label
105: 87(int) Load 89(ii)
107: 87(int) IAdd 105 106
Store 89(ii) 107
Branch 91
83: 72(ptr) AccessChain 13(input) 71
84: 10(float) Load 83
85: 29(bool) FOrdGreaterThan 84 62
SelectionMerge 87 None
BranchConditional 85 86 87
86: Label
Branch 82
87: Label
Branch 82
82: Label
Branch 79
81: Label
Store 91(ii) 92
Branch 93
93: Label
110: 10(float) Load 109(ii)
111: 10(float) FSub 110 15
Store 109(ii) 111
LoopMerge 95 96 None
Branch 97
97: Label
98: 89(int) Load 91(ii)
100: 29(bool) SLessThan 98 99
BranchConditional 100 94 95
94: Label
101: 89(int) Load 91(ii)
103: 29(bool) IEqual 101 102
SelectionMerge 105 None
BranchConditional 103 104 105
104: Label
Branch 96
105: Label
Branch 96
96: Label
107: 89(int) Load 91(ii)
109: 89(int) IAdd 107 108
Store 91(ii) 109
Branch 93
95: Label
112: 10(float) Load 111(ii)
113: 10(float) FSub 112 15
Store 111(ii) 113
Return
FunctionEnd