From d1d8c4a031c3fa76541ef917d72f169f6acf192c 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 9450b66b78..299abc1d5d 100644 --- a/src/video_core/renderer_vulkan/vk_compute_pass.cpp +++ b/src/video_core/renderer_vulkan/vk_compute_pass.cpp @@ -817,9 +817,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, @@ -827,7 +826,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 1f2dbc08fa..e7fa3a9752 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h @@ -1505,12 +1505,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]; @@ -1542,10 +1541,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; } @@ -1573,8 +1571,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