diff options
| author | 2021-05-24 00:55:39 -0400 | |
|---|---|---|
| committer | 2021-07-22 21:51:36 -0400 | |
| commit | df793fc0493a67ca2838ba816232da8409d03c8a (patch) | |
| tree | 826775d0642001231c28c0233674ee2cc5ee817a /src/shader_recompiler/backend | |
| parent | glsl: Add a more robust fp formatter (diff) | |
| download | yuzu-df793fc0493a67ca2838ba816232da8409d03c8a.tar.gz yuzu-df793fc0493a67ca2838ba816232da8409d03c8a.tar.xz yuzu-df793fc0493a67ca2838ba816232da8409d03c8a.zip | |
glsl: Implement FCMP
Diffstat (limited to 'src/shader_recompiler/backend')
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 | ||
| 12 | namespace Shader::Backend::GLSL { | 12 | namespace Shader::Backend::GLSL { |
| 13 | namespace { | ||
| 14 | void 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 | ||
| 14 | void EmitFPAbs16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 26 | void 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 | ||
| 19 | void EmitFPAbs32([[maybe_unused]] EmitContext& ctx, IR::Inst& inst, | 31 | void 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 | ||
| 24 | void EmitFPAbs64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 35 | void 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 | ||
| 29 | void EmitFPAdd16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 39 | void 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 | ||
| 34 | void EmitFPAdd32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 44 | void 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 | ||
| 39 | void EmitFPAdd64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 48 | void 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 | ||
| 44 | void EmitFPFma16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 52 | void 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 | ||
| 50 | void EmitFPFma32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 58 | void 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 | ||
| 56 | void EmitFPFma64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 63 | void 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 | ||
| 62 | void EmitFPMax32([[maybe_unused]] EmitContext& ctx, IR::Inst& inst, | 68 | void 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 | ||
| 67 | void EmitFPMax64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 72 | void 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 | ||
| 72 | void EmitFPMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 76 | void 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 | ||
| 77 | void EmitFPMin64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 80 | void 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 | ||
| 82 | void EmitFPMul16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 84 | void 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 | ||
| 87 | void EmitFPMul32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 89 | void 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 | ||
| 92 | void EmitFPMul64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 93 | void 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 | ||
| 97 | void EmitFPNeg16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 97 | void 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 | ||
| 102 | void EmitFPNeg32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 102 | void 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 | ||
| 107 | void EmitFPNeg64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 106 | void 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 | ||
| 112 | void EmitFPSin([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 110 | void 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 | ||
| 117 | void EmitFPCos([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 114 | void 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 | ||
| 122 | void EmitFPExp2([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 118 | void 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 | ||
| 127 | void EmitFPLog2([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 122 | void 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 | ||
| 132 | void EmitFPRecip32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 126 | void 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 | ||
| 137 | void EmitFPRecip64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 130 | void 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 | ||
| 142 | void EmitFPRecipSqrt32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 134 | void 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 | ||
| 147 | void EmitFPRecipSqrt64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 139 | void 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 | ||
| 152 | void EmitFPSqrt([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 144 | void 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 | ||
| 157 | void EmitFPSaturate16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 148 | void 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 | ||
| 162 | void EmitFPSaturate32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 153 | void 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 | ||
| 167 | void EmitFPSaturate64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 157 | void 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 | ||
| 179 | void EmitFPClamp32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 168 | void 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 | ||
| 187 | void EmitFPClamp64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 174 | void 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 | ||
| 195 | void EmitFPRoundEven16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 180 | void 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 | ||
| 200 | void EmitFPRoundEven32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 185 | void 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 | ||
| 205 | void EmitFPRoundEven64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 189 | void 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 | ||
| 210 | void EmitFPFloor16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 193 | void 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 | ||
| 215 | void EmitFPFloor32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 198 | void 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 | ||
| 220 | void EmitFPFloor64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 202 | void 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 | ||
| 225 | void EmitFPCeil16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 206 | void 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 | ||
| 230 | void EmitFPCeil32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 211 | void 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 | ||
| 235 | void EmitFPCeil64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 215 | void 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 | ||
| 240 | void EmitFPTrunc16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 219 | void 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 | ||
| 245 | void EmitFPTrunc32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 224 | void 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 | ||
| 250 | void EmitFPTrunc64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 228 | void 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 | ||
| 255 | void EmitFPOrdEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 232 | void 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 | ||
| 261 | void EmitFPOrdEqual32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 237 | void 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 | ||
| 267 | void EmitFPOrdEqual64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 242 | void 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 | ||
| 273 | void EmitFPUnordEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 247 | void 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 | ||
| 279 | void EmitFPUnordEqual32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 252 | void 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 | ||
| 285 | void EmitFPUnordEqual64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 257 | void 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 | ||
| 291 | void EmitFPOrdNotEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 262 | void 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 | ||
| 297 | void EmitFPOrdNotEqual32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 267 | void 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 | ||
| 303 | void EmitFPOrdNotEqual64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 272 | void 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 | ||
| 309 | void EmitFPUnordNotEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 277 | void 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 | ||
| 315 | void EmitFPUnordNotEqual32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 282 | void 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 | ||
| 321 | void EmitFPUnordNotEqual64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 287 | void 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 | ||
| 327 | void EmitFPOrdLessThan16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 292 | void 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 | ||
| 333 | void EmitFPOrdLessThan32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 297 | void 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 | ||
| 339 | void EmitFPOrdLessThan64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 302 | void 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 | ||
| 345 | void EmitFPUnordLessThan16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 307 | void 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 | ||
| 351 | void EmitFPUnordLessThan32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 312 | void 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 | ||
| 357 | void EmitFPUnordLessThan64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 317 | void 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 | ||
| 363 | void EmitFPOrdGreaterThan16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 322 | void 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 | ||
| 369 | void EmitFPOrdGreaterThan32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 328 | void 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 | ||
| 375 | void EmitFPOrdGreaterThan64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 333 | void 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 | ||
| 381 | void EmitFPUnordGreaterThan16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 338 | void 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 | ||
| 387 | void EmitFPUnordGreaterThan32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 344 | void 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 | ||
| 393 | void EmitFPUnordGreaterThan64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 349 | void 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 | ||
| 399 | void EmitFPOrdLessThanEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 354 | void 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 | ||
| 405 | void EmitFPOrdLessThanEqual32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 360 | void 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 | ||
| 411 | void EmitFPOrdLessThanEqual64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 365 | void 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 | ||
| 417 | void EmitFPUnordLessThanEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 370 | void 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 | ||
| 423 | void EmitFPUnordLessThanEqual32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 376 | void 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 | ||
| 429 | void EmitFPUnordLessThanEqual64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 381 | void 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 | ||
| 435 | void EmitFPOrdGreaterThanEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 386 | void 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 | ||
| 441 | void EmitFPOrdGreaterThanEqual32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 392 | void 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 | ||
| 447 | void EmitFPOrdGreaterThanEqual64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 397 | void 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 | ||
| 453 | void EmitFPUnordGreaterThanEqual16([[maybe_unused]] EmitContext& ctx, | 402 | void 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 | ||
| 460 | void EmitFPUnordGreaterThanEqual32([[maybe_unused]] EmitContext& ctx, | 408 | void 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 | ||
| 467 | void EmitFPUnordGreaterThanEqual64([[maybe_unused]] EmitContext& ctx, | 413 | void 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 | ||
| 474 | void EmitFPIsNan16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 418 | void 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 | ||
| 479 | void EmitFPIsNan32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 423 | void 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 | ||
| 484 | void EmitFPIsNan64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 427 | void 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); | |||
| 289 | void EmitFPTrunc16(EmitContext& ctx, IR::Inst& inst, std::string_view value); | 289 | void EmitFPTrunc16(EmitContext& ctx, IR::Inst& inst, std::string_view value); |
| 290 | void EmitFPTrunc32(EmitContext& ctx, IR::Inst& inst, std::string_view value); | 290 | void EmitFPTrunc32(EmitContext& ctx, IR::Inst& inst, std::string_view value); |
| 291 | void EmitFPTrunc64(EmitContext& ctx, IR::Inst& inst, std::string_view value); | 291 | void EmitFPTrunc64(EmitContext& ctx, IR::Inst& inst, std::string_view value); |
| 292 | void EmitFPOrdEqual16(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs); | 292 | void EmitFPOrdEqual16(EmitContext& ctx, std::string_view lhs, std::string_view rhs); |
| 293 | void EmitFPOrdEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs); | 293 | void EmitFPOrdEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs); |
| 294 | void EmitFPOrdEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs); | 294 | void EmitFPOrdEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs); |
| 295 | void EmitFPUnordEqual16(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | 295 | void EmitFPUnordEqual16(EmitContext& ctx, std::string_view lhs, std::string_view rhs); |
| 296 | std::string_view rhs); | ||
| 297 | void EmitFPUnordEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | 296 | void EmitFPUnordEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, |
| 298 | std::string_view rhs); | 297 | std::string_view rhs); |
| 299 | void EmitFPUnordEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | 298 | void EmitFPUnordEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, |
| 300 | std::string_view rhs); | 299 | std::string_view rhs); |
| 301 | void EmitFPOrdNotEqual16(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | 300 | void EmitFPOrdNotEqual16(EmitContext& ctx, std::string_view lhs, std::string_view rhs); |
| 302 | std::string_view rhs); | ||
| 303 | void EmitFPOrdNotEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | 301 | void EmitFPOrdNotEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, |
| 304 | std::string_view rhs); | 302 | std::string_view rhs); |
| 305 | void EmitFPOrdNotEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | 303 | void EmitFPOrdNotEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, |
| 306 | std::string_view rhs); | 304 | std::string_view rhs); |
| 307 | void EmitFPUnordNotEqual16(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | 305 | void EmitFPUnordNotEqual16(EmitContext& ctx, std::string_view lhs, std::string_view rhs); |
| 308 | std::string_view rhs); | ||
| 309 | void EmitFPUnordNotEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | 306 | void EmitFPUnordNotEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, |
| 310 | std::string_view rhs); | 307 | std::string_view rhs); |
| 311 | void EmitFPUnordNotEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | 308 | void EmitFPUnordNotEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, |
| 312 | std::string_view rhs); | 309 | std::string_view rhs); |
| 313 | void EmitFPOrdLessThan16(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | 310 | void EmitFPOrdLessThan16(EmitContext& ctx, std::string_view lhs, std::string_view rhs); |
| 314 | std::string_view rhs); | ||
| 315 | void EmitFPOrdLessThan32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | 311 | void EmitFPOrdLessThan32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, |
| 316 | std::string_view rhs); | 312 | std::string_view rhs); |
| 317 | void EmitFPOrdLessThan64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | 313 | void EmitFPOrdLessThan64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, |
| 318 | std::string_view rhs); | 314 | std::string_view rhs); |
| 319 | void EmitFPUnordLessThan16(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | 315 | void EmitFPUnordLessThan16(EmitContext& ctx, std::string_view lhs, std::string_view rhs); |
| 320 | std::string_view rhs); | ||
| 321 | void EmitFPUnordLessThan32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | 316 | void EmitFPUnordLessThan32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, |
| 322 | std::string_view rhs); | 317 | std::string_view rhs); |
| 323 | void EmitFPUnordLessThan64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | 318 | void EmitFPUnordLessThan64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, |
| 324 | std::string_view rhs); | 319 | std::string_view rhs); |
| 325 | void EmitFPOrdGreaterThan16(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | 320 | void EmitFPOrdGreaterThan16(EmitContext& ctx, std::string_view lhs, std::string_view rhs); |
| 326 | std::string_view rhs); | ||
| 327 | void EmitFPOrdGreaterThan32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | 321 | void EmitFPOrdGreaterThan32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, |
| 328 | std::string_view rhs); | 322 | std::string_view rhs); |
| 329 | void EmitFPOrdGreaterThan64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | 323 | void EmitFPOrdGreaterThan64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, |
| 330 | std::string_view rhs); | 324 | std::string_view rhs); |
| 331 | void EmitFPUnordGreaterThan16(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | 325 | void EmitFPUnordGreaterThan16(EmitContext& ctx, std::string_view lhs, std::string_view rhs); |
| 332 | std::string_view rhs); | ||
| 333 | void EmitFPUnordGreaterThan32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | 326 | void EmitFPUnordGreaterThan32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, |
| 334 | std::string_view rhs); | 327 | std::string_view rhs); |
| 335 | void EmitFPUnordGreaterThan64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | 328 | void EmitFPUnordGreaterThan64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, |
| 336 | std::string_view rhs); | 329 | std::string_view rhs); |
| 337 | void EmitFPOrdLessThanEqual16(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | 330 | void EmitFPOrdLessThanEqual16(EmitContext& ctx, std::string_view lhs, std::string_view rhs); |
| 338 | std::string_view rhs); | ||
| 339 | void EmitFPOrdLessThanEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | 331 | void EmitFPOrdLessThanEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, |
| 340 | std::string_view rhs); | 332 | std::string_view rhs); |
| 341 | void EmitFPOrdLessThanEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | 333 | void EmitFPOrdLessThanEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, |
| 342 | std::string_view rhs); | 334 | std::string_view rhs); |
| 343 | void EmitFPUnordLessThanEqual16(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | 335 | void EmitFPUnordLessThanEqual16(EmitContext& ctx, std::string_view lhs, std::string_view rhs); |
| 344 | std::string_view rhs); | ||
| 345 | void EmitFPUnordLessThanEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | 336 | void EmitFPUnordLessThanEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, |
| 346 | std::string_view rhs); | 337 | std::string_view rhs); |
| 347 | void EmitFPUnordLessThanEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | 338 | void EmitFPUnordLessThanEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, |
| 348 | std::string_view rhs); | 339 | std::string_view rhs); |
| 349 | void EmitFPOrdGreaterThanEqual16(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | 340 | void EmitFPOrdGreaterThanEqual16(EmitContext& ctx, std::string_view lhs, std::string_view rhs); |
| 350 | std::string_view rhs); | ||
| 351 | void EmitFPOrdGreaterThanEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | 341 | void EmitFPOrdGreaterThanEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, |
| 352 | std::string_view rhs); | 342 | std::string_view rhs); |
| 353 | void EmitFPOrdGreaterThanEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | 343 | void EmitFPOrdGreaterThanEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, |
| 354 | std::string_view rhs); | 344 | std::string_view rhs); |
| 355 | void EmitFPUnordGreaterThanEqual16(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | 345 | void EmitFPUnordGreaterThanEqual16(EmitContext& ctx, std::string_view lhs, std::string_view rhs); |
| 356 | std::string_view rhs); | ||
| 357 | void EmitFPUnordGreaterThanEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | 346 | void EmitFPUnordGreaterThanEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, |
| 358 | std::string_view rhs); | 347 | std::string_view rhs); |
| 359 | void EmitFPUnordGreaterThanEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | 348 | void 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 | ||
| 27 | std::string FormatFloat(std::string_view value, IR::Type type) { | 27 | std::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"; |