diff --git a/src/bgfx_p.h b/src/bgfx_p.h index c81b7222..2460f5f4 100755 --- a/src/bgfx_p.h +++ b/src/bgfx_p.h @@ -1603,7 +1603,7 @@ namespace bgfx if (ptr == NonLocalAllocator::invalidBlock) { IndexBufferHandle indexBufferHandle = { m_indexBufferHandle.alloc() }; - BX_WARN(invalidHandle != handle.idx, "Failed to allocate dynamic index buffer handle."); + BX_WARN(invalidHandle != indexBufferHandle.idx, "Failed to allocate index buffer handle."); if (indexBufferHandle.idx == invalidHandle) { return handle; @@ -1618,6 +1618,12 @@ namespace bgfx } handle.idx = m_dynamicIndexBufferHandle.alloc(); + BX_WARN(invalidHandle != handle.idx, "Failed to allocate dynamic index buffer handle."); + if (handle.idx == invalidHandle) + { + return handle; + } + DynamicIndexBuffer& dib = m_dynamicIndexBuffers[handle.idx]; dib.m_handle.idx = uint16_t(ptr>>32); dib.m_offset = uint32_t(ptr); diff --git a/src/renderer_d3d.h b/src/renderer_d3d.h index ef0f587c..67a4e631 100644 --- a/src/renderer_d3d.h +++ b/src/renderer_d3d.h @@ -7,6 +7,7 @@ #define __RENDERER_D3D_H__ #if BGFX_CONFIG_RENDERER_DIRECT3D9 +# include # include # pragma comment(lib, "dxerr.lib") # define DX_CHECK_EXTRA_F " (%s): %s"