From 8fc9cccd40c28b05f45dcda5a57d0029705372e2 Mon Sep 17 00:00:00 2001 From: Forrest Keller Date: Thu, 1 Jan 2026 13:33:47 -0600 Subject: [PATCH] Minor fixes to the code Fixed Vulkan complaining about the buffer size being wrong so just use VK_WHOLE_SIZE Fixed the frame throttle not working as intended (Will cause popin but can be tested fully to see if there is even any benefit to the throttle) ReadBlockUnsafe might be a bad idea here Removed VideoCommon::CacheType::NoTextureCache from the readblock as I think this did mostly nothing --- src/video_core/renderer_vulkan/vk_compute_pass.cpp | 5 ++--- src/video_core/texture_cache/texture_cache.h | 11 +++++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/video_core/renderer_vulkan/vk_compute_pass.cpp b/src/video_core/renderer_vulkan/vk_compute_pass.cpp index e419c3833a..d60c6d0cd4 100644 --- a/src/video_core/renderer_vulkan/vk_compute_pass.cpp +++ b/src/video_core/renderer_vulkan/vk_compute_pass.cpp @@ -813,9 +813,8 @@ void BlockLinearUnswizzle3DPass::Unswizzle( cmdbuf.PushConstants(*layout, VK_SHADER_STAGE_COMPUTE_BIT, 0, sizeof(pc), &pc); cmdbuf.Dispatch(gx, gy, gz); - // OPTIMIZATION: Combined barrier - merge buffer and image barriers when possible const bool is_first = (z_start == 0); - + // Single barrier for compute -> transfer (buffer ready, image transition) const VkBufferMemoryBarrier buffer_barrier{ .sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER, @@ -823,7 +822,7 @@ void BlockLinearUnswizzle3DPass::Unswizzle( .dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT, .buffer = out_buffer, .offset = 0, - .size = (VkDeviceSize)z_count * pc.slice_size, + .size = VK_WHOLE_SIZE, }; const VkImageMemoryBarrier pre_barrier{ diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index 55dd52b6c8..1d4000efbf 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h @@ -1501,12 +1501,11 @@ void TextureCache

::TickAsyncDecode() { template void TextureCache

::TickAsyncUnswizzle() { if (unswizzle_queue.empty()) { - current_unswizzle_frame = 0; return; } // Don't process every frame - allow more data to accumulate - if (current_unswizzle_frame++ < 2) return; + if (++current_unswizzle_frame < 2) return; PendingUnswizzle& task = unswizzle_queue.front(); Image& image = slot_images[task.image_id]; @@ -1538,10 +1537,9 @@ void TextureCache

::TickAsyncUnswizzle() { const size_t remaining = task.total_size - task.current_offset; const size_t copy_amount = std::min(CHUNK_SIZE, remaining); - gpu_memory->ReadBlock(image.gpu_addr + task.current_offset, + gpu_memory->ReadBlockUnsafe(image.gpu_addr + task.current_offset, task.staging_buffer.mapped_span.data() + task.current_offset, - copy_amount, - VideoCommon::CacheType::NoTextureCache); + copy_amount); task.current_offset += copy_amount; } @@ -1569,8 +1567,9 @@ void TextureCache

::TickAsyncUnswizzle() { runtime.FreeDeferredStagingBuffer(task.staging_buffer); image.flags &= ~ImageFlagBits::IsDecoding; unswizzle_queue.pop_front(); - current_unswizzle_frame = 0; } + + current_unswizzle_frame = 0; } template