VERY experimental Nintendo Switch 2 emulator
C++
gl_rasterizer_cache: Make MatchFlags an enum class
Lioncashf7eb0e8f1bd2
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cppindex 6c1c6775ad..fff1e1a5a2 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, GLuiglPixelStorei(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 usedExact = 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 flagstemplate <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 GetCopyableIntervalbool 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;