yuzu/src/shader_recompiler/backend/glsl/emit_glsl_floating_point.cpp

432 lines
16 KiB
C++
Raw Normal View History

2021-05-22 05:52:03 +00:00
// Copyright 2021 yuzu Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include <string_view>
#include "shader_recompiler/backend/glsl/emit_context.h"
#include "shader_recompiler/backend/glsl/emit_glsl_instructions.h"
#include "shader_recompiler/frontend/ir/value.h"
#include "shader_recompiler/profile.h"
namespace Shader::Backend::GLSL {
2021-05-24 04:55:39 +00:00
namespace {
void Compare(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs,
std::string_view op, bool ordered) {
2021-05-24 04:55:39 +00:00
ctx.AddU1("{}={}{}{}", inst, lhs, op, rhs, lhs, rhs);
if (ordered) {
2021-05-24 04:55:39 +00:00
ctx.code += fmt::format("&&!isnan({})&&!isnan({})", lhs, rhs);
} else {
ctx.code += fmt::format("||isnan({})||isnan({})", lhs, rhs);
2021-05-24 04:55:39 +00:00
}
ctx.code += ";";
}
} // namespace
2021-05-22 05:52:03 +00:00
void EmitFPAbs16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view value) {
2021-05-24 04:55:39 +00:00
throw NotImplementedException("GLSL Instruction");
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPAbs32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 05:52:03 +00:00
ctx.AddF32("{}=abs({});", inst, value);
}
2021-05-24 04:55:39 +00:00
void EmitFPAbs64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
ctx.AddF64("{}=abs({});", inst, value);
2021-05-22 05:52:03 +00:00
}
void EmitFPAdd16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
2021-05-24 04:55:39 +00:00
throw NotImplementedException("GLSL Instruction");
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPAdd32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
2021-05-22 06:32:57 +00:00
ctx.AddF32("{}=float({})+float({});", inst, a, b);
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPAdd64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
2021-05-22 06:32:57 +00:00
ctx.AddF64("{}=double({})+double({});", inst, a, b);
2021-05-22 05:52:03 +00:00
}
void EmitFPFma16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b,
[[maybe_unused]] std::string_view c) {
2021-05-24 04:55:39 +00:00
throw NotImplementedException("GLSL Instruction");
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPFma32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b,
std::string_view c) {
2021-05-22 05:52:03 +00:00
ctx.AddF32("{}=fma({},{},{});", inst, a, b, c);
}
2021-05-24 04:55:39 +00:00
void EmitFPFma64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b,
std::string_view c) {
2021-05-22 05:52:03 +00:00
ctx.AddF64("{}=fma({},{},{});", inst, a, b, c);
}
2021-05-24 04:55:39 +00:00
void EmitFPMax32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
2021-05-22 05:52:03 +00:00
ctx.AddF32("{}=max({},{});", inst, a, b);
}
2021-05-24 04:55:39 +00:00
void EmitFPMax64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
2021-05-22 05:52:03 +00:00
ctx.AddF64("{}=max({},{});", inst, a, b);
}
2021-05-24 04:55:39 +00:00
void EmitFPMin32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
2021-05-22 05:52:03 +00:00
ctx.AddF32("{}=min({},{});", inst, a, b);
}
2021-05-24 04:55:39 +00:00
void EmitFPMin64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
2021-05-22 05:52:03 +00:00
ctx.AddF64("{}=min({},{});", inst, a, b);
}
void EmitFPMul16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
2021-05-24 04:55:39 +00:00
throw NotImplementedException("GLSL Instruction");
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPMul32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
2021-05-22 05:52:03 +00:00
ctx.AddF32("{}={}*{};", inst, a, b);
}
2021-05-24 04:55:39 +00:00
void EmitFPMul64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
2021-05-22 05:52:03 +00:00
ctx.AddF64("{}={}*{};", inst, a, b);
}
void EmitFPNeg16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view value) {
2021-05-24 04:55:39 +00:00
throw NotImplementedException("GLSL Instruction");
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPNeg32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-23 03:31:30 +00:00
ctx.AddF32("{}=-({});", inst, value);
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPNeg64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-23 03:31:30 +00:00
ctx.AddF64("{}=-({});", inst, value);
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPSin(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 05:52:03 +00:00
ctx.AddF32("{}=sin({});", inst, value);
}
2021-05-24 04:55:39 +00:00
void EmitFPCos(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 05:52:03 +00:00
ctx.AddF32("{}=cos({});", inst, value);
}
2021-05-24 04:55:39 +00:00
void EmitFPExp2(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 05:52:03 +00:00
ctx.AddF32("{}=exp2({});", inst, value);
}
2021-05-24 04:55:39 +00:00
void EmitFPLog2(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 05:52:03 +00:00
ctx.AddF32("{}=log2({});", inst, value);
}
2021-05-24 04:55:39 +00:00
void EmitFPRecip32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 05:52:03 +00:00
ctx.AddF32("{}=1/{};", inst, value);
}
2021-05-24 04:55:39 +00:00
void EmitFPRecip64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 05:52:03 +00:00
ctx.AddF64("{}=1/{};", inst, value);
}
void EmitFPRecipSqrt32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view value) {
2021-05-24 04:55:39 +00:00
throw NotImplementedException("GLSL Instruction");
2021-05-22 05:52:03 +00:00
}
void EmitFPRecipSqrt64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view value) {
2021-05-24 04:55:39 +00:00
throw NotImplementedException("GLSL Instruction");
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPSqrt(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 05:52:03 +00:00
ctx.AddF32("{}=sqrt({});", inst, value);
}
void EmitFPSaturate16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view value) {
2021-05-24 04:55:39 +00:00
throw NotImplementedException("GLSL Instruction");
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPSaturate32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-23 03:03:27 +00:00
ctx.AddF32("{}=min(max({},0.0),1.0);", inst, value);
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPSaturate64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-23 03:03:27 +00:00
ctx.AddF64("{}=min(max({},0.0),1.0);", inst, value);
2021-05-22 05:52:03 +00:00
}
void EmitFPClamp16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view value,
[[maybe_unused]] std::string_view min_value,
[[maybe_unused]] std::string_view max_value) {
2021-05-24 04:55:39 +00:00
throw NotImplementedException("GLSL Instruction");
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPClamp32(EmitContext& ctx, IR::Inst& inst, std::string_view value,
std::string_view min_value, std::string_view max_value) {
2021-05-23 03:03:27 +00:00
// GLSL's clamp does not produce desirable results
ctx.AddF32("{}=min(max({},float({})),float({}));", inst, value, min_value, max_value);
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPClamp64(EmitContext& ctx, IR::Inst& inst, std::string_view value,
std::string_view min_value, std::string_view max_value) {
2021-05-23 03:03:27 +00:00
// GLSL's clamp does not produce desirable results
ctx.AddF64("{}=min(max({},double({})),double({}));", inst, value, min_value, max_value);
2021-05-22 05:52:03 +00:00
}
void EmitFPRoundEven16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view value) {
2021-05-24 04:55:39 +00:00
throw NotImplementedException("GLSL Instruction");
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPRoundEven32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 19:06:14 +00:00
ctx.AddF32("{}=roundEven({});", inst, value);
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPRoundEven64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 19:06:14 +00:00
ctx.AddF64("{}=roundEven({});", inst, value);
2021-05-22 05:52:03 +00:00
}
void EmitFPFloor16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view value) {
2021-05-24 04:55:39 +00:00
throw NotImplementedException("GLSL Instruction");
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPFloor32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 05:52:03 +00:00
ctx.AddF32("{}=floor({});", inst, value);
}
2021-05-24 04:55:39 +00:00
void EmitFPFloor64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 05:52:03 +00:00
ctx.AddF64("{}=floor({});", inst, value);
}
void EmitFPCeil16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view value) {
2021-05-24 04:55:39 +00:00
throw NotImplementedException("GLSL Instruction");
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPCeil32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 05:52:03 +00:00
ctx.AddF32("{}=ceil({});", inst, value);
}
2021-05-24 04:55:39 +00:00
void EmitFPCeil64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 05:52:03 +00:00
ctx.AddF64("{}=ceil({});", inst, value);
}
void EmitFPTrunc16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view value) {
2021-05-24 04:55:39 +00:00
throw NotImplementedException("GLSL Instruction");
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPTrunc32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 05:52:03 +00:00
ctx.AddF32("{}=trunc({});", inst, value);
}
2021-05-24 04:55:39 +00:00
void EmitFPTrunc64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 05:52:03 +00:00
ctx.AddF64("{}=trunc({});", inst, value);
}
2021-05-24 04:55:39 +00:00
void EmitFPOrdEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs,
2021-05-22 05:52:03 +00:00
[[maybe_unused]] std::string_view rhs) {
2021-05-24 04:55:39 +00:00
throw NotImplementedException("GLSL instruction");
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPOrdEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
std::string_view rhs) {
Compare(ctx, inst, lhs, rhs, "==", true);
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPOrdEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
std::string_view rhs) {
Compare(ctx, inst, lhs, rhs, "==", true);
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPUnordEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs,
2021-05-22 05:52:03 +00:00
[[maybe_unused]] std::string_view rhs) {
2021-05-24 04:55:39 +00:00
throw NotImplementedException("GLSL instruction");
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPUnordEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
std::string_view rhs) {
Compare(ctx, inst, lhs, rhs, "==", false);
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPUnordEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
std::string_view rhs) {
Compare(ctx, inst, lhs, rhs, "==", false);
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPOrdNotEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs,
2021-05-22 05:52:03 +00:00
[[maybe_unused]] std::string_view rhs) {
2021-05-24 04:55:39 +00:00
throw NotImplementedException("GLSL instruction");
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPOrdNotEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
std::string_view rhs) {
Compare(ctx, inst, lhs, rhs, "!=", true);
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPOrdNotEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
std::string_view rhs) {
Compare(ctx, inst, lhs, rhs, "!=", true);
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPUnordNotEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs,
2021-05-22 05:52:03 +00:00
[[maybe_unused]] std::string_view rhs) {
2021-05-24 04:55:39 +00:00
throw NotImplementedException("GLSL instruction");
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPUnordNotEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
std::string_view rhs) {
Compare(ctx, inst, lhs, rhs, "!=", false);
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPUnordNotEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
std::string_view rhs) {
Compare(ctx, inst, lhs, rhs, "!=", false);
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPOrdLessThan16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs,
2021-05-22 05:52:03 +00:00
[[maybe_unused]] std::string_view rhs) {
2021-05-24 04:55:39 +00:00
throw NotImplementedException("GLSL instruction");
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPOrdLessThan32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
std::string_view rhs) {
Compare(ctx, inst, lhs, rhs, "<", true);
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPOrdLessThan64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
std::string_view rhs) {
Compare(ctx, inst, lhs, rhs, "<", true);
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPUnordLessThan16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs,
2021-05-22 05:52:03 +00:00
[[maybe_unused]] std::string_view rhs) {
2021-05-24 04:55:39 +00:00
throw NotImplementedException("GLSL instruction");
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPUnordLessThan32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
std::string_view rhs) {
Compare(ctx, inst, lhs, rhs, "<", false);
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPUnordLessThan64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
std::string_view rhs) {
Compare(ctx, inst, lhs, rhs, "<", false);
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPOrdGreaterThan16([[maybe_unused]] EmitContext& ctx,
2021-05-22 05:52:03 +00:00
[[maybe_unused]] std::string_view lhs,
[[maybe_unused]] std::string_view rhs) {
2021-05-24 04:55:39 +00:00
throw NotImplementedException("GLSL instruction");
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPOrdGreaterThan32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
std::string_view rhs) {
Compare(ctx, inst, lhs, rhs, ">", true);
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPOrdGreaterThan64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
std::string_view rhs) {
Compare(ctx, inst, lhs, rhs, ">", true);
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPUnordGreaterThan16([[maybe_unused]] EmitContext& ctx,
2021-05-22 05:52:03 +00:00
[[maybe_unused]] std::string_view lhs,
[[maybe_unused]] std::string_view rhs) {
2021-05-24 04:55:39 +00:00
throw NotImplementedException("GLSL instruction");
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPUnordGreaterThan32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
std::string_view rhs) {
Compare(ctx, inst, lhs, rhs, ">", false);
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPUnordGreaterThan64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
std::string_view rhs) {
Compare(ctx, inst, lhs, rhs, ">", false);
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPOrdLessThanEqual16([[maybe_unused]] EmitContext& ctx,
2021-05-22 05:52:03 +00:00
[[maybe_unused]] std::string_view lhs,
[[maybe_unused]] std::string_view rhs) {
2021-05-24 04:55:39 +00:00
throw NotImplementedException("GLSL instruction");
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPOrdLessThanEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
std::string_view rhs) {
Compare(ctx, inst, lhs, rhs, "<=", true);
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPOrdLessThanEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
std::string_view rhs) {
Compare(ctx, inst, lhs, rhs, "<=", true);
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPUnordLessThanEqual16([[maybe_unused]] EmitContext& ctx,
2021-05-22 05:52:03 +00:00
[[maybe_unused]] std::string_view lhs,
[[maybe_unused]] std::string_view rhs) {
2021-05-24 04:55:39 +00:00
throw NotImplementedException("GLSL instruction");
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPUnordLessThanEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
std::string_view rhs) {
Compare(ctx, inst, lhs, rhs, "<=", false);
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPUnordLessThanEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
std::string_view rhs) {
Compare(ctx, inst, lhs, rhs, "<=", false);
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPOrdGreaterThanEqual16([[maybe_unused]] EmitContext& ctx,
2021-05-22 05:52:03 +00:00
[[maybe_unused]] std::string_view lhs,
[[maybe_unused]] std::string_view rhs) {
2021-05-24 04:55:39 +00:00
throw NotImplementedException("GLSL instruction");
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPOrdGreaterThanEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
std::string_view rhs) {
Compare(ctx, inst, lhs, rhs, ">=", true);
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPOrdGreaterThanEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
std::string_view rhs) {
Compare(ctx, inst, lhs, rhs, ">=", true);
2021-05-22 05:52:03 +00:00
}
void EmitFPUnordGreaterThanEqual16([[maybe_unused]] EmitContext& ctx,
[[maybe_unused]] std::string_view lhs,
[[maybe_unused]] std::string_view rhs) {
2021-05-24 04:55:39 +00:00
throw NotImplementedException("GLSL instruction");
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPUnordGreaterThanEqual32(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
std::string_view rhs) {
Compare(ctx, inst, lhs, rhs, ">=", false);
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPUnordGreaterThanEqual64(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
std::string_view rhs) {
Compare(ctx, inst, lhs, rhs, ">=", false);
2021-05-22 05:52:03 +00:00
}
void EmitFPIsNan16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view value) {
2021-05-24 04:55:39 +00:00
throw NotImplementedException("GLSL instruction");
2021-05-22 05:52:03 +00:00
}
2021-05-24 04:55:39 +00:00
void EmitFPIsNan32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 05:52:03 +00:00
ctx.AddU1("{}=isnan({});", inst, value);
}
2021-05-24 04:55:39 +00:00
void EmitFPIsNan64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 05:52:03 +00:00
ctx.AddU1("{}=isnan({});", inst, value);
}
} // namespace Shader::Backend::GLSL