Fix copyGpuBuffers when resize invalidates commands in flight (#876)

* Fix copyGpuBuffers when resize invalidates commands in flight

* Use _MB macro for size constant
This commit is contained in:
baggins183 2024-09-12 12:54:54 -07:00 committed by GitHub
parent 1b12138cda
commit bc66fe8fb5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 19 additions and 0 deletions

View file

@ -660,6 +660,12 @@ std::pair<std::span<const u32>, std::span<const u32>> Liverpool::CopyCmdBuffers(
std::span<const u32> dcb, std::span<const u32> ccb) {
auto& queue = mapped_queues[GfxQueueId];
// std::vector resize can invalidate spans for commands in flight
ASSERT_MSG(queue.dcb_buffer.capacity() >= queue.dcb_buffer_offset + dcb.size(),
"dcb copy buffer out of reserved space");
ASSERT_MSG(queue.ccb_buffer.capacity() >= queue.ccb_buffer_offset + ccb.size(),
"ccb copy buffer out of reserved space");
queue.dcb_buffer.resize(
std::max(queue.dcb_buffer.size(), queue.dcb_buffer_offset + dcb.size()));
queue.ccb_buffer.resize(