From 8014dd82594dbb40e13749203e67b21e8447733c Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Sun, 7 May 2023 23:34:52 +0200 Subject: [PATCH] Texture cache: Only force flush the dma downloads --- src/video_core/engines/maxwell_dma.cpp | 2 +- src/video_core/renderer_opengl/gl_rasterizer.cpp | 2 +- src/video_core/renderer_vulkan/vk_rasterizer.cpp | 2 +- src/video_core/texture_cache/texture_cache.h | 4 ++-- src/video_core/texture_cache/texture_cache_base.h | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/video_core/engines/maxwell_dma.cpp b/src/video_core/engines/maxwell_dma.cpp index f7400aac82..ebe5536dec 100644 --- a/src/video_core/engines/maxwell_dma.cpp +++ b/src/video_core/engines/maxwell_dma.cpp @@ -288,7 +288,7 @@ void MaxwellDMA::CopyPitchToBlockLinear() { write_buffer.resize_destructive(dst_size); memory_manager.ReadBlock(regs.offset_in, read_buffer.data(), src_size); - memory_manager.ReadBlock(regs.offset_out, write_buffer.data(), dst_size); + memory_manager.ReadBlockUnsafe(regs.offset_out, write_buffer.data(), dst_size); // If the input is linear and the output is tiled, swizzle the input and copy it over. SwizzleSubrect(write_buffer, read_buffer, bytes_per_pixel, width, height, depth, x_offset, diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 3f07fe8bbf..f5baa0f3cb 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -1304,7 +1304,7 @@ bool AccelerateDMA::DmaBufferImageCopy(const Tegra::DMA::ImageCopy& copy_info, const Tegra::DMA::BufferOperand& buffer_operand, const Tegra::DMA::ImageOperand& image_operand) { std::scoped_lock lock{buffer_cache.mutex, texture_cache.mutex}; - const auto image_id = texture_cache.DmaImageId(image_operand); + const auto image_id = texture_cache.DmaImageId(image_operand, IS_IMAGE_UPLOAD); if (image_id == VideoCommon::NULL_IMAGE_ID) { return false; } diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index 0bcc20544e..628e1376f7 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp @@ -793,7 +793,7 @@ bool AccelerateDMA::DmaBufferImageCopy(const Tegra::DMA::ImageCopy& copy_info, const Tegra::DMA::BufferOperand& buffer_operand, const Tegra::DMA::ImageOperand& image_operand) { std::scoped_lock lock{buffer_cache.mutex, texture_cache.mutex}; - const auto image_id = texture_cache.DmaImageId(image_operand); + const auto image_id = texture_cache.DmaImageId(image_operand, IS_IMAGE_UPLOAD); if (image_id == VideoCommon::NULL_IMAGE_ID) { return false; } diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index d49f3a7a0a..e1198dcf8c 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h @@ -811,7 +811,7 @@ void TextureCache

::PopAsyncFlushes() { } template -ImageId TextureCache

::DmaImageId(const Tegra::DMA::ImageOperand& operand) { +ImageId TextureCache

::DmaImageId(const Tegra::DMA::ImageOperand& operand, bool is_upload) { const ImageInfo dst_info(operand); const ImageId dst_id = FindDMAImage(dst_info, operand.address); if (!dst_id) { @@ -822,7 +822,7 @@ ImageId TextureCache

::DmaImageId(const Tegra::DMA::ImageOperand& operand) { // No need to waste time on an image that's synced with guest return NULL_IMAGE_ID; } - if (!image.info.dma_downloaded) { + if (!is_upload && !image.info.dma_downloaded) { // Force a full sync. image.info.dma_downloaded = true; return NULL_IMAGE_ID; diff --git a/src/video_core/texture_cache/texture_cache_base.h b/src/video_core/texture_cache/texture_cache_base.h index 01f5ac5880..0720494e55 100644 --- a/src/video_core/texture_cache/texture_cache_base.h +++ b/src/video_core/texture_cache/texture_cache_base.h @@ -207,7 +207,7 @@ public: /// Pop asynchronous downloads void PopAsyncFlushes(); - [[nodiscard]] ImageId DmaImageId(const Tegra::DMA::ImageOperand& operand); + [[nodiscard]] ImageId DmaImageId(const Tegra::DMA::ImageOperand& operand, bool is_upload); [[nodiscard]] std::pair DmaBufferImageCopy( const Tegra::DMA::ImageCopy& copy_info, const Tegra::DMA::BufferOperand& buffer_operand,