mirror of
https://github.com/ocornut/imgui.git
synced 2026-02-14 07:43:30 +00:00
Textures: fixed a building issue when ImTextureID is defined as a struct.
+ Added CI for this case.
This commit is contained in:
20
imgui.cpp
20
imgui.cpp
@@ -16121,14 +16121,20 @@ void ImGui::UpdateDebugToolFlashStyleColor()
|
||||
DebugFlashStyleColorStop();
|
||||
}
|
||||
|
||||
ImU64 ImGui::DebugTextureIDToU64(ImTextureID tex_id)
|
||||
{
|
||||
ImU64 v = 0;
|
||||
memcpy(&v, &tex_id, ImMin(sizeof(ImU64), sizeof(tex_id)));
|
||||
return v;
|
||||
}
|
||||
|
||||
static const char* FormatTextureIDForDebugDisplay(char* buf, int buf_size, ImTextureID tex_id)
|
||||
{
|
||||
union { void* ptr; int integer; } tex_id_opaque;
|
||||
memcpy(&tex_id_opaque, &tex_id, ImMin(sizeof(void*), sizeof(tex_id)));
|
||||
ImU64 v = ImGui::DebugTextureIDToU64(tex_id);
|
||||
if (sizeof(tex_id) >= sizeof(void*))
|
||||
ImFormatString(buf, buf_size, "0x%p", tex_id_opaque.ptr);
|
||||
ImFormatString(buf, buf_size, "0x%p", v);
|
||||
else
|
||||
ImFormatString(buf, buf_size, "0x%04X", tex_id_opaque.integer);
|
||||
ImFormatString(buf, buf_size, "0x%04X", v);
|
||||
return buf;
|
||||
}
|
||||
|
||||
@@ -16137,7 +16143,7 @@ static const char* FormatTextureRefForDebugDisplay(char* buf, int buf_size, ImTe
|
||||
char* buf_end = buf + buf_size;
|
||||
if (tex_ref._TexData != NULL)
|
||||
buf += ImFormatString(buf, buf_end - buf, "#%03d: ", tex_ref._TexData->UniqueID);
|
||||
return FormatTextureIDForDebugDisplay(buf, (int)(buf_end - buf), tex_ref.GetTexID()); // Calling TexRef::GetTexID() to avoid assert of cmd->GetTexID()
|
||||
return FormatTextureIDForDebugDisplay(buf, (int)(buf_end - buf), tex_ref.GetTexID());
|
||||
}
|
||||
|
||||
#ifdef IMGUI_ENABLE_FREETYPE
|
||||
@@ -16323,9 +16329,9 @@ void ImGui::DebugNodeTexture(ImTextureData* tex, int int_id, const ImFontAtlasRe
|
||||
}
|
||||
PopStyleVar();
|
||||
|
||||
char texid_desc[30];
|
||||
char texref_desc[30];
|
||||
Text("Status = %s (%d), Format = %s (%d), UseColors = %d", ImTextureDataGetStatusName(tex->Status), tex->Status, ImTextureDataGetFormatName(tex->Format), tex->Format, tex->UseColors);
|
||||
Text("TexID = %s, BackendUserData = %p", FormatTextureRefForDebugDisplay(texid_desc, IM_ARRAYSIZE(texid_desc), tex->GetTexRef()), tex->BackendUserData);
|
||||
Text("TexRef = %s, BackendUserData = %p", FormatTextureRefForDebugDisplay(texref_desc, IM_ARRAYSIZE(texref_desc), tex->GetTexRef()), tex->BackendUserData);
|
||||
TreePop();
|
||||
}
|
||||
PopID();
|
||||
|
||||
Reference in New Issue
Block a user