diff options
| author | 2018-04-20 22:28:09 -0400 | |
|---|---|---|
| committer | 2018-04-20 22:28:09 -0400 | |
| commit | ba6f3e8f9fb32beedeb05a0336faeb0be2b83f9c (patch) | |
| tree | a1c23456b8790665364737ce047274160802a0a0 /src | |
| parent | Merge pull request #372 from lioncash/enum (diff) | |
| parent | gl_rasterizer_cache: Make MatchFlags an enum class (diff) | |
| download | yuzu-ba6f3e8f9fb32beedeb05a0336faeb0be2b83f9c.tar.gz yuzu-ba6f3e8f9fb32beedeb05a0336faeb0be2b83f9c.tar.xz yuzu-ba6f3e8f9fb32beedeb05a0336faeb0be2b83f9c.zip | |
Merge pull request #373 from lioncash/enum2
gl_rasterizer_cache: Make MatchFlags an enum class
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 13 |
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 | |||
| 672 | glPixelStorei(GL_PACK_ROW_LENGTH, 0); | 672 | glPixelStorei(GL_PACK_ROW_LENGTH, 0); |
| 673 | } | 673 | } |
| 674 | 674 | ||
| 675 | enum MatchFlags { | 675 | enum class MatchFlags { |
| 676 | None = 0, | ||
| 676 | Invalid = 1, // Flag that can be applied to other match types, invalid matches require | 677 | Invalid = 1, // Flag that can be applied to other match types, invalid matches require |
| 677 | // validation before they can be used | 678 | // validation before they can be used |
| 678 | Exact = 1 << 1, // Surfaces perfectly match | 679 | Exact = 1 << 1, // Surfaces perfectly match |
| @@ -686,6 +687,10 @@ constexpr MatchFlags operator|(MatchFlags lhs, MatchFlags rhs) { | |||
| 686 | return static_cast<MatchFlags>(static_cast<int>(lhs) | static_cast<int>(rhs)); | 687 | return static_cast<MatchFlags>(static_cast<int>(lhs) | static_cast<int>(rhs)); |
| 687 | } | 688 | } |
| 688 | 689 | ||
| 690 | constexpr MatchFlags operator&(MatchFlags lhs, MatchFlags rhs) { | ||
| 691 | return static_cast<MatchFlags>(static_cast<int>(lhs) & static_cast<int>(rhs)); | ||
| 692 | } | ||
| 693 | |||
| 689 | /// Get the best surface match (and its match type) for the given flags | 694 | /// Get the best surface match (and its match type) for the given flags |
| 690 | template <MatchFlags find_flags> | 695 | template <MatchFlags find_flags> |
| 691 | Surface FindMatch(const SurfaceCache& surface_cache, const SurfaceParams& params, | 696 | Surface FindMatch(const SurfaceCache& surface_cache, const SurfaceParams& params, |
| @@ -703,15 +708,15 @@ Surface FindMatch(const SurfaceCache& surface_cache, const SurfaceParams& params | |||
| 703 | : (params.res_scale <= surface->res_scale); | 708 | : (params.res_scale <= surface->res_scale); |
| 704 | // validity will be checked in GetCopyableInterval | 709 | // validity will be checked in GetCopyableInterval |
| 705 | bool is_valid = | 710 | bool is_valid = |
| 706 | find_flags & MatchFlags::Copy | 711 | (find_flags & MatchFlags::Copy) != MatchFlags::None |
| 707 | ? true | 712 | ? true |
| 708 | : surface->IsRegionValid(validate_interval.value_or(params.GetInterval())); | 713 | : surface->IsRegionValid(validate_interval.value_or(params.GetInterval())); |
| 709 | 714 | ||
| 710 | if (!(find_flags & MatchFlags::Invalid) && !is_valid) | 715 | if ((find_flags & MatchFlags::Invalid) == MatchFlags::None && !is_valid) |
| 711 | continue; | 716 | continue; |
| 712 | 717 | ||
| 713 | auto IsMatch_Helper = [&](auto check_type, auto match_fn) { | 718 | auto IsMatch_Helper = [&](auto check_type, auto match_fn) { |
| 714 | if (!(find_flags & check_type)) | 719 | if ((find_flags & check_type) == MatchFlags::None) |
| 715 | return; | 720 | return; |
| 716 | 721 | ||
| 717 | bool matched; | 722 | bool matched; |