texture_cache: Fix infinitely recursive ImageCanRescale check
This commit is contained in:
parent
b1ae935f11
commit
4de584005f
@ -256,6 +256,8 @@ void AddImageAlias(ImageBase& lhs, ImageBase& rhs, ImageId lhs_id, ImageId rhs_i
|
|||||||
}
|
}
|
||||||
lhs.aliased_images.push_back(std::move(lhs_alias));
|
lhs.aliased_images.push_back(std::move(lhs_alias));
|
||||||
rhs.aliased_images.push_back(std::move(rhs_alias));
|
rhs.aliased_images.push_back(std::move(rhs_alias));
|
||||||
|
lhs.flags &= ~ImageFlagBits::IsRescalable;
|
||||||
|
rhs.flags &= ~ImageFlagBits::IsRescalable;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace VideoCommon
|
} // namespace VideoCommon
|
||||||
|
@ -36,8 +36,9 @@ enum class ImageFlagBits : u32 {
|
|||||||
|
|
||||||
// Rescaler
|
// Rescaler
|
||||||
Rescaled = 1 << 12,
|
Rescaled = 1 << 12,
|
||||||
RescaleChecked = 1 << 13,
|
CheckingRescalable = 1 << 13,
|
||||||
Blacklisted = 1 << 14,
|
IsRescalable = 1 << 14,
|
||||||
|
Blacklisted = 1 << 15,
|
||||||
};
|
};
|
||||||
DECLARE_ENUM_FLAG_OPERATORS(ImageFlagBits)
|
DECLARE_ENUM_FLAG_OPERATORS(ImageFlagBits)
|
||||||
|
|
||||||
|
@ -795,25 +795,25 @@ bool TextureCache<P>::BlackListImage(ImageId image_id) {
|
|||||||
|
|
||||||
template <class P>
|
template <class P>
|
||||||
bool TextureCache<P>::ImageCanRescale(ImageBase& image) {
|
bool TextureCache<P>::ImageCanRescale(ImageBase& image) {
|
||||||
if (True(image.flags & ImageFlagBits::Blacklisted)) {
|
if (!image.info.rescaleable || True(image.flags & ImageFlagBits::Blacklisted)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (True(image.flags & (ImageFlagBits::Rescaled | ImageFlagBits::RescaleChecked))) {
|
if (True(image.flags & (ImageFlagBits::Rescaled | ImageFlagBits::CheckingRescalable))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!image.info.rescaleable) {
|
if (True(image.flags & ImageFlagBits::IsRescalable)) {
|
||||||
image.flags &= ~ImageFlagBits::RescaleChecked;
|
return true;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
image.flags |= ImageFlagBits::RescaleChecked;
|
image.flags |= ImageFlagBits::CheckingRescalable;
|
||||||
for (const auto& alias : image.aliased_images) {
|
for (const auto& alias : image.aliased_images) {
|
||||||
Image& other_image = slot_images[alias.id];
|
Image& other_image = slot_images[alias.id];
|
||||||
if (!ImageCanRescale(other_image)) {
|
if (!ImageCanRescale(other_image)) {
|
||||||
image.flags &= ~ImageFlagBits::RescaleChecked;
|
image.flags &= ~ImageFlagBits::CheckingRescalable;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
image.flags &= ~ImageFlagBits::RescaleChecked;
|
image.flags &= ~ImageFlagBits::CheckingRescalable;
|
||||||
|
image.flags |= ImageFlagBits::IsRescalable;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user