summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoaglcontext.mm
Commit message (Collapse)AuthorAgeFilesLines
* Apply Q_CONSTINIT where beneficialSona Kurazyan2022-09-011-1/+1
| | | | | | | | | | Applied Q_CONSTINIT to variables with static storage duration, but skipped the POD types with core constant initializers. Task-number: QTBUG-100486 Change-Id: Iaabf824e9cb0f29a405a149912200d4e4b3573c1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Move QMacAutoReleasePool from qglobal.h to qcore_mac_p.hSona Kurazyan2022-09-011-0/+2
| | | | | | | | And include qcore_mac_p.h where needed. Task-number: QTBUG-99313 Change-Id: Idb1b005f1b5938e8cf329ae06ffaf0d249874db2 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* macOS: Clear NSOpenGLContext drawable when QNSView is about to go awayTor Arne Vestbø2021-11-161-0/+9
| | | | | | | | | | | | | | Calling doneCurrent() on a QCocoaGLContext only clears the current context, but doesns't reset the drawable (view) of the context. In most cases this is fine, but it has been observed to cause issues when using the software GL renderer on Big Sur and above. To be a good citizen we clear the drawable of any of our contexts that are tied to the NSView this about to be go away. Pick-to: 6.2 6.2.2 Change-Id: I8c845727c50871f30fbebc2ed62a7d0485651ecf Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* macOS: Restore logic to set wantsBestResolutionOpenGLSurfaceTor Arne Vestbø2021-05-201-0/+8
| | | | | | | | | | | | | | | | The logic was removed in 1fc7ca091b3fdda52381a383318a3a752ec21132 when we removed support for surface-backed views, based on the documentation for wantsBestResolutionOpenGLSurface noting that layer-backed views ignore the property. But in some cases, when plugin views are embedded into host views, and the host was built with a pre-10.14 SDK, AppKit seems to get confused, and we still need to set this property. Fixes: QTBUG-93770 Pick-to: 6.1 Change-Id: Id67f2fcb8c090c0e01c05d00792eaef311146df1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* macOS: Remove support for surface-backed viewsTor Arne Vestbø2020-08-181-45/+13
| | | | | | | | | | | | | Our deployment target is 10.14, which enables layer-backing by default, and our layer-backing support nowadays is stable enough that we don't need to maintain any of the old code paths for compatibility. The wantsBestResolutionOpenGLSurface property on NSView is only relevant for surface-backed views, so we no longer need to deal with it. Change-Id: I8aef4ac99371113d463ac35eee648a8a2fd1ea72 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Introduce platform API abstraction for QOpenGLContextTor Arne Vestbø2020-07-021-26/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The API is available by including qopenglcontext.h as usual, but scoped in the QPlatformInterface namespace. The namespace exposes platform specific type-safe interfaces that provide: a) Factory functions for adopting native contexts, e.g. QCocoaGLContext::fromNative(nsContext, shareContext); b) Access to underlying native handles, e.g. openGLContext->platformInterface<QCocoaGLContext>->nativeContext() c) Platform specific functionality, e.g. static QWGLContext::openGLModuleHandle() openGLContext->platformInterface<QEGLContext>->doSomething(); The platform interfaces live close to the classes they extend, removing the need for complex indirection and plumbing, and avoids kitchen-sink modules and APIs such as the extras modules, QPlatformFunctions, or QPlatformNativeInterface. In the case of QOpenGLContext these platform APIs are backed by the platform plugin, so dynamic_cast is used to ensure the platform plugin supports the requested interface, but this is and implementation detail. The interface APIs are agnostic to where the implementation lives, while still being available to the user as part of the APIs they extend/augment. The documentation will be restored when the dust settles. Task-number: QTBUG-80233 Change-Id: Iac612403383991c4b24064332542a6e4bcbb3293 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* macOS: Add a few more local autorelease pools to QCocoaGLContextTor Arne Vestbø2020-06-091-0/+6
| | | | | | | | | | Prevents buildup of autoreleased NSViews (drawables) in the outer pool of the main runloop, which may not drain as often as we wish. Change-Id: Ifcf7317c50ec243e0d957bf4a19aab8bf34d5dd6 Fixes: QTBUG-84762 Pick-to: 5.15 5.12 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* macOS: Clean up headersTor Arne Vestbø2020-06-051-2/+2
| | | | | | | | | | | | | | The headers are now C++ clean and can be used outside of Objective-C code. All includes of Objective-C frameworks have been moved to the implementation files. Header guards have been added in the few places they were missing. All includes are now done via #include, instead of sometimes using the #import variant. Change-Id: Ibb0a9c0bcfefbda4347737212e40e300a3184982 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* macOS: Fix or ignore deprecated API in 10.14Tor Arne Vestbø2020-03-271-14/+14
| | | | | | | Fixes: QTBUG-82128 Change-Id: I11abfcf7f245a7a25733625b50e207b07abba289 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* macOS: Ensure GL symbols are resolved from the OpenGL frameworkLucas Wang2020-03-151-1/+1
| | | | | | | | | | | | | | | | | | The app or its dependencies may link against X11's libGL.1.dylib from XQuarz, to support GLX on macOS. Doing so may place libGL earlier in the load order than Apple's OpenGL framework, which results in dlsym picking symbols from libGL when using the RTLD_DEFAULT lookup strategy, breaking Qt's OpenGL support in various ways: QOpenGLShaderProgram: could not create shader program Warning: "" failed to compile! To fix this we use RTLD_NEXT, which looks up the symbol in dependency order of the image that called dlsym, rather than the global load order. Change-Id: I1ec3055a4ab0bb96566c7e196d301b30785f2dc0 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* macOS: Improve QCocoaGLContext loggingTor Arne Vestbø2019-12-051-1/+19
| | | | | Change-Id: I27d0abe0eb5b0f0ba64b8787b430484c48b131c0 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* macOS: Don't set NSOpenGLPFANoRecovery for layer-backed viewsTor Arne Vestbø2019-10-241-8/+0
| | | | | | | | The Apple software renderer is perfectly capable of being used when compositing CA layers. Change-Id: I3b78ff61a79869ecdb7bd431388041f2c124472e Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* macOS: Respect Qt::AA_UseSoftwareOpenGLTor Arne Vestbø2019-10-241-0/+6
| | | | | Change-Id: Ia83e8e9e571e4f46d2a8d810c376015552755457 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* macOS: Skip NSOpenGLContext flush if window exposed size is out of syncTor Arne Vestbø2019-10-241-0/+15
| | | | | | | | | | | | | | | | | | | | | | Some clients such as QOpenGLWidget will end up drawing and flushing during the resize event, which for GL will result in an immediate update on the screen. The problem is that the underlying Core Animation layer, and the window's frame, has not been visually updated yet to the new size, so we end up drawing "ahead" of what the window server is showing the user. Ideally we'd be able to present the GL drawing in a transaction, in sync with the drawing of the window frame, but this API is only available for CAMetalLayer and CAEAGLLayer. As a workaround we detect when the exposed size is out of sync with the window geometry, and skip the flush until the exposed size has caught up. We know this will happen eventually as AppKit will always ask us to display after a resize. Change-Id: I1739ac8878b3fc6820a55dd017ddd170fd5f55d6 Fixes: QTBUG-79139 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* macOS: Improve handling of wantsBestResolutionOpenGLSurfaceTor Arne Vestbø2019-10-241-18/+28
| | | | | | | | | | | | | | | | | | | | | We were disabling wantsBestResolutionOpenGLSurface whenever we detected the Apple software renderer, but this isn't needed when layer-backed, and did in fact result in the exact same visual result as the bug the code was working around -- only rendering to a quarter of the viewport. We now apply the workaround only when software rendering is combined with surface-backed views. The logic has also been improved to not rely on string comparison to look for the software renderer, but instead uses the renderer ID that the context provides. Since tweaking the wantsBestResolutionOpenGLSurface is only relevant when using a window for GL rendering the logic has been moved into QCocoaGLContext. Change-Id: I021aaefbb7a9782bc8ee3c9703da246510326d50 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Merge remote-tracking branch 'origin/5.12' into 5.13Liang Qi2019-08-051-2/+9
|\ | | | | | | | | | | | | | | Conflicts: qmake/generators/unix/unixmake2.cpp src/plugins/platforms/cocoa/qcocoawindow.mm Change-Id: Iba7aa7324f35543e0297a3680956420058cd3630
| * macOS: Don't require setting all three color buffer sizes in QSurfaceFormatTor Arne Vestbø2019-08-021-2/+9
| | | | | | | | | | | | Change-Id: Iaa6eb4d64f549a31aa5c53145e8b37facec4ea78 Reviewed-by: Andy Nichols <andy.nichols@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-07-181-30/+53
|\| | | | | | | Change-Id: I685000c4f33fb3707b2102fae0b58092107dc8f0
| * macOS: Use correct virtual screen when resolving GL surface formatTor Arne Vestbø2019-07-171-1/+22
| | | | | | | | | | Change-Id: I8288db85c8e99bf9fccfcfbca7f9e3594d00fa48 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
| * macOS: Use lambdas instead of Obj-C categories for GL helper functionsTor Arne Vestbø2019-07-171-26/+20
| | | | | | | | | | | | | | | | Allows us to reference captured variables and keeps the function local to where it's used. Change-Id: I609892888720202021862d26a74ceb50e232f356 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
| * macOS: Move QCocoaGLContext initialization into dedicated methodTor Arne Vestbø2019-07-171-4/+12
| | | | | | | | | | Change-Id: I9dc2c400c3d26e9fcfaac04b61c1503229f59dba Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into 5.13Liang Qi2019-06-071-4/+4
|\| | | | | | | | | | | | | | | | | | | Conflicts: qmake/generators/makefile.cpp src/plugins/platforms/cocoa/qcocoaintegration.h src/plugins/platforms/cocoa/qcocoaintegration.mm Done-With: Jörg Bornemann <joerg.bornemann@qt.io> Change-Id: I5a61e161784cc6f947abe370aab8f2971a9cbe78
| * Rename QMacScopedObserver to the more fittingly QMacNotificationObserverTor Arne Vestbø2019-05-291-4/+4
| | | | | | | | | | | | Change-Id: I1d8280fe88871572a3a27e612de49717b3b9ef77 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | Fix can not -> cannotRobert Loehning2019-02-251-1/+1
|/ | | | | Change-Id: Ie9992f67ca59aff662a4be046ace08640e7c2714 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Merge remote-tracking branch 'origin/5.11' into 5.12.0Liang Qi2018-11-051-2/+7
|\ | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/cocoa/qcocoaglcontext.mm src/plugins/platforms/xcb/qxcbscreen.h Change-Id: If9b4c67288396ff7346088ce591c7a3588b51979
| * [cocoa] Disable offline renderers for dual AMD FirePro GPUMichael Brüning2018-10-231-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The AMD FirePro dual gpus on the Mac Pro have a problem with offline renderers in Chromium. Therefore, Chromium and thus Qt WebEngine disable this option via the pixel format attributes. The Qt Cocoa plugin on the other hand enables it in the recent versions, causing context creation in Qt WebEngine to fail when run on a Mac Pro with dual AMD FirePro gpus due to incompatible context options. This patch uses the environment variable QT_MAC_PRO_WEBENGINE_WORKAROUND which is set by Qt WebEngine upon application startup if the application is running on a late 2013 Mac Pro. It should typically not be set from anywhere else. [ChangeLog] Offline renderers will be disabled when the application is using Qt WebEngine and running on one of the late 2013 Mac Pro models. Fixes: QTBUG-70062 Change-Id: I0b0831efb6f4073ebd37672040aaed6370853fc0 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | macOS: Fix NSOpenGLContext view association checkTor Arne Vestbø2018-10-231-1/+2
| | | | | | | | | | | | | | | | The expression "m_context.view = view" always evaluates to the view, so the check was flawed. Change-Id: Icef4ba5244975ccd78a151c7d40c53b2364c6148 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | macOS: Don't call [NSOpenGLContext update] for every frameTor Arne Vestbø2018-10-031-3/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Calling update has a cost, and should only be done when the drawable object changes size or location. Instead of calling update each time makeCurrent is called, we listen for the appropriate notifications, limiting the number of update calls significantly. We still call update on the thread owning the QOpenGLContext, which is not ideal, as [NSOpenGLContext update] should only be called on the main thread, but in practice this works. Getting out of this situation is tricky, and setView has in theory the same problems. Until those problems have been solved we keep the behavior as is. Task-number: QTBUG-63572 Change-Id: Ibac9f8be7843f2aa006af6f7ee670bf027122440 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | macOS: Clarify what static mutex in QCocoaGLContext is used forTor Arne Vestbø2018-09-131-4/+6
| | | | | | | | | | | | Change-Id: I4af0b78dbecad40b2a73cdbdb09a8eb60efdb013 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | macOS: Release surfaces straight away when reconfiguring QCocoaGLContextTor Arne Vestbø2018-09-101-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Calling setView or update on NSOpenGLContext results in recreating the internal GL surfaces of the view. Unfortunately there seems to be a fixed amount of these surfaces available, so if we spin a loop where we for some reason end up recreating them, we'll easily run out, and lock up the whole window system: thread #6, name = 'SwapThread' frame #0: 0x00007fff7b45220a libsystem_kernel.dylib`mach_msg_trap + 10 frame #1: 0x00007fff7b451724 libsystem_kernel.dylib`mach_msg + 60 frame #2: 0x00007fff751c1675 SkyLight`SLSBindSurface + 247 frame #3: 0x00007fff5d9c4328 OpenGL`___lldb_unnamed_symbol29$$OpenGL + 255 frame #4: 0x00007fff6bf42c33 libGPUSupportMercury.dylib`gldAttachDrawable + 364 frame #5: 0x00007fff5d9e61e7 GLEngine`gliAttachDrawableWithOptions + 257 frame #6: 0x00007fff5d9c4bb0 OpenGL`___lldb_unnamed_symbol38$$OpenGL + 969 frame #7: 0x00007fff5d9c8b0e OpenGL`___lldb_unnamed_symbol57$$OpenGL + 82 frame #8: 0x00007fff5d9c8e55 OpenGL`CGLSetSurface + 330 frame #9: 0x00007fff50d0eb2c AppKit`NSOpenGLContextAttachOffScreenViewSurface + 352 This can happen e.g. when resizing the application, where AppKit itself spins a loop where we don't end up back in QCocoaEventDispatcher::processEvents() for each pass (where we do have a local pool). Or it can happen in the render-loop of a render-thread that doesn't use the event dispatcher. Change-Id: Iaf2f879dd01e3d807d0f35705ccc978dbc89036b Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | macOS: Use NSOpenGLContext's drawable directly to track active drawableTor Arne Vestbø2018-09-091-30/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | We don't need a separate QWindow pointer to keep track of the active window, it's recorded already by the NSOpenGLContext's drawable. And we don't need to juggle the drawable when the window is hidden, the drawable is still valid after the window is re-shown, and we call update on every frame (for now) anyways, which will reconfigure the drawable if needed. Change-Id: I199b6c027226dd239c13ecc4aba86986ca09a1eb Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | macOS: Clear NSOpenGLContex's drawable when using offscreen surfacesTor Arne Vestbø2018-09-071-21/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Otherwise the user might accidentally render to the previously active window, if not explicitly using an FBO. This will have an performance impact if doing makeCurrent on a real window and an offscreen window back and forth with the same context, but that's not really a common or recommended use of QOffscreenSurface, as you can create FBOs with a normal window current as well. The use case of QOffscreenSurface is when a real window is not available. Change-Id: If93d04f82564523e15d5970429afea34c5cd31fe Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | macOS: Rename QCocoaGLContext::setActiveWindow to setDrawableTor Arne Vestbø2018-09-061-11/+15
| | | | | | | | | | Change-Id: I0be5125b434418c005f45f05c54b22f0418b46e4 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | macOS: Remove support for QSurfaceFormat::StereoBuffersTor Arne Vestbø2018-08-311-5/+3
| | | | | | | | | | | | | | | | | | | | The NSOpenGLPFAStereo attribute was deprecated in macOS 10.12, without any replacement, and adding the attribute to the pixel format results in context creation failure, so we're assuming the feature is no longer supported an disable it wholesale on macOS. Change-Id: I27d9f300fdaff9abe90781e3160b97f8b66121ad Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | Revert "macOS: Don't call [NSOpenGLContext update] for every frame"Liang Qi2018-08-151-94/+38
| | | | | | | | | | | | | | | | | | | | This reverts commit 823acb069d92b68b36f1b2bb59575bb0595275b4. It caused some test failures in qtdeclarative and etc. Task-number: QTBUG-69891 Change-Id: I2e4038a46de254834e6389c63f6dad0c2e523b8e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | macOS: Don't call [NSOpenGLContext update] for every frameTor Arne Vestbø2018-08-071-38/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Calling update has a cost, and should only be done when the drawable object changes size or location. Instead of calling update each time makeCurrent is called, we listen for the appropriate notifications, limiting the number of update calls significantly. The code has also been refactored to get rid of the m_activeWindow member, as the active window can be tracked through the context's drawable object property. There is also no need to clear the drawable when a window is hidden, so the hook into QCocoaWindow can be removed. The QPlatformNativeInterface hook is internal and can safely be removed. Task-number: QTBUG-63572 Change-Id: I70e3267f47882e151144bd36a50abe906164429a Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | macOS: Don't make QCocoaGLContext current unless we have a drawableTor Arne Vestbø2018-08-041-3/+5
| | | | | | | | | | Change-Id: I12ac982aa977c69af936f503369c91bac88492a9 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* | macOS: Modernize and clean up QCocoaGLContext::updateSurfaceFormat()Tor Arne Vestbø2018-08-041-97/+76
| | | | | | | | | | | | | | | | | | | | The updateFormatFromContext function that read GL state has been merged into updateSurfaceFormat(), we're using AppKit classes and functions instead of Core GL, and the logic has been simplified by using attribute/parameter helpers. Change-Id: Iec6717f457a0b4dbc8e34c3e15fcbcc42895b23e Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* | macOS: Add note about high-resolution workaround in QCocoaGLContext::makeCurrentTor Arne Vestbø2018-08-041-0/+2
| | | | | | | | | | Change-Id: I0b82ef95c1a058586e8005665e1e2cab3f975833 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* | macOS: Simplify and clean up QCocoaGLContext constructorTor Arne Vestbø2018-08-041-27/+31
| | | | | | | | | | Change-Id: Ie16256282784926506355012a735511b98118614 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* | macOS: Clean up and rename QCocoaGLContext::pixelFormatForSurfaceFormat()Tor Arne Vestbø2018-08-041-23/+26
| | | | | | | | | | Change-Id: I1a439d8cec950cb23c977eedfcc1b8810c6cd1c5 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* | macOS: Disambiguate use of native handles in QCocoaGLContextTor Arne Vestbø2018-08-031-8/+3
| | | | | | | | | | | | | | | | | | We only need the QVariant native handle when creating the context, so there's no need for a getter, and we then rename the NSOpenGLContext getter to match e.g. QCocoaScreen::nativeScreen(). Change-Id: I041e0eff39af9c8836d8ecd560ea07e92dc63e03 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* | macOS: Remove GL defines from QCocoaGLContextTor Arne Vestbø2018-08-031-20/+0
| | | | | | | | | | | | | | They should be available in all SDKs we build against and support. Change-Id: I799492e0b21a877717fb3a8391bcbad0f8581628 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* | macOS: Don't mess with native handle for QOpenGLContextTor Arne Vestbø2018-08-031-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | QOpenGLContext::setNativeHandle() is documented as: "configuration settings, like format(), are ignored since this QOpenGLContext will wrap an already created native context" We should respect this and not apply QT_MAC_OPENGL_SURFACE_ORDER. Change-Id: Idfdf3eac0e9f9d0a86f1b23aa475c3e4f12127e2 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* | macOS: Remove unneeded auto-release-pools in QCocoaGLContextTor Arne Vestbø2018-08-031-3/+0
| | | | | | | | | | | | | | | | The makeCurrent one was not explained in the commit message that introduced it, and doesn't make any sense, while the constructor one is no longer needed. Change-Id: I67e2f2aaff5d8602781b27f122f415068a1f2301 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* | macOS: Add more logging to QCocoaGLContextTor Arne Vestbø2018-08-031-1/+11
| | | | | | | | | | Change-Id: I6e93934b466f86b7607c9ad30c4c28a9c0f40fd7 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* | macOS: Propagate [NSOpenGLContext setView:] failuresTor Arne Vestbø2018-08-031-10/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of trying to mask situations where [NSOpenGLContext setView:] will fail (such as calling it for a view that's not part of a window yet, or part of a window that hasn't been shown), we report the error up through the API, so that QOpenGLContext::makeCurrent() will return false. This is documented to occur e.g. when "the surface is not exposed, or the graphics hardware is not available due to e.g. the application being suspended." QGLWidget was taught how to deal with this situation in cc27a50e. Other Qt APIs seem to handle it fine, but if regressions occur they should be fixable though the same logic as in cc27a50e. Change-Id: I92775fc165444696b6c5b44fa0e28ce3c4ad2190 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* | macOS: Reorganize QCocoaGLContextTor Arne Vestbø2018-08-031-174/+173
| | | | | | | | | | | | | | | | Group methods by their areas of responsibility to make it easier to follow the logic of the code. Change-Id: I64dbf60004d0f4c281312451e0781da31997c64d Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* | macOS: Add categorized logging to QCocoaGLContextTor Arne Vestbø2018-07-181-5/+7
| | | | | | | | | | Change-Id: I0fa37457f91d905ed6fb8a2aba20add311705ec7 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>