Added occlusion query handle debug code.

This commit is contained in:
Branimir Karadžić 2015-11-02 16:38:55 -08:00
parent 202bfbd174
commit dc71df5ecc
3 changed files with 26 additions and 3 deletions

View File

@ -1328,6 +1328,11 @@ namespace bgfx
{ {
BX_CHECK(0 == m_instBufferCount, "Instance buffer allocated, but not used. This is incorrect, and causes memory leak."); BX_CHECK(0 == m_instBufferCount, "Instance buffer allocated, but not used. This is incorrect, and causes memory leak.");
if (BX_ENABLED(BGFX_CONFIG_DEBUG_OCCLUSION) )
{
m_occlusionQuerySet.clear();
}
// wait for render thread to finish // wait for render thread to finish
renderSemWait(); renderSemWait();
frameNoRenderWait(); frameNoRenderWait();

View File

@ -3605,6 +3605,17 @@ namespace bgfx
{ {
m_uniformSet.clear(); m_uniformSet.clear();
} }
if (BX_ENABLED(BGFX_CONFIG_DEBUG_OCCLUSION)
&& isValid(_occlusionQuery) )
{
BX_CHECK(m_occlusionQuerySet.end() == m_occlusionQuerySet.find(_occlusionQuery.idx)
, "OcclusionQuery %d was already used for this frame."
, _occlusionQuery.idx
);
m_occlusionQuerySet.insert(_occlusionQuery.idx);
}
return m_submit->submit(_id, _program, _occlusionQuery, _depth); return m_submit->submit(_id, _program, _occlusionQuery, _depth);
} }
@ -3873,10 +3884,12 @@ namespace bgfx
bool m_window; bool m_window;
}; };
typedef stl::unordered_set<uint16_t> HandleSet;
HandleSet m_uniformSet;
HandleSet m_occlusionQuerySet;
typedef stl::unordered_map<stl::string, UniformHandle> UniformHashMap; typedef stl::unordered_map<stl::string, UniformHandle> UniformHashMap;
UniformHashMap m_uniformHashMap; UniformHashMap m_uniformHashMap;
typedef stl::unordered_set<uint16_t> UniformSet;
UniformSet m_uniformSet;
UniformRef m_uniformRef[BGFX_CONFIG_MAX_UNIFORMS]; UniformRef m_uniformRef[BGFX_CONFIG_MAX_UNIFORMS];
ShaderRef m_shaderRef[BGFX_CONFIG_MAX_SHADERS]; ShaderRef m_shaderRef[BGFX_CONFIG_MAX_SHADERS];

View File

@ -164,11 +164,16 @@
# define BGFX_CONFIG_DEBUG_MTL BGFX_CONFIG_DEBUG # define BGFX_CONFIG_DEBUG_MTL BGFX_CONFIG_DEBUG
#endif // BGFX_CONFIG_DEBUG_MTL #endif // BGFX_CONFIG_DEBUG_MTL
/// /// Enable uniform debug checks.
#ifndef BGFX_CONFIG_DEBUG_UNIFORM #ifndef BGFX_CONFIG_DEBUG_UNIFORM
# define BGFX_CONFIG_DEBUG_UNIFORM BGFX_CONFIG_DEBUG # define BGFX_CONFIG_DEBUG_UNIFORM BGFX_CONFIG_DEBUG
#endif // BGFX_CONFIG_DEBUG_UNIFORM #endif // BGFX_CONFIG_DEBUG_UNIFORM
/// Enable occlusion debug checks.
#ifndef BGFX_CONFIG_DEBUG_OCCLUSION
# define BGFX_CONFIG_DEBUG_OCCLUSION BGFX_CONFIG_DEBUG
#endif // BGFX_CONFIG_DEBUG_OCCLUSION
#ifndef BGFX_CONFIG_MULTITHREADED #ifndef BGFX_CONFIG_MULTITHREADED
# define BGFX_CONFIG_MULTITHREADED ( (!BGFX_CONFIG_RENDERER_NULL)&&(0 \ # define BGFX_CONFIG_MULTITHREADED ( (!BGFX_CONFIG_RENDERER_NULL)&&(0 \
|| BX_PLATFORM_ANDROID \ || BX_PLATFORM_ANDROID \