Skip to content

fix: respect IMGUI_DISABLE_SSE in ImInvSqrt - #729

Open
MilosLord wants to merge 1 commit into
epezent:masterfrom
MilosLord:respect-imgui-disable-sse
Open

MilosLord wants to merge 1 commit into
epezent:masterfrom
MilosLord:respect-imgui-disable-sse

Conversation

@MilosLord

Copy link
Copy Markdown

ImInvSqrt currently uses _mm_rsqrt_ss even when IMGUI_DISABLE_SSE is defined. Its approximate result can differ between Intel and AMD CPUs, causing small differences that break pixel-exact render tests.

This change respects the flag by using the existing 1.0f / sqrtf(x) fallback, matching ImGui. Default behavior is unchanged.

clang++ -std=c++17 -O2 -march=x86-64-v3 [-DIMGUI_DISABLE_SSE] -c implot_items.cpp
llvm-objdump -d implot_items.o | grep -c rsqrtss

master, default:                      524
master, -DIMGUI_DISABLE_SSE:          524
this branch, default:                 524
this branch, -DIMGUI_DISABLE_SSE:     0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant