summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/backend/glsl
diff options
context:
space:
mode:
authorGravatar ameerj2021-05-24 00:55:39 -0400
committerGravatar ameerj2021-07-22 21:51:36 -0400
commitdf793fc0493a67ca2838ba816232da8409d03c8a (patch)
tree826775d0642001231c28c0233674ee2cc5ee817a /src/shader_recompiler/backend/glsl
parentglsl: Add a more robust fp formatter (diff)
downloadyuzu-df793fc0493a67ca2838ba816232da8409d03c8a.tar.gz
yuzu-df793fc0493a67ca2838ba816232da8409d03c8a.tar.xz
yuzu-df793fc0493a67ca2838ba816232da8409d03c8a.zip
glsl: Implement FCMP
Diffstat (limited to 'src/shader_recompiler/backend/glsl')
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_floating_point.cpp380
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_instructions.h35
-rw-r--r--src/shader_recompiler/backend/glsl/reg_alloc.cpp12
3 files changed, 185 insertions, 242 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_floating_point.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_floating_point.cpp
index e8c828e7c..665fc1562 100644
--- a/src/shader_recompiler/backend/glsl/emit_glsl_floating_point.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_glsl_floating_point.cpp
@@ -10,162 +10,151 @@
10#include "shader_recompiler/profile.h" 10#include "shader_recompiler/profile.h"
11 11
12namespace Shader::Backend::GLSL { 12namespace Shader::Backend::GLSL {
13namespace {
14void Compare(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs,
15 std::string_view op, std::string_view, bool ordered, bool inequality = false) {
16 ctx.AddU1("{}={}{}{}", inst, lhs, op, rhs, lhs, rhs);
17 if (ordered && inequality) {
18 ctx.code += fmt::format("&&!isnan({})&&!isnan({})", lhs, rhs);
19 } else if (!ordered && !inequality) {
20 ctx.code += fmt::format("||!isnan({})||!isnan({})", lhs, rhs);
21 }
22 ctx.code += ";";
23}
24} // namespace
13 25
14void EmitFPAbs16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 26void EmitFPAbs16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
15 [[maybe_unused]] std::string_view value) { 27 [[maybe_unused]] std::string_view value) {
16 throw NotImplementedException("GLSL"); 28 throw NotImplementedException("GLSL Instruction");
17} 29}
18 30
19void EmitFPAbs32([[maybe_unused]] EmitContext& ctx, IR::Inst& inst, 31void EmitFPAbs32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
20 [[maybe_unused]] std::string_view value) {
21 ctx.AddF32("{}=abs({});", inst, value); 32 ctx.AddF32("{}=abs({});", inst, value);
22} 33}
23 34
24void EmitFPAbs64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 35void EmitFPAbs64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
25 [[maybe_unused]] std::string_view value) { 36 ctx.AddF64("{}=abs({});", inst, value);
26 throw NotImplementedException("GLSL");
27} 37}
28 38
29void EmitFPAdd16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 39void EmitFPAdd16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
30 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { 40 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
31 throw NotImplementedException("GLSL"); 41 throw NotImplementedException("GLSL Instruction");
32} 42}
33 43
34void EmitFPAdd32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 44void EmitFPAdd32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
35 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
36 ctx.AddF32("{}=float({})+float({});", inst, a, b); 45 ctx.AddF32("{}=float({})+float({});", inst, a, b);
37} 46}
38 47
39void EmitFPAdd64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 48void EmitFPAdd64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
40 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
41 ctx.AddF64("{}=double({})+double({});", inst, a, b); 49 ctx.AddF64("{}=double({})+double({});", inst, a, b);
42} 50}
43 51
44void EmitFPFma16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 52void EmitFPFma16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
45 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b, 53 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b,
46 [[maybe_unused]] std::string_view c) { 54 [[maybe_unused]] std::string_view c) {
47 throw NotImplementedException("GLSL"); 55 throw NotImplementedException("GLSL Instruction");
48} 56}
49 57
50void EmitFPFma32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 58void EmitFPFma32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b,
51 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b, 59 std::string_view c) {
52 [[maybe_unused]] std::string_view c) {
53 ctx.AddF32("{}=fma({},{},{});", inst, a, b, c); 60 ctx.AddF32("{}=fma({},{},{});", inst, a, b, c);
54} 61}
55 62
56void EmitFPFma64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 63void EmitFPFma64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b,
57 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b, 64 std::string_view c) {
58 [[maybe_unused]] std::string_view c) {
59 ctx.AddF64("{}=fma({},{},{});", inst, a, b, c); 65 ctx.AddF64("{}=fma({},{},{});", inst, a, b, c);
60} 66}
61 67
62void EmitFPMax32([[maybe_unused]] EmitContext& ctx, IR::Inst& inst, 68void EmitFPMax32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
63 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
64 ctx.AddF32("{}=max({},{});", inst, a, b); 69 ctx.AddF32("{}=max({},{});", inst, a, b);
65} 70}
66 71
67void EmitFPMax64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 72void EmitFPMax64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
68 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
69 ctx.AddF64("{}=max({},{});", inst, a, b); 73 ctx.AddF64("{}=max({},{});", inst, a, b);
70} 74}
71 75
72void EmitFPMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 76void EmitFPMin32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
73 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
74 ctx.AddF32("{}=min({},{});", inst, a, b); 77 ctx.AddF32("{}=min({},{});", inst, a, b);
75} 78}
76 79
77void EmitFPMin64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 80void EmitFPMin64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
78 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
79 ctx.AddF64("{}=min({},{});", inst, a, b); 81 ctx.AddF64("{}=min({},{});", inst, a, b);
80} 82}
81 83
82void EmitFPMul16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 84void EmitFPMul16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
83 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { 85 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
84 throw NotImplementedException("GLSL"); 86 throw NotImplementedException("GLSL Instruction");
85} 87}
86 88
87void EmitFPMul32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 89void EmitFPMul32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
88 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
89 ctx.AddF32("{}={}*{};", inst, a, b); 90 ctx.AddF32("{}={}*{};", inst, a, b);
90} 91}
91 92
92void EmitFPMul64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 93void EmitFPMul64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
93 [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
94 ctx.AddF64("{}={}*{};", inst, a, b); 94 ctx.AddF64("{}={}*{};", inst, a, b);
95} 95}
96 96
97void EmitFPNeg16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 97void EmitFPNeg16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
98 [[maybe_unused]] std::string_view value) { 98 [[maybe_unused]] std::string_view value) {
99 throw NotImplementedException("GLSL"); 99 throw NotImplementedException("GLSL Instruction");
100} 100}
101 101
102void EmitFPNeg32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 102void EmitFPNeg32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
103 [[maybe_unused]] std::string_view value) {
104 ctx.AddF32("{}=-({});", inst, value); 103 ctx.AddF32("{}=-({});", inst, value);
105} 104}
106 105
107void EmitFPNeg64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 106void EmitFPNeg64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
108 [[maybe_unused]] std::string_view value) {
109 ctx.AddF64("{}=-({});", inst, value); 107 ctx.AddF64("{}=-({});", inst, value);
110} 108}
111 109
112void EmitFPSin([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 110void EmitFPSin(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
113 [[maybe_unused]] std::string_view value) {
114 ctx.AddF32("{}=sin({});", inst, value); 111 ctx.AddF32("{}=sin({});", inst, value);
115} 112}
116 113
117void EmitFPCos([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 114void EmitFPCos(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
118 [[maybe_unused]] std::string_view value) {
119 ctx.AddF32("{}=cos({});", inst, value); 115 ctx.AddF32("{}=cos({});", inst, value);
120} 116}
121 117
122void EmitFPExp2([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 118void EmitFPExp2(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
123 [[maybe_unused]] std::string_view value) {
124 ctx.AddF32("{}=exp2({});", inst, value); 119 ctx.AddF32("{}=exp2({});", inst, value);
125} 120}
126 121
127void EmitFPLog2([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 122void EmitFPLog2(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
128 [[maybe_unused]] std::string_view value) {
129 ctx.AddF32("{}=log2({});", inst, value); 123 ctx.AddF32("{}=log2({});", inst, value);
130} 124}
131 125
132void EmitFPRecip32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 126void EmitFPRecip32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
133 [[maybe_unused]] std::string_view value) {
134 ctx.AddF32("{}=1/{};", inst, value); 127 ctx.AddF32("{}=1/{};", inst, value);
135} 128}
136 129
137void EmitFPRecip64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 130void EmitFPRecip64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
138 [[maybe_unused]] std::string_view value) {
139 ctx.AddF64("{}=1/{};", inst, value); 131 ctx.AddF64("{}=1/{};", inst, value);
140} 132}
141 133
142void EmitFPRecipSqrt32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 134void EmitFPRecipSqrt32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
143 [[maybe_unused]] std::string_view value) { 135 [[maybe_unused]] std::string_view value) {
144 throw NotImplementedException("GLSL"); 136 throw NotImplementedException("GLSL Instruction");
145} 137}
146 138
147void EmitFPRecipSqrt64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 139void EmitFPRecipSqrt64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
148 [[maybe_unused]] std::string_view value) { 140 [[maybe_unused]] std::string_view value) {
149 throw NotImplementedException("GLSL"); 141 throw NotImplementedException("GLSL Instruction");
150} 142}
151 143
152void EmitFPSqrt([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 144void EmitFPSqrt(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
153 [[maybe_unused]] std::string_view value) {
154 ctx.AddF32("{}=sqrt({});", inst, value); 145 ctx.AddF32("{}=sqrt({});", inst, value);
155} 146}
156 147
157void EmitFPSaturate16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 148void EmitFPSaturate16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
158 [[maybe_unused]] std::string_view value) { 149 [[maybe_unused]] std::string_view value) {
159 throw NotImplementedException("GLSL"); 150 throw NotImplementedException("GLSL Instruction");
160} 151}
161 152
162void EmitFPSaturate32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 153void EmitFPSaturate32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
163 [[maybe_unused]] std::string_view value) {
164 ctx.AddF32("{}=min(max({},0.0),1.0);", inst, value); 154 ctx.AddF32("{}=min(max({},0.0),1.0);", inst, value);
165} 155}
166 156
167void EmitFPSaturate64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 157void EmitFPSaturate64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
168 [[maybe_unused]] std::string_view value) {
169 ctx.AddF64("{}=min(max({},0.0),1.0);", inst, value); 158 ctx.AddF64("{}=min(max({},0.0),1.0);", inst, value);
170} 159}
171 160
@@ -173,316 +162,269 @@ void EmitFPClamp16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst&
173 [[maybe_unused]] std::string_view value, 162 [[maybe_unused]] std::string_view value,
174 [[maybe_unused]] std::string_view min_value, 163 [[maybe_unused]] std::string_view min_value,
175 [[maybe_unused]] std::string_view max_value) { 164 [[maybe_unused]] std::string_view max_value) {
176 throw NotImplementedException("GLSL"); 165 throw NotImplementedException("GLSL Instruction");
177} 166}
178 167
179void EmitFPClamp32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 168void EmitFPClamp32(EmitContext& ctx, IR::Inst& inst, std::string_view value,
180 [[maybe_unused]] std::string_view value, 169 std::string_view min_value, std::string_view max_value) {
181 [[maybe_unused]] std::string_view min_value,
182 [[maybe_unused]] std::string_view max_value) {
183 // GLSL's clamp does not produce desirable results 170 // GLSL's clamp does not produce desirable results
184 ctx.AddF32("{}=min(max({},float({})),float({}));", inst, value, min_value, max_value); 171 ctx.AddF32("{}=min(max({},float({})),float({}));", inst, value, min_value, max_value);
185} 172}
186 173
187void EmitFPClamp64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 174void EmitFPClamp64(EmitContext& ctx, IR::Inst& inst, std::string_view value,
188 [[maybe_unused]] std::string_view value, 175 std::string_view min_value, std::string_view max_value) {
189 [[maybe_unused]] std::string_view min_value,
190 [[maybe_unused]] std::string_view max_value) {
191 // GLSL's clamp does not produce desirable results 176 // GLSL's clamp does not produce desirable results
192 ctx.AddF64("{}=min(max({},double({})),double({}));", inst, value, min_value, max_value); 177 ctx.AddF64("{}=min(max({},double({})),double({}));", inst, value, min_value, max_value);
193} 178}
194 179
195void EmitFPRoundEven16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 180void EmitFPRoundEven16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
196 [[maybe_unused]] std::string_view value) { 181 [[maybe_unused]] std::string_view value) {
197 throw NotImplementedException("GLSL"); 182 throw NotImplementedException("GLSL Instruction");
198} 183}
199 184
200void EmitFPRoundEven32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 185void EmitFPRoundEven32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
201 [[maybe_unused]] std::string_view value) {
202 ctx.AddF32("{}=roundEven({});", inst, value); 186 ctx.AddF32("{}=roundEven({});", inst, value);
203} 187}
204 188
205void EmitFPRoundEven64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 189void EmitFPRoundEven64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
206 [[maybe_unused]] std::string_view value) {
207 ctx.AddF64("{}=roundEven({});", inst, value); 190 ctx.AddF64("{}=roundEven({});", inst, value);
208} 191}
209 192
210void EmitFPFloor16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 193void EmitFPFloor16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
211 [[maybe_unused]] std::string_view value) { 194 [[maybe_unused]] std::string_view value) {
212 throw NotImplementedException("GLSL"); 195 throw NotImplementedException("GLSL Instruction");
213} 196}
214 197
215void EmitFPFloor32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 198void EmitFPFloor32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
216 [[maybe_unused]] std::string_view value) {
217 ctx.AddF32("{}=floor({});", inst, value); 199 ctx.AddF32("{}=floor({});", inst, value);
218} 200}
219 201
220void EmitFPFloor64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 202void EmitFPFloor64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
221 [[maybe_unused]] std::string_view value) {
222 ctx.AddF64("{}=floor({});", inst, value); 203 ctx.AddF64("{}=floor({});", inst, value);
223} 204}
224 205
225void EmitFPCeil16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 206void EmitFPCeil16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
226 [[maybe_unused]] std::string_view value) { 207 [[maybe_unused]] std::string_view value) {
227 throw NotImplementedException("GLSL"); 208 throw NotImplementedException("GLSL Instruction");
228} 209}
229 210
230void EmitFPCeil32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 211void EmitFPCeil32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
231 [[maybe_unused]] std::string_view value) {
232 ctx.AddF32("{}=ceil({});", inst, value); 212 ctx.AddF32("{}=ceil({});", inst, value);
233} 213}
234 214
235void EmitFPCeil64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 215void EmitFPCeil64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
236 [[maybe_unused]] std::string_view value) {
237 ctx.AddF64("{}=ceil({});", inst, value); 216 ctx.AddF64("{}=ceil({});", inst, value);
238} 217}
239 218
240void EmitFPTrunc16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 219void EmitFPTrunc16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
241 [[maybe_unused]] std::string_view value) { 220 [[maybe_unused]] std::string_view value) {
242 throw NotImplementedException("GLSL"); 221 throw NotImplementedException("GLSL Instruction");
243} 222}
244 223
245void EmitFPTrunc32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 224void EmitFPTrunc32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
246 [[maybe_unused]] std::string_view value) {
247 ctx.AddF32("{}=trunc({});", inst, value); 225 ctx.AddF32("{}=trunc({});", inst, value);
248} 226}
249 227
250void EmitFPTrunc64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 228void EmitFPTrunc64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
251 [[maybe_unused]] std::string_view value) {
252 ctx.AddF64("{}=trunc({});", inst, value); 229 ctx.AddF64("{}=trunc({});", inst, value);
253} 230}
254 231
255void EmitFPOrdEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 232void EmitFPOrdEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs,
256 [[maybe_unused]] std::string_view lhs,
257 [[maybe_unused]] std::string_view rhs) { 233 [[maybe_unused]] std::string_view rhs) {
258 throw NotImplementedException("GLSL"); 234 throw NotImplementedException("GLSL instruction");
259} 235}
260 236
261void EmitFPOrdEqual32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 237void EmitFPOrdEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
262 [[maybe_unused]] std::string_view lhs, 238 std::string_view rhs) {
263 [[maybe_unused]] std::string_view rhs) { 239 Compare(ctx, inst, lhs, rhs, "==", "F", true);
264 ctx.AddU1("{}={}=={};", inst, lhs, rhs);
265} 240}
266 241
267void EmitFPOrdEqual64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 242void EmitFPOrdEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
268 [[maybe_unused]] std::string_view lhs, 243 std::string_view rhs) {
269 [[maybe_unused]] std::string_view rhs) { 244 Compare(ctx, inst, lhs, rhs, "==", "F64", true);
270 throw NotImplementedException("GLSL");
271} 245}
272 246
273void EmitFPUnordEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 247void EmitFPUnordEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs,
274 [[maybe_unused]] std::string_view lhs,
275 [[maybe_unused]] std::string_view rhs) { 248 [[maybe_unused]] std::string_view rhs) {
276 throw NotImplementedException("GLSL"); 249 throw NotImplementedException("GLSL instruction");
277} 250}
278 251
279void EmitFPUnordEqual32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 252void EmitFPUnordEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
280 [[maybe_unused]] std::string_view lhs, 253 std::string_view rhs) {
281 [[maybe_unused]] std::string_view rhs) { 254 Compare(ctx, inst, lhs, rhs, "==", "F", false);
282 throw NotImplementedException("GLSL");
283} 255}
284 256
285void EmitFPUnordEqual64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 257void EmitFPUnordEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
286 [[maybe_unused]] std::string_view lhs, 258 std::string_view rhs) {
287 [[maybe_unused]] std::string_view rhs) { 259 Compare(ctx, inst, lhs, rhs, "==", "F64", false);
288 throw NotImplementedException("GLSL");
289} 260}
290 261
291void EmitFPOrdNotEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 262void EmitFPOrdNotEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs,
292 [[maybe_unused]] std::string_view lhs,
293 [[maybe_unused]] std::string_view rhs) { 263 [[maybe_unused]] std::string_view rhs) {
294 throw NotImplementedException("GLSL"); 264 throw NotImplementedException("GLSL instruction");
295} 265}
296 266
297void EmitFPOrdNotEqual32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 267void EmitFPOrdNotEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
298 [[maybe_unused]] std::string_view lhs, 268 std::string_view rhs) {
299 [[maybe_unused]] std::string_view rhs) { 269 Compare(ctx, inst, lhs, rhs, "!=", "F", true, true);
300 throw NotImplementedException("GLSL");
301} 270}
302 271
303void EmitFPOrdNotEqual64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 272void EmitFPOrdNotEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
304 [[maybe_unused]] std::string_view lhs, 273 std::string_view rhs) {
305 [[maybe_unused]] std::string_view rhs) { 274 Compare(ctx, inst, lhs, rhs, "!=", "F64", true, true);
306 throw NotImplementedException("GLSL");
307} 275}
308 276
309void EmitFPUnordNotEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 277void EmitFPUnordNotEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs,
310 [[maybe_unused]] std::string_view lhs,
311 [[maybe_unused]] std::string_view rhs) { 278 [[maybe_unused]] std::string_view rhs) {
312 throw NotImplementedException("GLSL"); 279 throw NotImplementedException("GLSL instruction");
313} 280}
314 281
315void EmitFPUnordNotEqual32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 282void EmitFPUnordNotEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
316 [[maybe_unused]] std::string_view lhs, 283 std::string_view rhs) {
317 [[maybe_unused]] std::string_view rhs) { 284 Compare(ctx, inst, lhs, rhs, "!=", "F", false, true);
318 throw NotImplementedException("GLSL");
319} 285}
320 286
321void EmitFPUnordNotEqual64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 287void EmitFPUnordNotEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
322 [[maybe_unused]] std::string_view lhs, 288 std::string_view rhs) {
323 [[maybe_unused]] std::string_view rhs) { 289 Compare(ctx, inst, lhs, rhs, "!=", "F64", false, true);
324 throw NotImplementedException("GLSL");
325} 290}
326 291
327void EmitFPOrdLessThan16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 292void EmitFPOrdLessThan16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs,
328 [[maybe_unused]] std::string_view lhs,
329 [[maybe_unused]] std::string_view rhs) { 293 [[maybe_unused]] std::string_view rhs) {
330 throw NotImplementedException("GLSL"); 294 throw NotImplementedException("GLSL instruction");
331} 295}
332 296
333void EmitFPOrdLessThan32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 297void EmitFPOrdLessThan32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
334 [[maybe_unused]] std::string_view lhs, 298 std::string_view rhs) {
335 [[maybe_unused]] std::string_view rhs) { 299 Compare(ctx, inst, lhs, rhs, "<", "F", true);
336 throw NotImplementedException("GLSL");
337} 300}
338 301
339void EmitFPOrdLessThan64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 302void EmitFPOrdLessThan64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
340 [[maybe_unused]] std::string_view lhs, 303 std::string_view rhs) {
341 [[maybe_unused]] std::string_view rhs) { 304 Compare(ctx, inst, lhs, rhs, "<", "F64", true);
342 throw NotImplementedException("GLSL");
343} 305}
344 306
345void EmitFPUnordLessThan16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 307void EmitFPUnordLessThan16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs,
346 [[maybe_unused]] std::string_view lhs,
347 [[maybe_unused]] std::string_view rhs) { 308 [[maybe_unused]] std::string_view rhs) {
348 throw NotImplementedException("GLSL"); 309 throw NotImplementedException("GLSL instruction");
349} 310}
350 311
351void EmitFPUnordLessThan32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 312void EmitFPUnordLessThan32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
352 [[maybe_unused]] std::string_view lhs, 313 std::string_view rhs) {
353 [[maybe_unused]] std::string_view rhs) { 314 Compare(ctx, inst, lhs, rhs, "<", "F", false);
354 throw NotImplementedException("GLSL");
355} 315}
356 316
357void EmitFPUnordLessThan64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 317void EmitFPUnordLessThan64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
358 [[maybe_unused]] std::string_view lhs, 318 std::string_view rhs) {
359 [[maybe_unused]] std::string_view rhs) { 319 Compare(ctx, inst, lhs, rhs, "<", "F64", false);
360 throw NotImplementedException("GLSL");
361} 320}
362 321
363void EmitFPOrdGreaterThan16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 322void EmitFPOrdGreaterThan16([[maybe_unused]] EmitContext& ctx,
364 [[maybe_unused]] std::string_view lhs, 323 [[maybe_unused]] std::string_view lhs,
365 [[maybe_unused]] std::string_view rhs) { 324 [[maybe_unused]] std::string_view rhs) {
366 throw NotImplementedException("GLSL"); 325 throw NotImplementedException("GLSL instruction");
367} 326}
368 327
369void EmitFPOrdGreaterThan32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 328void EmitFPOrdGreaterThan32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
370 [[maybe_unused]] std::string_view lhs, 329 std::string_view rhs) {
371 [[maybe_unused]] std::string_view rhs) { 330 Compare(ctx, inst, lhs, rhs, ">", "F", true);
372 throw NotImplementedException("GLSL");
373} 331}
374 332
375void EmitFPOrdGreaterThan64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 333void EmitFPOrdGreaterThan64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
376 [[maybe_unused]] std::string_view lhs, 334 std::string_view rhs) {
377 [[maybe_unused]] std::string_view rhs) { 335 Compare(ctx, inst, lhs, rhs, ">", "F64", true);
378 throw NotImplementedException("GLSL");
379} 336}
380 337
381void EmitFPUnordGreaterThan16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 338void EmitFPUnordGreaterThan16([[maybe_unused]] EmitContext& ctx,
382 [[maybe_unused]] std::string_view lhs, 339 [[maybe_unused]] std::string_view lhs,
383 [[maybe_unused]] std::string_view rhs) { 340 [[maybe_unused]] std::string_view rhs) {
384 throw NotImplementedException("GLSL"); 341 throw NotImplementedException("GLSL instruction");
385} 342}
386 343
387void EmitFPUnordGreaterThan32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 344void EmitFPUnordGreaterThan32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
388 [[maybe_unused]] std::string_view lhs, 345 std::string_view rhs) {
389 [[maybe_unused]] std::string_view rhs) { 346 Compare(ctx, inst, lhs, rhs, ">", "F", false);
390 throw NotImplementedException("GLSL");
391} 347}
392 348
393void EmitFPUnordGreaterThan64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 349void EmitFPUnordGreaterThan64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
394 [[maybe_unused]] std::string_view lhs, 350 std::string_view rhs) {
395 [[maybe_unused]] std::string_view rhs) { 351 Compare(ctx, inst, lhs, rhs, ">", "F64", false);
396 throw NotImplementedException("GLSL");
397} 352}
398 353
399void EmitFPOrdLessThanEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 354void EmitFPOrdLessThanEqual16([[maybe_unused]] EmitContext& ctx,
400 [[maybe_unused]] std::string_view lhs, 355 [[maybe_unused]] std::string_view lhs,
401 [[maybe_unused]] std::string_view rhs) { 356 [[maybe_unused]] std::string_view rhs) {
402 throw NotImplementedException("GLSL"); 357 throw NotImplementedException("GLSL instruction");
403} 358}
404 359
405void EmitFPOrdLessThanEqual32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 360void EmitFPOrdLessThanEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
406 [[maybe_unused]] std::string_view lhs, 361 std::string_view rhs) {
407 [[maybe_unused]] std::string_view rhs) { 362 Compare(ctx, inst, lhs, rhs, "<=", "F", true);
408 throw NotImplementedException("GLSL");
409} 363}
410 364
411void EmitFPOrdLessThanEqual64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 365void EmitFPOrdLessThanEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
412 [[maybe_unused]] std::string_view lhs, 366 std::string_view rhs) {
413 [[maybe_unused]] std::string_view rhs) { 367 Compare(ctx, inst, lhs, rhs, "<=", "F64", true);
414 throw NotImplementedException("GLSL");
415} 368}
416 369
417void EmitFPUnordLessThanEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 370void EmitFPUnordLessThanEqual16([[maybe_unused]] EmitContext& ctx,
418 [[maybe_unused]] std::string_view lhs, 371 [[maybe_unused]] std::string_view lhs,
419 [[maybe_unused]] std::string_view rhs) { 372 [[maybe_unused]] std::string_view rhs) {
420 throw NotImplementedException("GLSL"); 373 throw NotImplementedException("GLSL instruction");
421} 374}
422 375
423void EmitFPUnordLessThanEqual32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 376void EmitFPUnordLessThanEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
424 [[maybe_unused]] std::string_view lhs, 377 std::string_view rhs) {
425 [[maybe_unused]] std::string_view rhs) { 378 Compare(ctx, inst, lhs, rhs, "<=", "F", false);
426 throw NotImplementedException("GLSL");
427} 379}
428 380
429void EmitFPUnordLessThanEqual64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 381void EmitFPUnordLessThanEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
430 [[maybe_unused]] std::string_view lhs, 382 std::string_view rhs) {
431 [[maybe_unused]] std::string_view rhs) { 383 Compare(ctx, inst, lhs, rhs, "<=", "F64", false);
432 throw NotImplementedException("GLSL");
433} 384}
434 385
435void EmitFPOrdGreaterThanEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 386void EmitFPOrdGreaterThanEqual16([[maybe_unused]] EmitContext& ctx,
436 [[maybe_unused]] std::string_view lhs, 387 [[maybe_unused]] std::string_view lhs,
437 [[maybe_unused]] std::string_view rhs) { 388 [[maybe_unused]] std::string_view rhs) {
438 throw NotImplementedException("GLSL"); 389 throw NotImplementedException("GLSL instruction");
439} 390}
440 391
441void EmitFPOrdGreaterThanEqual32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 392void EmitFPOrdGreaterThanEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
442 [[maybe_unused]] std::string_view lhs, 393 std::string_view rhs) {
443 [[maybe_unused]] std::string_view rhs) { 394 Compare(ctx, inst, lhs, rhs, ">=", "F", true);
444 throw NotImplementedException("GLSL");
445} 395}
446 396
447void EmitFPOrdGreaterThanEqual64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 397void EmitFPOrdGreaterThanEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
448 [[maybe_unused]] std::string_view lhs, 398 std::string_view rhs) {
449 [[maybe_unused]] std::string_view rhs) { 399 Compare(ctx, inst, lhs, rhs, ">=", "F64", true);
450 throw NotImplementedException("GLSL");
451} 400}
452 401
453void EmitFPUnordGreaterThanEqual16([[maybe_unused]] EmitContext& ctx, 402void EmitFPUnordGreaterThanEqual16([[maybe_unused]] EmitContext& ctx,
454 [[maybe_unused]] IR::Inst& inst,
455 [[maybe_unused]] std::string_view lhs, 403 [[maybe_unused]] std::string_view lhs,
456 [[maybe_unused]] std::string_view rhs) { 404 [[maybe_unused]] std::string_view rhs) {
457 throw NotImplementedException("GLSL"); 405 throw NotImplementedException("GLSL instruction");
458} 406}
459 407
460void EmitFPUnordGreaterThanEqual32([[maybe_unused]] EmitContext& ctx, 408void EmitFPUnordGreaterThanEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
461 [[maybe_unused]] IR::Inst& inst, 409 std::string_view rhs) {
462 [[maybe_unused]] std::string_view lhs, 410 Compare(ctx, inst, lhs, rhs, ">=", "F", false);
463 [[maybe_unused]] std::string_view rhs) {
464 throw NotImplementedException("GLSL");
465} 411}
466 412
467void EmitFPUnordGreaterThanEqual64([[maybe_unused]] EmitContext& ctx, 413void EmitFPUnordGreaterThanEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
468 [[maybe_unused]] IR::Inst& inst, 414 std::string_view rhs) {
469 [[maybe_unused]] std::string_view lhs, 415 Compare(ctx, inst, lhs, rhs, ">=", "F64", false);
470 [[maybe_unused]] std::string_view rhs) {
471 throw NotImplementedException("GLSL");
472} 416}
473 417
474void EmitFPIsNan16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 418void EmitFPIsNan16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
475 [[maybe_unused]] std::string_view value) { 419 [[maybe_unused]] std::string_view value) {
476 ctx.AddU1("{}=isnan({});", inst, value); 420 throw NotImplementedException("GLSL instruction");
477} 421}
478 422
479void EmitFPIsNan32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 423void EmitFPIsNan32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
480 [[maybe_unused]] std::string_view value) {
481 ctx.AddU1("{}=isnan({});", inst, value); 424 ctx.AddU1("{}=isnan({});", inst, value);
482} 425}
483 426
484void EmitFPIsNan64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 427void EmitFPIsNan64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
485 [[maybe_unused]] std::string_view value) {
486 ctx.AddU1("{}=isnan({});", inst, value); 428 ctx.AddU1("{}=isnan({});", inst, value);
487} 429}
488 430
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h b/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h
index efa515a3c..4e0487543 100644
--- a/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h
+++ b/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h
@@ -289,71 +289,60 @@ void EmitFPCeil64(EmitContext& ctx, IR::Inst& inst, std::string_view value);
289void EmitFPTrunc16(EmitContext& ctx, IR::Inst& inst, std::string_view value); 289void EmitFPTrunc16(EmitContext& ctx, IR::Inst& inst, std::string_view value);
290void EmitFPTrunc32(EmitContext& ctx, IR::Inst& inst, std::string_view value); 290void EmitFPTrunc32(EmitContext& ctx, IR::Inst& inst, std::string_view value);
291void EmitFPTrunc64(EmitContext& ctx, IR::Inst& inst, std::string_view value); 291void EmitFPTrunc64(EmitContext& ctx, IR::Inst& inst, std::string_view value);
292void EmitFPOrdEqual16(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs); 292void EmitFPOrdEqual16(EmitContext& ctx, std::string_view lhs, std::string_view rhs);
293void EmitFPOrdEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs); 293void EmitFPOrdEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs);
294void EmitFPOrdEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs); 294void EmitFPOrdEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs);
295void EmitFPUnordEqual16(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 295void EmitFPUnordEqual16(EmitContext& ctx, std::string_view lhs, std::string_view rhs);
296 std::string_view rhs);
297void EmitFPUnordEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 296void EmitFPUnordEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
298 std::string_view rhs); 297 std::string_view rhs);
299void EmitFPUnordEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 298void EmitFPUnordEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
300 std::string_view rhs); 299 std::string_view rhs);
301void EmitFPOrdNotEqual16(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 300void EmitFPOrdNotEqual16(EmitContext& ctx, std::string_view lhs, std::string_view rhs);
302 std::string_view rhs);
303void EmitFPOrdNotEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 301void EmitFPOrdNotEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
304 std::string_view rhs); 302 std::string_view rhs);
305void EmitFPOrdNotEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 303void EmitFPOrdNotEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
306 std::string_view rhs); 304 std::string_view rhs);
307void EmitFPUnordNotEqual16(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 305void EmitFPUnordNotEqual16(EmitContext& ctx, std::string_view lhs, std::string_view rhs);
308 std::string_view rhs);
309void EmitFPUnordNotEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 306void EmitFPUnordNotEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
310 std::string_view rhs); 307 std::string_view rhs);
311void EmitFPUnordNotEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 308void EmitFPUnordNotEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
312 std::string_view rhs); 309 std::string_view rhs);
313void EmitFPOrdLessThan16(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 310void EmitFPOrdLessThan16(EmitContext& ctx, std::string_view lhs, std::string_view rhs);
314 std::string_view rhs);
315void EmitFPOrdLessThan32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 311void EmitFPOrdLessThan32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
316 std::string_view rhs); 312 std::string_view rhs);
317void EmitFPOrdLessThan64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 313void EmitFPOrdLessThan64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
318 std::string_view rhs); 314 std::string_view rhs);
319void EmitFPUnordLessThan16(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 315void EmitFPUnordLessThan16(EmitContext& ctx, std::string_view lhs, std::string_view rhs);
320 std::string_view rhs);
321void EmitFPUnordLessThan32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 316void EmitFPUnordLessThan32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
322 std::string_view rhs); 317 std::string_view rhs);
323void EmitFPUnordLessThan64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 318void EmitFPUnordLessThan64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
324 std::string_view rhs); 319 std::string_view rhs);
325void EmitFPOrdGreaterThan16(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 320void EmitFPOrdGreaterThan16(EmitContext& ctx, std::string_view lhs, std::string_view rhs);
326 std::string_view rhs);
327void EmitFPOrdGreaterThan32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 321void EmitFPOrdGreaterThan32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
328 std::string_view rhs); 322 std::string_view rhs);
329void EmitFPOrdGreaterThan64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 323void EmitFPOrdGreaterThan64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
330 std::string_view rhs); 324 std::string_view rhs);
331void EmitFPUnordGreaterThan16(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 325void EmitFPUnordGreaterThan16(EmitContext& ctx, std::string_view lhs, std::string_view rhs);
332 std::string_view rhs);
333void EmitFPUnordGreaterThan32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 326void EmitFPUnordGreaterThan32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
334 std::string_view rhs); 327 std::string_view rhs);
335void EmitFPUnordGreaterThan64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 328void EmitFPUnordGreaterThan64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
336 std::string_view rhs); 329 std::string_view rhs);
337void EmitFPOrdLessThanEqual16(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 330void EmitFPOrdLessThanEqual16(EmitContext& ctx, std::string_view lhs, std::string_view rhs);
338 std::string_view rhs);
339void EmitFPOrdLessThanEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 331void EmitFPOrdLessThanEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
340 std::string_view rhs); 332 std::string_view rhs);
341void EmitFPOrdLessThanEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 333void EmitFPOrdLessThanEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
342 std::string_view rhs); 334 std::string_view rhs);
343void EmitFPUnordLessThanEqual16(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 335void EmitFPUnordLessThanEqual16(EmitContext& ctx, std::string_view lhs, std::string_view rhs);
344 std::string_view rhs);
345void EmitFPUnordLessThanEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 336void EmitFPUnordLessThanEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
346 std::string_view rhs); 337 std::string_view rhs);
347void EmitFPUnordLessThanEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 338void EmitFPUnordLessThanEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
348 std::string_view rhs); 339 std::string_view rhs);
349void EmitFPOrdGreaterThanEqual16(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 340void EmitFPOrdGreaterThanEqual16(EmitContext& ctx, std::string_view lhs, std::string_view rhs);
350 std::string_view rhs);
351void EmitFPOrdGreaterThanEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 341void EmitFPOrdGreaterThanEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
352 std::string_view rhs); 342 std::string_view rhs);
353void EmitFPOrdGreaterThanEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 343void EmitFPOrdGreaterThanEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
354 std::string_view rhs); 344 std::string_view rhs);
355void EmitFPUnordGreaterThanEqual16(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 345void EmitFPUnordGreaterThanEqual16(EmitContext& ctx, std::string_view lhs, std::string_view rhs);
356 std::string_view rhs);
357void EmitFPUnordGreaterThanEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 346void EmitFPUnordGreaterThanEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
358 std::string_view rhs); 347 std::string_view rhs);
359void EmitFPUnordGreaterThanEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, 348void EmitFPUnordGreaterThanEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
diff --git a/src/shader_recompiler/backend/glsl/reg_alloc.cpp b/src/shader_recompiler/backend/glsl/reg_alloc.cpp
index 007f8c89d..9f529c358 100644
--- a/src/shader_recompiler/backend/glsl/reg_alloc.cpp
+++ b/src/shader_recompiler/backend/glsl/reg_alloc.cpp
@@ -25,6 +25,18 @@ std::string Representation(Id id) {
25} 25}
26 26
27std::string FormatFloat(std::string_view value, IR::Type type) { 27std::string FormatFloat(std::string_view value, IR::Type type) {
28 // TODO: Confirm FP64 nan/inf
29 if (type == IR::Type::F32) {
30 if (value == "nan") {
31 return "uintBitsToFloat(0x7fc00000)";
32 }
33 if (value == "inf") {
34 return "uintBitsToFloat(0x7f800000)";
35 }
36 if (value == "-inf") {
37 return "uintBitsToFloat(0xff800000)";
38 }
39 }
28 const bool needs_dot = value.find_first_of('.') == std::string_view::npos; 40 const bool needs_dot = value.find_first_of('.') == std::string_view::npos;
29 const bool needs_suffix = !value.ends_with('f'); 41 const bool needs_suffix = !value.ends_with('f');
30 const auto suffix = type == IR::Type::F32 ? "f" : "lf"; 42 const auto suffix = type == IR::Type::F32 ? "f" : "lf";