|
@@ -19,6 +19,14 @@ namespace bgfx
|
|
|
# define BGFX_CHECK_RENDER_THREAD()
|
|
# define BGFX_CHECK_RENDER_THREAD()
|
|
|
#endif // BGFX_CONFIG_MULTITHREADED && !BX_PLATFORM_OSX && !BX_PLATFORM_IOS
|
|
#endif // BGFX_CONFIG_MULTITHREADED && !BX_PLATFORM_OSX && !BX_PLATFORM_IOS
|
|
|
|
|
|
|
|
|
|
+#define BGFX_CHECK_HANDLE(_handle, _max) \
|
|
|
|
|
+ BX_CHECK(isValid(_handle) \
|
|
|
|
|
+ && _handle.idx < _max \
|
|
|
|
|
+ , "Invalid handle. %d (< %d " #_max ")" \
|
|
|
|
|
+ , _handle.idx \
|
|
|
|
|
+ , _max \
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
#if BX_PLATFORM_ANDROID
|
|
#if BX_PLATFORM_ANDROID
|
|
|
::ANativeWindow* g_bgfxAndroidWindow = NULL;
|
|
::ANativeWindow* g_bgfxAndroidWindow = NULL;
|
|
|
|
|
|
|
@@ -2749,18 +2757,21 @@ again:
|
|
|
void setUniform(UniformHandle _handle, const void* _value, uint16_t _num)
|
|
void setUniform(UniformHandle _handle, const void* _value, uint16_t _num)
|
|
|
{
|
|
{
|
|
|
BGFX_CHECK_MAIN_THREAD();
|
|
BGFX_CHECK_MAIN_THREAD();
|
|
|
|
|
+ BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_UNIFORMS);
|
|
|
s_ctx->setUniform(_handle, _value, _num);
|
|
s_ctx->setUniform(_handle, _value, _num);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void setIndexBuffer(IndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices)
|
|
void setIndexBuffer(IndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices)
|
|
|
{
|
|
{
|
|
|
BGFX_CHECK_MAIN_THREAD();
|
|
BGFX_CHECK_MAIN_THREAD();
|
|
|
|
|
+ BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_INDEX_BUFFERS);
|
|
|
s_ctx->setIndexBuffer(_handle, _firstIndex, _numIndices);
|
|
s_ctx->setIndexBuffer(_handle, _firstIndex, _numIndices);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void setIndexBuffer(DynamicIndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices)
|
|
void setIndexBuffer(DynamicIndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices)
|
|
|
{
|
|
{
|
|
|
BGFX_CHECK_MAIN_THREAD();
|
|
BGFX_CHECK_MAIN_THREAD();
|
|
|
|
|
+ BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS);
|
|
|
s_ctx->setIndexBuffer(_handle, _firstIndex, _numIndices);
|
|
s_ctx->setIndexBuffer(_handle, _firstIndex, _numIndices);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -2785,12 +2796,14 @@ again:
|
|
|
void setVertexBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices)
|
|
void setVertexBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices)
|
|
|
{
|
|
{
|
|
|
BGFX_CHECK_MAIN_THREAD();
|
|
BGFX_CHECK_MAIN_THREAD();
|
|
|
|
|
+ BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_VERTEX_BUFFERS);
|
|
|
s_ctx->setVertexBuffer(_handle, _startVertex, _numVertices);
|
|
s_ctx->setVertexBuffer(_handle, _startVertex, _numVertices);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void setVertexBuffer(DynamicVertexBufferHandle _handle, uint32_t _numVertices)
|
|
void setVertexBuffer(DynamicVertexBufferHandle _handle, uint32_t _numVertices)
|
|
|
{
|
|
{
|
|
|
BGFX_CHECK_MAIN_THREAD();
|
|
BGFX_CHECK_MAIN_THREAD();
|
|
|
|
|
+ BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS);
|
|
|
s_ctx->setVertexBuffer(_handle, _numVertices);
|
|
s_ctx->setVertexBuffer(_handle, _numVertices);
|
|
|
}
|
|
}
|
|
|
|
|
|