Closed elishacloud closed 4 years ago
Awesome work!
This makes GTA III and Vice City not use vsync when running in windowed mode (forced by another mod), even though games should request vsync. Is this intended?
EDIT:
I should have checked the code before asking:
// Windowed mode should always present immediately
That doesn't match my experience though, PRESENT_ONE
always worked fine in windowed. Where is this change coming from?
EDIT2: OK I see that it's just DX8's behaviour... That is not optimal to be fair, but I can understand the reasoning. It makes using windowed mode in GTA quite annoying though.
@CookiePLMonster, this may be the behavior of Windows when using Direct3D9. Native Direct3D8 it uses "Composed: Copy with GPU GDI", but with d3d8to9 it uses "Hardware Composed: Independent Flip". These modes handle vsync (and GDI) differently. I found out if you call Direct3D9SetSwapEffectUpgradeShim(0)
it will switch the Direct3D9 mode back.
See this thread for more details.
I found out if you call
Direct3D9SetSwapEffectUpgradeShim(0)
it will switch the Direct3D9 mode back.
Would that be worth doing for d3d8to9 then, or is forced-no-vsync the behaviour you desire in this scenario?
I found out if you call
Direct3D9SetSwapEffectUpgradeShim(0)
it will switch the Direct3D9 mode back.Would that be worth doing for d3d8to9 then, or is forced-no-vsync the behaviour you desire in this scenario?
See comments here to answer that question.
This pull request fixes #49 This pull request fixes #63 This pull request fixes #86 This pull request fixes #103 This pull also fixes AquaNox, which never worked before with d3d8to9.
There are three main updates in this pull:
This will properly set the vsync based on whether the game is usin windowed or fullscreen. This also removes the code that forced
D3DMULTISAMPLE_NONE
, as this broke some AA functions.AquaNox uses almost 100 VirtexShaders. Several of them would set only on the x and y components of the pPos register, which is not allowed in DirectX9. See sample below.
Before fix (see error):
After fix:
D3DRS_LINEPATTERN
,D3DRS_EDGEANTIALIAS
andD3DRS_PATCHSEGMENTS
These states were removed in DirectX9. For
D3DRS_LINEPATTERN
andD3DRS_PATCHSEGMENTS
this changes from returningD3DERR_INVALIDCALL
to returningD3D_OK
. It also changesD3DRS_EDGEANTIALIAS
to useD3DRS_ANTIALIASEDLINEENABLE
instead.These changes are required for AquaNox because AquaNox would monitor the return call and fail out if anything other than
D3D_OK
is returned.