mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2025-03-14 00:49:53 -04:00
Merge pull request #700 from jdryg/alloc_large_dyn_buffers
Allow allocation of DVBs/DIBs larger than the predefined sizes.
This commit is contained in:
commit
3d5166f6f6
1 changed files with 8 additions and 4 deletions
12
src/bgfx_p.h
12
src/bgfx_p.h
|
@ -2282,12 +2282,14 @@ namespace bgfx
|
|||
return ptr;
|
||||
}
|
||||
|
||||
uint32_t allocSize = bx::uint32_max(BGFX_CONFIG_DYNAMIC_INDEX_BUFFER_SIZE, _size);
|
||||
|
||||
CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateDynamicIndexBuffer);
|
||||
cmdbuf.write(indexBufferHandle);
|
||||
cmdbuf.write(BGFX_CONFIG_DYNAMIC_INDEX_BUFFER_SIZE);
|
||||
cmdbuf.write(allocSize);
|
||||
cmdbuf.write(_flags);
|
||||
|
||||
m_dynIndexBufferAllocator.add(uint64_t(indexBufferHandle.idx) << 32, BGFX_CONFIG_DYNAMIC_INDEX_BUFFER_SIZE);
|
||||
m_dynIndexBufferAllocator.add(uint64_t(indexBufferHandle.idx) << 32, allocSize);
|
||||
ptr = m_dynIndexBufferAllocator.alloc(_size);
|
||||
}
|
||||
|
||||
|
@ -2432,12 +2434,14 @@ namespace bgfx
|
|||
return NonLocalAllocator::invalidBlock;
|
||||
}
|
||||
|
||||
uint32_t allocSize = bx::uint32_max(BGFX_CONFIG_DYNAMIC_VERTEX_BUFFER_SIZE, _size);
|
||||
|
||||
CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateDynamicVertexBuffer);
|
||||
cmdbuf.write(vertexBufferHandle);
|
||||
cmdbuf.write(BGFX_CONFIG_DYNAMIC_VERTEX_BUFFER_SIZE);
|
||||
cmdbuf.write(allocSize);
|
||||
cmdbuf.write(_flags);
|
||||
|
||||
m_dynVertexBufferAllocator.add(uint64_t(vertexBufferHandle.idx)<<32, BGFX_CONFIG_DYNAMIC_VERTEX_BUFFER_SIZE);
|
||||
m_dynVertexBufferAllocator.add(uint64_t(vertexBufferHandle.idx) << 32, allocSize);
|
||||
ptr = m_dynVertexBufferAllocator.alloc(_size);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue