summaryrefslogtreecommitdiffstats
path: root/src/opengl
Commit message (Collapse)AuthorAgeFilesLines
* Long live [[nodiscard]] QFile::openGiuseppe D'Angelo2024-04-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Having already caught some bugs in real code because of unchecked calls to QFile::open, this commit marks QFile::open (and open() in other file-I/O classes) as [[nodiscard]]. Since it's going to raise warnings, the plan is to keep the existing behavior up to and including the next LTS. Then the warnings will switch on by default. All of this is protected by system of macros to opt-in or opt-out the behavioral change at any time. A possible counter-argument for doing this is that QFile::open is also used for opening files in the the resource system, and that opening "cannot fail". It clearly can, if the resource is moved away or renamed; code should at a minimum use a Q_ASSERT in debug builds. Another counter-argument is the opening of file handles or descriptors; but again, that opening may fail in case the handle has been closed or if the flags are incompatible. --- Why not marking *every* open() override? Because some are not meant to be called directly -- for instance sockets are supposed to be open via calls to `connectToHost` or similar. One notable exception is QIODevice::open() itself. Although rarely called directly by user code (which just calls open() on a specific subclass, which likely has an override), it may be called: 1) By code that just takes a `QIODevice *` and does something with it. That code is arguably more rare than code using QFile directly. Still, being "generic" code, they have an extra responsibility when making sure to handle a possible opening failure. 2) By QIODevice subclasses, which are even more rare. However, they usually ignore the return from QIODevice::open() as it's unconditionally true. (QIODevice::open() doesn't use the protected virtual pattern.) I'll try and tackle QIODevice in a future commit. [ChangeLog][QtCore][QFileDevice] The open() functions of file-related I/O classes (such as QFile, QSaveFile, QTemporaryFile) can now be marked with the "nodiscard" attribute, in order to prevent a category of bugs where the return value of open() is not checked and the file is then used. In order to avoid warnings in existing code, the marking can be opted in or out, by defining QT_USE_NODISCARD_FILE_OPEN or the QT_NO_USE_NODISCARD_FILE_OPEN macros. By default, Qt will automatically enable nodiscard on these functions starting from Qt 6.10. Change-Id: Ied940e1c0a37344f5200b2c51b05cd1afcb2557d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Correct the internal signatures in the GL 4.5 func wrappersLaszlo Agocs2024-04-163-9/+135
| | | | | | | | | | | | | | | | | | | | | | There are 9 functions in the 4.5 API that were initially specified to use GLsizei, but later "magically" became GLsizeiptr (i.e. 64-bit or 32-bit depending on the arch). The current gl.xml, unlike old ones, uses GLsizeiptr, as do the extension headers and most of the online docs, except some that of the reference pages are stuck with GLsizei. Assuming that today's OpenGL implementations expect GLsizeiptr, fix the the internal signatures, so that calling into the GL implementation is done using the correct argument sizes. In addition, add GLsizeiptr signatures in the public API guarded with >= QT_VERSION(7, 0, 0). Pick-to: 6.7 6.6 6.5 Fixes: QTBUG-67807 Change-Id: Ifc7e97b0479a186000a56709c37ba7f77b6f1ff2 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* OpenGL: Add parameters to choose FBO grab orientationMikko Hallamaa2024-03-132-16/+31
| | | | | | | | | | | | We want to be able to pass as an argument whether the texture grabbed to an FBO is supposed to have a flipped y-axis or not. This is required for screen capture on the EGLFS platform. Task-number: QTBUG-121835 Pick-to: 6.7 6.6 6.5 Change-Id: I6dddc879a4be7ff2c2c189747193423644be55a0 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Mention QChronoTimer in API docsAhmad Samir2024-03-031-1/+1
| | | | | Change-Id: Iaf9fb31994f1580b2051dbd0b1b8eef2a218aa39 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Correct doc snippet licenseLucie Gérard2024-02-281-1/+1
| | | | | | | | | | | | | | All file under doc/snippet should be license as Documentation snippets and according to QUIP-18 [1] this is LicenseRef-Qt-Commercial OR BSD-3-Clause [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I76eedfb6b15c4091f726a5652e3530001d7cdaf7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Refix invalid glTexImage2D operation in FramebufferObjectEirik Aavitsland2024-02-091-1/+3
| | | | | | | | | | | | | | | | | | A recent change fixed the texture format parameter to be RGB instead of RGBA for opaque internal formats. However, this broke the RGB10 case, since the pixel type is then GL_UNSIGNED_INT_2_10_10_10_REV. The doc says: "GL_INVALID_OPERATION is generated if type is [...] GL_UNSIGNED_INT_2_10_10_10_REV [...] and format is neither GL_RGBA nor GL_BGRA." https://registry.khronos.org/OpenGL-Refpages/gl4/html/glTexImage2D.xhtml This modifies ba9e57d65f15c935632b0ad22db0bead9a7d5f90. Pick-to: 6.7 6.6 6.5 Change-Id: I9a004331513179a3f840a007af0418d14e7f5dff Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* QOpenGLFramebufferObject: Avoid illegal call to glTexImage2DAleix Pol2024-01-311-3/+15
| | | | | | | | | | | | | | | According to the documentation: GL_INVALID_OPERATION is generated if the combination of internalFormat, format and type is not one of those in the tables above. https://registry.khronos.org/OpenGL-Refpages/es3.0/html/glTexImage2D.xhtml We were allowing the RGB values be passed as RGBA, after this change we don't do so anymore. This would result for KWin in: Mesa: User error: GL_INVALID_OPERATION in glTexImage2D(format = GL_RGBA, type = GL_UNSIGNED_BYTE, internalformat = GL_RGB8) Pick-to: 6.5 6.6 6.7 Change-Id: Ifde8a570eff01be573f780655d8cedbb96f5ba2b Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Make sure OpenGLContext is not nullptrJacek Poplawski2024-01-101-0/+2
| | | | | | | | | In QOpenGLCompositorBackingStore::resize it is already checked whether dstWin is valid, but dstCtx may also be nullptr at this point. Pick-to: 6.7 Task-number: QTBUG-120078 Change-Id: I4a6ad71dd8225b94baff05984275ad1860298dfc Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Add an opportunity to grab via QOpenGLCompositor to FBOArtem Dyomin2024-01-072-3/+17
| | | | | | | | | | | The feature is needed for screen capturing Qt multimedia in order to have better performance of getting frames (avoid recreating fbo). In QtMM, we're going to create FBO and use it as a hw frame (or just render it to image on the first stage) Pick-to: 6.7 6.6 6.5 Change-Id: Id08a86b76447faa0f341c6967c2dad8f34c84959 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Doc: Fix \fn template arguments for Qt OpenGLTopi Reinio2023-11-181-1/+1
| | | | | | | | | Upcoming changes to QDoc require accurate definition for template arguments in \fn commands. Task-number: QTBUG-118080 Change-Id: I3fde4b0c8867eaf50162dec3178e5c6e5dad3a6f Reviewed-by: Luca Di Sera <luca.disera@qt.io>
* Include what you need: <QPointer>Marc Mutz2023-10-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | All these TUs relied on transitive includes of qpointer.h, maybe to a large extent via qevent.h, though, given that qevent.h is more or less the only public QtBase header that includes qpointer.h, something else seems to be at play here. Said qevent.h actually needs QPointer in-name-only, so a forward declaration would suffice. Prepare for qevent.h dropping the include. The algorithm I used was: If the TU mentions 'passiveGrabbers', the name of the QEvent function that returns QPointers, and the TU doesn't have qpointer.h included explicitly, include it. That may produce False Positives, but better safe than sorry. Otherwise, in src/, add an include to all source and header files which mention QPointer. Exception: if foo.h of a foo.cpp already includes it, don't include again. Task-number: QTBUG-117670 Change-Id: I3321cccdb41ce0ba6d8a709cea92427aba398254 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Doc: Fix warnings and linking issuesTopi Reinio2023-10-091-0/+3
| | | | | | | | | | | | | | | | | | | | Remove or replace links to examples that were removed or moved under manual tests. Replace code snippets that were quoting the now-missing examples. Fix documentation of QSet::removeIf(). Fix typo in documentation macro: Unknown command '\examplecateogry'. Add qtopengl, qtshadertools dependencies to Qt Widgets documentation project to enable correct linking to those topics. Mark all documentation sets in qtbase as free of warnings. Pick-to: 6.6 6.5 Change-Id: I058cd5f2063aa933ea310bceff906f05422a7cb2 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QOpenGLCompositorBackingStore: ensure backing store on flushed windowsAxel Spoerl2023-09-132-0/+6
| | | | | | | | | | | | | | | | | | | | | | | When the first QEglFSWindow got created for a QWindow, a backing store was created with it and associated to the new QEglFSWindow. When the window was hidden on the platform screen, the QEglFSWindow got deleted and re-created when it was supposed to be shown. The re-created QEglFSWindow was no longer associated to the backing store. It was therefore not rendered on the screen. => ensure that the backing store is re-associated to the QEglFSWindow, corrsponding to the QWindow argument passed to flush(). No autotest is added, because the fix is purely visual. The widgets/menus example can be used to test the functionality manually (see bug reports). Fixes: QTBUG-115196 Fixes: QTBUG-116769 Pick-to: 6.6 6.5 6.2 Change-Id: I92ce2e8f7e76bd2d26e713a4d20612d079fb4717 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Doc: Qt OpenGL: Remove duplicate source dir from documentation configTopi Reinio2023-08-221-7/+6
| | | | | | | | | | | | | | As /examples/opengl is already listed in exampledirs, .qdoc source files under that directory do not need to be listed in sourcedirs. Doing so will cause the example to be listed twice in lists generated by the \generatelist and \annotatedlist QDoc commands. Same applies to imagedirs variable. Pick-to: 6.6 6.5 Change-Id: I168dbfe111a4cb9615626eb9869f97d3814a14b7 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
* Enable QT_NO_CONTEXTLESS_CONNECT for most of QtBaseGiuseppe D'Angelo2023-07-111-0/+1
| | | | | | | | | It's clean now, keep it as such. Enabling it for QtCore is still OK, because it just hides a function template declared in a header. Change-Id: I8e7dfae179732ba04241a6a3258c2d722e8259df Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QOpenGLFunctions: fix -Wunused-private-field (Clang 15)Marc Mutz2023-07-0518-22/+11
| | | | | | | | | | | | | | | | | | I see this with -unity-build -unity-build-batch-size 32, but I don't know whether it's unity-build or just Clang 15, so also pick to 6.2. The issue exists in 5.15, too, presumably, but I have no desire to find a non-C++17 fix. It appears the generator (glgen) is out-of-sync with the state of its supposed output as of at least 18aae36a90c0753f1b1e615ba8437d8ebd1bd2fb, so don't try to update the generator (I failed to find where these fields originate from, anyway). Pick-to: 6.6 6.5 6.2 Task-number: QTBUG-115031 Change-Id: Ia27620b8f8034c3e8eff383abb849e6ce93dce8a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Docs: Add link to OPenGL examples to OpenGL indexSafiyyah Moosa2023-06-302-2/+2
| | | | | | | Task-number: QTBUG-112824 Pick-to: 6.5 6.6 Change-Id: Ib507e8c32518442fd211f3486c4317b4907ea414 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Use a global value for warning limit when testing documentation in CITopi Reinio2023-06-271-3/+0
| | | | | | | | | | | | | | | | | | | The most common limit for the maximum number of allowed documentation warnings is zero. Use a global value for 'warninglimit', adopted by all Qt module documentation projects that include the configuration from qtbase/doc/global. This allows for a temporary increase of the limit across all modules as needed - for example, when updating the QDoc binary that the CI provisions to a version that introduces new types of documentation warnings. Increase this base limit temporarily to 10 to help re-enable documentation testing in CI as it's currently disabled. Task-number: QTBUG-113326 Change-Id: I8b66951ca9324bcfaec3b5a7ec2cff544c62feb0 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* rhi: Make it a QPA-style private but semi-public APILaszlo Agocs2023-05-212-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qrhi.h, qshader.h, qshaderdescription.h (and qshaderbaker.h from shadertools; done separately) become "RHI APIs", following the concept of QPA APIs. Mirror completely what is done for QPA headers, but using the "rhi" prefix for the headers. This involves updating syncqt to handle the new category of headers. (a note on the regex: matching everything starting with "qrhi" is not acceptable due to incorrectly matching existing and future headers, hence specifying the four header names explicitly) There is going to be one difference to QPA: the documentation for everything RHI is going to be public and part of the regular docs, not hidden with \internal. In addition to the header renaming and adding the comments and documentation notes and warnings, there is one significant change here: there is no longer a need to do API-specific includes, such as qrhid3d11[_p].h, qrhivulkan[_p].h, etc. These are simply merged into a single header that is then included from qrhi.h. This means that users within Qt, and any future applications can just do #include <rhi/qrhi.h> (or rhi/qshader.h if the QRhi stuff is not relevant), no other headers are needed. There are no changes to functionality in this patch. Only the documentation is expanded, quite a lot, to eliminate all qdoc warnings and make the generated API docs complete. An example, with a quite extensive doc page is added as well. Task-number: QTBUG-113331 Change-Id: I91c749826348f14320cb335b1c83e9d1ea2b1d8b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Clarify module changes in Qt6Jaishree Vyas2023-05-091-1/+1
| | | | | | | | | Changed Briefs for better understanding Fixes: QTBUG-109324 Pick-to: 6.5 Change-Id: I15b0c0dc12b1bf96626fb8ea4ad16d04b2b118ca Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* gl: Check for image validity in readbackLaszlo Agocs2023-04-251-6/+12
| | | | | | | | | | | Returning a null QImage is preferable over passing a null bits() to glReadPixels. (matters when QImage's malloc() gives null, thus 'd' is null -> isNull() == true) Fixes: QTBUG-113127 Pick-to: 6.5 6.4 6.2 5.15 Change-Id: Ieca4d91eefdea47da5251dabe77cc31b48eb0e28 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Use Qt CMake APIs to exclude files from Unity BuildAmir Masoud Abdol2023-04-031-8/+7
| | | | | | | | | | | | | | | | | | | | This is a bit of a cleanup, mainly around unity build, and a few other minor things: - I replaced the direct inclusion of sources files using `set_source_files_properties`, and instead used `NO_UNITY_BUILD_SOURCES` when possible. In most cases, they are being excluded in their respective `qt_internal_extend_target` but sometimes I had to make a new extension. - In few cases, we had to manually exclude the NO_PCH files, so, I instead passed them directly to the NO_PCH_SOURCES which also exclude them from the unity build as well. - Removed a few unnecessary "" Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: I466576592c1d115a2da4d88672c1e4b9f995f2ed Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add QImage null check when QOpenGLTexture convertsLaszlo Agocs2023-03-211-1/+6
| | | | | | | | | | | ...the image to RGBA8888. Just mirror the first null check that is done for the user-provided QImage. The same should be done for the result of convertToFormat(). Pick-to: 6.5 6.5 6.2 5.15 Fixes: QTBUG-68884 Change-Id: I77091d7a2bc6e32d2aa292dc7650c1af091fcec1 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* QOpenGLTexture: Add a doc note about the unavoidable conversionLaszlo Agocs2023-03-161-0/+6
| | | | | | | | | | | As requested by users. Explicitly stated in the docs that the QImage is going to be converted, to avoid surprises. Pick-to: 6.5 6.2 5.15 Fixes: QTBUG-105364 Change-Id: Ia6a8930bcee8bd3cdbef016083599bd435b37a09 Reviewed-by: Kristoffer Skau <kristoffer.skau@qt.io> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Add QOpenGLWindow/Widget doc note about depth/stencilLaszlo Agocs2023-03-161-0/+17
| | | | | | | | Pick-to: 6.5 6.2 5.15 Fixes: QTBUG-108050 Change-Id: If011d6efff996870ff23eff3c2d1cf455d31b7a6 Reviewed-by: Kristoffer Skau <kristoffer.skau@qt.io> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Avoid incomplete textures in GL paint engineLaszlo Agocs2023-03-024-31/+68
| | | | | | | | | | | | | | | | | | | | | | ...which can happen if the OpenGL implementation reuses IDs so that a glGenTextures results in the same ID that was used by a texture destroyed by glDeleteTextures just before. In this case the lastTextureUsed tracking needs to be aware and invalidate, otherwise the newly created texture is assumed to be already existing (the ID is the same as before after all), and so operations such as setting the minification filter is skipped (which is fatal with OpenGL given that we do not use mipmaps). This is exercised in practice by the drawPixmapFragments test introduced in the previous patch. On Intel graphics it would work, but it does not render correctly with NVIDIA due to how the driver's internal ID handling works. Pick-to: 6.5.0 6.5 6.4 6.2 Change-Id: Ic2771fe9a2dec7da4aa3804d8498dd89e3c18415 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* GL paint engine: Fix drawPixmapFragments when using buffer objectsLaszlo Agocs2023-03-021-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Until recently the buffer object-based code path (so not client-side pointers) was only hit with a core profile context. This changed at some point in 6.4 and later to support WebGL (that has no client-side pointers, unlike OpenGL ES 2.0 it is based on). Now buffer objects are preferred over client-side pointers, always. Problem is, drawPixmapFragment() was never functional on this code path, it seems. Expecting that transferMode() does all the uploadData() needed is wrong. transferMode() bails out if the mode is the same as before, and that's exactly what happens when an application calls drawPixmapFragments() on the painter twice, after each other. How exactly this works with client-side pointers is not fully clear, but presumably the data buffer address stays the same so all pointers passed in to the glVertexAttribPointer calls are valid, and it sources the data for each draw call (probably), thus the rendering is all correct even though only the first, not the second, drawPixmapFragment() led to calling uploadData() internally. Amends e487b07e18f1cb7ff126744be57b2ae1b9839c6c although this patch on its own is just as applicable pre-6.4 as well (to fix drawPixmapFragments when using a core profile context). Pick-to: 6.5.0 6.5 6.4 6.2 Fixes: QTBUG-111416 Change-Id: I2ad358424e613192a51b99b937aef7660f5dbe08 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Increase cache size for QOpenGLTextureCacheKristoffer Skau2023-02-281-1/+11
| | | | | | | | | | | | Currently images that does not fit in the cache will be destroyed, which is unfortunate. 256 MB cache is too small for todays standards, so increasing it to 1 GB. Also adding an environment variable so that it is changeable if required. Fixes: QTBUG-111498 Pick-to: 6.5 Change-Id: I70c65cad6219a59102b16abc50f098aa0b017314 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Doc: Remove duplicate wordsAndreas Eliasson2023-02-281-1/+1
| | | | | | Change-Id: Ia7a38a1035bd34d00f20351a0adc3927e473b2e7 Pick-to: 6.5 6.4 6.2 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Add some exclusions for CMake Unity (Jumbo) buildsFriedemann Kleint2023-02-161-0/+8
| | | | | | | | | | | | | Add exclusions for issues that are likely not fixable (3rd party code, X11 define clashes, etc) in 3rd party, tools and plugins. Pick-to: 6.5 Task-number: QTBUG-109394 Done-with: Amir Masoud Abdol <amir.abdol@qt.io> Change-Id: I698c004201a76a48389271c130e44fba20f5adf7 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* src: Remove remains of qmake conversion from CMakeLists.txt filesFriedemann Kleint2023-02-101-3/+0
| | | | | | Pick-to: 6.5 Change-Id: Id644d322a602038403bb7f46c532744575fbf6d3 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* trace: Remove unused tracepoint filesAntti Määttä2023-02-101-12/+0
| | | | | | | | | | These can be removed now that the modules use tracepointgen tool. Pick-to: 6.5 Change-Id: I265e019f99e1ccc557a284ff53b110073066e530 Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io> Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
* Trace: Convert qtopengl module to use tracepointgen toolAntti Määttä2023-02-104-18/+27
| | | | | | | | Pick-to: 6.5 Change-Id: I441455a4d49a559fb591ea5c8cffb97af66fb2b1 Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io> Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
* QtOpenGL: Disambiguate class name QTextureBinderFriedemann Kleint2023-01-131-5/+5
| | | | | | | | | It occurs twice, causing a clash in CMake Unity (Jumbo) builds. Task-number: QTBUG-109394 Pick-to: 6.5 Change-Id: I39341af72cfa406d80c598a56db9e02f80c61a9b Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* eglfs: Improve z-order handlingSérgio Martins2022-10-291-4/+18
| | | | | | | | | | | | | | In 9ccbbeecbd we've added basic z-order handling, so main window always stacks behind tool windows. After extensive testing we found more basic cases to be handled: - Modal windows go on top - Qt::Popup goes on top of Qt::Tool Fixes: QTBUG-105707 Pick-to: 6.4 Change-Id: I00eba330864c7abc31652226d55f66f4b7f44dc0 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Do not use client-side data pointers in qopenglpaintengineMikolaj Boc2022-10-212-63/+43
| | | | | | | | | | Buffers can be uploaded - no need to keep these in client memory. Decouple uploading of buffers from the creation of vao. Pick-to: 6.4 6.4.0 Fixes: QTBUG-107539 Change-Id: Idf75bd80033a44c34af6837cd4d65b75c183d886 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Replace usages of Q_CLANG_QDOC with Q_QDOCLuca Di Sera2022-10-212-2/+2
| | | | | | | | | | | | | | | | | | | | | | | To allow the user to customize the C++ code that QDoc sees, so as to be able to work-around some limitations on QDoc itself, QDoc defines two symbols: Q_QDOC and Q_CLANG_QDOC, both of which are "true" during an entire execution of QDoc. At a certain point in time, QDoc allowed the user the choice between a custom C++ parser and a Clang based one. The Q_QDOC symbol would always be defined while the Q_CLANG_QDOC symbol would be defined only when the Clang based parser was chosen. In more recent times, QDoc always uses a Clang based parser, such that both Q_CLANG_QDOC and Q_QDOC are always defined, making them equivalent. To avoid using different symbols, and the possible confusion and fragmentation that derives from it, all usages of Q_CLANG_QDOC are now replaced by the equivalent usages of Q_QDOC. Change-Id: I5810abb9ad1016a4c5bbea99acd03381b8514b3f Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Long live Q_UNREACHABLE_RETURN()!Marc Mutz2022-10-152-12/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a combination of Q_UNREACHABLE() with a return statement. ATM, the return statement is unconditionally included. If we notice that some compilers warn about return after __builtin_unreachable(), then we can map Q_UNREACHABLE_RETURN(...) to Q_UNREACHABLE() without having to touch all the code that uses explicit Q_UNREACHABLE() + return. The fact that Boost has BOOST_UNREACHABLE_RETURN() indicates that there are compilers that complain about a lack of return after Q_UNREACHABLE (we know that MSVC, ICC, and GHS are among them), as well as compilers that complained about a return being present (Coverity). Take this opportunity to properly adapt to Coverity, by leaving out the return statement on this compiler. Apply the macro around the code base, using a clang-tidy transformer rule: const std::string unr = "unr", val = "val", ret = "ret"; auto makeUnreachableReturn = cat("Q_UNREACHABLE_RETURN(", ifBound(val, cat(node(val)), cat("")), ")"); auto ignoringSwitchCases = [](auto stmt) { return anyOf(stmt, switchCase(subStmt(stmt))); }; makeRule( stmt(ignoringSwitchCases(stmt(isExpandedFromMacro("Q_UNREACHABLE")).bind(unr)), nextStmt(returnStmt(optionally(hasReturnValue(expr().bind(val)))).bind(ret))), {changeTo(node(unr), cat(makeUnreachableReturn, ";")), // TODO: why is the ; lost w/o this? changeTo(node(ret), cat(""))}, cat("use ", makeUnreachableReturn)) ); where nextStmt() is copied from some upstream clang-tidy check's private implementation and subStmt() is a private matcher that gives access to SwitchCase's SubStmt. A.k.a. qt-use-unreachable-return. There were some false positives, suppressed them with NOLINTNEXTLINE. They're not really false positiives, it's just that Clang sees the world in one way and if conditonal compilation (#if) differs for other compilers, Clang doesn't know better. This is an artifact of matching two consecutive statements. I haven't figured out how to remove the empty line left by the deletion of the return statement, if it, indeed, was on a separate line, so post-processed the patch to remove all the lines matching ^\+ *$ from the diff: git commit -am meep git reset --hard HEAD^ git diff HEAD..HEAD@{1} | sed '/^\+ *$/d' | recountdiff - | patch -p1 [ChangeLog][QtCore][QtAssert] Added Q_UNREACHABLE_RETURN() macro. Change-Id: I9782939f16091c964f25b7826e1c0dbd13a71305 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-113-4/+4
| | | | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace, with manual unstaging of the actual definition and documentation in dist/, src/corelib/doc/ and src/corelib/global/. Task-number: QTBUG-99313 Change-Id: I4c7114444a325ad4e62d0fcbfd347d2bbfb21541 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Fix broken Text rendering when noantialiased NativeRendering is usedDominik Holland2022-10-111-1/+4
| | | | | | | | | | | In case antialiasing is disabled the QFontEngine::Format_Mono is used to render in the glyph cache. In this format the padding needs to be 8-bit aligned. Fixes: QTBUG-107038 Pick-to: 6.4 6.3 6.2 5.15 Change-Id: Icf69150b6b446099ad05d706ddcab0a57f8fe0c0 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Port from container.count()/length() to size()Marc Mutz2022-10-044-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is semantic patch using ClangTidyTransformator: auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o) makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'. <classes> are: // sequential: "QByteArray", "QList", "QQueue", "QStack", "QString", "QVarLengthArray", "QVector", // associative: "QHash", "QMultiHash", "QMap", "QMultiMap", "QSet", // Qt has no QMultiSet Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix QtOpenGL tracepointsRafael Roquetto2022-09-153-5/+14
| | | | | | | | | | Make use of supported types only. As such, QOpenGL2PaintEngineExPrivate_drawTexture_entry has to be adjusted so that it does not exceed the maximum number of supported parameters by LTTNG, and thus the 'pattern' argument had to be dropped. Change-Id: I8d1c1dea7de82063926502d77dde1063b2096b73 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Defer creating the special shaders in the texture blitterLaszlo Agocs2022-09-141-18/+57
| | | | | | | | | | | | | | | | | | Port of the 5.15 change. It is not strictly required for Qt 6 since the immediate problem of failing to compile some of the shaders with some drivers will pop up much more rarely in practice, because neither Multimedia nor the backing store compositor for QOpenGLWidget/QQuickWidget use QOpenGLTextureBlitter in 6.4 and newer. To maintain the internal behavior between 5 and 6, the patch is nonetheless ported to Qt 6. It also has a performance benefit for the users of the blitter, because now the special shader variants (for rectangle or external textures) are only created when needed. Task-number: QTBUG-101396 Change-Id: I1cf4bec0c74045f4b6f94765563254026bf0b7d8 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Move qopengltimerquery.h to a common sources of the QtOpenGL moduleAlexey Edelev2022-09-131-1/+2
| | | | | | | | | | | | qopengltimerquery.h contains platform-specific guards inside the file and can be processed for any platform. Fix the issue by adding it to a commong source tree but not the header usage used since it's easier and public header can be used by user-projects directly. Task-number: QTBUG-103196 Task-number: QTBUG-87480 Change-Id: Ic01a7f2d0de56da946c2ed699a8b183f70d5f9d0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* 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>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-08-232-2/+2
| | | | | | | Task-number: QTBUG-105718 Change-Id: I5d3ef70a31235868b9be6cb479b7621bf2a8ba39 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* eglfs: Ensure correct z-order of windowsSérgio Martins2022-08-042-3/+52
| | | | | | | | | | | - The main window needs to be at the back always, since it's fullscreen. If the root window gets in front then there's no way to retrieve the secondary windows. - Qt::Tool and transient child windows go to front as in other QPAs Change-Id: I4a2793628250756bc07daaee0763ea7174a7bebd Pick-to: 6.3 6.4 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Add license headers to cmake filesLucie Gérard2022-08-032-0/+6
| | | | | | | | | | | | CMakeLists.txt and .cmake files of significant size (more than 2 lines according to our check in tst_license.pl) now have the copyright and license header. Existing copyright statements remain intact Task-number: QTBUG-88621 Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QOpenGLBuffer: add move-SMFs and swap()sMarc Mutz2022-07-202-2/+39
| | | | | | | | | | | | | | | | | | - add move special member functions (docs copied from QHostInfo) - add member swap - use move-and-swap, not pure-swap, because these objects hold resources (handles) other than just memory - Q_DECLARE_SHARED (it's not implicitly shared, but explicitly) - adds ADL swap and Q_DECLARE_TYPEINFO [ChangeLog][QtOpenGL][QOpenGLBuffer] Added member-swap(), move constructor, move assignment operator. Change-Id: I22dc92108bdd393fff4361db23e94eaf3d7ea9cc Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QOpenGLBuffer: remove unused include of QScopedPointerMarc Mutz2022-07-201-1/+0
| | | | | | | | | | Nothing in this class uses one. Pick-to: 6.4 Task-number: QTBUG-97601 Change-Id: I09397ec55ef87ddb5ab05d51c705bab83d6995fc Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>