summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp')
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp125
1 files changed, 68 insertions, 57 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp
index 6977f74f9..f03b2dba9 100644
--- a/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp
@@ -16,69 +16,75 @@ void EmitIAdd32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* in
16 ctx.AddU32("{}={}+{};", *inst, a, b); 16 ctx.AddU32("{}={}+{};", *inst, a, b);
17} 17}
18 18
19void EmitIAdd64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string a, 19void EmitIAdd64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
20 [[maybe_unused]] std::string b) { 20 [[maybe_unused]] std::string a, [[maybe_unused]] std::string b) {
21 throw NotImplementedException("GLSL Instruction"); 21 throw NotImplementedException("GLSL Instruction");
22} 22}
23 23
24void EmitISub32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string a, 24void EmitISub32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
25 [[maybe_unused]] std::string b) { 25 [[maybe_unused]] std::string a, [[maybe_unused]] std::string b) {
26 throw NotImplementedException("GLSL Instruction"); 26 throw NotImplementedException("GLSL Instruction");
27} 27}
28 28
29void EmitISub64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string a, 29void EmitISub64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
30 [[maybe_unused]] std::string b) { 30 [[maybe_unused]] std::string a, [[maybe_unused]] std::string b) {
31 throw NotImplementedException("GLSL Instruction"); 31 throw NotImplementedException("GLSL Instruction");
32} 32}
33 33
34void EmitIMul32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string a, 34void EmitIMul32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
35 [[maybe_unused]] std::string b) { 35 [[maybe_unused]] std::string a, [[maybe_unused]] std::string b) {
36 throw NotImplementedException("GLSL Instruction"); 36 throw NotImplementedException("GLSL Instruction");
37} 37}
38 38
39void EmitINeg32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string value) { 39void EmitINeg32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
40 throw NotImplementedException("GLSL Instruction"); 40 [[maybe_unused]] std::string value) {
41 ctx.AddU32("{}=-{};", *inst, value);
41} 42}
42 43
43void EmitINeg64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string value) { 44void EmitINeg64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
45 [[maybe_unused]] std::string value) {
44 throw NotImplementedException("GLSL Instruction"); 46 throw NotImplementedException("GLSL Instruction");
45} 47}
46 48
47void EmitIAbs32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string value) { 49void EmitIAbs32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
50 [[maybe_unused]] std::string value) {
48 throw NotImplementedException("GLSL Instruction"); 51 throw NotImplementedException("GLSL Instruction");
49} 52}
50 53
51void EmitIAbs64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string value) { 54void EmitIAbs64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
55 [[maybe_unused]] std::string value) {
52 throw NotImplementedException("GLSL Instruction"); 56 throw NotImplementedException("GLSL Instruction");
53} 57}
54 58
55void EmitShiftLeftLogical32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string base, 59void EmitShiftLeftLogical32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
56 [[maybe_unused]] std::string shift) { 60 [[maybe_unused]] std::string base, [[maybe_unused]] std::string shift) {
57 throw NotImplementedException("GLSL Instruction"); 61 throw NotImplementedException("GLSL Instruction");
58} 62}
59 63
60void EmitShiftLeftLogical64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string base, 64void EmitShiftLeftLogical64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
61 [[maybe_unused]] std::string shift) { 65 [[maybe_unused]] std::string base, [[maybe_unused]] std::string shift) {
62 throw NotImplementedException("GLSL Instruction"); 66 throw NotImplementedException("GLSL Instruction");
63} 67}
64 68
65void EmitShiftRightLogical32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string base, 69void EmitShiftRightLogical32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
70 [[maybe_unused]] std::string base,
66 [[maybe_unused]] std::string shift) { 71 [[maybe_unused]] std::string shift) {
67 throw NotImplementedException("GLSL Instruction"); 72 throw NotImplementedException("GLSL Instruction");
68} 73}
69 74
70void EmitShiftRightLogical64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string base, 75void EmitShiftRightLogical64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
76 [[maybe_unused]] std::string base,
71 [[maybe_unused]] std::string shift) { 77 [[maybe_unused]] std::string shift) {
72 throw NotImplementedException("GLSL Instruction"); 78 throw NotImplementedException("GLSL Instruction");
73} 79}
74 80
75void EmitShiftRightArithmetic32([[maybe_unused]] EmitContext& ctx, 81void EmitShiftRightArithmetic32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
76 [[maybe_unused]] std::string base, 82 [[maybe_unused]] std::string base,
77 [[maybe_unused]] std::string shift) { 83 [[maybe_unused]] std::string shift) {
78 throw NotImplementedException("GLSL Instruction"); 84 throw NotImplementedException("GLSL Instruction");
79} 85}
80 86
81void EmitShiftRightArithmetic64([[maybe_unused]] EmitContext& ctx, 87void EmitShiftRightArithmetic64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
82 [[maybe_unused]] std::string base, 88 [[maybe_unused]] std::string base,
83 [[maybe_unused]] std::string shift) { 89 [[maybe_unused]] std::string shift) {
84 throw NotImplementedException("GLSL Instruction"); 90 throw NotImplementedException("GLSL Instruction");
@@ -99,9 +105,9 @@ void EmitBitwiseXor32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::In
99 throw NotImplementedException("GLSL Instruction"); 105 throw NotImplementedException("GLSL Instruction");
100} 106}
101 107
102void EmitBitFieldInsert([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string base, 108void EmitBitFieldInsert([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
103 [[maybe_unused]] std::string insert, [[maybe_unused]] std::string offset, 109 [[maybe_unused]] std::string base, [[maybe_unused]] std::string insert,
104 std::string count) { 110 [[maybe_unused]] std::string offset, std::string count) {
105 throw NotImplementedException("GLSL Instruction"); 111 throw NotImplementedException("GLSL Instruction");
106} 112}
107 113
@@ -117,43 +123,48 @@ void EmitBitFieldUExtract([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR
117 throw NotImplementedException("GLSL Instruction"); 123 throw NotImplementedException("GLSL Instruction");
118} 124}
119 125
120void EmitBitReverse32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string value) { 126void EmitBitReverse32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
127 [[maybe_unused]] std::string value) {
121 throw NotImplementedException("GLSL Instruction"); 128 throw NotImplementedException("GLSL Instruction");
122} 129}
123 130
124void EmitBitCount32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string value) { 131void EmitBitCount32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
132 [[maybe_unused]] std::string value) {
125 throw NotImplementedException("GLSL Instruction"); 133 throw NotImplementedException("GLSL Instruction");
126} 134}
127 135
128void EmitBitwiseNot32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string value) { 136void EmitBitwiseNot32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
137 [[maybe_unused]] std::string value) {
129 throw NotImplementedException("GLSL Instruction"); 138 throw NotImplementedException("GLSL Instruction");
130} 139}
131 140
132void EmitFindSMsb32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string value) { 141void EmitFindSMsb32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
142 [[maybe_unused]] std::string value) {
133 throw NotImplementedException("GLSL Instruction"); 143 throw NotImplementedException("GLSL Instruction");
134} 144}
135 145
136void EmitFindUMsb32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string value) { 146void EmitFindUMsb32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
147 [[maybe_unused]] std::string value) {
137 throw NotImplementedException("GLSL Instruction"); 148 throw NotImplementedException("GLSL Instruction");
138} 149}
139 150
140void EmitSMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string a, 151void EmitSMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
141 [[maybe_unused]] std::string b) { 152 [[maybe_unused]] std::string a, [[maybe_unused]] std::string b) {
142 throw NotImplementedException("GLSL Instruction"); 153 throw NotImplementedException("GLSL Instruction");
143} 154}
144 155
145void EmitUMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string a, 156void EmitUMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
146 [[maybe_unused]] std::string b) { 157 [[maybe_unused]] std::string a, [[maybe_unused]] std::string b) {
147 throw NotImplementedException("GLSL Instruction"); 158 throw NotImplementedException("GLSL Instruction");
148} 159}
149 160
150void EmitSMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string a, 161void EmitSMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
151 [[maybe_unused]] std::string b) { 162 [[maybe_unused]] std::string a, [[maybe_unused]] std::string b) {
152 throw NotImplementedException("GLSL Instruction"); 163 throw NotImplementedException("GLSL Instruction");
153} 164}
154 165
155void EmitUMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string a, 166void EmitUMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
156 [[maybe_unused]] std::string b) { 167 [[maybe_unused]] std::string a, [[maybe_unused]] std::string b) {
157 throw NotImplementedException("GLSL Instruction"); 168 throw NotImplementedException("GLSL Instruction");
158} 169}
159 170
@@ -169,53 +180,53 @@ void EmitUClamp32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst*
169 throw NotImplementedException("GLSL Instruction"); 180 throw NotImplementedException("GLSL Instruction");
170} 181}
171 182
172void EmitSLessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string lhs, 183void EmitSLessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
173 [[maybe_unused]] std::string rhs) { 184 [[maybe_unused]] std::string lhs, [[maybe_unused]] std::string rhs) {
174 throw NotImplementedException("GLSL Instruction"); 185 throw NotImplementedException("GLSL Instruction");
175} 186}
176 187
177void EmitULessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string lhs, 188void EmitULessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
178 [[maybe_unused]] std::string rhs) { 189 [[maybe_unused]] std::string lhs, [[maybe_unused]] std::string rhs) {
179 throw NotImplementedException("GLSL Instruction"); 190 throw NotImplementedException("GLSL Instruction");
180} 191}
181 192
182void EmitIEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string lhs, 193void EmitIEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
183 [[maybe_unused]] std::string rhs) { 194 [[maybe_unused]] std::string lhs, [[maybe_unused]] std::string rhs) {
184 throw NotImplementedException("GLSL Instruction"); 195 throw NotImplementedException("GLSL Instruction");
185} 196}
186 197
187void EmitSLessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string lhs, 198void EmitSLessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
188 [[maybe_unused]] std::string rhs) { 199 [[maybe_unused]] std::string lhs, [[maybe_unused]] std::string rhs) {
189 throw NotImplementedException("GLSL Instruction"); 200 throw NotImplementedException("GLSL Instruction");
190} 201}
191 202
192void EmitULessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string lhs, 203void EmitULessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
193 [[maybe_unused]] std::string rhs) { 204 [[maybe_unused]] std::string lhs, [[maybe_unused]] std::string rhs) {
194 throw NotImplementedException("GLSL Instruction"); 205 throw NotImplementedException("GLSL Instruction");
195} 206}
196 207
197void EmitSGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string lhs, 208void EmitSGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
198 [[maybe_unused]] std::string rhs) { 209 [[maybe_unused]] std::string lhs, [[maybe_unused]] std::string rhs) {
199 throw NotImplementedException("GLSL Instruction"); 210 throw NotImplementedException("GLSL Instruction");
200} 211}
201 212
202void EmitUGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string lhs, 213void EmitUGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
203 [[maybe_unused]] std::string rhs) { 214 [[maybe_unused]] std::string lhs, [[maybe_unused]] std::string rhs) {
204 throw NotImplementedException("GLSL Instruction"); 215 throw NotImplementedException("GLSL Instruction");
205} 216}
206 217
207void EmitINotEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string lhs, 218void EmitINotEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
208 [[maybe_unused]] std::string rhs) { 219 [[maybe_unused]] std::string lhs, [[maybe_unused]] std::string rhs) {
209 throw NotImplementedException("GLSL Instruction"); 220 throw NotImplementedException("GLSL Instruction");
210} 221}
211 222
212void EmitSGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string lhs, 223void EmitSGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
213 [[maybe_unused]] std::string rhs) { 224 [[maybe_unused]] std::string lhs, [[maybe_unused]] std::string rhs) {
214 throw NotImplementedException("GLSL Instruction"); 225 throw NotImplementedException("GLSL Instruction");
215} 226}
216 227
217void EmitUGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string lhs, 228void EmitUGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst* inst,
218 [[maybe_unused]] std::string rhs) { 229 [[maybe_unused]] std::string lhs, [[maybe_unused]] std::string rhs) {
219 throw NotImplementedException("GLSL Instruction"); 230 throw NotImplementedException("GLSL Instruction");
220} 231}
221} // namespace Shader::Backend::GLSL 232} // namespace Shader::Backend::GLSL