summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/examples/common/bgfx_utils.h
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/bgfx/examples/common/bgfx_utils.h')
-rw-r--r--3rdparty/bgfx/examples/common/bgfx_utils.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/3rdparty/bgfx/examples/common/bgfx_utils.h b/3rdparty/bgfx/examples/common/bgfx_utils.h
index f9037da53ac..b6731fc22e9 100644
--- a/3rdparty/bgfx/examples/common/bgfx_utils.h
+++ b/3rdparty/bgfx/examples/common/bgfx_utils.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2016 Branimir Karadzic. All rights reserved.
+ * Copyright 2011-2017 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
*/
@@ -15,6 +15,20 @@ bgfx::ProgramHandle loadProgram(const char* _vsName, const char* _fsName);
bgfx::TextureHandle loadTexture(const char* _name, uint32_t _flags = BGFX_TEXTURE_NONE, uint8_t _skip = 0, bgfx::TextureInfo* _info = NULL);
void calcTangents(void* _vertices, uint16_t _numVertices, bgfx::VertexDecl _decl, const uint16_t* _indices, uint32_t _numIndices);
+/// Returns true if both internal transient index and vertex buffer have
+/// enough space.
+///
+/// @param[in] _numVertices Number of vertices.
+/// @param[in] _decl Vertex declaration.
+/// @param[in] _numIndices Number of indices.
+///
+inline bool checkAvailTransientBuffers(uint32_t _numVertices, const bgfx::VertexDecl& _decl, uint32_t _numIndices)
+{
+ return _numVertices == bgfx::getAvailTransientVertexBuffer(_numVertices, _decl)
+ && _numIndices == bgfx::getAvailTransientIndexBuffer(_numIndices)
+ ;
+}
+
struct MeshState
{
struct Texture