diff options
author | Lioncash <mathew1800@gmail.com> | 2020-09-22 23:31:53 +0200 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2020-09-22 23:32:33 +0200 |
commit | ff45c3957858cdf189b73e11550da06fe4337b8e (patch) | |
tree | 288ff1cc4677d6511ed8cc7e1b0db20ce2d2590f /src/video_core/shader | |
parent | Merge pull request #4697 from lioncash/copy5 (diff) | |
download | yuzu-ff45c3957858cdf189b73e11550da06fe4337b8e.tar yuzu-ff45c3957858cdf189b73e11550da06fe4337b8e.tar.gz yuzu-ff45c3957858cdf189b73e11550da06fe4337b8e.tar.bz2 yuzu-ff45c3957858cdf189b73e11550da06fe4337b8e.tar.lz yuzu-ff45c3957858cdf189b73e11550da06fe4337b8e.tar.xz yuzu-ff45c3957858cdf189b73e11550da06fe4337b8e.tar.zst yuzu-ff45c3957858cdf189b73e11550da06fe4337b8e.zip |
Diffstat (limited to 'src/video_core/shader')
-rw-r--r-- | src/video_core/shader/ast.h | 25 | ||||
-rw-r--r-- | src/video_core/shader/track.cpp | 4 |
2 files changed, 11 insertions, 18 deletions
diff --git a/src/video_core/shader/ast.h b/src/video_core/shader/ast.h index cca13bcde..8e5a22ab3 100644 --- a/src/video_core/shader/ast.h +++ b/src/video_core/shader/ast.h @@ -199,55 +199,48 @@ public: } std::optional<u32> GetGotoLabel() const { - auto inner = std::get_if<ASTGoto>(&data); - if (inner) { + if (const auto* inner = std::get_if<ASTGoto>(&data)) { return {inner->label}; } - return {}; + return std::nullopt; } Expr GetGotoCondition() const { - auto inner = std::get_if<ASTGoto>(&data); - if (inner) { + if (const auto* inner = std::get_if<ASTGoto>(&data)) { return inner->condition; } return nullptr; } void MarkLabelUnused() { - auto inner = std::get_if<ASTLabel>(&data); - if (inner) { + if (auto* inner = std::get_if<ASTLabel>(&data)) { inner->unused = true; } } bool IsLabelUnused() const { - auto inner = std::get_if<ASTLabel>(&data); - if (inner) { + if (const auto* inner = std::get_if<ASTLabel>(&data)) { return inner->unused; } return true; } std::optional<u32> GetLabelIndex() const { - auto inner = std::get_if<ASTLabel>(&data); - if (inner) { + if (const auto* inner = std::get_if<ASTLabel>(&data)) { return {inner->index}; } - return {}; + return std::nullopt; } Expr GetIfCondition() const { - auto inner = std::get_if<ASTIfThen>(&data); - if (inner) { + if (const auto* inner = std::get_if<ASTIfThen>(&data)) { return inner->condition; } return nullptr; } void SetGotoCondition(Expr new_condition) { - auto inner = std::get_if<ASTGoto>(&data); - if (inner) { + if (auto* inner = std::get_if<ASTGoto>(&data)) { inner->condition = std::move(new_condition); } } diff --git a/src/video_core/shader/track.cpp b/src/video_core/shader/track.cpp index d5ed81442..6be3ea92b 100644 --- a/src/video_core/shader/track.cpp +++ b/src/video_core/shader/track.cpp @@ -205,12 +205,12 @@ std::optional<u32> ShaderIR::TrackImmediate(Node tracked, const NodeBlock& code, const auto result = TrackRegister(&std::get<GprNode>(*tracked), code, cursor - 1); const auto& found = result.first; if (!found) { - return {}; + return std::nullopt; } if (const auto immediate = std::get_if<ImmediateNode>(&*found)) { return immediate->GetValue(); } - return {}; + return std::nullopt; } std::pair<Node, s64> ShaderIR::TrackRegister(const GprNode* tracked, const NodeBlock& code, |