-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
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
Fix integer underflow when rounding up in VoxelGI #80356
Fix integer underflow when rounding up in VoxelGI #80356
Conversation
The code wanted to divide and round up: - 0 / 64 = 0 - 63 / 64 = 1 - 64 / 64 = 1 - 65 / 64 = 2 However when the dividend was exactly 0 it would underflow and produce 67108864 instead. This caused TDRs on empty scenes or extremely slow performance Fix godotengine#80286
Given that this is used in multiple places, and this error has creeped in (probably via copy paste), would this be better to fix once and use a macro or inlined math function in the different uses? 🤔 e.g. (and / or version without the multiplier as you are using here) |
Note that doesn't appear to resolve #55359. (I tested this as requested in #80286 (comment).) OS: Linux All tests done with VoxelGI quality set to High in the project settings.
|
I believe you have a transposition error in row four column one, 258 instead of 528 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Thanks! |
Cherry-picked for 4.1.2. |
The code wanted to divide and round up:
However when the dividend was exactly 0 it would underflow and produce 67108864 instead.
This caused TDRs on empty scenes or extremely slow performance
Fix #80286