summaryrefslogtreecommitdiffstats
path: root/src/gui/opengl/qopengltexturehelper.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QOpenGLTexture: Enable multisample 2D textures on GLES 3.1+Laszlo Agocs2018-05-301-0/+6
| | | | | | Task-number: QTBUG-68510 Change-Id: Ib224189906b595bbae5aab95c888dd13e94171aa Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Clean up resolving of OpenGL functions on WindowsLars Knoll2016-03-021-11/+4
| | | | | | | | | | | | Always try both e/wglGetProcAddress and ::GetProcAddress to resolve the methods. Like this QOpengGLContext::getProcAddress is able to return any OpenGL entry point, and we can both simplify the code we have in the QPA backend as well as get rid of windows specific code paths in Qt Gui. Task-number: QTBUG-39531 Change-Id: I1ddf1b0974f69b56b219a619655b723eb0134b14 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Generate more compact code to resolve the QOpenGLExtraFunctionsLars Knoll2016-03-011-6/+6
| | | | | | | | Similar to the parent commit, this reduces binary size significantly. Change-Id: Idd6753ec5e04ec84d93bf6f86b5c71550b90ae9b Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Get rid of the gles3helper classLars Knoll2016-03-011-8/+8
| | | | | | | | | Since the backends can now resolve all possible GL functions, there's no need for the special handling for GLES that this class did anymore. Change-Id: Ib48aecc9a892f3c883d76ffc82217f346dbb3adc Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Avoid repeated QByteArray creation when resolving opengl functionsLars Knoll2016-03-011-48/+48
| | | | | | | | | | 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>
* Don't resolve GL 1 symbols in the texture helperLars Knoll2016-03-011-101/+41
| | | | | | | | | We already have these symbols resolved in QOpenGLFunctions, so simply use those. Change-Id: I6047181dbe47be9b0a83656af454d0ca1f3df6eb Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Updated license headersJani Heikkinen2016-01-151-13/+19
| | | | | | | | | | | 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>
* QOpenGLTexture: fix target for compressed texturesMauro Persano2016-01-041-138/+70
| | | | | | | | | | | Trying to set data for a compressed cubemap texture face fails, because the code incorrectly tries to bind to a cubemap face target. This was already fixed for uncompressed textures. Instead of duplicating the code, moved the texture binding/unbinding code to a RAII class. Change-Id: I8f1cb7fc661b919200f85c3465d6e6e3c22d0871 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Fix crash in QOpenGLTextureSean Harmer2015-07-151-0/+2
| | | | | | | | | | Any function using the non-dsa helpers and glTextureParameterf() would crash as this code path failed to initialize the function pointers. Task-number: QTBUG-47133 Change-Id: I8970c9693ec471a96b135ae5728ab6407ee06a6f Reviewed-by: Mike Krus <mike.krus@kdab.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Merge remote-tracking branch 'origin/5.4' into 5.5Liang Qi2015-04-151-1/+1
|\ | | | | | | Change-Id: I004854a25ebbf12b1fda88900162fe7878716c58
| * Add a cast to glTexImage2D to keep QNX happyLaszlo Agocs2015-04-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | The internalformat parameter seems to be GLenum (unsigned int) on QNX based on the error message in the linked bug report. The standard is GLint, though. To keep everyone happy, add a cast. Task-number: QTBUG-45346 Change-Id: I57fece7b381e0d02acc842a21b1edc5451ea0224 Reviewed-by: Sérgio Martins <sergio.martins@kdab.com> Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
* | Disable DSA on RadeonLaszlo Agocs2015-03-141-2/+10
| | | | | | | | | | | | | | | | | | Try to prevent crashes on Windows and broken textures on Linux. Task-number: QTBUG-40653 Task-number: QTBUG-44988 Change-Id: I1fd259ba5ca3980c3087411e1dae1ae56bb2c2e4 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | Prevent crashing on ES2 SDK - ES3 device scenarios with AndroidLaszlo Agocs2015-02-121-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Making a build with an older NDK having only gl2.h results in crashing QOpenGLTexture on devices that provide ES 3.0 or 3.1. This is because immutable storage is supported (based on runtime checks) but the function pointers are not there (due to ifdef checks). Fix this like we did in other places: get rid of the ifdef and dlsym the ES3-only symbols. Task-number: QTBUG-44397 Change-Id: Ief518ec8c7d532aeea0075ba166baf8d22e66ec5 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | Update copyright headersJani Heikkinen2015-02-111-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-15/+18
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Resolve GLES3 functions from the shared libLaszlo Agocs2015-01-101-15/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Unfortunately the few functions that are part of the OpenGL ES 3.0 standard and are used by QtGui have to have special handling after all. Just directly calling the functions causes issues when building on a GLES3 capable system and deploying somewhere where only GLES2 is available. Using eglGetProcAddress and such is not an option because the ES spec does not guarantee that standard functions are resolvable via that mechanism. Task-number: QTBUG-43318 Change-Id: I72f985d75ca669835839016573cbb8e4a3fb41db Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
* | Use the static TexStorage2|3D funcs in es buildsLaszlo Agocs2014-11-191-0/+5
|/ | | | | | | | | | When building with -opengl es2 and having ES 3.0 or newer, TexStorage must resolve directly to the functions. Other paths (desktop, ES when using dynamic on Windows) are already covered below. Change-Id: If214578bf23547d6f66a17bc999e9fabf97ba770 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.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>
* Do not resolve core functions on GLES in texture helperLaszlo Agocs2014-08-231-0/+64
| | | | | | | | | | | | | As the spec for eglGetProcAddress says, some implementations may not return function pointers for core functions. Similarly to how we cannot get OpenGL 1.0/1.1 functions with WGL for example. To make sure QOpenGLTexture does not just crash with such implementations, we simply use the statically exported functions in -opengl es2 builds. Change-Id: I213bfcc21e58888b17e0ebcd0a26f26f77517e40 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Rename new QOpenGLContext APIsLaszlo Agocs2014-04-251-3/+3
| | | | | | | | | | | | | | isES() becomes isOpenGLES(). The library type enums are changed DesktopGL -> LibGL and GLES2 -> LibGLES. This removes the now unnecessary version number, the confusing "desktop" term and provides better readability. The old function/values are kept until the related qtdeclarative changes are integrated. Task-number: QTBUG-38564 Change-Id: Ibb0a1209985f1ce4bb9451f9b7b093c2b68a6505 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Dynamic GL: remove exporting symbolsLaszlo Agocs2014-03-041-5/+4
| | | | | | | | | | | | | | | | | | | | | Remove the opengl proxy for now. Later it will either be moved into a separate library or replaced by a QOpenGLFunctions-based approach. This means that the -opengl dynamic configuration is not usable for the time being. The rest of the enablers remain in place. The convenience function QOpenGLFunctions::isES() is now moved to QOpenGLContext and is changed to check the renderable type. This is extremely useful since besides supporting dynamic GL it solves also the problem of GL_ARB_ES2_compatibility (i.e. it triggers the real ES path when creating an ES-compatible context with a desktop OpenGL implementation). Task-number: QTBUG-36483 Task-number: QTBUG-37172 Change-Id: I045be3fc16e9043e1528cf48e6bf0903da4fa7ca Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* OpenGL: Fix QOpenGLTexture for cubemaps with mutable storageSean Harmer2014-02-141-8/+48
| | | | | | | | | | | | The code was not creating all of the storage necessary for cubemaps as well as attempting to bind to the cubemap face targets which is invalid when using mutable storage - typically on OS X where EXT_direct_state_access is not available and immutable storage is only available at all if using an OpenGL 4.1 context. Change-Id: I4cf84f1b88c90e8359366392b3ccda65669ebfa7 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Pasi Keränen <pasi.keranen@digia.com>
* Dynamic GL switch on WindowsLaszlo Agocs2014-02-141-20/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* QOpenGLTextureHelper: explain why we use GetProcAddress on Windows / DesktopGLGiuseppe D'Angelo2014-02-071-0/+3
| | | | | | | | | | | | In the future, we might want to refactor this code to inconditionally use the common Desktop / ES2 subset (like the rest of Qt does), and then resolve only the functions actually available at runtime. For now, state why we're doing that on Windows. Change-Id: Ic21035bcd88ddc1d9274fd90a146c2824d783b25 Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* QOpenGLTextureHelper: fix 3D texture support on ES2Giuseppe D'Angelo2014-02-071-14/+17
| | | | | | | | | | | | | | | | | | The code first tried to check for the GL_OES_texture_3D extension, and if present it resolved the pointers to the gl*Tex*3DOES functions. But then it overwrote those pointers by attempting to resolve the Desktop GL gl*Tex*3D functions, thus making them unusable. So, if the extension is found, don't overwrite the pointers. If the extension is NOT found, keep the general behavior of still trying to resolve those functions. (That is going to fail, but refactoring the general behavior belongs to a separate commit.) Change-Id: Idaba122cf9500f136e3f79284d3c82284257036d Reviewed-by: James Turner <james.turner@kdab.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* QOpenGLTextureHelper: de-inline the DSA / DSA emulator wrappersGiuseppe D'Angelo2014-02-061-0/+364
| | | | | | | | | | | | There's no advantage at keeping them inline because we never call them directly: we take pointers to them. This can actually cause multiple copies of the function to be emitted, then the linker may or may not decide to discard N-1 copies. Just avoid this route and deinline them. Change-Id: I5adc704b50ec7f26498846fcbb86cb5b5d016b4b Reviewed-by: James Turner <james.turner@kdab.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* QOpenGLTextureHelper (Windows): Don't load desktop DLL when GLES2 is usedAndrew Knight2013-11-211-1/+1
| | | | | | | | GL functions should come from the context, not the desktop GL lib, when Qt is configured for OpenGL ES 2 (e.g. ANGLE). Change-Id: I794e1d5989ac72d2e98070d20e91f9c2c4cb7183 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Enable QOpenGLTexture for OpenGL ES 2Jorgen Lind2013-11-141-0/+17
| | | | | Change-Id: I3ec2b7af303070c92e86c0f5ca729eb1a1731682 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Long live QOpenGLTexture!Sean Harmer2013-09-221-0/+219
Task-number: QTBUG-33274 Change-Id: I9259d947d11f8ba330a2cd7f5620d8f1af0a804b Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>