diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index ccc4e305b9..e76d3d76c2 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp @@ -705,7 +705,7 @@ void TryTransformSwizzleIfNeeded(PixelFormat format, std::array copies) { // As per the size-compatible formats section of vulkan, copy manually via ReinterpretImage @@ -1925,7 +1945,9 @@ bool Image::ScaleUp(bool ignore) { if (NeedsScaleHelper()) { return BlitScaleHelper(true); } else { - BlitScale(*scheduler, *original_image, *scaled_image, info, aspect_mask, resolution); + const bool supports_linear_filter = runtime->SupportsLinearFilter(info.format); + BlitScale(*scheduler, *original_image, *scaled_image, info, aspect_mask, resolution, + supports_linear_filter); } return true; } @@ -1950,7 +1972,9 @@ bool Image::ScaleDown(bool ignore) { if (NeedsScaleHelper()) { return BlitScaleHelper(false); } else { - BlitScale(*scheduler, *scaled_image, *original_image, info, aspect_mask, resolution, false); + const bool supports_linear_filter = runtime->SupportsLinearFilter(info.format); + BlitScale(*scheduler, *scaled_image, *original_image, info, aspect_mask, resolution, + supports_linear_filter, false); } return true; } @@ -1959,9 +1983,10 @@ bool Image::BlitScaleHelper(bool scale_up) { using namespace VideoCommon; static constexpr auto BLIT_OPERATION = Tegra::Engines::Fermi2D::Operation::SrcCopy; const bool is_color{aspect_mask == VK_IMAGE_ASPECT_COLOR_BIT}; - const bool is_bilinear{is_color && !IsPixelFormatInteger(info.format)}; - const auto operation = is_bilinear ? Tegra::Engines::Fermi2D::Filter::Bilinear - : Tegra::Engines::Fermi2D::Filter::Point; + const bool supports_linear_filter = runtime->SupportsLinearFilter(info.format); + const bool is_bilinear = is_color && supports_linear_filter; + const auto filter_mode = is_bilinear ? Tegra::Engines::Fermi2D::Filter::Bilinear + : Tegra::Engines::Fermi2D::Filter::Point; const bool is_2d = info.type == ImageType::e2D; const auto& resolution = runtime->resolution; @@ -2000,14 +2025,14 @@ bool Image::BlitScaleHelper(bool scale_up) { } runtime->blit_image_helper.BlitColor(blit_framebuffer.get(), *blit_view, dst_region, - src_region, operation, BLIT_OPERATION); + src_region, filter_mode, BLIT_OPERATION); } else if (aspect_mask == (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) { if (!blit_framebuffer) { blit_framebuffer = std::make_unique(*runtime, nullptr, view_ptr, extent, scale_up); } runtime->blit_image_helper.BlitDepthStencil(blit_framebuffer.get(), *blit_view, - dst_region, src_region, operation, + dst_region, src_region, filter_mode, BLIT_OPERATION); } else { // TODO: Use helper blits where applicable diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.h b/src/video_core/renderer_vulkan/vk_texture_cache.h index ec9a29d117..f2adc11471 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.h +++ b/src/video_core/renderer_vulkan/vk_texture_cache.h @@ -117,6 +117,7 @@ public: bool IsFormatDitherable(VideoCore::Surface::PixelFormat format); bool IsFormatScalable(VideoCore::Surface::PixelFormat format); + bool SupportsLinearFilter(VideoCore::Surface::PixelFormat format) const; VkFormat GetSupportedFormat(VkFormat requested_format, VkFormatFeatureFlags required_features) const;