summaryrefslogtreecommitdiffstats
path: root/src/video_core/shader/control_flow.h
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2019-06-26 02:15:40 +0200
committerFernandoS27 <fsahmkow27@gmail.com>2019-07-09 14:14:39 +0200
commit01b21ee1e8e7455dd84ee7f22d33426caaaafdb3 (patch)
treeed443fde0bf5e5bd140d0f7787c44e87ad5f5505 /src/video_core/shader/control_flow.h
parentshader_ir: Unify blocks in decompiled shaders. (diff)
downloadyuzu-01b21ee1e8e7455dd84ee7f22d33426caaaafdb3.tar
yuzu-01b21ee1e8e7455dd84ee7f22d33426caaaafdb3.tar.gz
yuzu-01b21ee1e8e7455dd84ee7f22d33426caaaafdb3.tar.bz2
yuzu-01b21ee1e8e7455dd84ee7f22d33426caaaafdb3.tar.lz
yuzu-01b21ee1e8e7455dd84ee7f22d33426caaaafdb3.tar.xz
yuzu-01b21ee1e8e7455dd84ee7f22d33426caaaafdb3.tar.zst
yuzu-01b21ee1e8e7455dd84ee7f22d33426caaaafdb3.zip
Diffstat (limited to '')
-rw-r--r--src/video_core/shader/control_flow.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/video_core/shader/control_flow.h b/src/video_core/shader/control_flow.h
index 4a2cd622c..4689b0c10 100644
--- a/src/video_core/shader/control_flow.h
+++ b/src/video_core/shader/control_flow.h
@@ -1,3 +1,7 @@
+// Copyright 2019 yuzu Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
#pragma once
#include <cstring>
@@ -20,12 +24,15 @@ struct Condition {
ConditionCode cc{ConditionCode::T};
bool IsUnconditional() const {
- return (predicate == Pred::UnusedIndex) && (cc == ConditionCode::T);
+ return predicate == Pred::UnusedIndex && cc == ConditionCode::T;
+ }
+ bool operator==(const Condition& other) const {
+ return std::tie(predicate, cc) == std::tie(other.predicate, other.cc);
}
};
struct ShaderBlock {
- ShaderBlock() {}
+ ShaderBlock() = default;
ShaderBlock(const ShaderBlock& sb) = default;
u32 start{};
u32 end{};
@@ -35,11 +42,12 @@ struct ShaderBlock {
bool kills{};
s32 address{};
bool operator==(const Branch& b) const {
- return std::memcmp(this, &b, sizeof(Branch)) == 0;
+ return std::tie(cond, kills, address) == std::tie(b.cond, b.kills, b.address);
}
} branch;
bool operator==(const ShaderBlock& sb) const {
- return std::memcmp(this, &sb, sizeof(ShaderBlock)) == 0;
+ return std::tie(start, end, ignore_branch, branch) ==
+ std::tie(sb.start, sb.end, sb.ignore_branch, sb.branch);
}
};