mirror of
https://github.com/ocornut/imgui.git
synced 2026-04-02 13:37:40 -05:00
Textures: allowed backend to destroy texture while inside the NewFrame/EndFrame scope. (#8811)
This commit is contained in:
6
imgui.h
6
imgui.h
@@ -3491,8 +3491,10 @@ struct ImTextureData
|
||||
ImTextureID GetTexID() const { return TexID; }
|
||||
|
||||
// Called by Renderer backend
|
||||
void SetTexID(ImTextureID tex_id) { TexID = tex_id; } // Call after creating or destroying the texture. Never modify TexID directly!
|
||||
void SetStatus(ImTextureStatus status) { Status = status; } // Call after honoring a request. Never modify Status directly!
|
||||
// - Call SetTexID() and SetStatus() after honoring texture requests. Never modify TexID and Status directly!
|
||||
// - A backend may decide to destroy a texture that we did not request to destroy, which is fine (e.g. freeing resources), but we immediately set the texture back in _WantCreate mode.
|
||||
void SetTexID(ImTextureID tex_id) { TexID = tex_id; }
|
||||
void SetStatus(ImTextureStatus status) { Status = status; if (status == ImTextureStatus_Destroyed && !WantDestroyNextFrame) Status = ImTextureStatus_WantCreate; }
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user