From fbc67a05637f3acb47f933066fb2e548f9d35d8c Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Thu, 20 Dec 2018 23:42:02 -0300 Subject: shader_ir: Add condition code helper --- src/video_core/shader/shader_ir.cpp | 10 ++++++++++ src/video_core/shader/shader_ir.h | 3 +++ 2 files changed, 13 insertions(+) (limited to 'src/video_core') diff --git a/src/video_core/shader/shader_ir.cpp b/src/video_core/shader/shader_ir.cpp index aec1fb36b..3c37c7145 100644 --- a/src/video_core/shader/shader_ir.cpp +++ b/src/video_core/shader/shader_ir.cpp @@ -321,6 +321,16 @@ OperationCode ShaderIR::GetPredicateCombiner(PredOperation operation) { return op->second; } +Node ShaderIR::GetConditionCode(Tegra::Shader::ConditionCode cc) { + switch (cc) { + case Tegra::Shader::ConditionCode::NEU: + return GetInternalFlag(InternalFlag::Zero, true); + default: + UNIMPLEMENTED_MSG("Unimplemented condition code: {}", static_cast(cc)); + return GetPredicate(static_cast(Pred::NeverExecute)); + } +} + void ShaderIR::SetRegister(BasicBlock& bb, Register dest, Node src) { bb.push_back(Operation(OperationCode::Assign, GetRegister(dest), src)); } diff --git a/src/video_core/shader/shader_ir.h b/src/video_core/shader/shader_ir.h index f13129ab3..8223ff044 100644 --- a/src/video_core/shader/shader_ir.h +++ b/src/video_core/shader/shader_ir.h @@ -672,6 +672,9 @@ private: /// Returns a predicate combiner operation OperationCode GetPredicateCombiner(Tegra::Shader::PredOperation operation); + /// Returns a condition code evaluated from internal flags + Node GetConditionCode(Tegra::Shader::ConditionCode cc); + template inline Node Operation(OperationCode code, const T*... operands) { return StoreNode(OperationNode(code, operands...)); -- cgit v1.2.3