summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowseglcontext.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QWindowsEGLContext: Fix overly specific EGL include path.Friedemann Kleint2015-11-051-1/+1
| | | | | | | Allow for using other EGL implementations besides ANGLE. Change-Id: I64ceca477912150425e4a9328001cc911bd351bf Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.5' into 5.6Liang Qi2015-10-021-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/doc/src/qmake-manual.qdoc src/corelib/tools/qstring.h src/gui/image/qimagereader.cpp src/network/access/qnetworkaccessmanager.cpp src/tools/qdoc/doc/examples/examples.qdoc src/widgets/accessible/qaccessiblewidgetfactory_p.h src/widgets/doc/qtwidgets.qdocconf Change-Id: I8fae62283aebefe24e5ca4b4abd97386560c0fcb
| * windows: Avoid __eglMustCast... in EGLLaszlo Agocs2015-08-271-1/+1
| | | | | | | | | | | | | | | | | | WinCE headers do not have this type. Task-number: QTBUG-47964 Change-Id: I5573eaf754b825774576c55b7cb4acfbd9e8d8dd Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* | windows: Improve error handling with EGLLaszlo Agocs2015-09-231-12/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When disabling the graphics adapter, things start failing with context lost and then bad_alloc and bad_access failures when creating contexts/window surfaces. Swap buffers now handles context loss. This makes it possible for Qt Quick to act when the graphics adapter goes away. Similarly, the window surface creation failure EGL_BAD_ACCESS is treated the same way as context loss. Note that this will not really help the main issue, because rendering is not possible without a GPU (reinit attempts will fail either at context creation or window surface creation), but proper logging and context loss reporting improves the situation somewhat. Also unify and prettyify the warning and debug prints. This makes it easier to understand what is going on. Change-Id: Iec3a9b54f1134e78e87eefcf938525283ec9412a Task-number: QTBUG-48095 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* | Revert "Handle context loss in window surface creation too"Laszlo Agocs2015-06-231-2/+1
| | | | | | | | | | | | | | | | | | | | This reverts commit e4f5278a4f308297bdcf12c04c8b4600a1294ef7. Revert this for now until we figure out what exactly is needed for the Windows 7 CI virtual machines. Change-Id: Ibd5578eac1d172785fac5e94c4c5c7508f8ddb79 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Handle context loss in window surface creation tooLaszlo Agocs2015-06-221-1/+2
|/ | | | | | | | | | While this is not what the EGL spec says, we can get EGL_CONTEXT_LOST in eglCreateWindowSurface too with ANGLE. Handle it the same way like we do for eglMakeCurrent and eglSwapBuffers (no warning, just return the error code silently since we may recover from this). Change-Id: I6b6c57ffd4fca23e1a14a90ef7b18b33f4c96fd2 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* windows: Use EGL extensions as they ought to be usedLaszlo Agocs2015-05-281-5/+11
| | | | | | | | | | | | | | | | | | | We take some shortcuts still because we know that with ANGLE the header with the extension constants is always available. A proper implementation would not rely on the constants being available and would dynamically check for the extension and would take care of defining the constants if not available. However, just getting the extension list to check if the functions needed to get the display are available is already a chicken-egg problem so we won't go there. Using eglGetProcAddress properly solves the issues with static builds too since this always works. Task-number: QTBUG-46284 Change-Id: Iff23669ebacaffa0c5f76fd2c928af689307874f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Gunnar Roth Reviewed-by: Andrew Knight <andrew.knight@intopalo.com>
* windows: Fix platform plugin compilation with new angleAndrew Knight2015-04-091-1/+2
| | | | | | | | | The identifiers for configuring a software renderer changed. Change-Id: I739cedbb0a00bc6be94df716d66cd1520d4f7c9d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com> Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
* Enhance EGL_CONTEXT_LOST checksLaszlo Agocs2015-03-111-8/+25
| | | | | | | | | Apparently failures can occur not just when doing eglMakeCurrent() but also when creating window surfaces. Change-Id: Ife1210293d5120fd41352164d9c89e83fb5ce468 Reviewed-by: Michael Brüning <michael.bruning@theqtcompany.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2015-02-101-19/+24
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro src/gui/image/qimage_conversions.cpp src/gui/opengl/qopenglextensions_p.h src/gui/text/qtextengine.cpp src/network/ssl/qsslsocket_openssl.cpp src/plugins/platforms/eglfs/qeglfshooks_stub.cpp src/plugins/platforms/eglfs/qeglfsscreen.cpp src/plugins/platforms/eglfs/qeglfswindow.cpp src/plugins/platforms/windows/qwindowsfontdatabase.cpp src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp src/plugins/platforms/windows/qwindowsnativeinterface.cpp src/plugins/platforms/windows/qwindowsscreen.cpp src/plugins/platforms/windows/qwindowswindow.cpp src/plugins/platforms/windows/qwindowswindow.h src/plugins/platforms/xcb/qxcbdrag.h src/widgets/itemviews/qabstractitemview.cpp src/widgets/kernel/qwidget.cpp src/widgets/util/qsystemtrayicon_p.h tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp Thanks to Friedemann Kleint for resolving the qwindowsfontdatabase.cpp conflicts. Change-Id: I937232c30523d5121c195d947d92aec6f129b03e
| * Merge remote-tracking branch 'origin/5.4.1' into 5.4Frederik Gladhorn2015-01-291-14/+18
| |\ | | | | | | | | | Change-Id: Idadb5639da6e55e7ac8cc30eedf76d147d8d5d23
| | * Windows/ANGLE: Fix initialization of contexts.Friedemann Kleint2015-01-281-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | Immediately try to initialize a context obtained by eglGetPlatformDisplayEXT() and clear display in case it fails, falling back to eglGetDisplay(). Change-Id: Ia6c1c6da4daff6651153c854eda4fb8749bdc526 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
| | * Windows: Add infrastructure to be able to a GL renderer based on GPU.Friedemann Kleint2015-01-151-10/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce flags for the renderer type and move code to qwindowsopengltester. Introduce QWindowsOpenGLTester::supportedGlesRenderers() where type-dependent checking can be added. Change-Id: I4bbffaf861cb0fdbea0919e081e3626fb5a872de Task-number: QTBUG-43263 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
| * | Make -static -opengl dynamic builds succeedLaszlo Agocs2015-01-191-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Right now it breaks in qwindowseglcontext due to its ifdefs for static ANGLE-only builds. The checks for QT_STATIC should be extended with QT_OPENGL_DYNAMIC so that it continues to resolve functions dynamically in -opengl dynamic builds even when combined with -static. Task-number: QTBUG-43993 Change-Id: Iac6d0353ef16a32a22ab1db0a833fbb0165f328c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
| * | Windows: make TranslucentBackground functional alwaysLaszlo Agocs2015-01-191-0/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QOpenGLWidget and QQuickWidget was not functional when WA_TranslucentBackground was set. This is due to the static "isGL" type of checks that are not suitable since 5.3 due to RasterGLSurface windows which may or may not be OpenGL windows, depending on their content. To handle this, we have to do some check on every makeCurrent and perform the necessary calls (most importantly SetLayeredWindowAttributes). Task-number: QTBUG-43854 Change-Id: If19c79482ec4f0a8b795ee710d52ed7e08b52563 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* / Expose context lossLaszlo Agocs2015-01-221-1/+11
|/ | | | | | | | | | | | | | | | | On platforms like Windows (and presumably on mobile devices too) the loss of the context (e.g. the underlying D3D device in case of ANGLE) is an event that can happen randomly and needs sufficient handling. Enhance QOpenGLContext::isValid() with the purpose of indicating context loss. Currently only the Windows EGL backend (ANGLE) has support for it. Other platforms may be added later. Task-number: QTBUG-43263 Change-Id: I8177694c1ee7cebbd5d330e34757fd94c563e6d6 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* windows: fix platform compilation after ANGLE upgradeAndrew Knight2014-11-141-2/+2
| | | | | | | | | Upstream changed how WARP is meant to interact with EGL, and so the enum names changed. Change-Id: I10d4bcac71b75a1223ea8af4d3fcf584f5685a02 Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-18/+10
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Define EGL_EGLEXT_PROTOTYPES for ANGLEv5.4.0-alpha1Laszlo Agocs2014-09-061-0/+1
| | | | | | | | | Otherwise the protos are not pulled in so the ANGLE-only build cannot suceed (unless the flag is defined from somewhere else). Task-number: QTBUG-41164 Change-Id: I959d154da88f7ccc8159ec7e810ffdba0e7f50ea Reviewed-by: Andrew Knight <andrew.knight@digia.com>
* windows: Fix dynamic opengl buildLaszlo Agocs2014-09-031-4/+4
| | | | | | | Cannot call WGL or EGL functions directly anymore. Change-Id: I0d5c6217679d87a2092c945a9b841dfd7b6c299a Reviewed-by: Andrew Knight <andrew.knight@digia.com>
* Enable QT_ANGLE_PLATFORM selection in dynamic buildsLaszlo Agocs2014-09-031-1/+1
| | | | | Change-Id: I8ebe62ec1e024e8a0a0f9e8aeac6fb81b1095e72 Reviewed-by: Andrew Knight <andrew.knight@digia.com>
* windows: Allow selection of ANGLE's rendererAndrew Knight2014-09-021-1/+30
| | | | | | | | | | | | The default behavior of ANGLE is to use D3D11 before falling back to D3D9. This change improves flexibility the platform plugin to explicitly create a D3D11, D3D9, or D3D11 software (WARP) context by setting the QT_ANGLE_PLATFORM to "d3d11", "d3d9", or "warp", respectively. Task-number: QTBUG-41031 Change-Id: Ie1d399c1cb0e360e5b3a6d9f2a4b28745d86cc71 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* Prevent current context from becoming inconsistent upon create()Laszlo Agocs2014-09-011-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | Platform plugins have a tendency to make the newly created native context current with a temporary surface. This is usually needed to query some information related to the new context. Afterwards most of them just reset to having nothing current. This has two issues: It unexpectedly changes the current context/surface. A call into QOpenGLContext::create() does not imply that the current context will get changed. This is the minor issue and we could probably live with it (at least if it had been documented). However, the real issue is that QOpenGLContext::currentContext() will become inconsistent: it will still report whatever was current before the create() even though on the EGL/WGL/GLX level that's not the case anymore. To prevent all this confusion the platform plugins can easily be changed to restore whatever context/surface was current before they altered it. Change-Id: I6a5b4597c86571327524ddb13e0d02538593cc7b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Do not show warning on null result in getProcAddressLaszlo Agocs2014-07-291-1/+1
| | | | | | | | | Other platforms do not do this either. What is more, some of the extension handling code will try to resolve functions that are not necessiarly present, and this is not an error. Change-Id: I39dad8f8d89fc45de3ea83f04727a8e38b6a3387 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* windows: Fix ANGLE function resolution in static buildsAndrew Knight2014-07-151-165/+180
| | | | | | | | | The EGL/GLES functions are now resolved statically when needed. Task-number: QTBUG-40199 Change-Id: I58c675b1c410708237475e1e5d6609ca7d6713f1 Reviewed-by: Kai Koehne <kai.koehne@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Load winsys and gl dynamically in the windows pluginLaszlo Agocs2014-05-221-28/+786
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The dynamic builds (-opengl dynamic) are now functional on Windows. In such a build no components in Qt link to any OpenGL libraries directly and qmake will not automatically add any such libraries to the applications' makefiles. Instead, the libraries are chosen and loaded during runtime and applications are expected to use QOpenGLFunctions instead of direct OpenGLfunction calls. Set the environment variable QT_OPENGL to desktop or angle to skip testing and force the given implementation. The application attributes (AA_UseOpenGLES and such) are also taken into account. The testing logic is same as before: We try to load opengl32 and resolve a shader related function. If this fails, ANGLE is chosen. This allows utilizing full desktop OpenGL on systems that have proper drivers, while a transparent fallback to ANGLE will be done automatically for systems that don't. The latter includes also remote desktop connections. Software rendering via Mesa llvmpipe is supported too. The fallback is automatic on systems where the desktop test fails and ANGLE fails to load or initialize (e.g. due to missing libs like d3dcompiler), as long as a suitable patched build of Mesa is available. [ChangeLog][QtGui] Dynamic OpenGL implementation loading is now supported on Windows. This requires Qt to be configured with -opengl dynamic. Task-number: QTBUG-36483 Change-Id: Ie8bb25a6d55b3a1609b00150aeccd909aec27313 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Remove unused parameter from QEGLPlatformContext constructorLaszlo Agocs2014-03-101-1/+1
| | | | | | | | The API is chosen via QSurfaceFormat, the constructor argument is ignored. Remove this historical artifact. Change-Id: I4a5c1e12cb297de22f239ad0a6747c1c36168eed Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Dynamic GL switch on WindowsLaszlo Agocs2014-02-141-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The patch introduces a new build configuration on Windows which can be requested by passing -opengl dynamic to configure. Platforms other than Windows (including WinRT) are not affected. The existing Angle and desktop configurations are not affected. These continue to function as before and Angle remains the default. In the future, when all modules have added support for the dynamic path, as described below, the default configuration could be changed to be the dynamic one. This would allow providing a single set of binaries in the official builds instead of the current two. When requesting dynamic GL, Angle is built but QT_OPENGL_ES[_2] are never defined. Instead, the code path that has traditionally been desktop GL only becomes the dynamic path that has to do runtime checks. Qt modules and applications are not linked to opengl32.dll or libegl/glesv2.dll in this case. Instead, QtGui exports all necessary egl/egl/gl functions which will, under the hood, forward all requests to a dynamically loaded EGL/WGL/GL implementation. Porting guide (better said, changes needed to prepare your code to work with dynamic GL builds when the fallback to Angle is utilized): 1. In !QT_OPENGL_ES[_2] code branches use QOpenGLFunctions::isES() to differentiate between desktop and ES where needed. Keep in mind that it is the desktop GL header (plus qopenglext.h) that is included, not the GLES one. QtGui's proxy will handle some differences, for example calling glClearDepth will route to glClearDepthf when needed. The built-in eglGetProcAddress is able to retrieve pointers for standard GLES2 functions too so code resolving OpenGL 2 functions will function in any case. 2. QT_CONFIG will contain "opengl" and "dynamicgl" in dynamic builds, but never "angle" or "opengles2". 3. The preprocessor define QT_OPENGL_DYNAMIC is also available in dynamic builds. The usage of this is strongly discouraged and should not be needed anywhere except for QtGui and the platform plugin. 4. Code in need of the library handle can use QOpenGLFunctions::platformGLHandle(). The decision on which library to load is currently based on a simple test that creates a dummy window/context and tries to resolve an OpenGL 2 function. If this fails, it goes for Angle. This seems to work well on Win7 PCs for example that do not have proper graphics drivers providing OpenGL installed but are D3D9 capable using the default drivers. Setting QT_OPENGL to desktop or angle skips the test and forces usage of the given GL. There are also two new application attributes that could be used for the same purpose. If Angle is requested but the libraries are not present, desktop is tried. If desktop is requested, or if angle is requested but nothing works, the EGL/WGL functions will still be callable but will return 0. This conveniently means that eglInitialize() and such will report a failure. Debug messages can be enabled by setting QT_OPENGLPROXY_DEBUG. This will tell which implementation is chosen. The textures example application is ported to OpenGL 2, the GL 1 code path is removed. [ChangeLog][QtGui] Qt builds on Windows can now be configured for dynamic loading of the OpenGL implementation. This can be requested by passing -opengl dynamic to configure. In this mode no modules will link to opengl32.dll or Angle's libegl/libglesv2. Instead, QtGui will dynamically choose between desktop and Angle during the first GL/EGL/WGL call. This allows deploying applications with a single set of Qt libraries with the ability of transparently falling back to Angle in case the opengl32.dll is not suitable, due to missing graphics drivers for example. Task-number: QTBUG-36483 Change-Id: I716fdebbf60b355b7d9ef57d1e069eef366b4ab9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Port Windows QPA plugin to new logger API.Friedemann Kleint2014-01-221-5/+3
| | | | | | | | | | | | | | | | Introduce logging categories and change most debug statements to qCDebug(). Retrieve the filter rules from the environment variable QT_QPA_VERBOSE (should be removed once the logging framework offers a more convenient way of configuring). Replace the old per-category variables controlling verboseness of the output by a single variable which can be set on the command line. Change-Id: Iae55ecdb0e150efd165b7d3e90b371f72853f194 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add ANGLE as a 3rdparty library to Qt.Jason Barron2012-10-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | ANGLE is a component that implements the OpenGL ES 2.0 API on top of DirectX 9. See the following for more info: http://code.google.com/p/angleproject/ ANGLE is now the default configuration on Windows. If you want to use desktop OpenGL, you should build Qt with the following configure options: -opengl desktop To configure Qt to use another OpenGL ES 2 implementation, you should use: -opengl es2 -no-angle Task-number: QTBUG-24207 Change-Id: Iefcbeaa37ed920f431729749ab8333b248fe5134 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Windows: Add ANGLE support.Friedemann Kleint2012-05-311-0/+166
- Add QWindowsEGLContext usable for ANGLE and Windows CE. - Add QWindowsEGLStaticContext containing the display for resource cleanup. - Add EGLSurface to QWindowsWindow. - Add a -angle option specifying the path to the external ANGLE installation to configure, add libraries to the mkspecs. Initial-patch-by: Jabot Corentin <corentinjabot@gmail.com> Task-number: QTBUG-24207 Change-Id: I5f80b1efb6996da7c5d70aa3720f7801c9e4c6af Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com> Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>