Fix desync caused by graphics drivers corrupting the SSE control register - #71
Open
11EJDE11 wants to merge 1 commit into
Open
Fix desync caused by graphics drivers corrupting the SSE control register#7111EJDE11 wants to merge 1 commit into
11EJDE11 wants to merge 1 commit into
Conversation
|
Nightly build for this pull request:
This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build. |
11EJDE11
marked this pull request as ready for review
July 31, 2026 01:17
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.
Some graphics drivers return from D3D9 calls with the calling thread's MXCSR modified and never restore it.
From the attached logs, the rounding mode is changed during that call:
Bad: SetVideoMode-after-SetDisplayMode MXCSR=7FA0(rc=ZERO) x87CW=0E7F(rc=ZERO,pc=53)
vs
Good: SetVideoMode-after-SetDisplayMode MXCSR=1FA0(rc=nearest) x87CW=0E7F(rc=ZERO,pc=53)
rc=ZERO means SSE math truncates instead of rounding to nearest. Phobos replaces INIClass::ReadDouble (0x5283D0) with an SSE implementation, so percentage values parse low on the affected machine:
[Sidebar]HarvesterCounter.ConditionRed=50%:0.49999997 (should be 0.5)[Road]Hover=75%:0.74999994 (should be 0.75)debug_bad.log
debug_good.log
Fixed by restoring the SSE control register (MXCSR) right after SetDisplayMode, which is where it actually gets flipped and before before INIClass::ReadDouble runs. Also restore it at the start of every logic frame in case it happens mid-game.