mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-12-27 19:00:58 +01:00
Texture Cache: Fix Rescaling on Multisample
This commit is contained in:
parent
19ca0c9ab5
commit
ea82bd4b7e
3 changed files with 21 additions and 8 deletions
|
@ -860,9 +860,10 @@ void TextureCacheRuntime::BlitImage(Framebuffer* dst_framebuffer, ImageView& dst
|
|||
cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT,
|
||||
0, nullptr, nullptr, read_barriers);
|
||||
if (is_resolve) {
|
||||
VkImageResolve resolve_info =
|
||||
MakeImageResolve(dst_region, src_region, dst_layers, src_layers);
|
||||
cmdbuf.ResolveImage(src_image, VK_IMAGE_LAYOUT_GENERAL, dst_image,
|
||||
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
|
||||
MakeImageResolve(dst_region, src_region, dst_layers, src_layers));
|
||||
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, resolve_info);
|
||||
} else {
|
||||
const bool is_linear = filter == Fermi2D::Filter::Bilinear;
|
||||
const VkFilter vk_filter = is_linear ? VK_FILTER_LINEAR : VK_FILTER_NEAREST;
|
||||
|
@ -1149,6 +1150,9 @@ bool Image::ScaleUp() {
|
|||
if (aspect_mask == 0) {
|
||||
aspect_mask = ImageAspectMask(info.format);
|
||||
}
|
||||
if (info.num_samples > 1) {
|
||||
return true;
|
||||
}
|
||||
const PixelFormat format = StorageFormat(info.format);
|
||||
const auto format_info = MaxwellToVK::SurfaceFormat(device, FormatType::Optimal, false, format);
|
||||
const auto similar = device.GetSupportedFormat(
|
||||
|
|
|
@ -101,7 +101,7 @@ ImageInfo::ImageInfo(const TICEntry& config) noexcept {
|
|||
// FIXME: Call this without passing *this
|
||||
layer_stride = CalculateLayerStride(*this);
|
||||
maybe_unaligned_layer_stride = CalculateLayerSize(*this);
|
||||
rescaleable &= (block.depth == 0) && resources.levels == 1 && num_samples == 1;
|
||||
rescaleable &= (block.depth == 0) && resources.levels == 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ ImageInfo::ImageInfo(const Tegra::Engines::Maxwell3D::Regs& regs, size_t index)
|
|||
type = ImageType::e3D;
|
||||
size.depth = rt.depth;
|
||||
} else {
|
||||
rescaleable = block.depth == 0 && size.height > 256 && num_samples == 1;
|
||||
rescaleable = block.depth == 0 && size.height > 256;
|
||||
type = ImageType::e2D;
|
||||
resources.layers = rt.depth;
|
||||
}
|
||||
|
|
|
@ -476,17 +476,26 @@ void TextureCache<P>::BlitImage(const Tegra::Engines::Fermi2D::Surface& dst,
|
|||
Image& dst_image = slot_images[dst_id];
|
||||
Image& src_image = slot_images[src_id];
|
||||
|
||||
bool is_resolve = src_image.info.num_samples != 1 && dst_image.info.num_samples == 1;
|
||||
|
||||
bool is_src_rescaled = True(src_image.flags & ImageFlagBits::Rescaled);
|
||||
bool is_dst_rescaled = True(dst_image.flags & ImageFlagBits::Rescaled);
|
||||
|
||||
if (is_src_rescaled != is_dst_rescaled) {
|
||||
if (ImageCanRescale(dst_image)) {
|
||||
ScaleUp(dst_image);
|
||||
is_dst_rescaled = True(dst_image.flags & ImageFlagBits::Rescaled);
|
||||
}
|
||||
if (ImageCanRescale(src_image)) {
|
||||
ScaleUp(src_image);
|
||||
is_src_rescaled = True(src_image.flags & ImageFlagBits::Rescaled);
|
||||
if (is_resolve) {
|
||||
dst_image.info.rescaleable = true;
|
||||
for (const auto& alias : dst_image.aliased_images) {
|
||||
Image& other_image = slot_images[alias.id];
|
||||
other_image.info.rescaleable = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ImageCanRescale(dst_image)) {
|
||||
ScaleUp(dst_image);
|
||||
is_dst_rescaled = True(dst_image.flags & ImageFlagBits::Rescaled);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue