Skip to content

Fix desync caused by graphics drivers corrupting the SSE control register#71

Draft
11EJDE11 wants to merge 1 commit into
CnCNet:mainfrom
11EJDE11:fix-renderer-desync
Draft

Fix desync caused by graphics drivers corrupting the SSE control register#71
11EJDE11 wants to merge 1 commit into
CnCNet:mainfrom
11EJDE11:fix-renderer-desync

Conversation

@11EJDE11

Copy link
Copy Markdown
Member

Draft for now. Want to do some more testing and get feedback. If it's better for Phobos, feel free to take it.

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

@github-actions

Copy link
Copy Markdown

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.

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