2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

gl_stream_buffer/vk_staging_buffer_pool: Fix size check

Fix a tragic off-by-one condition that causes Vulkan's stream buffer to
think it's always full, using fallback memory. The OpenGL was also
affected by this bug to a lesser extent.
This commit is contained in:
ReinUsesLisp 2021-02-13 05:11:48 -03:00
parent d3c7a7e7cf
commit 682d82faf3
2 changed files with 2 additions and 2 deletions

View file

@ -40,7 +40,7 @@ std::pair<std::span<u8>, size_t> StreamBuffer::Request(size_t size) noexcept {
glClientWaitSync(fences[region].handle, 0, GL_TIMEOUT_IGNORED); glClientWaitSync(fences[region].handle, 0, GL_TIMEOUT_IGNORED);
fences[region].Release(); fences[region].Release();
} }
if (iterator + size > free_iterator) { if (iterator + size >= free_iterator) {
free_iterator = iterator + size; free_iterator = iterator + size;
} }
if (iterator + size > STREAM_BUFFER_SIZE) { if (iterator + size > STREAM_BUFFER_SIZE) {

View file

@ -153,7 +153,7 @@ StagingBufferRef StagingBufferPool::GetStreamBuffer(size_t size) {
used_iterator = iterator; used_iterator = iterator;
free_iterator = std::max(free_iterator, iterator + size); free_iterator = std::max(free_iterator, iterator + size);
if (iterator + size > STREAM_BUFFER_SIZE) { if (iterator + size >= STREAM_BUFFER_SIZE) {
std::fill(sync_ticks.begin() + Region(used_iterator), sync_ticks.begin() + NUM_SYNCS, std::fill(sync_ticks.begin() + Region(used_iterator), sync_ticks.begin() + NUM_SYNCS,
current_tick); current_tick);
used_iterator = 0; used_iterator = 0;