diff options
| author | 2020-09-22 17:31:53 -0400 | |
|---|---|---|
| committer | 2020-09-22 17:32:33 -0400 | |
| commit | ff45c3957858cdf189b73e11550da06fe4337b8e (patch) | |
| tree | 288ff1cc4677d6511ed8cc7e1b0db20ce2d2590f /src/video_core/shader/track.cpp | |
| parent | Merge pull request #4697 from lioncash/copy5 (diff) | |
| download | yuzu-ff45c3957858cdf189b73e11550da06fe4337b8e.tar.gz yuzu-ff45c3957858cdf189b73e11550da06fe4337b8e.tar.xz yuzu-ff45c3957858cdf189b73e11550da06fe4337b8e.zip | |
General: Make use of std::nullopt where applicable
Allows some implementations to avoid completely zeroing out the internal
buffer of the optional, and instead only set the validity byte within
the structure.
This also makes it consistent how we return empty optionals.
Diffstat (limited to 'src/video_core/shader/track.cpp')
| -rw-r--r-- | src/video_core/shader/track.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
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, | |||
| 205 | const auto result = TrackRegister(&std::get<GprNode>(*tracked), code, cursor - 1); | 205 | const auto result = TrackRegister(&std::get<GprNode>(*tracked), code, cursor - 1); |
| 206 | const auto& found = result.first; | 206 | const auto& found = result.first; |
| 207 | if (!found) { | 207 | if (!found) { |
| 208 | return {}; | 208 | return std::nullopt; |
| 209 | } | 209 | } |
| 210 | if (const auto immediate = std::get_if<ImmediateNode>(&*found)) { | 210 | if (const auto immediate = std::get_if<ImmediateNode>(&*found)) { |
| 211 | return immediate->GetValue(); | 211 | return immediate->GetValue(); |
| 212 | } | 212 | } |
| 213 | return {}; | 213 | return std::nullopt; |
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | std::pair<Node, s64> ShaderIR::TrackRegister(const GprNode* tracked, const NodeBlock& code, | 216 | std::pair<Node, s64> ShaderIR::TrackRegister(const GprNode* tracked, const NodeBlock& code, |