1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-16 00:54:19 +00:00

Fonts: avoid both ImTextureRef fields being set simultaneously.

This commit is contained in:
ocornut 2025-03-19 15:00:13 +01:00
parent 0fff7ceda4
commit a548cd9934
2 changed files with 5 additions and 6 deletions

View file

@ -2615,7 +2615,6 @@ ImFontAtlas::ImFontAtlas()
TexMaxWidth = 8192;
TexMaxHeight = 8192;
RendererHasTextures = false; // Assumed false by default, as apps can call e.g Atlas::Build() after backend init and before ImGui can update.
TexRef._TexData = NULL;// this;
TexNextUniqueID = 1;
FontNextUniqueID = 1;
Builder = NULL;
@ -3882,9 +3881,8 @@ static void ImFontAtlasBuildSetTexture(ImFontAtlas* atlas, ImTextureData* tex)
atlas->TexData = tex;
atlas->TexUvScale = ImVec2(1.0f / tex->Width, 1.0f / tex->Height);
atlas->TexRef._TexData = tex;
//atlas->TexID._TexID = tex->TexID; // <-- We intentionally don't do that and leave it 0, to allow late upload.
ImTextureRef new_tex_ref = atlas->TexRef;
ImFontAtlasUpdateDrawListsTextures(atlas, old_tex_ref, new_tex_ref);
//atlas->TexRef._TexID = tex->TexID; // <-- We intentionally don't do that. It would be misleading and betray promise that both fields aren't set.
ImFontAtlasUpdateDrawListsTextures(atlas, old_tex_ref, atlas->TexRef);
}
// Create a new texture, discard previous one