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

FPS counter #765

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

FPS counter #765

wants to merge 1 commit into from

Conversation

katajakasa
Copy link
Member

@katajakasa katajakasa commented Nov 8, 2024

DO NOT MERGE! This uses GetPerformanceCounter, which is not very portable. We should wait for SDL3 and SDL_GetTicksNS() for this.

So, for dev testing only for now!

@Vagabond
Copy link
Member

This seems silly to need SDL3 for, we could just use a platform dependent high resolution timing source, or use a library like https://github.com/nclack/tictoc

@katajakasa
Copy link
Member Author

This seems silly to need SDL3 for, we could just use a platform dependent high resolution timing source, or use a library like https://github.com/nclack/tictoc

We don't need SDL3 for this, but this is not important enough to pull in yet another dependency, therefore we should merge this when we need to swap to SDL3.

@Nopey
Copy link
Contributor

Nopey commented Nov 26, 2024

SDL3's SDL_GetTicksNS uses SDL_GetPerformanceCounter, and some values calculated from SDL_GetPerformanceFrequency.

https://github.com/libsdl-org/SDL/blob/5c8bed378040007d0e2e9267ff4bc76c016cee8f/src/timer/SDL_timer.c#L624

What about GetPerformanceCounter is not portable?
We could avoid the (double) arithmetic if we're careful with our Uint64's

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.

3 participants