mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-17 20:52:36 +01:00
ImGui: Fixed texture leak.
This commit is contained in:
@@ -242,9 +242,9 @@ struct OcornutImguiContext
|
|||||||
const uint16_t xx = uint16_t(bx::max(clipRect.x, 0.0f) );
|
const uint16_t xx = uint16_t(bx::max(clipRect.x, 0.0f) );
|
||||||
const uint16_t yy = uint16_t(bx::max(clipRect.y, 0.0f) );
|
const uint16_t yy = uint16_t(bx::max(clipRect.y, 0.0f) );
|
||||||
encoder->setScissor(xx, yy
|
encoder->setScissor(xx, yy
|
||||||
, uint16_t(bx::min(clipRect.z, 65535.0f)-xx)
|
, uint16_t(bx::min(clipRect.z, 65535.0f)-xx)
|
||||||
, uint16_t(bx::min(clipRect.w, 65535.0f)-yy)
|
, uint16_t(bx::min(clipRect.w, 65535.0f)-yy)
|
||||||
);
|
);
|
||||||
|
|
||||||
encoder->setState(state);
|
encoder->setState(state);
|
||||||
encoder->setTexture(0, s_tex, th);
|
encoder->setTexture(0, s_tex, th);
|
||||||
@@ -446,11 +446,11 @@ struct OcornutImguiContext
|
|||||||
const FontRangeMerge& frm = s_fontRangeMerge[ii];
|
const FontRangeMerge& frm = s_fontRangeMerge[ii];
|
||||||
|
|
||||||
io.Fonts->AddFontFromMemoryTTF( (void*)frm.data
|
io.Fonts->AddFontFromMemoryTTF( (void*)frm.data
|
||||||
, (int)frm.size
|
, (int)frm.size
|
||||||
, _fontSize-3.0f
|
, _fontSize-3.0f
|
||||||
, &config
|
, &config
|
||||||
, frm.ranges
|
, frm.ranges
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -459,6 +459,17 @@ struct OcornutImguiContext
|
|||||||
|
|
||||||
void destroy()
|
void destroy()
|
||||||
{
|
{
|
||||||
|
for (ImTextureData* texData : ImGui::GetPlatformIO().Textures)
|
||||||
|
{
|
||||||
|
if (1 == texData->RefCount)
|
||||||
|
{
|
||||||
|
ImGui::TextureBgfx tex = bx::bitCast<ImGui::TextureBgfx>(texData->GetTexID() );
|
||||||
|
bgfx::destroy(tex.handle);
|
||||||
|
texData->SetTexID(ImTextureID_Invalid);
|
||||||
|
texData->SetStatus(ImTextureStatus_Destroyed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::ShutdownDockContext();
|
ImGui::ShutdownDockContext();
|
||||||
ImGui::DestroyContext(m_imgui);
|
ImGui::DestroyContext(m_imgui);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user