summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/frontend/ir/ir_emitter.cpp
diff options
context:
space:
mode:
authorFernandoS27 <fsahmkow27@gmail.com>2021-03-24 00:02:30 +0100
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:24 +0200
commit8cb9443cb99c4510e6ef26a91d09a31a8fa6281f (patch)
tree2337f294c7179e1e2e98cafedde5c2eb254965cb /src/shader_recompiler/frontend/ir/ir_emitter.cpp
parentshader: Implement NDC [-1, 1], attribute types and default varying initialization (diff)
downloadyuzu-8cb9443cb99c4510e6ef26a91d09a31a8fa6281f.tar
yuzu-8cb9443cb99c4510e6ef26a91d09a31a8fa6281f.tar.gz
yuzu-8cb9443cb99c4510e6ef26a91d09a31a8fa6281f.tar.bz2
yuzu-8cb9443cb99c4510e6ef26a91d09a31a8fa6281f.tar.lz
yuzu-8cb9443cb99c4510e6ef26a91d09a31a8fa6281f.tar.xz
yuzu-8cb9443cb99c4510e6ef26a91d09a31a8fa6281f.tar.zst
yuzu-8cb9443cb99c4510e6ef26a91d09a31a8fa6281f.zip
Diffstat (limited to 'src/shader_recompiler/frontend/ir/ir_emitter.cpp')
-rw-r--r--src/shader_recompiler/frontend/ir/ir_emitter.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.cpp b/src/shader_recompiler/frontend/ir/ir_emitter.cpp
index ce610799a..6280c08f6 100644
--- a/src/shader_recompiler/frontend/ir/ir_emitter.cpp
+++ b/src/shader_recompiler/frontend/ir/ir_emitter.cpp
@@ -731,6 +731,24 @@ F16F32F64 IREmitter::FPSaturate(const F16F32F64& value) {
}
}
+F16F32F64 IREmitter::FPClamp(const F16F32F64& value, const F16F32F64& min_value,
+ const F16F32F64& max_value) {
+ if (value.Type() != min_value.Type() || value.Type() != max_value.Type()) {
+ throw InvalidArgument("Mismatching types {}, {}, and {}", value.Type(), min_value.Type(),
+ max_value.Type());
+ }
+ switch (value.Type()) {
+ case Type::F16:
+ return Inst<F16>(Opcode::FPClamp16, value, min_value, max_value);
+ case Type::F32:
+ return Inst<F32>(Opcode::FPClamp32, value, min_value, max_value);
+ case Type::F64:
+ return Inst<F64>(Opcode::FPClamp64, value, min_value, max_value);
+ default:
+ ThrowInvalidType(value.Type());
+ }
+}
+
F16F32F64 IREmitter::FPRoundEven(const F16F32F64& value, FpControl control) {
switch (value.Type()) {
case Type::F16: