From 612eb2f7ede382171f0e8dca9ba4fa77664c3ae9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Sat, 23 Aug 2014 10:37:25 -0700 Subject: [PATCH] Fixed uniform leak at shutdown. --- examples/common/nanovg/nanovg_bgfx.cpp | 5 +++++ src/bgfx_p.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/examples/common/nanovg/nanovg_bgfx.cpp b/examples/common/nanovg/nanovg_bgfx.cpp index e90d121f..34524dfa 100644 --- a/examples/common/nanovg/nanovg_bgfx.cpp +++ b/examples/common/nanovg/nanovg_bgfx.cpp @@ -963,6 +963,11 @@ namespace bgfx::destroyUniform(gl->u_params); bgfx::destroyUniform(gl->s_tex); + if (bgfx::isValid(gl->u_halfTexel) ) + { + bgfx::destroyUniform(gl->u_halfTexel); + } + for (uint32_t ii = 0, num = gl->ntextures; ii < num; ++ii) { if (bgfx::isValid(gl->textures[ii].id) ) diff --git a/src/bgfx_p.h b/src/bgfx_p.h index 8bcd3e5b..2fd00fe5 100644 --- a/src/bgfx_p.h +++ b/src/bgfx_p.h @@ -2520,6 +2520,8 @@ namespace bgfx BX_WARN(isValid(handle), "Failed to allocate uniform handle."); if (isValid(handle) ) { + BX_TRACE("Creating uniform (handle %3d) %s", handle.idx, _name); + UniformRef& uniform = m_uniformRef[handle.idx]; uniform.m_refCount = 1; uniform.m_type = _type;