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

Allow software renderer to simulate vsync #6407

Closed
wants to merge 1 commit into from

Conversation

weirddan455
Copy link
Contributor

@weirddan455 weirddan455 commented Oct 18, 2022

Vsync was enabled in the software renderer but it only gave a hint to apply to a potential hardware accelerated framebuffer.

This adds a check to see if we are on a full software path (or otherwise didn't get vsync) and simulate it if the application requests vsync.

Let me know if that WindowTextureData declaration needs to go somewhere else. Wasn't really sure what header to put it in.

Some history I dug up if you're interested. Issue and commit for enabling vsync in software (last year):
#4612
fcfd19d

Issue and commit for the simulated vsync (just last month):
#5134
d744aaf

Vsync was enabled in the software renderer but it only gave a hint to
apply to a potential hardware accelerated framebuffer.

This adds a check to see if we are on a full software path (or otherwise
didn't get vsync) and simulate it if the application requests vsync.
@weirddan455
Copy link
Contributor Author

Btw I tested behavior by setting the SDL_HINT_FRAMEBUFFER_ACCELERATION hint. Before if that hint was set to 0, and SDL_RENDERER_SOFTWARE | SDL_RENDERER_PRESENTVSYNC was requested in SDL_CreateRenderer, it would get 500+ FPS. Now, it's mostly equal to my refresh rate.

If hint is set to 1, it uses real vsync from the hardware (same behavior).

@slouken
Copy link
Collaborator

slouken commented Mar 10, 2024

@weirddan455, I'd like to get this into the SDL 3.0 release, can you update your PR?

@slouken
Copy link
Collaborator

slouken commented Aug 6, 2024

We have simulated vsync in for SDL 3.0, thanks!

@slouken slouken closed this Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants