From 937c7e67a4aa2a8b68b448a38ab9c491cc442b33 Mon Sep 17 00:00:00 2001 From: emufan4568 Date: Tue, 6 Sep 2022 22:32:16 +0300 Subject: [PATCH] rasterizer_cache: Touch up MatchFlags comments --- .../rasterizer_cache/cached_surface.cpp | 18 ----------- .../rasterizer_cache/rasterizer_cache.cpp | 32 ++++--------------- src/video_core/rasterizer_cache/utils.cpp | 18 +++++++++++ src/video_core/rasterizer_cache/utils.h | 2 ++ 4 files changed, 26 insertions(+), 44 deletions(-) diff --git a/src/video_core/rasterizer_cache/cached_surface.cpp b/src/video_core/rasterizer_cache/cached_surface.cpp index d03f9f2e4..c053bc634 100644 --- a/src/video_core/rasterizer_cache/cached_surface.cpp +++ b/src/video_core/rasterizer_cache/cached_surface.cpp @@ -15,24 +15,6 @@ namespace OpenGL { -static Aspect ToAspect(SurfaceType type) { - switch (type) { - case SurfaceType::Color: - case SurfaceType::Texture: - case SurfaceType::Fill: - return Aspect::Color; - case SurfaceType::Depth: - return Aspect::Depth; - case SurfaceType::DepthStencil: - return Aspect::DepthStencil; - default: - LOG_CRITICAL(Render_OpenGL, "Unknown SurfaceType {}", type); - UNREACHABLE(); - } - - return Aspect::Color; -} - CachedSurface::~CachedSurface() { if (texture.handle) { auto tag = is_custom ? HostTextureTag{PixelFormat::RGBA8, diff --git a/src/video_core/rasterizer_cache/rasterizer_cache.cpp b/src/video_core/rasterizer_cache/rasterizer_cache.cpp index 90bd446ee..3f048b403 100644 --- a/src/video_core/rasterizer_cache/rasterizer_cache.cpp +++ b/src/video_core/rasterizer_cache/rasterizer_cache.cpp @@ -16,25 +16,6 @@ namespace OpenGL { -// TODO: Deduplicate this -static Aspect ToAspect(SurfaceType type) { - switch (type) { - case SurfaceType::Color: - case SurfaceType::Texture: - case SurfaceType::Fill: - return Aspect::Color; - case SurfaceType::Depth: - return Aspect::Depth; - case SurfaceType::DepthStencil: - return Aspect::DepthStencil; - default: - LOG_CRITICAL(Render_OpenGL, "Unknown SurfaceType {}", type); - UNREACHABLE(); - } - - return Aspect::Color; -} - template static constexpr auto RangeFromInterval(Map& map, const Interval& interval) { return boost::make_iterator_range(map.equal_range(interval)); @@ -106,13 +87,12 @@ void RasterizerCache::CopySurface(const Surface& src_surface, const Surface& dst } enum MatchFlags { - 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 - SubRect = 1 << 2, // Surface encompasses params - Copy = 1 << 3, // Surface we can copy from - Expand = 1 << 4, // Surface that can expand params - TexCopy = 1 << 5 // Surface that will match a display transfer "texture copy" parameters + Invalid = 1, ///< Surface is allowed to be only partially valid + Exact = 1 << 1, ///< Surface perfectly matches params + SubRect = 1 << 2, ///< Surface encompasses params + Copy = 1 << 3, ///< Surface that can be used as a copy source + Expand = 1 << 4, ///< Surface that can expand params + TexCopy = 1 << 5 ///< Surface that will match a display transfer "texture copy" parameters }; static constexpr MatchFlags operator|(MatchFlags lhs, MatchFlags rhs) { diff --git a/src/video_core/rasterizer_cache/utils.cpp b/src/video_core/rasterizer_cache/utils.cpp index 990ab4842..c341f8910 100644 --- a/src/video_core/rasterizer_cache/utils.cpp +++ b/src/video_core/rasterizer_cache/utils.cpp @@ -89,4 +89,22 @@ ClearValue MakeClearValue(Aspect aspect, PixelFormat format, const u8* fill_data return result; } +Aspect ToAspect(SurfaceType type) { + switch (type) { + case SurfaceType::Color: + case SurfaceType::Texture: + case SurfaceType::Fill: + return Aspect::Color; + case SurfaceType::Depth: + return Aspect::Depth; + case SurfaceType::DepthStencil: + return Aspect::DepthStencil; + default: + LOG_CRITICAL(Render_OpenGL, "Unknown SurfaceType {}", type); + UNREACHABLE(); + } + + return Aspect::Color; +} + } // namespace OpenGL diff --git a/src/video_core/rasterizer_cache/utils.h b/src/video_core/rasterizer_cache/utils.h index 810b65a3b..d3aa1c283 100644 --- a/src/video_core/rasterizer_cache/utils.h +++ b/src/video_core/rasterizer_cache/utils.h @@ -49,6 +49,8 @@ struct TextureCubeConfig { [[nodiscard]] ClearValue MakeClearValue(Aspect aspect, PixelFormat format, const u8* fill_data); +[[nodiscard]] Aspect ToAspect(SurfaceType type); + } // namespace OpenGL namespace std {