src/video/cocoa/SDL_cocoaopengl.m


Log

Author Commit Date CI Message
Sam Lantinga 7b100001 2022-11-30T15:51:17 Reverted code formatting for Apple platforms We didn't get the merge right, and rather than tease out exactly what happened, I'm just reverting for now.
Sam Lantinga b8d85c69 2022-11-30T12:51:59 Update for SDL3 coding style (#6717) I updated .clang-format and ran clang-format 14 over the src and test directories to standardize the code base. In general I let clang-format have it's way, and added markup to prevent formatting of code that would break or be completely unreadable if formatted. The script I ran for the src directory is added as build-scripts/clang-format-src.sh This fixes: #6592 #6593 #6594 (cherry picked from commit 5750bcb174300011b91d1de20edb288fcca70f8c)
Joshua Root 2df39e64 2022-11-27T11:27:19 Fix build with Xcode < 7 The _Nullable attribute is not available in older versions. (cherry picked from commit 9a64aa6f95298bf459f8b9dca583df7064956cd9)
Ryan C. Gordon 3f5593d6 2022-11-26T13:57:12 cocoa: Patched to compile on macOS SDK < 10.10. Fixes #6586. (cherry picked from commit fa5adcafd52303fde86c64094462303404259d75)
Ryan C. Gordon 7c760f7f 2022-11-16T11:32:08 cocoa: Update CVDisplayLink timing when screen changes. This handles both the window moving to a new display and changing the current display's refresh rate in System Preferences Reference Issue #4918.
Ryan C. Gordon 1fd66cc8 2022-11-16T10:15:21 Revert "cocoa: Backed out CVDisplayLink code for macOS vsync." This reverts commit 04b50f6c6bef67b744b192c78775771b51ff2141. It turns out OpenGL vsync has broken again in macOS 12, so we're reintroducing our CVDisplayLink code to deal with it, again. Reference Issue #4918.
Noel Berry 00452e47 2022-08-24T11:25:13 Adding SDL_GetWindowSizeInPixels for window size in pixels (#6112)
Ryan C. Gordon 3119d58f 2022-08-10T10:48:23 cocoa: Change the new sync_dispatch hint to async_dispatch. This is so the default is safer.
Salman Ahmed b4660e9d 2022-08-10T03:40:00 macOS: Add hint for blocking thread on OpenGL context update dispatch (#5708)
Shootfast 60d1944e 2022-07-06T20:12:30 SDL_video: Added SDL_GL_FLOATBUFFERS to allow Cocoa GL contexts to use EDR
Pierre Wendling 6c536afd 2022-06-27T15:43:17 Fix C89 declaration for macOS modules. Since Clang 14, `-Wdeclaration-after-statement` is enforced on every standard.
Alex Szpakowski f871c178 2022-05-10T17:32:24 macOS: remove dead code for supporting 10.6 at runtime.
Alex Szpakowski ec8fa577 2022-05-07T21:57:23 macOS: always use Objective-C ARC (automatic ref counting). Change Cocoa SDL_VideoData and SDL_WindowData implementations from C structs to Objective-C objects, since bridging between C and ObjC is easier that way.
Sam Lantinga 120c76c8 2022-01-03T09:40:00 Updated copyright for 2022
Learath 033c0abb 2021-03-27T14:04:00 Use dispatch_async for -[NSOpenGLContext update]. Fixes #3680
Sam Lantinga 9130f7c3 2021-01-02T10:25:38 Updated copyright for 2021
Ryan C. Gordon 309d6137 2020-04-07T14:01:25 cocoa: OpenGL setView and update must be used on main thread (thanks, Tim!). If called from background threads, use Grand Central Dispatch to use the main thread instead. On the main thread, just call them directly. Fixes Bugzilla #4932.
Ryan C. Gordon f2ff953e 2020-03-26T13:42:56 cocoa: Just update the OpenGL context directly if on the main thread.
Michael Maltese 361417c0 2020-03-25T16:40:43 cocoa: allow calling CreateWindowFrom on an NSView This lets applications embed SDL with other widgets surrounding it. Already possible on Windows and X11. Fixes Bugzilla #5060.
Emir Marincic 5b3b55a1 2020-03-20T11:52:18 [NSOpenGLContext update[ is prohibited outside the main thread
Sam Lantinga a8780c6a 2020-01-16T20:49:25 Updated copyright date for 2020
Alex Szpakowski 8fb8adfc 2019-07-13T17:04:02 macOS: Fix SDL_GL_CreateContext/MakeCurrent on non-main threads causing a Main Thread Checker warning when built with Xcode 11 / the macOS 10.15 SDK. Fixes bug #4714.
Ryan C. Gordon ed8b78d3 2019-06-14T21:18:53 cocoa: ignore compiler warnings about OpenGL being deprecated.
Ryan C. Gordon 04b50f6c 2019-06-11T16:19:01 cocoa: Backed out CVDisplayLink code for macOS vsync. This was to deal with broken vsync support in macOS 10.14, which we assumed would remain broken indefinitely, but a later 10.14 released fixed it. This is a loss of late-swap support, but there are several subtle problems in our CVDiplayLink code that are also evaporating, to be fair. Fixes Bugzilla #4575. (Backed out changeset 8760fed23001)
Alex Szpakowski 9d7b2615 2019-04-17T20:14:40 macOS: Fix compilation when using the 10.9 SDK or older.
Alex Szpakowski 00c824a8 2019-04-10T22:30:58 Fix disabling OpenGL vsync on macOS 10.14.4+ (bug #4575).
Sam Lantinga 5e13087b 2019-01-04T22:01:14 Updated copyright for 2019
Ryan C. Gordon 13869f19 2018-12-16T01:03:17 cocoa: Implement OpenGL swap interval support with CVDisplayLink. Not only does this fix macOS 10.14 ("Mojave")'s broken NSOpenGLCPSwapInterval support, it also lets us implement "adaptive vsync" on macOS! CVDisplayLink is supported back to macOS 10.4 ("Tiger"), so we just use it universally without version checks and dump NSOpenGLCPSwapInterval, Mojave or not.
Ryan C. Gordon 1fb20f0a 2018-10-18T23:38:27 cocoa: Put a mutex around GL_SwapBuffers. Prevents deadlock when swapping two different GL contexts on two different threads at the same time on macOS 10.14 ("Mojave"). Fixes Bugzilla #4278.
Ryan C. Gordon 072e17bf 2018-10-18T11:59:48 cocoa: GL_GetDrawableSize only uses -[NSView convertRectToBacking] for highDPI. On Mojave, this will report large numbers for retina displays in fullscreen mode, which isn't how it works on previous versions. (transplanted from c6c1731780e2bef94f944a4795e2dfbba46d9500)
Ryan C. Gordon eac3fd28 2018-10-18T11:59:48 cocoa: GL_GetDrawableSize only uses -[NSView convertRectToBacking] for highDPI. On Mojave, this will report large numbers for retina displays in fullscreen mode, which isn't how it works on previous versions.
Sam Lantinga e3cc5b2c 2018-01-03T10:03:25 Updated copyright for 2018
Sam Lantinga 57ebc727 2017-12-04T20:35:01 Fixed bug 3975 - Add GLES2 support for macOS via ANGLE library Andrey Seems latest google angle library successfully built & tested under macOS'es. https://github.com/google/angle We need to use GLES2 to implement true cross-platform code.
Sam Lantinga 45b774e3 2017-01-01T18:33:28 Updated copyright for 2017
Sam Lantinga 524bf3c2 2016-12-09T01:47:43 Fixed bug 3513 - SDL_GL_SwapWindow does not return error status Return an error code from SDL_GL_SwapWindow(), like the other SDL APIs.
Ryan C. Gordon 15bc7aea 2016-01-04T22:00:04 Mac: allows apps to use OpenGL on a slower, integrated GPU. This is often useful for SDL apps that aren't meant to be games: the integrated GPU starts up faster, uses less power, and is often more than fast enough. Note that even with this change, the app will still default to the more powerful, discrete GPU if one is available; an app that prefers the integrated GPU will still need the NSSupportsAutomaticGraphicsSwitching key properly set in its Info.plist and Mac OS X 10.7 or later. https://developer.apple.com/library/mac/qa/qa1734/_index.html
Sam Lantinga 42065e78 2016-01-02T10:10:34 Updated copyright to 2016
Philipp Wiesemann 0e45984f 2015-06-21T17:33:46 Fixed crash if initialization of EGL failed but was tried again later. The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly uninitialized data structure if loading the library first failed. A later try to use EGL then skipped initialization and assumed it was previously successful because the data structure now already existed. This led to at least one crash in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was dereferenced to make a call to eglBindAPI().
Sam Lantinga 2c4a6ea0 2015-05-26T06:27:46 Updated the copyright year to 2015
Alex Szpakowski 4fc40266 2015-05-05T19:01:55 Replaced all remaining uses of NSAutoreleasePool with @autoreleasepool blocks (bugzilla #2680.)
Ryan C. Gordon b72938c8 2015-04-20T12:22:44 Windows: Always set the system timer resolution to 1ms by default. An existing hint lets apps that don't need the timer resolution changed avoid this, to save battery, etc, but this fixes several problems in timing, audio callbacks not firing fast enough, etc. Fixes Bugzilla #2944.
Alex Szpakowski fe6c797c 2015-04-10T23:30:31 Fixed an iOS view orientation issue when SDL_GL_CreateContext or SDL_CreateRenderer is called.
Edward Rudd b88ca1b4 2015-02-10T16:28:56 the last parameter of XChangeProperty is the number of elements.. and when the element format is 32.. the element is "long" so we have 5 long elements here. Yes this seems confusing as on mac+linux Long is either 32 or 64bits depending on the architecture, but this is how the X11 protocol is defined. Thus 5 is the correct value for the nelts here. Not 5 or 10 depending on the architecture. More info on the confusion https://bugs.freedesktop.org/show_bug.cgi?id=16802
Philipp Wiesemann b48e54aa 2015-01-26T22:00:29 Fixed bug 2802 - [patch] Fix android build compiling in wrong filesystem implementation Jonas Kulla The configure script didn't differentiate between Linux and Android, unconditionally compiling in the unix implementation of SDL_sysfilesystem.c. I'm probably one of the very few people building SDL for android using classic configure + standalone toolchain, so this has gone undetected all along.
David Ludwig 70438be2 2014-12-03T10:55:23 WinRT: fixed bug whereby SDL would override an app's default orientation WinRT apps can set a default, preferred orientation via a .appxmanifest file. SDL was overriding this on app startup, and making the app use all possible orientations (landscape and portrait). Thanks to Eric Wing for the heads up on this!
Philipp Wiesemann 9c398852 2014-11-22T22:20:40 Corrected header file documentation comment.
Pierre-Loup A. Griffais 24c86b55 2014-09-11T19:24:42 [X11] Reconcile logical keyboard state with physical state on FocusIn since the window system doesn't do it for us like other platforms. This prevents sticky keys and missed keys when going in and out of focus, for example Alt would appear to stick if switching away from an SDL app with Alt-Tab and had to be pressed again. CR: Sam
Sam Lantinga fc4e798d 2014-07-07T12:48:25 Fixed bug 2631 - Mac: minor code cleanup Alex Szpakowski Some minor changes to the Mac-specific backend code: - Fixed up some code style issues (mostly brace style inconsistencies). - Fixed a compiler warning in SDL_cocoaevents.m. - Removed some useless code now that the 10.7 SDK is required to build SDL. - Removed Gestalt(gestaltSystemVersion, ...) call and switched to NSAppKitVersionNumber for version checking code. Using Gestalt with gestaltSystemVersion will give 0x1090 in Mac OS 10.10+, and the whole Gestalt function was deprecated in Mac OS 10.8.
David Ludwig 3dcb451f 2014-04-09T21:29:19 Added a README file regarding WinRT support To note, this file is currently formatted with CRLF line endings, rather than LF, to allow the file to be viewed with Notepad.
Sam Lantinga b677d1d8 2014-03-10T19:59:06 Fixed Mac OS X OpenGL context creation to match other backends, where we only care about the actual version we request if it's 3.0 or newer or a special profile context. Eventually we'll probably move the version checking to higher level code and report the actual version of context that got created, but to avoid breakage we'll leave it like this for now.
Sam Lantinga 28398109 2014-03-10T18:45:07 Fixed regression causing the renderer to recreate its window since it's not getting an OpenGL 2.1 context anymore.
Ryan C. Gordon bafa4c7a 2014-03-01T21:33:48 Dynamically load glGetString(), to avoid direct dependency on OpenGL.
Ryan C. Gordon 99583397 2014-03-01T20:46:45 Mac OS X: Make OpenGL context selection more robust, avoid software fallback. Fixes Bugzilla #2197.
J?rgen P. Tjern? 95f7e242 2014-02-25T15:28:12 Mac: Immediately update current OpenGL context's shape. Previously we were postponing our -[NSOpenGLContext update] call to the next SDL_GL_SwapWindow, even if the context was current on the current thread. This changes it so that we will do the update immediately if it's the current context. If you're rendering on another thread, you need to call SDL_GL_SwapWindow once after a resize event to ensure your drawable will produce non-garbage data. Bug: https://bugzilla.libsdl.org/show_bug.cgi?id=2339
Sam Lantinga 58edac3e 2014-02-02T00:53:27 Fixed bug 2374 - Update copyright for 2014... Is it that time already??
Sam Lantinga 27779311 2013-12-27T10:18:11 Bump SDL to build with 10.7 SDK. This also bumps the minimum requirement for building SDL to 10.7, and removes some checking we no longer need. CR: saml
Gabriel Jacobo f848adff 2013-11-29T10:06:08 Improve Android pause/resume behavior.
Ryan C. Gordon 7e1289af 2013-11-24T23:56:17 Make internal SDL sources include SDL_internal.h instead of SDL_config.h The new header will include SDL_config.h, but allows for other global stuff.
Philipp Wiesemann 0f8d9995 2013-11-02T11:42:00 Corrected typo in source comment.
Ryan C. Gordon d36c7363 2013-10-28T22:43:39 Updated GL version tests for Mac OS X 10.9 ("Mavericks"). They changed the name of their GL 3.2 enum, added the GL 4.1 core profile.
Edward Rudd 869a7076 2013-09-20T13:43:00 add in High DPI support (aka Retina) - based on J?rgen's patch with a few bug fixes
Ryan C. Gordon bfe1b1d0 2013-09-14T01:30:57 Don't incorrectly report success for negative swap intervals on Mac OS X.
Sam Lantinga 37509cf3 2013-09-13T17:40:41 Mac: Fix cast warning.
Gabriel Jacobo dad42067 2013-08-12T11:13:50 Fixes #2022, do not resume on Android when surfaceChanged If the app is in landscape mode and the user presses the power button, a pause is followed immediately by a surfaceChanged event because the lock screen is shown in portrait mode. This triggers a "false" resume. So, we just pause and resume following the onWindowFocusChanged events. Also, wait for SDL_APP_WILLENTERBACKGROUND and SDL_APP_DIDENTERBACKGROUND before blocking the event pump.
Sam Lantinga 1ad936eb 2013-08-11T19:56:43 Fixed bug 2027 - Full-screen appears to be broken - hang in SDL_DestroyWindow() Rainer Deyke I'm running Linux Mint 15 with the Cinnamon window manager. SDL_DestroyWindow consistently locks up for me when the window if fullscreen.