Added check available memory for instance buffer.

This commit is contained in:
bkaradzic 2013-06-03 20:51:06 -07:00
parent 52511156ac
commit e79102bf0e
2 changed files with 14 additions and 0 deletions

View file

@ -606,6 +606,13 @@ namespace bgfx
/// ///
bool checkAvailTransientVertexBuffer(uint32_t _num, const VertexDecl& _decl); bool checkAvailTransientVertexBuffer(uint32_t _num, const VertexDecl& _decl);
/// Returns true if internal instance data buffer has enough space.
///
/// @param _num Number of instances.
/// @param _stride Stride per instance.
///
bool checkAvailInstanceDataBuffer(uint32_t _num, uint16_t _stride);
/// Returns true if both internal transient index and vertex buffer have /// Returns true if both internal transient index and vertex buffer have
/// enough space. /// enough space.
/// ///

View file

@ -938,6 +938,13 @@ namespace bgfx
return s_ctx.m_submit->checkAvailTransientVertexBuffer(_num, _decl.m_stride); return s_ctx.m_submit->checkAvailTransientVertexBuffer(_num, _decl.m_stride);
} }
bool checkAvailInstanceDataBuffer(uint32_t _num, uint16_t _stride)
{
BGFX_CHECK_MAIN_THREAD();
BX_CHECK(0 < _num, "Requesting 0 instances.");
return s_ctx.m_submit->checkAvailTransientVertexBuffer(_num, _stride);
}
bool checkAvailTransientBuffers(uint32_t _numVertices, const VertexDecl& _decl, uint32_t _numIndices) bool checkAvailTransientBuffers(uint32_t _numVertices, const VertexDecl& _decl, uint32_t _numIndices)
{ {
return checkAvailTransientVertexBuffer(_numVertices, _decl) return checkAvailTransientVertexBuffer(_numVertices, _decl)