From 3ad45f4186f9c57ab85a15f2b28b358a8b4c90ae Mon Sep 17 00:00:00 2001 From: DrChat Date: Fri, 9 Feb 2018 20:57:26 -0600 Subject: [PATCH] [Vulkan] New docs for buffer cache --- src/xenia/gpu/vulkan/vulkan_command_processor.cc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/xenia/gpu/vulkan/vulkan_command_processor.cc b/src/xenia/gpu/vulkan/vulkan_command_processor.cc index 9bab7fda5..6112d9a3d 100644 --- a/src/xenia/gpu/vulkan/vulkan_command_processor.cc +++ b/src/xenia/gpu/vulkan/vulkan_command_processor.cc @@ -860,14 +860,13 @@ bool VulkanCommandProcessor::PopulateVertexBuffers( // TODO: Make the buffer cache ... actually cache buffers. We can have // a list of buffers that were cached, and store those in chunks in a // multiple of the host's page size. - // WRITE WATCHES: We need to invalidate vertex buffers if they're written - // to. Since most vertex buffers aren't aligned to a page boundary, this - // means a watch may cover more than one vertex buffer. - // We need to maintain a list of write watches, and what memory ranges - // they cover. If a vertex buffer lies within a write watch's range, assign - // it to the watch. If there's partial alignment where a buffer lies within - // one watch and outside of it, should we create a new watch or extend the - // existing watch? + // So, we need to track all vertex buffers in a sorted map, and track all + // write watches in a sorted map. When a vertex buffer is uploaded, track + // all untracked pages with 1-page write watches. In the callback, + // invalidate any overlapping vertex buffers. + // + // We would keep the old transient buffer as a staging buffer, and upload + // to a GPU-only buffer that tracks all cached vertex buffers. auto buffer_ref = buffer_cache_->UploadVertexBuffer( current_setup_buffer_, physical_address, source_length, static_cast(fetch->endian), current_batch_fence_);