diff options
Diffstat (limited to 'src/video_core/shader/control_flow.h')
-rw-r--r-- | src/video_core/shader/control_flow.h | 16 |
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); } }; |