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

457 lines
16 KiB
C++
Raw Normal View History

2021-05-22 06:52:03 +01:00
// Copyright 2021 yuzu Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include <string_view>
2021-05-29 07:09:29 +01:00
#include "shader_recompiler/backend/glsl/emit_glsl_instructions.h"
#include "shader_recompiler/backend/glsl/glsl_emit_context.h"
#include "shader_recompiler/frontend/ir/modifiers.h"
2021-05-22 06:52:03 +01:00
#include "shader_recompiler/frontend/ir/value.h"
namespace Shader::Backend::GLSL {
2021-05-24 05:55:39 +01:00
namespace {
void Compare(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs,
std::string_view op, bool ordered) {
2021-07-17 01:13:15 +01:00
const auto nan_op{ordered ? "&&!" : "||"};
ctx.AddU1("{}={}{}{}"
"{}isnan({}){}isnan({});",
inst, lhs, op, rhs, nan_op, lhs, nan_op, rhs);
2021-05-24 05:55:39 +01:00
}
2021-06-11 05:33:33 +01:00
bool IsPrecise(const IR::Inst& inst) {
return inst.Flags<IR::FpControl>().no_contraction;
}
2021-06-04 01:57:52 +01:00
} // Anonymous namespace
2021-05-22 06:52:03 +01:00
void EmitFPAbs16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view value) {
NotImplemented();
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01:00
void EmitFPAbs32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 06:52:03 +01:00
ctx.AddF32("{}=abs({});", inst, value);
}
2021-05-24 05:55:39 +01:00
void EmitFPAbs64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
ctx.AddF64("{}=abs({});", inst, value);
2021-05-22 06:52:03 +01:00
}
void EmitFPAdd16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
NotImplemented();
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01:00
void EmitFPAdd32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
2021-06-11 05:33:33 +01:00
if (IsPrecise(inst)) {
2021-06-09 06:16:25 +01:00
ctx.AddPrecF32("{}={}+{};", inst, a, b);
} else {
2021-06-09 06:16:25 +01:00
ctx.AddF32("{}={}+{};", inst, a, b);
}
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01:00
void EmitFPAdd64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
2021-06-11 05:33:33 +01:00
if (IsPrecise(inst)) {
2021-06-09 06:16:25 +01:00
ctx.AddPrecF64("{}={}+{};", inst, a, b);
} else {
2021-06-09 06:16:25 +01:00
ctx.AddF64("{}={}+{};", inst, a, b);
}
2021-05-22 06:52:03 +01: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) {
NotImplemented();
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01:00
void EmitFPFma32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b,
std::string_view c) {
2021-06-11 05:33:33 +01:00
if (IsPrecise(inst)) {
ctx.AddPrecF32("{}=fma({},{},{});", inst, a, b, c);
} else {
ctx.AddF32("{}=fma({},{},{});", inst, a, b, c);
}
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01:00
void EmitFPFma64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b,
std::string_view c) {
2021-06-11 05:33:33 +01:00
if (IsPrecise(inst)) {
ctx.AddPrecF64("{}=fma({},{},{});", inst, a, b, c);
} else {
ctx.AddF64("{}=fma({},{},{});", inst, a, b, c);
}
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01:00
void EmitFPMax32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
2021-05-22 06:52:03 +01:00
ctx.AddF32("{}=max({},{});", inst, a, b);
}
2021-05-24 05:55:39 +01:00
void EmitFPMax64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
2021-05-22 06:52:03 +01:00
ctx.AddF64("{}=max({},{});", inst, a, b);
}
2021-05-24 05:55:39 +01:00
void EmitFPMin32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
2021-05-22 06:52:03 +01:00
ctx.AddF32("{}=min({},{});", inst, a, b);
}
2021-05-24 05:55:39 +01:00
void EmitFPMin64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
2021-05-22 06:52:03 +01: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) {
NotImplemented();
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01:00
void EmitFPMul32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
2021-06-11 05:33:33 +01:00
if (IsPrecise(inst)) {
ctx.AddPrecF32("{}={}*{};", inst, a, b);
} else {
ctx.AddF32("{}={}*{};", inst, a, b);
}
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01:00
void EmitFPMul64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
2021-06-11 05:33:33 +01:00
if (IsPrecise(inst)) {
ctx.AddPrecF64("{}={}*{};", inst, a, b);
} else {
ctx.AddF64("{}={}*{};", inst, a, b);
}
2021-05-22 06:52:03 +01:00
}
void EmitFPNeg16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view value) {
NotImplemented();
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01:00
void EmitFPNeg32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
ctx.AddF32("{}=0.f-({});", inst, value);
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01:00
void EmitFPNeg64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
ctx.AddF64("{}=double(0.)-({});", inst, value);
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01:00
void EmitFPSin(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 06:52:03 +01:00
ctx.AddF32("{}=sin({});", inst, value);
}
2021-05-24 05:55:39 +01:00
void EmitFPCos(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 06:52:03 +01:00
ctx.AddF32("{}=cos({});", inst, value);
}
2021-05-24 05:55:39 +01:00
void EmitFPExp2(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 06:52:03 +01:00
ctx.AddF32("{}=exp2({});", inst, value);
}
2021-05-24 05:55:39 +01:00
void EmitFPLog2(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 06:52:03 +01:00
ctx.AddF32("{}=log2({});", inst, value);
}
2021-05-24 05:55:39 +01:00
void EmitFPRecip32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
ctx.AddF32("{}=(1.0f)/{};", inst, value);
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01:00
void EmitFPRecip64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
ctx.AddF64("{}=1.0/{};", inst, value);
2021-05-22 06:52:03 +01:00
}
void EmitFPRecipSqrt32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view value) {
2021-06-01 04:07:13 +01:00
ctx.AddF32("{}=inversesqrt({});", inst, value);
2021-05-22 06:52:03 +01:00
}
void EmitFPRecipSqrt64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view value) {
NotImplemented();
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01:00
void EmitFPSqrt(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 06:52:03 +01:00
ctx.AddF32("{}=sqrt({});", inst, value);
}
void EmitFPSaturate16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view value) {
NotImplemented();
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01:00
void EmitFPSaturate32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-23 04:03:27 +01:00
ctx.AddF32("{}=min(max({},0.0),1.0);", inst, value);
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01:00
void EmitFPSaturate64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-23 04:03:27 +01:00
ctx.AddF64("{}=min(max({},0.0),1.0);", inst, value);
2021-05-22 06:52:03 +01: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) {
NotImplemented();
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01: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 04:03:27 +01:00
// GLSL's clamp does not produce desirable results
ctx.AddF32("{}=min(max({},float({})),float({}));", inst, value, min_value, max_value);
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01: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 04:03:27 +01:00
// GLSL's clamp does not produce desirable results
ctx.AddF64("{}=min(max({},double({})),double({}));", inst, value, min_value, max_value);
2021-05-22 06:52:03 +01:00
}
void EmitFPRoundEven16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view value) {
NotImplemented();
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01:00
void EmitFPRoundEven32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 20:06:14 +01:00
ctx.AddF32("{}=roundEven({});", inst, value);
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01:00
void EmitFPRoundEven64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 20:06:14 +01:00
ctx.AddF64("{}=roundEven({});", inst, value);
2021-05-22 06:52:03 +01:00
}
void EmitFPFloor16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view value) {
NotImplemented();
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01:00
void EmitFPFloor32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 06:52:03 +01:00
ctx.AddF32("{}=floor({});", inst, value);
}
2021-05-24 05:55:39 +01:00
void EmitFPFloor64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 06:52:03 +01:00
ctx.AddF64("{}=floor({});", inst, value);
}
void EmitFPCeil16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view value) {
NotImplemented();
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01:00
void EmitFPCeil32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 06:52:03 +01:00
ctx.AddF32("{}=ceil({});", inst, value);
}
2021-05-24 05:55:39 +01:00
void EmitFPCeil64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 06:52:03 +01:00
ctx.AddF64("{}=ceil({});", inst, value);
}
void EmitFPTrunc16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view value) {
NotImplemented();
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01:00
void EmitFPTrunc32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 06:52:03 +01:00
ctx.AddF32("{}=trunc({});", inst, value);
}
2021-05-24 05:55:39 +01:00
void EmitFPTrunc64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 06:52:03 +01:00
ctx.AddF64("{}=trunc({});", inst, value);
}
2021-05-24 05:55:39 +01:00
void EmitFPOrdEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs,
2021-05-22 06:52:03 +01:00
[[maybe_unused]] std::string_view rhs) {
NotImplemented();
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01: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 06:52:03 +01:00
}
2021-05-24 05:55:39 +01: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 06:52:03 +01:00
}
2021-05-24 05:55:39 +01:00
void EmitFPUnordEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs,
2021-05-22 06:52:03 +01:00
[[maybe_unused]] std::string_view rhs) {
NotImplemented();
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01: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 06:52:03 +01:00
}
2021-05-24 05:55:39 +01: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 06:52:03 +01:00
}
2021-05-24 05:55:39 +01:00
void EmitFPOrdNotEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs,
2021-05-22 06:52:03 +01:00
[[maybe_unused]] std::string_view rhs) {
NotImplemented();
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01: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 06:52:03 +01:00
}
2021-05-24 05:55:39 +01: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 06:52:03 +01:00
}
2021-05-24 05:55:39 +01:00
void EmitFPUnordNotEqual16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs,
2021-05-22 06:52:03 +01:00
[[maybe_unused]] std::string_view rhs) {
NotImplemented();
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01: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 06:52:03 +01:00
}
2021-05-24 05:55:39 +01: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 06:52:03 +01:00
}
2021-05-24 05:55:39 +01:00
void EmitFPOrdLessThan16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs,
2021-05-22 06:52:03 +01:00
[[maybe_unused]] std::string_view rhs) {
NotImplemented();
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01: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 06:52:03 +01:00
}
2021-05-24 05:55:39 +01: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 06:52:03 +01:00
}
2021-05-24 05:55:39 +01:00
void EmitFPUnordLessThan16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs,
2021-05-22 06:52:03 +01:00
[[maybe_unused]] std::string_view rhs) {
NotImplemented();
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01: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 06:52:03 +01:00
}
2021-05-24 05:55:39 +01: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 06:52:03 +01:00
}
2021-05-24 05:55:39 +01:00
void EmitFPOrdGreaterThan16([[maybe_unused]] EmitContext& ctx,
2021-05-22 06:52:03 +01:00
[[maybe_unused]] std::string_view lhs,
[[maybe_unused]] std::string_view rhs) {
NotImplemented();
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01: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 06:52:03 +01:00
}
2021-05-24 05:55:39 +01: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 06:52:03 +01:00
}
2021-05-24 05:55:39 +01:00
void EmitFPUnordGreaterThan16([[maybe_unused]] EmitContext& ctx,
2021-05-22 06:52:03 +01:00
[[maybe_unused]] std::string_view lhs,
[[maybe_unused]] std::string_view rhs) {
NotImplemented();
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01: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 06:52:03 +01:00
}
2021-05-24 05:55:39 +01: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 06:52:03 +01:00
}
2021-05-24 05:55:39 +01:00
void EmitFPOrdLessThanEqual16([[maybe_unused]] EmitContext& ctx,
2021-05-22 06:52:03 +01:00
[[maybe_unused]] std::string_view lhs,
[[maybe_unused]] std::string_view rhs) {
NotImplemented();
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01: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 06:52:03 +01:00
}
2021-05-24 05:55:39 +01: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 06:52:03 +01:00
}
2021-05-24 05:55:39 +01:00
void EmitFPUnordLessThanEqual16([[maybe_unused]] EmitContext& ctx,
2021-05-22 06:52:03 +01:00
[[maybe_unused]] std::string_view lhs,
[[maybe_unused]] std::string_view rhs) {
NotImplemented();
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01: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 06:52:03 +01:00
}
2021-05-24 05:55:39 +01: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 06:52:03 +01:00
}
2021-05-24 05:55:39 +01:00
void EmitFPOrdGreaterThanEqual16([[maybe_unused]] EmitContext& ctx,
2021-05-22 06:52:03 +01:00
[[maybe_unused]] std::string_view lhs,
[[maybe_unused]] std::string_view rhs) {
NotImplemented();
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01: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 06:52:03 +01:00
}
2021-05-24 05:55:39 +01: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 06:52:03 +01:00
}
void EmitFPUnordGreaterThanEqual16([[maybe_unused]] EmitContext& ctx,
[[maybe_unused]] std::string_view lhs,
[[maybe_unused]] std::string_view rhs) {
NotImplemented();
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01: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 06:52:03 +01:00
}
2021-05-24 05:55:39 +01: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 06:52:03 +01:00
}
void EmitFPIsNan16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view value) {
NotImplemented();
2021-05-22 06:52:03 +01:00
}
2021-05-24 05:55:39 +01:00
void EmitFPIsNan32(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 06:52:03 +01:00
ctx.AddU1("{}=isnan({});", inst, value);
}
2021-05-24 05:55:39 +01:00
void EmitFPIsNan64(EmitContext& ctx, IR::Inst& inst, std::string_view value) {
2021-05-22 06:52:03 +01:00
ctx.AddU1("{}=isnan({});", inst, value);
}
} // namespace Shader::Backend::GLSL