Added check for memory leak.
This commit is contained in:
parent
2c05b90792
commit
3e4ec1dc24
@ -1062,6 +1062,8 @@ namespace bgfx
|
||||
|
||||
uint32_t Context::frame()
|
||||
{
|
||||
BX_CHECK(0 == m_instBufferCount, "Instance buffer allocated, but not used. This is incorrect, and causes memory leak.");
|
||||
|
||||
// wait for render thread to finish
|
||||
renderSemWait();
|
||||
frameNoRenderWait();
|
||||
|
@ -1081,7 +1081,7 @@ namespace bgfx
|
||||
|
||||
uint16_t setScissor(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height)
|
||||
{
|
||||
uint16_t scissor = m_rectCache.add(_x, _y, _width, _height);
|
||||
uint16_t scissor = (uint16_t)m_rectCache.add(_x, _y, _width, _height);
|
||||
m_state.m_scissor = scissor;
|
||||
return scissor;
|
||||
}
|
||||
@ -1561,6 +1561,7 @@ namespace bgfx
|
||||
, m_submit(&m_frame[1])
|
||||
, m_numFreeDynamicIndexBufferHandles(0)
|
||||
, m_numFreeDynamicVertexBufferHandles(0)
|
||||
, m_instBufferCount(0)
|
||||
, m_frames(0)
|
||||
, m_debug(BGFX_DEBUG_NONE)
|
||||
, m_rendererInitialized(false)
|
||||
@ -1967,6 +1968,8 @@ namespace bgfx
|
||||
|
||||
BGFX_API_FUNC(const InstanceDataBuffer* allocInstanceDataBuffer(uint32_t _num, uint16_t _stride) )
|
||||
{
|
||||
++m_instBufferCount;
|
||||
|
||||
uint16_t stride = BX_ALIGN_16(_stride);
|
||||
uint32_t offset = m_submit->allocTransientVertexBuffer(_num, stride);
|
||||
|
||||
@ -2522,6 +2525,8 @@ namespace bgfx
|
||||
|
||||
BGFX_API_FUNC(void setInstanceDataBuffer(const InstanceDataBuffer* _idb, uint16_t _num) )
|
||||
{
|
||||
--m_instBufferCount;
|
||||
|
||||
m_submit->setInstanceDataBuffer(_idb, _num);
|
||||
}
|
||||
|
||||
@ -2727,6 +2732,7 @@ namespace bgfx
|
||||
uint16_t m_seqMask[BGFX_CONFIG_MAX_VIEWS];
|
||||
|
||||
Resolution m_resolution;
|
||||
int32_t m_instBufferCount;
|
||||
uint32_t m_frames;
|
||||
uint32_t m_debug;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user