TextureCache: Further fixes on resolve algorithm.

This commit is contained in:
Fernando Sahmkow 2021-11-19 22:23:48 +01:00
parent b805c7bf05
commit 6f896d1fae
2 changed files with 17 additions and 16 deletions

View File

@ -1096,13 +1096,13 @@ typename TextureCache<P>::BlitImages TextureCache<P>::GetBlitImages(
if (GetFormatType(dst_info.format) != GetFormatType(src_info.format)) { if (GetFormatType(dst_info.format) != GetFormatType(src_info.format)) {
continue; continue;
} }
src_id = FindOrInsertImage(src_info, src_addr); RelaxedOptions find_options{};
RelaxedOptions dst_options{};
if (src_info.num_samples > 1) { if (src_info.num_samples > 1) {
// it's a resolve, we must enforce the same format. // it's a resolve, we must enforce the same format.
dst_options = RelaxedOptions::ForceBrokenViews; find_options = RelaxedOptions::ForceBrokenViews;
} }
dst_id = FindOrInsertImage(dst_info, dst_addr, dst_options); src_id = FindOrInsertImage(src_info, src_addr, find_options);
dst_id = FindOrInsertImage(dst_info, dst_addr, find_options);
} while (has_deleted_images); } while (has_deleted_images);
return BlitImages{ return BlitImages{
.dst_id = dst_id, .dst_id = dst_id,

View File

@ -1151,19 +1151,25 @@ bool IsSubresource(const ImageInfo& candidate, const ImageBase& image, GPUVAddr
void DeduceBlitImages(ImageInfo& dst_info, ImageInfo& src_info, const ImageBase* dst, void DeduceBlitImages(ImageInfo& dst_info, ImageInfo& src_info, const ImageBase* dst,
const ImageBase* src) { const ImageBase* src) {
bool is_resolve = false;
const auto original_src_format = src_info.format;
const auto original_dst_format = dst_info.format;
if (src) { if (src) {
src_info.format = src->info.format; if (GetFormatType(src->info.format) != SurfaceType::ColorTexture) {
src_info.format = src->info.format;
}
is_resolve = src->info.num_samples > 1;
src_info.num_samples = src->info.num_samples; src_info.num_samples = src->info.num_samples;
src_info.size = src->info.size; src_info.size = src->info.size;
} }
if (dst) { if (dst && GetFormatType(dst->info.format) != SurfaceType::ColorTexture) {
dst_info.format = dst->info.format; dst_info.format = dst->info.format;
dst_info.num_samples = dst->info.num_samples;
dst_info.size = dst->info.size;
} }
if (src && GetFormatType(src->info.format) != SurfaceType::ColorTexture) { if (src && GetFormatType(src->info.format) != SurfaceType::ColorTexture) {
if (dst) { if (dst) {
src_info.format = dst_info.format; if (GetFormatType(dst->info.format) == SurfaceType::ColorTexture) {
src_info.format = original_src_format;
}
} else { } else {
dst_info.format = src->info.format; dst_info.format = src->info.format;
} }
@ -1171,18 +1177,13 @@ void DeduceBlitImages(ImageInfo& dst_info, ImageInfo& src_info, const ImageBase*
if (dst && GetFormatType(dst->info.format) != SurfaceType::ColorTexture) { if (dst && GetFormatType(dst->info.format) != SurfaceType::ColorTexture) {
if (src) { if (src) {
if (GetFormatType(src->info.format) == SurfaceType::ColorTexture) { if (GetFormatType(src->info.format) == SurfaceType::ColorTexture) {
dst_info.format = src->info.format; dst_info.format = original_dst_format;
} }
} else { } else {
src_info.format = dst->info.format; src_info.format = dst->info.format;
} }
} }
if (src_info.num_samples > 1) { ASSERT(!is_resolve || dst_info.format == src_info.format);
dst_info.format = src_info.format;
}
if (dst_info.num_samples > 1) {
src_info.format = dst_info.format;
}
} }
u32 MapSizeBytes(const ImageBase& image) { u32 MapSizeBytes(const ImageBase& image) {