Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS+vsync: Game slows down to 5fps after taking 2-10 screenshots #661

Open
Macil opened this issue Mar 14, 2023 · 5 comments
Open

MacOS+vsync: Game slows down to 5fps after taking 2-10 screenshots #661

Macil opened this issue Mar 14, 2023 · 5 comments

Comments

@Macil
Copy link
Contributor

Macil commented Mar 14, 2023

If I take 2-10 screenshots, then after a random one of the screenshots the game suddenly slows down to 5 fps (at least that's what it says; feels more like 1 fps). This only happens for me with MacOS while vsync is on. The bug is dependably triggerable when I start the game with vsync on; it's not always triggerable if I've switched the setting while the game is running.

Once the issue happens, changing vsync to off does not fix it. Changing vsync to triple buffered does alleviate the issue, until I change it back to on or off.

I'm unable to reproduce this on Linux or Windows vkQuake, QS, or QSS. This is only slightly affected by the Max FPS setting (have tried with 60 and above 60 like 180): increasing the max fps slightly increases the framerate the game reports at during the slowdown (can get to 7-15 fps), though it oscillates and feels much more jank than what a consistent low framerate would be like.

While watching a scrolling sky texture during a slowdown, I think I figured out why it feels more like 1 fps: the game is consistently alternating between freezing for about a whole second and then quickly doing five frames. (Could some vsync timer be lowering its resolution to 1s somehow because of the quarter-second freeze during a screenshot, and so from then on for a whole second the game thinks it needs to wait more time before a frame, and then suddenly the timer ticks forward in one jump and a batch of frames all think it's time to go immediately until real time catches up to the vsync timer? I still need to actually look at the vsync code.)

Willing to debug this further over the next few days.

@Macil Macil added the bug label Mar 14, 2023
@Novum
Copy link
Owner

Novum commented Mar 14, 2023

I bet this is some MoltenVK issue

@Novum
Copy link
Owner

Novum commented Mar 15, 2023

I checked and this is definitely a MoltenVK bug. There is nothing in that code that could affect performance. It is very buggy in regards to vsync too (sometimes it syncs, sometimes it doesn't). Very frustrating, but nothing I can do on my side.

@Novum Novum closed this as completed Mar 15, 2023
@Novum Novum reopened this Mar 15, 2023
@Novum
Copy link
Owner

Novum commented Mar 15, 2023

Guess I can keep this open for now.

@temx
Copy link
Collaborator

temx commented Mar 15, 2023

Maybe grabbing from somewhere else than the swapchain might help? That'd also allow hidding some HUD elements or notify strings in screenshots.

@alexey-lysiuk
Copy link
Contributor

Setting MVK_CONFIG_SYNCHRONOUS_QUEUE_SUBMITS environment variable to 0 fixes the problem for me, i.e. launching with MVK_CONFIG_SYNCHRONOUS_QUEUE_SUBMITS=0 ./vkquake command line
I was checking this on old Mac with Intel UHD Graphics 630.

@Novum Novum removed their assignment Apr 30, 2023
@Novum Novum added MoltenVK bug and removed bug labels Apr 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants