Overallocate dynamic buffers on resize.

This commit is contained in:
Branimir Karadžić 2022-08-19 18:21:11 -07:00
parent 6b5b50c2cf
commit 99770c9f43

View File

@ -3398,7 +3398,7 @@ namespace bgfx
return NonLocalAllocator::kInvalidBlock; return NonLocalAllocator::kInvalidBlock;
} }
const uint32_t allocSize = bx::max<uint32_t>(BGFX_CONFIG_DYNAMIC_INDEX_BUFFER_SIZE, _size); const uint32_t allocSize = bx::max<uint32_t>(BGFX_CONFIG_DYNAMIC_INDEX_BUFFER_SIZE, bx::alignUp(_size, 1<<20) );
IndexBuffer& ib = m_indexBuffers[indexBufferHandle.idx]; IndexBuffer& ib = m_indexBuffers[indexBufferHandle.idx];
ib.m_size = allocSize; ib.m_size = allocSize;
@ -3582,7 +3582,7 @@ namespace bgfx
return NonLocalAllocator::kInvalidBlock; return NonLocalAllocator::kInvalidBlock;
} }
const uint32_t allocSize = bx::max<uint32_t>(BGFX_CONFIG_DYNAMIC_VERTEX_BUFFER_SIZE, _size); const uint32_t allocSize = bx::max<uint32_t>(BGFX_CONFIG_DYNAMIC_VERTEX_BUFFER_SIZE, bx::alignUp(_size, 1<<20) );
VertexBuffer& vb = m_vertexBuffers[vertexBufferHandle.idx]; VertexBuffer& vb = m_vertexBuffers[vertexBufferHandle.idx];
vb.m_size = allocSize; vb.m_size = allocSize;