crosire / d3d8to9

A D3D8 pseudo-driver which converts API calls and bytecode shaders to equivalent D3D9 ones.
BSD 2-Clause "Simplified" License
875 stars 77 forks source link

[Sonic Adventure DX] Frame-pacing/performance issues with v1.11.0 #115

Closed ViperAcidZX closed 1 year ago

ViperAcidZX commented 3 years ago

I noticed that this particular version of d3d8to9 seems to have some sort of frame-pacing issue and frame-rate dips with Sonic Adventure DX (modded through SADX Mod Installer) while an older version of d3d8to9 (in this case, v1.10.1 that was included in BetterSADX) doesn't have this issue. I doubt it has something to do with my PC since it's more than capable of running the game with or without mods that relies on DirectX 9 to function.

PiKeyAr commented 2 years ago

v1.11.1 just released, is this still an issue?

SinbadTheTailor commented 2 years ago

v1.11.1 just released, is this still an issue?

I recently tested it, and it still seems to be an issue for me, using the SADX Mod Installer with the Latern Mod and d3d8to9 enabled.

Bigmac9922 commented 1 year ago

v1.11.1 and v1.11.0 both have the same stutter issue however v1.10.1 seem to work much better. @crosire

crosire commented 1 year ago

The only real difference between those that could apply is that if D3DSWAPEFFECT_COPY_VSYNC is used, v1.11 leaves the presentation interval at D3DPRESENT_INTERVAL_DEFAULT when the game set is as such, whereas v1.10 always forced it to D3DPRESENT_INTERVAL_ONE. These two are almost identical, except that as per https://learn.microsoft.com/en-us/windows/win32/direct3d9/d3dpresent:

D3DPRESENT_INTERVAL_IMMEDIATE regardless of the refresh rate or swap effect. D3DPRESENT_INTERVAL_DEFAULT uses the default system timer resolution whereas the D3DPRESENT_INTERVAL_ONE calls timeBeginPeriod to enhance system timer resolution. This improves the quality of vertical sync, but consumes slightly more processing time.

I imagine that is why you are seeing performance differences. However, d3d8to9 attempts to do a 1 to 1 translation of what the game is doing. And the game appears to have set D3DPRESENT_INTERVAL_DEFAULT, so d3d8to9 preserves that now. Forcing the present interval to D3DPRESENT_INTERVAL_ONE instead is out of scope of this project (it is probably possible to achieve by forcing V-Sync in the driver control panel though).

PiKeyAr commented 1 year ago

Thank you for the explanation. I appreciate you taking the time to look into this. We have made changes to the SADX Mod Loader to force the game to use D3DPRESENT_INTERVAL_ONE when VSync is enabled in game settings. If this was the issue, it should be now resolved.

@Bigmac9922 @ViperAcidZX @SinbadTheTailor could you test with the latest version of SADX Mod Manager? After the Mod Manager update, press the "Update D3D8to9" button in the Graphics tab and check "Enable V-sync".

ViperAcidZX commented 1 year ago

Thank you for the explanation. I appreciate you taking the time to look into this. We have made changes to the SADX Mod Loader to force the game to use D3DPRESENT_INTERVAL_ONE when VSync is enabled in game settings. If this was the issue, it should be now resolved.

@Bigmac9922 @ViperAcidZX @SinbadTheTailor could you test with the latest version of SADX Mod Manager? After the Mod Manager update, press the "Update D3D8to9" button in the Graphics tab and check "Enable V-sync".

I just tested the new version of D3D8to9 from the updated SADX Mod Manager and it seems like the issue has been finally fixed for me so far. I just ran through Emerald Coast and no hitching or frame-pacing issues happened during my session.