MCPcopy Create free account
hub / github.com/Raais/ImStudio / DebugCheckVersionAndDataLayout

Method DebugCheckVersionAndDataLayout

src/third-party/imgui/imgui.cpp:7910–7921  ·  view source on GitHub ↗

Helper function to verify ABI compatibility between caller code and compiled version of Dear ImGui. Verify that the type sizes are matching between the calling file's compilation unit and imgui.cpp's compilation unit If the user has inconsistent compilation settings, imgui configuration #define, packing pragma, etc. your user code may see different structures than what imgui.cpp sees, which is pro

Source from the content-addressed store, hash-verified

7908// may see different structures than what imgui.cpp sees, which is problematic.
7909// We usually require settings to be in imconfig.h to make sure that they are accessible to all compilation units involved with Dear ImGui.
7910bool ImGui::DebugCheckVersionAndDataLayout(const char* version, size_t sz_io, size_t sz_style, size_t sz_vec2, size_t sz_vec4, size_t sz_vert, size_t sz_idx)
7911{
7912 bool error = false;
7913 if (strcmp(version, IMGUI_VERSION) != 0) { error = true; IM_ASSERT(strcmp(version, IMGUI_VERSION) == 0 && "Mismatched version string!"); }
7914 if (sz_io != sizeof(ImGuiIO)) { error = true; IM_ASSERT(sz_io == sizeof(ImGuiIO) && "Mismatched struct layout!"); }
7915 if (sz_style != sizeof(ImGuiStyle)) { error = true; IM_ASSERT(sz_style == sizeof(ImGuiStyle) && "Mismatched struct layout!"); }
7916 if (sz_vec2 != sizeof(ImVec2)) { error = true; IM_ASSERT(sz_vec2 == sizeof(ImVec2) && "Mismatched struct layout!"); }
7917 if (sz_vec4 != sizeof(ImVec4)) { error = true; IM_ASSERT(sz_vec4 == sizeof(ImVec4) && "Mismatched struct layout!"); }
7918 if (sz_vert != sizeof(ImDrawVert)) { error = true; IM_ASSERT(sz_vert == sizeof(ImDrawVert) && "Mismatched struct layout!"); }
7919 if (sz_idx != sizeof(ImDrawIdx)) { error = true; IM_ASSERT(sz_idx == sizeof(ImDrawIdx) && "Mismatched struct layout!"); }
7920 return !error;
7921}
7922
7923static void ImGui::ErrorCheckNewFrameSanityChecks()
7924{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected