Defer occlusion query destruction to avoid usage overlap.

This commit is contained in:
Branimir Karadžić 2017-02-14 18:20:49 -08:00
Родитель 42a01f6f1a
Коммит 3a43edcf30
2 изменённых файлов: 12 добавлений и 2 удалений

Просмотреть файл

@ -1511,6 +1511,12 @@ namespace bgfx
destroyDynamicVertexBufferInternal(m_freeDynamicVertexBufferHandle[ii]);
}
m_numFreeDynamicVertexBufferHandles = 0;
for (uint16_t ii = 0, num = m_numFreeOcclusionQueryHandles; ii < num; ++ii)
{
m_occlusionQueryHandle.free(m_freeOcclusionQueryHandle[ii].idx);
}
m_numFreeOcclusionQueryHandles = 0;
}
void Context::freeAllHandles(Frame* _frame)

Просмотреть файл

@ -2194,6 +2194,7 @@ namespace bgfx
, m_submit(&m_frame[BGFX_CONFIG_MULTITHREADED ? 1 : 0])
, m_numFreeDynamicIndexBufferHandles(0)
, m_numFreeDynamicVertexBufferHandles(0)
, m_numFreeOcclusionQueryHandles(0)
, m_colorPaletteDirty(0)
, m_instBufferCount(0)
, m_frames(0)
@ -3620,7 +3621,8 @@ namespace bgfx
BGFX_API_FUNC(void destroyOcclusionQuery(OcclusionQueryHandle _handle) )
{
BGFX_CHECK_HANDLE("destroyOcclusionQuery", m_occlusionQueryHandle, _handle);
m_occlusionQueryHandle.free(_handle.idx);
m_freeOcclusionQueryHandle[m_numFreeOcclusionQueryHandles++] = _handle;
}
BGFX_API_FUNC(void saveScreenShot(const char* _filePath) )
@ -4120,8 +4122,10 @@ namespace bgfx
uint16_t m_numFreeDynamicIndexBufferHandles;
uint16_t m_numFreeDynamicVertexBufferHandles;
DynamicIndexBufferHandle m_freeDynamicIndexBufferHandle[BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS];
uint16_t m_numFreeOcclusionQueryHandles;
DynamicIndexBufferHandle m_freeDynamicIndexBufferHandle[BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS];
DynamicVertexBufferHandle m_freeDynamicVertexBufferHandle[BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS];
OcclusionQueryHandle m_freeOcclusionQueryHandle[BGFX_CONFIG_MAX_OCCLUSION_QUERIES];
NonLocalAllocator m_dynIndexBufferAllocator;
bx::HandleAllocT<BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS> m_dynamicIndexBufferHandle;