summaryrefslogtreecommitdiffstats
path: root/src/opengl/qopenglframebufferobject.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* 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>
* Trace: Convert qtopengl module to use tracepointgen toolAntti Määttä2023-02-101-4/+14
| | | | | | | | 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>
* Long live Q_UNREACHABLE_RETURN()!Marc Mutz2022-10-151-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-111-1/+1
| | | | | | | | | | | | | | | | 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>
* Port from container.count()/length() to size()Marc Mutz2022-10-041-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Introduce float QImage formats and renderingAllan Sandfeld Jensen2021-05-261-0/+44
| | | | | | | | | Useful for some HDR representations and HDR rendering. Change-Id: If6e8a661faa3d2afdf17b6ed4d8ff5c5b2aeb30e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QOpenGLFramebufferObject: merge toImage overloadsVolker Hilsheimer2020-09-101-13/+0
| | | | | | | Address ### Qt 6 comment Change-Id: I60b1dba72dbf2490294c84e5d1a85ae7e7181fc3 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Use QList instead of QVector in openglJarek Kobus2020-06-261-4/+4
| | | | | | Task-number: QTBUG-84469 Change-Id: I26c1cfab7f2d9aa5c71847ae02bfe0cf15c04a1b Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Add more LTTNG tracing pointsJosé Dapena Paz2020-06-111-1/+6
| | | | | | | | | | | | * QImage and QPixmap copy and transform operations. * OpenGL paint engine texture cache texture upload * OpenGL paint engine draw texture Task-number: QTBUG-83347 Pick-to: 5.15 Change-Id: I03150d6ff80cbbcd787133d75854715cb81b5571 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Get rid of QT_OPENGL_ES*Eskil Abrahamsen Blomfeldt2020-04-171-2/+2
| | | | | | | | | | | The QT_OPENGL_ES* macros are leftovers from an earlier, ad hoc configuration system, which has since been replaced by QT_CONFIG. To clean things up in Qt 6, we use the new way instead. Task-number: QTBUG-83467 Change-Id: I578dc7695bff9d5ee303b22e44f60fee22fe0c28 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Move QOpenGLFrameBufferObject from QtGui to QtOpenGLJohan Klokkhammer Helsing2020-02-171-0/+1857
Task-number: QTBUG-74409 Change-Id: I817ea6f052fc61a6465d443450c8017ac5d0c0e9 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>