julianxhokaxhiu / FFNx

Next generation modding platform for Final Fantasy VII and Final Fantasy VIII ( with native Steam 2013 release support! )
GNU General Public License v3.0
359 stars 48 forks source link

[ Core ] Stuttering in window mode #729

Open DLPB2 opened 1 week ago

DLPB2 commented 1 week ago

Hi, guys - as a courtesy to the gaming community, I am sharing what I learned about DWM and the need to make sure you are properly implementing the call to dwmflush(). I haven't checked your source, so forgive me if this is already implemented - Doesn't seem many people are to their detriment.

Please see https://forum.cheatengine.org/viewtopic.php?p=5791077#5791077

julianxhokaxhiu commented 1 week ago

Thank you very much for having brought this up. Very interesting topic!

Have you got a video to showcase the before/after? So I can try to reproduce it here and see if it has an impact on our own side as well. Asking because since we use a completely different way to render, might be we have this resolved via bgfx instead of having to patch FFNx ( from the understanding of the API it seems it impacts mainly the DirectX layer ).

Thank you in advance in case. Looking forward to it.

DLPB2 commented 6 days ago

Video before and after won't be much use since that itself adds an issue. But I've definitely proven the fault exists (before would skip at least 3 times during opening credits - it's sometimes subtle. Although not to me because it drives me insane). bgfx needs to be calling dwmflush after swapbuffer.

https://devblogs.microsoft.com/directx/demystifying-full-screen-optimizations/

Here is an official statement that shows they turn it off when borderless fs window - so that would explain OpenGL not having issues in full screen.

"To get back this performance overhead, we enhanced the DWM to recognize when a game is running in a borderless full screen window with no other applications on the screen. "

julianxhokaxhiu commented 5 days ago

Thanks for sharing this info. May I ask on which GPUs did you test the fix? I'm trying to gather some info here as I think this behavior doesn't apply on bgfx as we have other type of ways to cap the framerate, but if you uncap it there's no VSYNC in place in any case. If you could share more info on the PC specs you have where you were able to repro this I'd appreciate.