gl_rasterizer_cache: Make MatchFlags an enum class
Prevents implicit conversions and scope pollution.
This commit is contained in:
parent
1df3a7710e
commit
7db0b8d74f
|
@ -672,7 +672,8 @@ void CachedSurface::DownloadGLTexture(const MathUtil::Rectangle<u32>& rect, GLui
|
||||||
glPixelStorei(GL_PACK_ROW_LENGTH, 0);
|
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
|
Invalid = 1, // Flag that can be applied to other match types, invalid matches require
|
||||||
// validation before they can be used
|
// validation before they can be used
|
||||||
Exact = 1 << 1, // Surfaces perfectly match
|
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));
|
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
|
/// Get the best surface match (and its match type) for the given flags
|
||||||
template <MatchFlags find_flags>
|
template <MatchFlags find_flags>
|
||||||
Surface FindMatch(const SurfaceCache& surface_cache, const SurfaceParams& params,
|
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);
|
: (params.res_scale <= surface->res_scale);
|
||||||
// validity will be checked in GetCopyableInterval
|
// validity will be checked in GetCopyableInterval
|
||||||
bool is_valid =
|
bool is_valid =
|
||||||
find_flags & MatchFlags::Copy
|
(find_flags & MatchFlags::Copy) != MatchFlags::None
|
||||||
? true
|
? true
|
||||||
: surface->IsRegionValid(validate_interval.value_or(params.GetInterval()));
|
: 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;
|
continue;
|
||||||
|
|
||||||
auto IsMatch_Helper = [&](auto check_type, auto match_fn) {
|
auto IsMatch_Helper = [&](auto check_type, auto match_fn) {
|
||||||
if (!(find_flags & check_type))
|
if ((find_flags & check_type) == MatchFlags::None)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool matched;
|
bool matched;
|
||||||
|
|
Loading…
Reference in New Issue