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

perf: disable vsync by default #4414

Merged
merged 2 commits into from
Mar 31, 2024

Conversation

scarf005
Copy link
Member

@scarf005 scarf005 commented Mar 31, 2024

Purpose of change

image

(the section with red arrow indicates time taken to render spinner UI)

for more than 7 years SDL was initalized with SDL_RENDERER_PRESENTVSYNC. With vsync, the game must synchronize with monitor's refresh rate (60hz ~= 16.7ms), causing slowdown. Disabling VSync may improve performance.

Describe the solution

image

added disabled-by-default option Use Vsync (VSYNC) to control vsync behavior on GPU rendering.

Describe alternatives you've considered

keep using vsync

Testing

image

with vsync without vsync
image image

image

with vsync without vsync
03-31_03 03-31_02
2024-03-31_20-23-14.mp4

Additional context

GPUs hate him! make your fps higher using this one weird trick

@scarf005 scarf005 requested a review from olanti-p March 31, 2024 11:39
@github-actions github-actions bot added the src PR changes related to source code. label Mar 31, 2024
@scarf005 scarf005 changed the title perf: disable vsync by default perf: disable vsync by default (30% FPS improvement) Mar 31, 2024
src/options.cpp Outdated Show resolved Hide resolved
@scarf005 scarf005 requested a review from olanti-p March 31, 2024 11:46
@scarf005 scarf005 changed the title perf: disable vsync by default (30% FPS improvement) perf: disable vsync by default (90% faster) Mar 31, 2024
@scarf005 scarf005 changed the title perf: disable vsync by default (90% faster) perf: disable vsync by default (1.9x faster) Mar 31, 2024
@scarf005 scarf005 changed the title perf: disable vsync by default (1.9x faster) perf: disable vsync by default (50% faster) Mar 31, 2024
@scarf005 scarf005 changed the title perf: disable vsync by default (50% faster) perf: disable vsync by default Mar 31, 2024
@scarf005 scarf005 merged commit 404ca35 into cataclysmbnteam:main Mar 31, 2024
13 checks passed
@scarf005 scarf005 deleted the perf-toggleable-vsync branch March 31, 2024 15:50
Lamandus added a commit to Lamandus/Cataclysm-BN that referenced this pull request Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
src PR changes related to source code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants