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

SDL_PollEvent vs SDL_WaitEvent in macos is problem #6282

Closed
mumin16 opened this issue Sep 26, 2022 · 14 comments
Closed

SDL_PollEvent vs SDL_WaitEvent in macos is problem #6282

mumin16 opened this issue Sep 26, 2022 · 14 comments
Milestone

Comments

@mumin16
Copy link

mumin16 commented Sep 26, 2022

SDL_PollEvent's CPU usage is normal in linux and windows but it is %80-90 in macos .
SDL_WaitEvent's CPU usage is normal in macos but it is ugly in linux and windows. what is problem?

@mumin16 mumin16 changed the title SDL_PollEvent vs SDL_WaitEvent in macos problem SDL_PollEvent vs SDL_WaitEvent in macos is problem Sep 26, 2022
@icculus
Copy link
Collaborator

icculus commented Sep 26, 2022

SDL_PollEvent will use a lot of CPU if called in a tight loop, that is not unusual.

Usually there are other things that reduce CPU usage, like limiting framerate and such.

@icculus
Copy link
Collaborator

icculus commented Sep 27, 2022

Closing this as (probably?) not a bug.

@icculus icculus closed this as not planned Won't fix, can't repro, duplicate, stale Sep 27, 2022
@slouken
Copy link
Collaborator

slouken commented Sep 27, 2022

@mumin16, can you describe what you mean by SDL_WaitEvent CPU usage being ugly on Linux and Windows?

Also, can you post a test program that shows us what is happening?

@slouken slouken reopened this Sep 27, 2022
@slouken slouken added this to the 2.26.0 milestone Sep 27, 2022
@icculus icculus added the waiting Waiting on user response label Oct 3, 2022
@mumin16
Copy link
Author

mumin16 commented Oct 9, 2022

There is a problem. I don't know if this problem is from imgui or sdl2 or macOS ventura beta 10.
The problem is:
Screenshot 2022-10-09 at 20 38 54

@mumin16
Copy link
Author

mumin16 commented Oct 9, 2022

6500 fps and %99 cpu usage in macOS...

@mumin16
Copy link
Author

mumin16 commented Oct 9, 2022

Screenshot from 2022-10-09 20-44-38

@mumin16
Copy link
Author

mumin16 commented Oct 9, 2022

same code is 60 fps and %0.7 cpu usage in linux...

@slime73
Copy link
Contributor

slime73 commented Oct 9, 2022

Does your code use vsync? If not, your graphics driver might be forcing vsync on in Linux.

@mumin16
Copy link
Author

mumin16 commented Oct 9, 2022

Untitled

@mumin16
Copy link
Author

mumin16 commented Oct 9, 2022

same code is 60 fps and %0.1 cpu usage in windows...

@madebr
Copy link
Contributor

madebr commented Oct 9, 2022

Is this one of the imgui samples at https://github.com/ocornut/imgui/tree/master/examples you're testing?
What renderer are you using?
Have you made any modifications?

Never mind, you're using SDL2 + OpenGL3.

@icculus
Copy link
Collaborator

icculus commented Oct 10, 2022

...is it possible the macOS beta broke OpenGL vsync again?

@leonstyhre
Copy link

Yes this seems to be the exact same problem as when Monterey was released, and which I think was fixed with the 12.1 update. Regardless of whether I run my application in fullscreen or windowed mode VSync does not work. Unfortunately this bug is part of the final Ventura release so it's already affecting all my macOS users that have upgraded.

@slouken slouken removed the waiting Waiting on user response label Nov 14, 2022
@slouken
Copy link
Collaborator

slouken commented Nov 14, 2022

This is caused by vsync being broken on the latest macOS, and is a duplicate of #4918.

@slouken slouken closed this as not planned Won't fix, can't repro, duplicate, stale Nov 14, 2022
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

No branches or pull requests

6 participants