rasterizer_cache: Remove Invalid match flags
* It was specified in every FindMatch. Only copy did not specify it, but copy surfaces ignore the flag regardless making it superflous
This commit is contained in:
@ -251,7 +251,7 @@ auto RasterizerCache<T>::GetSurface(const SurfaceParams& params, ScaleMatch matc
|
|||||||
ASSERT(!params.is_tiled || (params.width % 8 == 0 && params.height % 8 == 0));
|
ASSERT(!params.is_tiled || (params.width % 8 == 0 && params.height % 8 == 0));
|
||||||
|
|
||||||
// Check for an exact match in existing surfaces
|
// Check for an exact match in existing surfaces
|
||||||
Surface surface = FindMatch<MatchFlags::Exact | MatchFlags::Invalid>(params, match_res_scale);
|
Surface surface = FindMatch<MatchFlags::Exact>(params, match_res_scale);
|
||||||
|
|
||||||
if (!surface) {
|
if (!surface) {
|
||||||
u16 target_res_scale = params.res_scale;
|
u16 target_res_scale = params.res_scale;
|
||||||
@ -259,8 +259,7 @@ auto RasterizerCache<T>::GetSurface(const SurfaceParams& params, ScaleMatch matc
|
|||||||
// This surface may have a subrect of another surface with a higher res_scale, find
|
// This surface may have a subrect of another surface with a higher res_scale, find
|
||||||
// it to adjust our params
|
// it to adjust our params
|
||||||
SurfaceParams find_params = params;
|
SurfaceParams find_params = params;
|
||||||
Surface expandable =
|
Surface expandable = FindMatch<MatchFlags::Expand>(find_params, match_res_scale);
|
||||||
FindMatch<MatchFlags::Expand | MatchFlags::Invalid>(find_params, match_res_scale);
|
|
||||||
if (expandable && expandable->res_scale > target_res_scale) {
|
if (expandable && expandable->res_scale > target_res_scale) {
|
||||||
target_res_scale = expandable->res_scale;
|
target_res_scale = expandable->res_scale;
|
||||||
}
|
}
|
||||||
@ -268,8 +267,7 @@ auto RasterizerCache<T>::GetSurface(const SurfaceParams& params, ScaleMatch matc
|
|||||||
// Keep res_scale when reinterpreting d24s8 -> rgba8
|
// Keep res_scale when reinterpreting d24s8 -> rgba8
|
||||||
if (params.pixel_format == PixelFormat::RGBA8) {
|
if (params.pixel_format == PixelFormat::RGBA8) {
|
||||||
find_params.pixel_format = PixelFormat::D24S8;
|
find_params.pixel_format = PixelFormat::D24S8;
|
||||||
expandable = FindMatch<MatchFlags::Expand | MatchFlags::Invalid>(find_params,
|
expandable = FindMatch<MatchFlags::Expand>(find_params, match_res_scale);
|
||||||
match_res_scale);
|
|
||||||
if (expandable && expandable->res_scale > target_res_scale) {
|
if (expandable && expandable->res_scale > target_res_scale) {
|
||||||
target_res_scale = expandable->res_scale;
|
target_res_scale = expandable->res_scale;
|
||||||
}
|
}
|
||||||
@ -297,14 +295,14 @@ auto RasterizerCache<T>::GetSurfaceSubRect(const SurfaceParams& params, ScaleMat
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Attempt to find encompassing surface
|
// Attempt to find encompassing surface
|
||||||
Surface surface = FindMatch<MatchFlags::SubRect | MatchFlags::Invalid>(params, match_res_scale);
|
Surface surface = FindMatch<MatchFlags::SubRect>(params, match_res_scale);
|
||||||
|
|
||||||
// Check if FindMatch failed because of res scaling
|
// Check if FindMatch failed because of res scaling
|
||||||
// If that's the case create a new surface with
|
// If that's the case create a new surface with
|
||||||
// the dimensions of the lower res_scale surface
|
// the dimensions of the lower res_scale surface
|
||||||
// to suggest it should not be used again
|
// to suggest it should not be used again
|
||||||
if (!surface && match_res_scale != ScaleMatch::Ignore) {
|
if (!surface && match_res_scale != ScaleMatch::Ignore) {
|
||||||
surface = FindMatch<MatchFlags::SubRect | MatchFlags::Invalid>(params, ScaleMatch::Ignore);
|
surface = FindMatch<MatchFlags::SubRect>(params, ScaleMatch::Ignore);
|
||||||
if (surface) {
|
if (surface) {
|
||||||
SurfaceParams new_params = *surface;
|
SurfaceParams new_params = *surface;
|
||||||
new_params.res_scale = params.res_scale;
|
new_params.res_scale = params.res_scale;
|
||||||
@ -324,8 +322,7 @@ auto RasterizerCache<T>::GetSurfaceSubRect(const SurfaceParams& params, ScaleMat
|
|||||||
|
|
||||||
// Check for a surface we can expand before creating a new one
|
// Check for a surface we can expand before creating a new one
|
||||||
if (!surface) {
|
if (!surface) {
|
||||||
surface =
|
surface = FindMatch<MatchFlags::Expand>(aligned_params, match_res_scale);
|
||||||
FindMatch<MatchFlags::Expand | MatchFlags::Invalid>(aligned_params, match_res_scale);
|
|
||||||
if (surface) {
|
if (surface) {
|
||||||
aligned_params.width = aligned_params.stride;
|
aligned_params.width = aligned_params.stride;
|
||||||
aligned_params.UpdateParams();
|
aligned_params.UpdateParams();
|
||||||
@ -659,8 +656,7 @@ template <class T>
|
|||||||
auto RasterizerCache<T>::GetTexCopySurface(const SurfaceParams& params) -> SurfaceRect_Tuple {
|
auto RasterizerCache<T>::GetTexCopySurface(const SurfaceParams& params) -> SurfaceRect_Tuple {
|
||||||
Common::Rectangle<u32> rect{};
|
Common::Rectangle<u32> rect{};
|
||||||
|
|
||||||
Surface match_surface =
|
Surface match_surface = FindMatch<MatchFlags::TexCopy>(params, ScaleMatch::Ignore);
|
||||||
FindMatch<MatchFlags::TexCopy | MatchFlags::Invalid>(params, ScaleMatch::Ignore);
|
|
||||||
|
|
||||||
if (match_surface) {
|
if (match_surface) {
|
||||||
ValidateSurface(match_surface, params.addr, params.size);
|
ValidateSurface(match_surface, params.addr, params.size);
|
||||||
@ -1046,8 +1042,8 @@ void RasterizerCache<T>::InvalidateRegion(PAddr addr, u32 size, const Surface& r
|
|||||||
|
|
||||||
for (const auto& remove_surface : remove_surfaces) {
|
for (const auto& remove_surface : remove_surfaces) {
|
||||||
if (remove_surface == region_owner) {
|
if (remove_surface == region_owner) {
|
||||||
Surface expanded_surface = FindMatch<MatchFlags::SubRect | MatchFlags::Invalid>(
|
Surface expanded_surface =
|
||||||
*region_owner, ScaleMatch::Ignore);
|
FindMatch<MatchFlags::SubRect>(*region_owner, ScaleMatch::Ignore);
|
||||||
ASSERT(expanded_surface);
|
ASSERT(expanded_surface);
|
||||||
|
|
||||||
if ((region_owner->invalid_regions - expanded_surface->invalid_regions).empty()) {
|
if ((region_owner->invalid_regions - expanded_surface->invalid_regions).empty()) {
|
||||||
|
@ -31,12 +31,11 @@ enum class ScaleMatch {
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum class MatchFlags {
|
enum class MatchFlags {
|
||||||
Invalid = 1, ///< Surface is allowed to be only partially valid
|
Exact = 1 << 0, ///< Surface perfectly matches params
|
||||||
Exact = 1 << 1, ///< Surface perfectly matches params
|
SubRect = 1 << 1, ///< Surface encompasses params
|
||||||
SubRect = 1 << 2, ///< Surface encompasses params
|
Copy = 1 << 2, ///< Surface that can be used as a copy source
|
||||||
Copy = 1 << 3, ///< Surface that can be used as a copy source
|
Expand = 1 << 3, ///< Surface that can expand params
|
||||||
Expand = 1 << 4, ///< Surface that can expand params
|
TexCopy = 1 << 4 ///< Surface that will match a display transfer "texture copy" parameters
|
||||||
TexCopy = 1 << 5 ///< Surface that will match a display transfer "texture copy" parameters
|
|
||||||
};
|
};
|
||||||
|
|
||||||
DECLARE_ENUM_FLAG_OPERATORS(MatchFlags);
|
DECLARE_ENUM_FLAG_OPERATORS(MatchFlags);
|
||||||
|
Reference in New Issue
Block a user