Merge pull request #6469 from ReinUsesLisp/blit-view-compat

texture_cache/util: Avoid relaxed image views on different bytes per block
This commit is contained in:
Ameer J 2021-06-16 21:08:07 -04:00 committed by GitHub
commit c5b517aa5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1096,7 +1096,15 @@ std::optional<SubresourceBase> FindSubresource(const ImageInfo& candidate, const
return std::nullopt; return std::nullopt;
} }
const ImageInfo& existing = image.info; 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)) { if (!IsViewCompatible(existing.format, candidate.format, broken_views, native_bgr)) {
return std::nullopt; return std::nullopt;
} }