Textures: ImTextureData pixels are not immediately destroyed on setting ImTextureStatus_WantDestroy.
This commit is contained in:
+3
-2
@@ -2780,9 +2780,9 @@ void ImFontAtlasUpdateNewFrame(ImFontAtlas* atlas, int frame_count)
|
|||||||
else if (tex->WantDestroyNextFrame && tex->Status != ImTextureStatus_WantDestroy)
|
else if (tex->WantDestroyNextFrame && tex->Status != ImTextureStatus_WantDestroy)
|
||||||
{
|
{
|
||||||
// Request destroy. Keep bool as it allows us to keep track of things.
|
// Request destroy. Keep bool as it allows us to keep track of things.
|
||||||
|
// We don't destroy pixels right away, as backend may have an in-flight copy from RAM.
|
||||||
IM_ASSERT(tex->Status == ImTextureStatus_OK || tex->Status == ImTextureStatus_WantCreate || tex->Status == ImTextureStatus_WantUpdates);
|
IM_ASSERT(tex->Status == ImTextureStatus_OK || tex->Status == ImTextureStatus_WantCreate || tex->Status == ImTextureStatus_WantUpdates);
|
||||||
tex->Status = ImTextureStatus_WantDestroy;
|
tex->Status = ImTextureStatus_WantDestroy;
|
||||||
tex->DestroyPixels();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The backend may need defer destroying by a few frames, to handle texture used by previous in-flight rendering.
|
// The backend may need defer destroying by a few frames, to handle texture used by previous in-flight rendering.
|
||||||
@@ -2794,9 +2794,10 @@ void ImFontAtlasUpdateNewFrame(ImFontAtlas* atlas, int frame_count)
|
|||||||
if (tex->Status == ImTextureStatus_WantDestroy && tex->TexID == ImTextureID_Invalid && tex->BackendUserData == NULL)
|
if (tex->Status == ImTextureStatus_WantDestroy && tex->TexID == ImTextureID_Invalid && tex->BackendUserData == NULL)
|
||||||
remove_from_list = true;
|
remove_from_list = true;
|
||||||
|
|
||||||
// Remove
|
// Destroy and remove
|
||||||
if (remove_from_list)
|
if (remove_from_list)
|
||||||
{
|
{
|
||||||
|
tex->DestroyPixels();
|
||||||
IM_DELETE(tex);
|
IM_DELETE(tex);
|
||||||
atlas->TexList.erase(atlas->TexList.begin() + tex_n);
|
atlas->TexList.erase(atlas->TexList.begin() + tex_n);
|
||||||
tex_n--;
|
tex_n--;
|
||||||
|
|||||||
Reference in New Issue
Block a user