-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clipper with many entries is triggering an assert related to ItemsHeight (Floating Point issues) #3962
Comments
I have done an easy fix for the moment by fixing the clipper
To:
|
I believe this has nothing to do with Tables, it's a problem with cursor positioning, Same as #3609. We use float for all positions., although we only need unit precision (+1/-1) for vertical axis, floats can only guarantee it up to 16777216.0f aka 986895 lines with a typical default line height of ~17 (13 font + 4 spacing), and less lines with a larger fonts.
Your number of lines (0x1eea802 = ~32 millions) is largely above that limit, and I believe things don't actually work well from ~1 millions. Going from 1 to 32 merely reduce precision down enough to cancel out the line height. I don't have a good solution/answer to that problem presently, but UX wise I don't think it is meaningful for the user to make 32 millions entries available. Although the clipper aim to make large amount scrollable, there's a point where it doesn't make sense. Consider virtualizing the display, displaying items in chunks or or exposing more filters. |
I must add that will be merely avoid the assert your encountered, but scrolling and layout are likely to be severely impacted by the loss of the precision either way. |
I think I will do that in consequence, thank you very much for your quick answer! |
… ranges (not fully tested) + clipper tweaks (#3609, #3962 + ocornut/imgui_club#20) This does NOT fix all problems with large ranges and floating point precision, it merely attenuate them.
I have pushed variety of tweaks/fixes to improve this from multiple angles. With those changes, e.g. in the Tables>Advanced demo
a76bc52 Clipper: store initial precision loss and apply delta in clipper. 027a7ba Clipper: use line size instead of cursor comparison when ranges are large. 6e141a9 Internals: made ScrollbarEx() use ImS64 to facilitate use with larger ranges (not fully tested) (+ unrelated fixed a small bug while doing this 926addb and 20e040c) |
Hello,
I am using
ImGuiListClipper
in a table with 0x1eea802 elements. In don't do any fancy things, just putting text in each column.Everything is working well except if I scroll in the middle of the table where I trigger an assert:
Because I don't have this problem with less elements, I guess it could be an integer overflow inside ImGui however I don't have a good understanding about how
table->RowPosY1
andtable->RowPosY2
are calculated.Do you have an idea how to fix it please? Thank you.
OS: macOS Big Sur
The text was updated successfully, but these errors were encountered: