Repository navigation
fix: stop frame timing and unit IDs losing precision in long sessions - #23
Merged
Merged
Conversation
(cherry picked from commit 753c5ac) Ported from upstream PR 188 (bolrog/d2dx).
Started after ~4 minutes due to float precision limits, would be visible after ~18-36 hours when it would be off by 4-8ms. (cherry picked from commit d314ddd) Ported from upstream PR 188 (bolrog/d2dx). Shim update: tests/linux/shim/UtilsStub.cpp now stubs TimeEnd/TimeToMs. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
RenderContext::_prevTime had no initial value, so the first Present() computed the frame time against garbage. Text and weather motion prediction read that frame time. The bug predates the port above (it was an uninitialised double before); start from 0, which makes the first frame time the time since the RenderContext was created. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Port of upstream PR 188 (bolrog/d2dx, by Jarcho), tracker item 1. It addresses the FPS slowdown after long play sessions reported in upstream issues 166, 146 and 141. That is the upstream author's claim; it hasn't been verified in the game here.
TimeEnd+TimeToMs) instead of a float that loses precision as the session gets longer (RenderContext,Utils).UnitMotionPredictor), which could confuse units once IDs pass 65535.tests/linux/shim/UtilsStub.cppfollows the new timing functions.RenderContext::_prevTimeis now initialised to 0, so the first frame's time isn't computed from garbage. That bug predates the port.The upstream commits are cherry-picked with
-xand keep Jarcho as author; the source changes are identical to the upstream PR. Please merge with a merge commit or rebase, not squash, so the authorship stays on the commits (squash would make the PR opener the author).Checked: no other callers of the removed
TimeEndMs; the widenedUnitIdAndTypeis only accessed field by field (no SIMD or memory reinterpretation). Linux tests: 24 passed. Windows CI is the real build check.🤖 Generated with Claude Code