summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2018-12-20 23:40:54 -0300
committerGravatar ReinUsesLisp2019-01-15 17:54:49 -0300
commita58abbcfc4580c8d43935e2aecc6fa151509bf5b (patch)
tree7133d18e62891991f5ea0e6c06332c0c72ecebb4
parentshader_ir: Add comparison helpers (diff)
downloadyuzu-a58abbcfc4580c8d43935e2aecc6fa151509bf5b.tar.gz
yuzu-a58abbcfc4580c8d43935e2aecc6fa151509bf5b.tar.xz
yuzu-a58abbcfc4580c8d43935e2aecc6fa151509bf5b.zip
shader_ir: Add predicate combiner helper
-rw-r--r--src/video_core/shader/shader_ir.cpp12
-rw-r--r--src/video_core/shader/shader_ir.h3
2 files changed, 15 insertions, 0 deletions
diff --git a/src/video_core/shader/shader_ir.cpp b/src/video_core/shader/shader_ir.cpp
index 20a1a50ef..aec1fb36b 100644
--- a/src/video_core/shader/shader_ir.cpp
+++ b/src/video_core/shader/shader_ir.cpp
@@ -309,6 +309,18 @@ Node ShaderIR::GetPredicateComparisonHalf(Tegra::Shader::PredCondition condition
309 return predicate; 309 return predicate;
310} 310}
311 311
312OperationCode ShaderIR::GetPredicateCombiner(PredOperation operation) {
313 static const std::unordered_map<PredOperation, OperationCode> PredicateOperationTable = {
314 {PredOperation::And, OperationCode::LogicalAnd},
315 {PredOperation::Or, OperationCode::LogicalOr},
316 {PredOperation::Xor, OperationCode::LogicalXor},
317 };
318
319 const auto op = PredicateOperationTable.find(operation);
320 UNIMPLEMENTED_IF_MSG(op == PredicateOperationTable.end(), "Unknown predicate operation");
321 return op->second;
322}
323
312void ShaderIR::SetRegister(BasicBlock& bb, Register dest, Node src) { 324void ShaderIR::SetRegister(BasicBlock& bb, Register dest, Node src) {
313 bb.push_back(Operation(OperationCode::Assign, GetRegister(dest), src)); 325 bb.push_back(Operation(OperationCode::Assign, GetRegister(dest), src));
314} 326}
diff --git a/src/video_core/shader/shader_ir.h b/src/video_core/shader/shader_ir.h
index 372ed10da..f13129ab3 100644
--- a/src/video_core/shader/shader_ir.h
+++ b/src/video_core/shader/shader_ir.h
@@ -669,6 +669,9 @@ private:
669 Node GetPredicateComparisonHalf(Tegra::Shader::PredCondition condition, 669 Node GetPredicateComparisonHalf(Tegra::Shader::PredCondition condition,
670 const MetaHalfArithmetic& meta, Node op_a, Node op_b); 670 const MetaHalfArithmetic& meta, Node op_a, Node op_b);
671 671
672 /// Returns a predicate combiner operation
673 OperationCode GetPredicateCombiner(Tegra::Shader::PredOperation operation);
674
672 template <typename... T> 675 template <typename... T>
673 inline Node Operation(OperationCode code, const T*... operands) { 676 inline Node Operation(OperationCode code, const T*... operands) {
674 return StoreNode(OperationNode(code, operands...)); 677 return StoreNode(OperationNode(code, operands...));