Added more handle checks.

This commit is contained in:
Branimir Karadžić 2015-02-25 22:40:56 -08:00
parent 579f43fad7
commit a396f671ec
2 changed files with 8 additions and 1 deletions

View file

@ -2823,24 +2823,28 @@ again:
void setInstanceDataBuffer(const InstanceDataBuffer* _idb, uint32_t _num)
{
BGFX_CHECK_MAIN_THREAD();
BX_CHECK(NULL != _idb, "_idb can't be NULL");
s_ctx->setInstanceDataBuffer(_idb, _num);
}
void setInstanceDataBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _num)
{
BGFX_CHECK_MAIN_THREAD();
BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_VERTEX_BUFFERS);
s_ctx->setInstanceDataBuffer(_handle, _startVertex, _num);
}
void setInstanceDataBuffer(DynamicVertexBufferHandle _handle, uint32_t _startVertex, uint32_t _num)
{
BGFX_CHECK_MAIN_THREAD();
BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS);
s_ctx->setInstanceDataBuffer(_handle, _startVertex, _num);
}
void setProgram(ProgramHandle _handle)
{
BGFX_CHECK_MAIN_THREAD();
BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_PROGRAMS);
s_ctx->setProgram(_handle);
}
@ -2865,24 +2869,28 @@ again:
void setBuffer(uint8_t _stage, IndexBufferHandle _handle, Access::Enum _access)
{
BGFX_CHECK_MAIN_THREAD();
BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_INDEX_BUFFERS);
s_ctx->setBuffer(_stage, _handle, _access);
}
void setBuffer(uint8_t _stage, VertexBufferHandle _handle, Access::Enum _access)
{
BGFX_CHECK_MAIN_THREAD();
BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_VERTEX_BUFFERS);
s_ctx->setBuffer(_stage, _handle, _access);
}
void setBuffer(uint8_t _stage, DynamicIndexBufferHandle _handle, Access::Enum _access)
{
BGFX_CHECK_MAIN_THREAD();
BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS);
s_ctx->setBuffer(_stage, _handle, _access);
}
void setBuffer(uint8_t _stage, DynamicVertexBufferHandle _handle, Access::Enum _access)
{
BGFX_CHECK_MAIN_THREAD();
BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS);
s_ctx->setBuffer(_stage, _handle, _access);
}

View file

@ -1410,7 +1410,6 @@ namespace bgfx
void setProgram(ProgramHandle _handle)
{
BX_CHECK(isValid(_handle), "Can't set program with invalid handle.");
m_key.m_program = _handle.idx;
}