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

[Patch] Vertical retrace sync for OpenGL on Mac OS X (Quartz) #68

Closed
SDLBugzilla opened this issue Feb 10, 2021 · 0 comments
Closed

[Patch] Vertical retrace sync for OpenGL on Mac OS X (Quartz) #68

SDLBugzilla opened this issue Feb 10, 2021 · 0 comments
Labels
enhancement

Comments

@SDLBugzilla
Copy link
Collaborator

@SDLBugzilla SDLBugzilla commented Feb 10, 2021

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: HG 1.2
Reported for operating system, platform: Mac OS X (All), PowerPC

Comments on the original bug report:

On 2006-01-30 13:48:46 +0000, Christian Walther wrote:

On Mac OS X (Quartz), (double-buffered) OpenGL rendering is currently not synchronized to vertical retrace - SDL_GL_SwapBuffers() swaps and returns immediately. The attached patch changes this (see http://lists.apple.com/archives/mac-opengl/2006/Jan/msg00080.html for what it does exactly).

I actually wondered whether there might be a reason this has been unimplemented for so long. I'm not sure what SDL's general policy on vertical retrace syncing for OpenGL is (the SDL_GL_SwapBuffers() documentation doesn't mention it) and I didn't check what other backends do about it, but since for non-OpenGL the policy seems to be "do it if possible" (see the SDL_Flip() documentation), I figured it might not be a bad thing to add. Does everybody agree with that, or might there be an application that depends on the previous behavior? For my own application, the effect is very beneficial - no more tearing, less fan noise, and longer battery life.

The patch has been tested on Mac OS X 10.2.8, 10.3.9, and 10.4.3, and it works both in fullscreen and in windowed mode (on 10.4 even when the window is partially obscured).

On 2006-01-30 13:49:54 +0000, Christian Walther wrote:

Created attachment 55
Quartz GL vsync patch

On 2006-01-30 13:58:28 +0000, Ryan C. Gordon wrote:

There is a parameter for SDL_GL_SetAttribute() to enable this (but the attribute itself may be sitting in another bugzilla entry...). We shouldn't enable it by default, because it hurts framerate, which can be a real problem in some situations.

--ryan.

On 2006-01-30 14:40:59 +0000, Christian Walther wrote:

Ah, you mean https://bugzilla.libsdl.org/show_bug.cgi?id=2 . I saw it before I submitted this bug, but only glanced over it since it seemed to refer to OpenGL extensions (which is not true, it refers to the GLX and WGL equivalents of what I'm doing here). I now examined that patch in more detail and came to the conclusion that it would be trivial to adapt my patch to be the Quartz implementation of the other one. So that's probably the way to go, even if it means waiting for 1.3. It's certainly the cleaner way of making it optional than conditionalizing it on an environment variable, which was my first idea.

On 2006-01-30 14:48:19 +0000, Ryan C. Gordon wrote:

While Bug # 2 is an API change, it doesn't require us to break binary compatibility, so it could be added to 1.2.10...we did this with several other API additions, not the least of which being multisampling support in SDL_GL_SetAttribute() for 1.2.9.

I'm flagging this bug as depending on Bug # 2, since that seems to be the way forward, in any case.

--ryan.

On 2006-04-27 03:59:17 +0000, Sam Lantinga wrote:

This is in SVN, thanks!

@SDLBugzilla SDLBugzilla added the enhancement label Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement
Projects
None yet
Development

No branches or pull requests

1 participant