Skip to content

Commit

Permalink
Fix scratch buffer allocation bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcourteaux committed Jun 12, 2024
1 parent e8ac78b commit b067dc7
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/renderer_vk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4441,8 +4441,6 @@ VK_IMPORT_DEVICE
BGFX_PROFILER_SCOPE("copy to scratch", kColorResource);
bx::memCopy(result.m_data, _data, _size);
}
size_t totalSize = bx::strideAlign(_size, scratch.m_align);
scratch.m_pos += totalSize;
return result;
}
}
Expand Down Expand Up @@ -4709,7 +4707,7 @@ VK_DESTROY
const uint32_t dstOffset = bx::strideAlign(m_pos, align);
if (dstOffset + _size <= m_size)
{
m_pos = dstOffset;
m_pos = dstOffset + _size;
return dstOffset;
} else
{
Expand All @@ -4725,8 +4723,6 @@ VK_DESTROY
if (_size > 0)
{
bx::memCopy(&m_data[dstOffset], _data, _size);
const uint32_t alignedSize = bx::strideAlign(_size, m_align);
m_pos = dstOffset + alignedSize;
}

return dstOffset;
Expand Down

0 comments on commit b067dc7

Please sign in to comment.