Browse Source

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
pull/3246/head
Forrest Keller 1 month ago
committed by crueter
parent
commit
8fc9cccd40
  1. 3
      src/video_core/renderer_vulkan/vk_compute_pass.cpp
  2. 11
      src/video_core/texture_cache/texture_cache.h

3
src/video_core/renderer_vulkan/vk_compute_pass.cpp

@ -813,7 +813,6 @@ void BlockLinearUnswizzle3DPass::Unswizzle(
cmdbuf.PushConstants(*layout, VK_SHADER_STAGE_COMPUTE_BIT, 0, sizeof(pc), &pc); cmdbuf.PushConstants(*layout, VK_SHADER_STAGE_COMPUTE_BIT, 0, sizeof(pc), &pc);
cmdbuf.Dispatch(gx, gy, gz); cmdbuf.Dispatch(gx, gy, gz);
// OPTIMIZATION: Combined barrier - merge buffer and image barriers when possible
const bool is_first = (z_start == 0); const bool is_first = (z_start == 0);
// Single barrier for compute -> transfer (buffer ready, image transition) // Single barrier for compute -> transfer (buffer ready, image transition)
@ -823,7 +822,7 @@ void BlockLinearUnswizzle3DPass::Unswizzle(
.dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT, .dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT,
.buffer = out_buffer, .buffer = out_buffer,
.offset = 0, .offset = 0,
.size = (VkDeviceSize)z_count * pc.slice_size,
.size = VK_WHOLE_SIZE,
}; };
const VkImageMemoryBarrier pre_barrier{ const VkImageMemoryBarrier pre_barrier{

11
src/video_core/texture_cache/texture_cache.h

@ -1501,12 +1501,11 @@ void TextureCache<P>::TickAsyncDecode() {
template <class P> template <class P>
void TextureCache<P>::TickAsyncUnswizzle() { void TextureCache<P>::TickAsyncUnswizzle() {
if (unswizzle_queue.empty()) { if (unswizzle_queue.empty()) {
current_unswizzle_frame = 0;
return; return;
} }
// Don't process every frame - allow more data to accumulate // 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(); PendingUnswizzle& task = unswizzle_queue.front();
Image& image = slot_images[task.image_id]; Image& image = slot_images[task.image_id];
@ -1538,10 +1537,9 @@ void TextureCache<P>::TickAsyncUnswizzle() {
const size_t remaining = task.total_size - task.current_offset; const size_t remaining = task.total_size - task.current_offset;
const size_t copy_amount = std::min(CHUNK_SIZE, remaining); 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, task.staging_buffer.mapped_span.data() + task.current_offset,
copy_amount,
VideoCommon::CacheType::NoTextureCache);
copy_amount);
task.current_offset += copy_amount; task.current_offset += copy_amount;
} }
@ -1569,8 +1567,9 @@ void TextureCache<P>::TickAsyncUnswizzle() {
runtime.FreeDeferredStagingBuffer(task.staging_buffer); runtime.FreeDeferredStagingBuffer(task.staging_buffer);
image.flags &= ~ImageFlagBits::IsDecoding; image.flags &= ~ImageFlagBits::IsDecoding;
unswizzle_queue.pop_front(); unswizzle_queue.pop_front();
current_unswizzle_frame = 0;
} }
current_unswizzle_frame = 0;
} }
template <class P> template <class P>

Loading…
Cancel
Save