diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2018-12-21 02:56:08 +0100 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-01-15 21:54:49 +0100 |
commit | 833d0806f92b893220cf43d63c223a7cd9af9022 (patch) | |
tree | 523c7921c8fb055608c6aef633c0c6efbc54da14 /src/video_core/shader/shader_ir.cpp | |
parent | shader_ir: Add setters (diff) | |
download | yuzu-833d0806f92b893220cf43d63c223a7cd9af9022.tar yuzu-833d0806f92b893220cf43d63c223a7cd9af9022.tar.gz yuzu-833d0806f92b893220cf43d63c223a7cd9af9022.tar.bz2 yuzu-833d0806f92b893220cf43d63c223a7cd9af9022.tar.lz yuzu-833d0806f92b893220cf43d63c223a7cd9af9022.tar.xz yuzu-833d0806f92b893220cf43d63c223a7cd9af9022.tar.zst yuzu-833d0806f92b893220cf43d63c223a7cd9af9022.zip |
Diffstat (limited to 'src/video_core/shader/shader_ir.cpp')
-rw-r--r-- | src/video_core/shader/shader_ir.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/video_core/shader/shader_ir.cpp b/src/video_core/shader/shader_ir.cpp index 48046d967..af95e54ef 100644 --- a/src/video_core/shader/shader_ir.cpp +++ b/src/video_core/shader/shader_ir.cpp @@ -121,6 +121,25 @@ Node ShaderIR::GetLocalMemory(Node address) { return StoreNode(LmemNode(address)); } +Node ShaderIR::GetOperandAbsNegFloat(Node value, bool absolute, bool negate) { + if (absolute) { + value = Operation(OperationCode::FAbsolute, NO_PRECISE, value); + } + if (negate) { + value = Operation(OperationCode::FNegate, NO_PRECISE, value); + } + return value; +} + +Node ShaderIR::GetSaturatedFloat(Node value, bool saturate) { + if (!saturate) { + return value; + } + const Node positive_zero = Immediate(std::copysignf(0, 1)); + const Node positive_one = Immediate(1.0f); + return Operation(OperationCode::FClamp, NO_PRECISE, value, positive_zero, positive_one); +} + void ShaderIR::SetRegister(BasicBlock& bb, Register dest, Node src) { bb.push_back(Operation(OperationCode::Assign, GetRegister(dest), src)); } |