mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-15 22:54:00 +00:00
texture_cache/util: Avoid relaxed image views on different bytes per pixel
Avoids API usage errors on UE4 titles leading to crashes.
This commit is contained in:
parent
8b5655a98e
commit
3d89398b84
1 changed files with 9 additions and 1 deletions
|
@ -1087,7 +1087,15 @@ std::optional<SubresourceBase> FindSubresource(const ImageInfo& candidate, const
|
|||
return std::nullopt;
|
||||
}
|
||||
const ImageInfo& existing = image.info;
|
||||
if (False(options & RelaxedOptions::Format)) {
|
||||
if (True(options & RelaxedOptions::Format)) {
|
||||
// Format checking is relaxed, but we still have to check for matching bytes per block.
|
||||
// This avoids creating a view for blits on UE4 titles where formats with different bytes
|
||||
// per block are aliased.
|
||||
if (BytesPerBlock(existing.format) != BytesPerBlock(candidate.format)) {
|
||||
return std::nullopt;
|
||||
}
|
||||
} else {
|
||||
// Format comaptibility is not relaxed, ensure we are creating a view on a compatible format
|
||||
if (!IsViewCompatible(existing.format, candidate.format, broken_views, native_bgr)) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue