From 4cea9a2f99dc2fddec4a190b30bc25679bc9e295 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sat, 4 Mar 2017 18:01:36 +1000 Subject: [PATCH] Vulkan: Fix underflow in StreamBuffer::WaitForClearSpace This could cause the assertion on line 212 to fail when uploading large amounts of data in between command buffer executions. --- Source/Core/VideoBackends/Vulkan/StreamBuffer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/VideoBackends/Vulkan/StreamBuffer.cpp b/Source/Core/VideoBackends/Vulkan/StreamBuffer.cpp index 6cf55ab0f2..25aa9e3d07 100644 --- a/Source/Core/VideoBackends/Vulkan/StreamBuffer.cpp +++ b/Source/Core/VideoBackends/Vulkan/StreamBuffer.cpp @@ -316,7 +316,7 @@ bool StreamBuffer::WaitForClearSpace(size_t num_bytes) // We're currently allocating behind the GPU. This would give us between the current // offset and the GPU position worth of space to work with. Again, > because we can't // align the GPU position with the buffer offset. - size_t available_space_inbetween = m_current_offset - gpu_position; + size_t available_space_inbetween = gpu_position - m_current_offset; if (available_space_inbetween > num_bytes) { // Leave the offset as-is, but update the GPU position.