diff --git a/include/bgfx.h b/include/bgfx.h index 9675e3cc..9c8055f0 100644 --- a/include/bgfx.h +++ b/include/bgfx.h @@ -606,6 +606,13 @@ namespace bgfx /// 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 /// enough space. /// diff --git a/src/bgfx.cpp b/src/bgfx.cpp index 922e6298..c85681b4 100755 --- a/src/bgfx.cpp +++ b/src/bgfx.cpp @@ -938,6 +938,13 @@ namespace bgfx 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) { return checkAvailTransientVertexBuffer(_numVertices, _decl)