summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qopenglcontext.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QtGui: replace some QMutexLockers with (new) qt_{scoped,unique}_lock()Marc Mutz2019-09-121-5/+6
| | | | | | | | In QImageReader, also replace a QMutex with a QBasicMutex, making the code similar to the corresponding code in QPicture. Change-Id: Ia1cd546eccd3662837762e506235e350b7a08647 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Merge remote-tracking branch 'origin/5.13' into devLiang Qi2019-08-131-3/+0
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/win32-clang-msvc/qmake.conf src/corelib/tools/qlist.h src/gui/painting/qcompositionfunctions.cpp src/gui/painting/qtriangulator_p.h src/gui/text/qfontengine_p.h src/network/kernel/qhostinfo_p.h src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp Done-With: Allan Sandfeld Jensen <allan.jensen@qt.io> Change-Id: Ib8a0308cf77224c4fbdcf56778fdac4a43e37798
| * Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-08-081-3/+0
| |\ | | | | | | | | | Change-Id: I4c0fd501db974fb8339944b8df845336776d80a9
| | * eglfs: Fix raster windowsLaszlo Agocs2019-08-071-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also sanitize the initial WebAssembly hack. Both eglfs and wasm lack the concept of true raster windows. A QWindow with RasterSurface is rendered with OpenGL no matter what. The two platforms took two different approaches to work around the rest of the machinery: - wasm disabled the QOpenGLContext warning for non-OpenGL QWindows, - eglfs forced the QWindow surfaceType to OpenGLSurface whenever it was originally set to RasterSurface. Now, the latter breaks since c4e9eabc309a275efc222f4127f31ba4677259b7, leaving all raster window applications failing on eglfs, because flush in the backingstore is now checking the surface type and disallows OpenGLSurface windows. (just like how QOpenGLContext disallows RasterSurface windows) To solve all this correctly, introduce a new platform capability, OpenGLOnRasterSurface, and remove the special handling in the platform plugins. Change-Id: I7785dfb1c955577bbdccdc14ebaaac5babdec57c Fixes: QTBUG-77100 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-07-191-1/+1
|\| | | | | | | | | | | Change-Id: I999ba23a27cd897017d15c6ffe41ea8cd008ffb9
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-07-181-1/+1
| |\| | | | | | | | | | Change-Id: I685000c4f33fb3707b2102fae0b58092107dc8f0
| | * Tie QPlatformOpenGLContext to its QOpenGLContext before initializingTor Arne Vestbø2019-07-171-1/+1
| | | | | | | | | | | | | | | | | | | | | So that the context can be referenced during initialization. Change-Id: I9ec69b2431ba1ac6256cb2e969a76f515497e247 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | | QtGui: port from QMutex::Recursive to QRecursiveMutexMarc Mutz2019-07-061-2/+1
| | | | | | | | | | | | | | | Change-Id: I1ce4fcfa1bfb9a89fe3ebe61d049b9b3100fd700 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Port from QAtomic::load() to loadRelaxed()Giuseppe D'Angelo2019-06-201-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | Semi-automated, just needed ~20 manual fixes: $ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)load\(\)/$1loadRelaxed\(\)/g' -i \{\} + $ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)store\(/$1storeRelaxed\(/g' -i \{\} + It can be easily improved (e.g. for store check that there are no commas after the opening parens). The most common offender is QLibrary::load, and some code using std::atomic directly. Change-Id: I07c38a3c8ed32c924ef4999e85c7e45cf48f0f6c Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Doc: replace even more null/0/nullptr with \nullptr macroChristian Ehrlicher2019-05-081-2/+2
| | | | | | | | | | | | | | | | Try to replace all wordings like '.. to 0' with '.. to \nullptr'. Also checked for 'null pointer' and similar. Change-Id: I73341f59ba51e0798e816a8b1a532c7c7374b74a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-03-151-1/+1
|\| | | | | | | Change-Id: I2bf3b4ceb79364330eae4cbf3cdee9a82d1be46d
| * QOpenGLContext: fix docs about sharingGiuseppe D'Angelo2019-03-131-1/+1
| | | | | | | | | | | | | | FBOs cannot be shared. Streamline the remainder of the sentence. Change-Id: I654b23f86f4ee4ea2ca8e71958464d9f55394297 Reviewed-by: Martin Smith <martin.smith@qt.io>
* | QtGui/Network/OpenGl/Widgets/Xml: use \nullptr in documentationChristian Ehrlicher2019-02-201-1/+2
| | | | | | | | | | | | | | Replace null and '\c nullptr' with \nullptr in the documentation. Change-Id: I58934eea06943309ba895833f1991629870ab45b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | QtGui: replace 0 with \nullptr in documentationChristian Ehrlicher2019-02-021-4/+3
|/ | | | | | | | | Replace 0 with \nullptr in the documentation. As a drive-by also replace some 0 with nullptr in the corresponding code. Change-Id: Ieffbfffa76e3018257b667a3e8ad6e3b88486cde Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Documentation: Add \nullptr macro and use where applicableFriedemann Kleint2019-01-101-1/+1
| | | | | | | | | | | | | | | | Qt for Python users reading the documentation assume that int(0) can be passed for pointer parameters. Use the newly introduced \nullptr to disambiguate this. In a follow-up step, the \nullptr macro can be defined as None when generating the Qt for Python documentation. Task-number: PYSIDE-903 Change-Id: I3a45f87175a0668ab5f3f95f0aff409f7e3ef027 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Update QOpenGLContext::currentContext after QPlatformOpenGLContext::makeCurrentTor Arne Vestbø2018-09-091-10/+8
| | | | | | | | | | | | Instead of doing it up front and then restoring the current context if the makeCurrent call failed. By delaying the update, QPlatformOpenGLContext::makeCurrent has the option to check which context was current before the call. Change-Id: I458f5c00d7c820acbe2f8552b0513fce99b9b683 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Make QOpenGLContext::makeCurrent use early exit for all its flowTor Arne Vestbø2018-09-081-44/+42
| | | | | | | | The case of the platform context failing makeCurrent is the exception. Change-Id: I606e6fb379f84e886bff9e27355dda9b31ff9ebe Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* WebAssembly for QtBaseMorten Johan Sørvig2018-08-301-0/+3
| | | | | | | | | | | | This is the squashed diff from wip/webassembly to dev. Done-with: Peng Wu <peng.wu@intopalo.com> Done-with: Sami Enne <sami.enne@intopalo.com> Done-with: Morten Johan Sørvig <morten.sorvig@qt.io> Started-by: Andrew Knight <andrew.knight@intopalo.com> Change-Id: I6562433c0a38d6ec49ab675e0f104f2665f3392d Reviewed-by: Lorn Potter <lorn.potter@gmail.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Fix documentation issue for QOpenGLContext::makeCurrentTor Arne Vestbø2018-08-151-1/+1
| | | | | | | Change-Id: Id0118e44e1ed44fecdd803dbc57ca0588a1afec0 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Martin Smith <martin.smith@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Be more explicit about the effects of swapBuffers() on the current contextTor Arne Vestbø2018-08-061-1/+2
| | | | | Change-Id: I7ab9e4e7323d49cf19774bfd0c51f8516ecb842d Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Add needsWorkaround for additional Adreno targetsHerman van Hazendonk2018-03-011-2/+6
| | | | | | | | | | | | | Seems this issue is still there with Adreno 5xx and 6xx is suspected to have it as well (no device to test though), so added both 5xx and 6xx to cover these. Updated 30x to 3xx in order to cover Adreno 320 and 330 as per https://en.wikipedia.org/wiki/Adreno. Amends 9ae028f507a22bd03c861e9d14c2efc4aa2efeda Task-number: QTBUG-66702 Change-Id: I6ce3f6499d3ff9da884be45039e5f5e0990f7e1f Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Merge remote-tracking branch 'origin/5.9' into 5.11Liang Qi2018-02-141-0/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/corelib/animation/qvariantanimation.cpp src/corelib/global/qglobal.cpp src/corelib/global/qlogging.cpp src/corelib/io/qprocess_win.cpp src/corelib/json/qjsonarray.cpp src/corelib/tools/qsimd_p.h src/corelib/tools/qtimezoneprivate_p.h src/corelib/xml/qxmlstream_p.h src/gui/kernel/qsimpledrag.cpp src/gui/kernel/qsimpledrag_p.h src/plugins/generic/generic.pro src/plugins/platforms/cocoa/qcocoamenu.mm src/widgets/styles/qmacstyle_mac.mm tests/auto/concurrent/qtconcurrentmap/BLACKLIST tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp tests/auto/gui/kernel/qwindow/BLACKLIST tests/auto/widgets/dialogs/qmessagebox/BLACKLIST Change-Id: I508d686cf20f7f8cc6a7119b9bc7c3bbb505c58e
| * Enable glyph cache workaround for Mali-T880Tero Alamäki2018-01-191-0/+1
| | | | | | | | | | Change-Id: I531e57c26e886cd8de09ca860d7e10b05d1a724b Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into 5.10Lars Knoll2017-12-301-1/+3
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf mkspecs/win32-g++/qmake.conf src/corelib/global/qglobal_p.h src/corelib/global/qoperatingsystemversion_p.h src/corelib/io/qfilesystemengine_win.cpp src/network/bearer/qbearerengine.cpp src/platformsupport/input/libinput/qlibinputpointer.cpp src/sql/doc/snippets/code/doc_src_sql-driver.cpp src/widgets/kernel/qwidget_p.h src/widgets/kernel/qwidgetwindow.cpp src/widgets/styles/qfusionstyle.cpp tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp Change-Id: I80e2722f481b12fff5d967c28f89208c0e9a1dd8
| * iOS: Harden logic for when it's safe to use the graphics hardwareTor Arne Vestbø2017-12-071-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To fix QTBUG-52493 we tied the exposed state of a window to the application being in the foreground. This has the result of a visible flash of black between hiding the launch screen and showing the first frame of the application, as the application is still waiting for UIApplicationStateActive to begin rendering, which happens after iOS hides the launch screen. According to the iOS OpenGL ES Programming Guide, it should be safe to render GL in UIApplicationStateInactive as well, and even in UIApplicationStateBackground, as long as the rendering finishes before the UIApplicationDidEnterBackgroundNotification returns. To ensure that we catch any bugs in this area, checks have been added that verify that no rendering happens while in the background state. Task-number: QTBUG-63229 Task-number: QTBUG-52493 Task-number: QTBUG-55205 Change-Id: Ib42bedbeddd7479ab0fb5e5b7de9f5805658e111 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2017-11-091-0/+1
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/kernel/qwindow.cpp src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/windows/qwindowssystemtrayicon.cpp src/plugins/platforms/xcb/qxcbconnection_xi2.cpp tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp tests/auto/widgets/kernel/qaction/tst_qaction.cpp Change-Id: Ifa515dc0ece7eb1471b00c1214149629a7e6a233
| * Enable glyph cache workaround for GC2000 as wellLaszlo Agocs2017-11-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | The glyph cache resize is clearly doing something that is not actually legal with OpenGL ES. Until this gets investigated properly, add the Vivante GC2000 (found in the commonly used i.MX6 quad) to the list since reports show that the issue occurs there as well. Task-number: QTBUG-49490 Change-Id: Ia890346d8dbb1691bc113e2ef522713ba6709393 Reviewed-by: Louis Kröger <louis.kroeger@gmail.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* | Add debug operators for QOpenGLVersionProfile QOpenGLContext(Group)Friedemann Kleint2017-05-171-0/+55
|/ | | | | Change-Id: I2bf06761bc3a19aa1f0973d9b2f32cec4cbdca0c Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Environment variable enabling the workaround FBO readback bugMarco Martin2017-04-051-0/+34
| | | | | | | | | | On some ARM devices the font glyph generation is broken Add an environment variable to enable workaround_brokenFBOReadBack in QOpenGLContext, to fix font rendering on such devices as Mali and Adreno Change-Id: I9cc99ecb8b71a35bc369ec9dd11b877016b1179e Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Improve use of QHash to minimize double hashingAllan Sandfeld Jensen2016-11-101-2/+3
| | | | | | | | Avoid looking up by key twice in a row in various locations, but instead using iterators and index lookup. Change-Id: I61a079115199ab9c041ad3a26d36b45ee3f775e0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-06-131-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: config_help.txt configure mkspecs/features/uikit/sdk.prf src/corelib/global/qhooks.cpp src/corelib/io/qfilesystemwatcher.cpp src/corelib/io/qlockfile_unix.cpp src/corelib/tools/qalgorithms.h src/gui/kernel/qwindowsysteminterface.h src/gui/text/qtextdocument_p.cpp src/network/access/access.pri src/network/access/qnetworkaccessmanager.cpp src/network/access/qnetworkreplynsurlconnectionimpl.mm src/src.pro src/testlib/qtestcase.cpp src/widgets/kernel/qwidgetbackingstore_p.h src/widgets/styles/qwindowscestyle.cpp src/widgets/styles/qwindowsmobilestyle.cpp tests/auto/corelib/io/qdiriterator/qdiriterator.pro tests/auto/corelib/io/qfileinfo/qfileinfo.pro tests/auto/gui/kernel/qwindow/BLACKLIST tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp tools/configure/configureapp.cpp Change-Id: Ibf7fb9c8cf263a810ade82f821345d0725c57c67
| * Gui: use const (and const APIs) moreAnton Kudryavtsev2016-06-011-2/+2
| | | | | | | | | | | | | | For CoW types, prefer const methods to avoid needless detach()ing. Change-Id: I88d08d499e1be72c1f6d983fecdcee513df18aa2 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | QOpenGLContext: add a way to disable the thread affinity checkGiuseppe D'Angelo2016-05-021-3/+12
|/ | | | | | | | | | | | | | The problem of the check is that it makes Qt non compliant with OpenGL thread affinity semantics. One is allowed to make a GL context current on any thread, without the Qt-specific idea of moving the QOpenGLContext to that thread first. Moreover, the move is plain impossible if the user needs to handle the context to 3rd party code which assumes the context to have GL semantics. Add an application flag to disable that. Change-Id: I55ca02ee62f8cc171a9a1bddef5331ad0949c061 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-04-071-1/+3
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/network/access/qftp.cpp src/widgets/itemviews/qheaderview.cpp src/widgets/itemviews/qlistview.cpp tests/auto/network/access/qftp/tst_qftp.cpp Change-Id: I9f928f25d45d8944dd60bb583f649fc1615bc5d9
| * Do not disconnect with nullptr when unplugging screensLaszlo Agocs2016-04-051-1/+3
| | | | | | | | | | | | | | Task-number: QTBUG-42803 Change-Id: I080ec3f0cc2cb55b43a9b8792f03b002b2e0f982 Reviewed-by: Gunnar Sletta <gunnar@sletta.org> Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
* | QtGui: use printf-style qWarning/qDebug where possible (I)Marc Mutz2016-03-041-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The printf-style version of QDebug expands to a lot less code than the std::ostream-style version. Of course, you pay in type safety (but compilers warn about it these days), you cannot stream complex Qt types and streaming QStrings is awkward, but in many cases you actually improve on readability. But the main reason is that something that's not supposed to be executed under normal operation has no business bloating executable code size. This is not an attempt at converting all qWarnings() to printf-style, only the low-hanging fruit. In this first part, replace qWarning() << "..."; with qWarning("..."); In QTransform shared warning strings. Saves 3KiB in text size on optimized GCC 5.3 AMD64 builds. Change-Id: I142a8020eaab043d78465178192f2c8c6d1cc4f9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
* | Refactor initialization/caching code for versioned opengl functionsLars Knoll2016-03-021-22/+2
| | | | | | | | | | | | | | Saves around 80k in Qt Gui. Change-Id: I3f7068ae699136d0edf46a49694ade7e1df3c91d Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* | Use an enum for versioning the opengl function backendsLars Knoll2016-03-021-4/+3
| | | | | | | | | | | | | | | | Saves some code, is easier to maintain and will allow for some more nice refactoring. Change-Id: Ica7ae8e9d36acbe6586e488bc6aff114336c65bb Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* | Avoid repeated QByteArray creation when resolving opengl functionsLars Knoll2016-03-011-1/+10
| | | | | | | | | | | | | | | | | | | | Add an getProcAddress(const char *) overload to QOpenGLContext, and refactor the QPA interface to take a const char *. Like this we can avoid lots of mallocs when resoving GL methods. Change-Id: Ic45b985fbaa0da8d32ba3e3b485351173352ca6f Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | QtGui: eradicate Q_FOREACH loops [needing qAsConst()]Marc Mutz2016-02-111-1/+1
| | | | | | | | | | | | | | | | | | | | ... by replacing them with C++11 range-for loops. To avoid detaches of these mutable Qt containers, wrap the container in qAsConst(). Change-Id: I90fd517ad542ef92034403c15ebb8300a56ac693 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com> Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* | Doc: Fix grammar in QOpenGLContext::openGLModuleType() docsAndy Maloney2016-02-061-1/+1
| | | | | | | | | | Change-Id: I4eb0361940bad8b0b0726fc3a584062d297f3164 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
* | Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | | | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devFrederik Gladhorn2016-01-081-3/+3
|\| | | | | | | | | | | Based on merge done by Liang Qi Change-Id: Id566e5b9f284d29bff2199f13f9417c660f5b26f
| * Avoid unnecessary detaching of the pending deletions list.Volker Krause2016-01-061-3/+3
| | | | | | | | | | | | | | | | | | | | | | This code seems to be hit three times per frame in a hybrid QQ2/Qt3D app, quickly generating thousands of allocations here via the detach in begin(). Heaptrack confirms they are all gone now. Change-Id: I7d09f3f5c2b24a2590b701216715055751306e82 Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Use Q_UNLIKELY for every qFatal()/qCritical()Marc Mutz2015-11-291-1/+1
|/ | | | | | | | | | | | | | | | | | | | | If, after checking a condition, we issue a qFatal() or a qCritical(), by definition that check is unlikely to be true. Tell the compiler so it can move the error handling code out of the normal code path to increase the effective icache size. Moved conditional code around where possible so that we could always use Q_UNLIKELY, instead of having to revert to Q_LIKELY here and there. In some cases, simplified the expressions newly wrapped in Q_UNLIKELY as a drive-by. Change-Id: I67537d62b04bc6977d69254690c5ebbdf98bfd6d Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Null out QOpenGLContext::screen upon screen disconnectLaszlo Agocs2015-09-221-2/+14
| | | | | | | | | Returning a dangling pointer is no good. Do what QOffscreenSurface does: just null it out. Task-number: QTBUG-42803 Change-Id: I01a6db9ae8974a1c78157ebc67097c8dac3a6b6e Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Expose GLES 3.0 and 3.1 functionsLaszlo Agocs2015-07-231-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using the approach we already do for some GLES 3.0 functions we can provide a cross-platform, cross-GL-GLES wrapper for ES 3.0 and 3.1 functions too. Applications only have to take extra care about the version requests (context version and version directives in shader code), the rest of their code can stay the same across desktop/mobile/embedded, even when ES 3 functions are used. The new functions are placed to a new subclass which is placed between QOpenGLFunctions and the internal QOpenGLExtensions. This is necessary because, unlike with QOpenGLFunctions, there is no guarantee that these functions are always available in all configurations. When running on desktop OpenGL, we resolve as usual. If the OpenGL version contains the function in question, either in core or as an extension, it will all just work. This is handy because it does not rely on 4.x extensions like GL_ARB_ESx_compatibility, and so ES 3.0 functions will be functional on OpenGL 3.x systems too by just setting a 3.x version number in the QSurfaceFormat. We will no longer qFatal on broken systems where the driver returns a 3.0 or 3.1 context without the corresponding functions present. Instead, we show a warning and gracefully fall back to resolving as usual, via eglGetProcAddress or similar. For functions that are available in ES2 as an extension this may just work fine. Added also an example that runs identically both with OpenGL and OpenGL ES 3 and utilizes some ES 3.0 features like instanced drawing. [ChangeLog] Added QOpenGLExtraFunctions providing OpenGL ES 3.0 and 3.1 function wrappers in a cross-platform manner. Task-number: QTBUG-46161 Change-Id: I9f929eb61946c35c415b178c4d6ab2c1c958684e Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
* Use Q_GLOBAL_STATIC for QThreadStorage<QGuiGLThreadContext *>Sérgio Martins2015-06-191-5/+5
| | | | | | | | | QThreadStorage isn't a trivial type. Change-Id: Iedc3c16320fd025a0ccf627eac43a85ebd02aa5e Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Fix incorrect FBO bindings with QOpenGLWidgetLaszlo Agocs2015-03-301-3/+17
| | | | | | | | | | | | | | QOpenGLContext::defaultFramebufferObject() knows nothing about QOpenGLWidget and QQuickWidget. The problem is that this function (and others that rely on it) is expected to give the widget's backing FBO in paintGL() and friends. To overcome this, we have to provide a way for such widgets that indicate what is the expected "default fbo". Task-number: QTBUG-43269 Change-Id: I43f439f8609382b9f7004707ab0ef9f091952b4f Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Make versioned OpenGL functions working with the subclass patternLaszlo Agocs2015-03-271-1/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QOpenGLFunctions allows both deriving from it and getting an instance via QOpenGLContext::functions(). Unsurprisingly a large number of users attempt to use the versioned function wrappers in the same way. Unfortunately this approach was not that well supported. Besides some potential base class exporting issues the real blocker for QOpenGLWidget - or any versionfunction subclass whose associated context changes during its lifetime - is that the functions instances could only be initialized once. Unlike instances retrieved via QOpenGLContext::versionFunctions(), instances created "manually" were not deinitialized upon the destruction of the associated context because context did not know about them. A pattern like initializeOpenGLFunctions(); delete context; create new context and make it current initializeOpenGLFunctions(); is working fine in QOpenGLFunctions-derived classes but not with the versioned ones. To overcome this, start registering such instances to the context too. QOpenGLContext::destroy() can then reset the internal state so a subsequent initializeOpenGLFunctions() will reinitialize properly instead of bailing out mistakenly thinking that everything is ready to use. Task-number: QTBUG-45199 Change-Id: Ia1420bcccb33c51508698b7a1b036c7544a66e74 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>