Replaced checkAvail* with getAvail* API.

This commit is contained in:
Branimir Karadžić
2016-12-22 16:18:44 -08:00
parent 0d93dd074d
commit 07aae82d16
19 changed files with 86 additions and 101 deletions

View File

@@ -2862,34 +2862,26 @@ error:
s_ctx->destroyDynamicVertexBuffer(_handle);
}
bool checkAvailTransientIndexBuffer(uint32_t _num)
uint32_t getAvailTransientIndexBuffer(uint32_t _num)
{
BGFX_CHECK_MAIN_THREAD();
BX_CHECK(0 < _num, "Requesting 0 indices.");
return s_ctx->checkAvailTransientIndexBuffer(_num);
return s_ctx->getAvailTransientIndexBuffer(_num);
}
bool checkAvailTransientVertexBuffer(uint32_t _num, const VertexDecl& _decl)
uint32_t getAvailTransientVertexBuffer(uint32_t _num, const VertexDecl& _decl)
{
BGFX_CHECK_MAIN_THREAD();
BX_CHECK(0 < _num, "Requesting 0 vertices.");
BX_CHECK(0 != _decl.m_stride, "Invalid VertexDecl.");
return s_ctx->checkAvailTransientVertexBuffer(_num, _decl.m_stride);
return s_ctx->getAvailTransientVertexBuffer(_num, _decl.m_stride);
}
bool checkAvailInstanceDataBuffer(uint32_t _num, uint16_t _stride)
uint32_t getAvailInstanceDataBuffer(uint32_t _num, uint16_t _stride)
{
BGFX_CHECK_MAIN_THREAD();
BX_CHECK(0 < _num, "Requesting 0 instances.");
return s_ctx->checkAvailTransientVertexBuffer(_num, _stride);
}
bool checkAvailTransientBuffers(uint32_t _numVertices, const VertexDecl& _decl, uint32_t _numIndices)
{
BX_CHECK(0 != _decl.m_stride, "Invalid VertexDecl.");
return checkAvailTransientVertexBuffer(_numVertices, _decl)
&& checkAvailTransientIndexBuffer(_numIndices)
;
return s_ctx->getAvailTransientVertexBuffer(_num, _stride);
}
void allocTransientIndexBuffer(TransientIndexBuffer* _tib, uint32_t _num)
@@ -2920,7 +2912,8 @@ error:
bool allocTransientBuffers(bgfx::TransientVertexBuffer* _tvb, const bgfx::VertexDecl& _decl, uint32_t _numVertices, bgfx::TransientIndexBuffer* _tib, uint32_t _numIndices)
{
if (checkAvailTransientBuffers(_numVertices, _decl, _numIndices) )
if (_numVertices == getAvailTransientVertexBuffer(_numVertices, _decl)
&& _numIndices == getAvailTransientIndexBuffer(_numIndices) )
{
allocTransientVertexBuffer(_tvb, _numVertices, _decl);
allocTransientIndexBuffer(_tib, _numIndices);
@@ -4274,26 +4267,20 @@ BGFX_C_API void bgfx_destroy_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_ha
bgfx::destroyDynamicVertexBuffer(handle.cpp);
}
BGFX_C_API bool bgfx_check_avail_transient_index_buffer(uint32_t _num)
BGFX_C_API uint32_t bgfx_get_avail_transient_index_buffer(uint32_t _num)
{
return bgfx::checkAvailTransientIndexBuffer(_num);
return bgfx::getAvailTransientIndexBuffer(_num);
}
BGFX_C_API bool bgfx_check_avail_transient_vertex_buffer(uint32_t _num, const bgfx_vertex_decl_t* _decl)
BGFX_C_API uint32_t bgfx_get_avail_transient_vertex_buffer(uint32_t _num, const bgfx_vertex_decl_t* _decl)
{
const bgfx::VertexDecl& decl = *(const bgfx::VertexDecl*)_decl;
return bgfx::checkAvailTransientVertexBuffer(_num, decl);
return bgfx::getAvailTransientVertexBuffer(_num, decl);
}
BGFX_C_API bool bgfx_check_avail_instance_data_buffer(uint32_t _num, uint16_t _stride)
BGFX_C_API uint32_t bgfx_get_avail_instance_data_buffer(uint32_t _num, uint16_t _stride)
{
return bgfx::checkAvailInstanceDataBuffer(_num, _stride);
}
BGFX_C_API bool bgfx_check_avail_transient_buffers(uint32_t _numVertices, const bgfx_vertex_decl_t* _decl, uint32_t _numIndices)
{
const bgfx::VertexDecl& decl = *(const bgfx::VertexDecl*)_decl;
return bgfx::checkAvailTransientBuffers(_numVertices, decl, _numIndices);
return bgfx::getAvailInstanceDataBuffer(_num, _stride);
}
BGFX_C_API void bgfx_alloc_transient_index_buffer(bgfx_transient_index_buffer_t* _tib, uint32_t _num)
@@ -4886,10 +4873,9 @@ BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version)
BGFX_IMPORT_FUNC(create_dynamic_vertex_buffer_mem) \
BGFX_IMPORT_FUNC(update_dynamic_vertex_buffer) \
BGFX_IMPORT_FUNC(destroy_dynamic_vertex_buffer) \
BGFX_IMPORT_FUNC(check_avail_transient_index_buffer) \
BGFX_IMPORT_FUNC(check_avail_transient_vertex_buffer) \
BGFX_IMPORT_FUNC(check_avail_instance_data_buffer) \
BGFX_IMPORT_FUNC(check_avail_transient_buffers) \
BGFX_IMPORT_FUNC(get_avail_transient_index_buffer) \
BGFX_IMPORT_FUNC(get_avail_transient_vertex_buffer) \
BGFX_IMPORT_FUNC(get_avail_instance_data_buffer) \
BGFX_IMPORT_FUNC(alloc_transient_index_buffer) \
BGFX_IMPORT_FUNC(alloc_transient_vertex_buffer) \
BGFX_IMPORT_FUNC(alloc_transient_buffers) \