mirror of https://git.suyu.dev/suyu/suyu
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:
parent
d3c7a7e7cf
commit
682d82faf3
|
@ -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) {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue