summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-04-21 04:28:09 +0200
committerGitHub <noreply@github.com>2018-04-21 04:28:09 +0200
commitba6f3e8f9fb32beedeb05a0336faeb0be2b83f9c (patch)
treea1c23456b8790665364737ce047274160802a0a0 /src/video_core
parentMerge pull request #372 from lioncash/enum (diff)
parentgl_rasterizer_cache: Make MatchFlags an enum class (diff)
downloadyuzu-ba6f3e8f9fb32beedeb05a0336faeb0be2b83f9c.tar
yuzu-ba6f3e8f9fb32beedeb05a0336faeb0be2b83f9c.tar.gz
yuzu-ba6f3e8f9fb32beedeb05a0336faeb0be2b83f9c.tar.bz2
yuzu-ba6f3e8f9fb32beedeb05a0336faeb0be2b83f9c.tar.lz
yuzu-ba6f3e8f9fb32beedeb05a0336faeb0be2b83f9c.tar.xz
yuzu-ba6f3e8f9fb32beedeb05a0336faeb0be2b83f9c.tar.zst
yuzu-ba6f3e8f9fb32beedeb05a0336faeb0be2b83f9c.zip
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index 6c1c6775a..fff1e1a5a 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -672,7 +672,8 @@ void CachedSurface::DownloadGLTexture(const MathUtil::Rectangle<u32>& rect, GLui
glPixelStorei(GL_PACK_ROW_LENGTH, 0);
}
-enum MatchFlags {
+enum class MatchFlags {
+ None = 0,
Invalid = 1, // Flag that can be applied to other match types, invalid matches require
// validation before they can be used
Exact = 1 << 1, // Surfaces perfectly match
@@ -686,6 +687,10 @@ constexpr MatchFlags operator|(MatchFlags lhs, MatchFlags rhs) {
return static_cast<MatchFlags>(static_cast<int>(lhs) | static_cast<int>(rhs));
}
+constexpr MatchFlags operator&(MatchFlags lhs, MatchFlags rhs) {
+ return static_cast<MatchFlags>(static_cast<int>(lhs) & static_cast<int>(rhs));
+}
+
/// Get the best surface match (and its match type) for the given flags
template <MatchFlags find_flags>
Surface FindMatch(const SurfaceCache& surface_cache, const SurfaceParams& params,
@@ -703,15 +708,15 @@ Surface FindMatch(const SurfaceCache& surface_cache, const SurfaceParams& params
: (params.res_scale <= surface->res_scale);
// validity will be checked in GetCopyableInterval
bool is_valid =
- find_flags & MatchFlags::Copy
+ (find_flags & MatchFlags::Copy) != MatchFlags::None
? true
: surface->IsRegionValid(validate_interval.value_or(params.GetInterval()));
- if (!(find_flags & MatchFlags::Invalid) && !is_valid)
+ if ((find_flags & MatchFlags::Invalid) == MatchFlags::None && !is_valid)
continue;
auto IsMatch_Helper = [&](auto check_type, auto match_fn) {
- if (!(find_flags & check_type))
+ if ((find_flags & check_type) == MatchFlags::None)
return;
bool matched;