summaryrefslogtreecommitdiffstats
path: root/src/opengl/qopenglpaintengine.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Q*PaintEngineState: use canonical signature for the copy constructorGiuseppe D'Angelo2025-01-121-1/+1
| | | | | | | | I'm not sure why this code had copy constructors taking by non-const reference. Add the missing const. Change-Id: Ie6d1cb6eab7b829a59e21f1874b041a00a52d1e9 Reviewed-by: Allan Sandfeld Jensen <[email protected]>
* Replace QPair/qMakePair with std::pair in qtbase/openglIsak Fyksen2024-11-211-1/+1
| | | | | | Task-number: QTBUG-115841 Change-Id: Ic7a362a41fb52d39d8a168f0ba4ed6d33458dd73 Reviewed-by: Matthias Rauter <[email protected]>
* Avoid incomplete textures in GL paint engineLaszlo Agocs2023-03-021-11/+29
| | | | | | | | | | | | | | | | | | | | | | ...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 <[email protected]>
* 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 <[email protected]>
* Trace: Convert qtopengl module to use tracepointgen toolAntti Määttä2023-02-101-12/+4
| | | | | | | | Pick-to: 6.5 Change-Id: I441455a4d49a559fb591ea5c8cffb97af66fb2b1 Reviewed-by: Hatem ElKharashy <[email protected]> Reviewed-by: Tomi Korpipää <[email protected]> Reviewed-by: Janne Koskinen <[email protected]>
* Do not use client-side data pointers in qopenglpaintengineMikolaj Boc2022-10-211-24/+23
| | | | | | | | | | 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 <[email protected]>
* Fix QtOpenGL tracepointsRafael Roquetto2022-09-151-1/+10
| | | | | | | | | | 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 <[email protected]>
* Fix typos in docs and commentsKai Köhne2022-06-151-1/+1
| | | | | | | | | Found by codespell Pick-to: 6.4 Change-Id: Ie3e301a23830c773a2e9aff487c702a223d246eb Reviewed-by: Nicholas Bennett <[email protected]> Reviewed-by: Edward Welbourne <[email protected]>
* Support cosmetic brush patterns in the pdf and opengl paint enginesEirik Aavitsland2022-06-041-5/+20
| | | | | | | | | | | | | | | | | | This implements the recent functionality extension of painting cosmetic (untransformed) brush patterns, and the corresponding NonCosmeticBrushPatterns render hint, in the pdf and opengl paint engines. As part of the implementation it also fixes a couple of pre-existing bugs in the opengl engine, relating to updating the brush after changes in transformation or brush origin. As a driveby, it also includes a minor fix for the lance testing tool: request stencil buffer, as that is needed and not always provided by default. This echoes a recent fix done to tst_baseline_painting. Change-Id: Ia8811477e015eebeb40ed138bca96643ce1ab0dc Reviewed-by: Allan Sandfeld Jensen <[email protected]>
* 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 <[email protected]> Reviewed-by: Lars Knoll <[email protected]> Reviewed-by: Jörg Bornemann <[email protected]>
* QtOpenGL: Fix build with GCC 12: qt_imageForBrush is in QtGuiThiago Macieira2022-04-221-1/+1
| | | | | | | | /usr/bin/ld: lib/libQt6OpenGL.t.so.6.4.0: protected symbol `_Z16qt_imageForBrushib' isn't defined Pick-to: 6.2 6.3 Change-Id: If05aeeb7176e4f13af9afffd16e845af9638337b Reviewed-by: Giuseppe D'Angelo <[email protected]>
* Fix painting clipping glitches with fractional scalingEirik Aavitsland2022-03-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In QPainter, clipping can only be done on whole pixels. The various ways of specifying a clipping rectangle to the QPainter API have been inconsistent in how fractional rectangles (either specified directly, or as a result of fractional scaling) are mapped (rounded) to integer coordinates. Also, the mappings have not made sure to keep the edge-to-edge property of clip rects under scaling. This is particularly important when scaling QRegions with multiple rects, as QRegion is designed on the assumption that an area can be described as a set of edge-to-edge rects. The fix rounds a clip rect identically with a fill rect. (Indeed, a followup plan would be to merge QRasterPaintEngine's toNormalizedFillRect() with the rectangle rounding function in this commit). Notably, a QRectF clip is now interpreted the same as a QPainterPath clip describing the same area. This modifies d9cc1499954829faf9486fb72056e29f1bad58e3 Task-number: QTBUG-100329 Fixes: QTBUG-95957 Task-number: QTBUG-100343 Pick-to: 6.3 Change-Id: Iaae6464b9b17f8bf3adc69007f6ef8d623bf2c80 Reviewed-by: Volker Hilsheimer <[email protected]>
* Add some debug warnings to the GL paint engine regarding stencilLaszlo Agocs2021-09-231-0/+8
| | | | | | | | | | | There is absolutely nothing we can do if the render target has no stencil buffer, but print at least a warning in debug builds to give a hint to the developer. Pick-to: 6.2 Task-number: QTBUG-96786 Change-Id: If7f84f28f9bc9b3dadd01d0816c8db4015a1db0b Reviewed-by: Volker Hilsheimer <[email protected]>
* Introduce float QImage formats and renderingAllan Sandfeld Jensen2021-05-261-0/+2
| | | | | | | | | Useful for some HDR representations and HDR rendering. Change-Id: If6e8a661faa3d2afdf17b6ed4d8ff5c5b2aeb30e Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Tor Arne Vestbø <[email protected]> Reviewed-by: Lars Knoll <[email protected]>
* Disable spurious MSVC warning C4273 in Qt Gui, Qt OpenGLKai Köhne2021-05-031-0/+10
| | | | | | | | | | | | For optimized/release builds, cl 19.28 produces some false positive "potential divide by 0" warnings even for code where no valid code path can lead to such a division. Fixes: QTBUG-92940 Pick-to: 6.1 Change-Id: I461f9104d7b9dc2d74839bf30bebb2b9d4cf2db3 Reviewed-by: Friedemann Kleint <[email protected]> Reviewed-by: Eirik Aavitsland <[email protected]>
* Implement vertical subpixel positioning where availableEskil Abrahamsen Blomfeldt2021-01-251-6/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For some use cases, vertical subpixel positioning may be useful, as it allows you to vertically align text with other painting primitives. This does impose an overhead, so we make it opt-int with a render hint on the painter. Note that this is only supported on Freetype currently. It might be possible to support on older macOS versions, prior to Mojave (which has disabled subpixel positioning entirely), but since it would have limited usefulness and Freetype is cross-platform anyway, I skipped that. Note: This drive-by-fixes an issue with subpixel positioning where glyphs would always be offset by 1/64, because we added the aliasing offset *after* we had determined the closest subpixel position. The idea of this, as far as I can understand, is rather to snap to nearest subpixel position upwards, not to add an offset to all glyphs, so it should be added before finding the correct position. It had a subtle visual effect when animating the position. It might be that we could get rid of it entirely, as I haven't been able to reproduce any issues with that, but I have moved it instead, to match what I believe the intention was. [ChangeLog][QtGui][Text] Added render hint flag QPainter::VerticalSubpixelPositioning which will position text at subpixel positions vertically whenever supported. In absence of this, text position will be rounded vertically as before. Fixes: QTBUG-35682 Change-Id: I8ce7a72a64e5a0924dac7c244e3e07c2938bfd09 Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Allan Sandfeld Jensen <[email protected]>
* Remove Qt4Compatible paintingAllan Sandfeld Jensen2020-11-121-2/+2
| | | | | Change-Id: Ie54206ca9b509875568f2158e229fca9cb1860a2 Reviewed-by: Lars Knoll <[email protected]>
* Fix floating point clip rectangle rounding in raster and opengl paint engineJani Hautakangas2020-07-071-1/+1
| | | | | | | Fixes: QTBUG-83229 Pick-to: 5.15 Change-Id: If94028f27c9085e391acb9c423cde1b7c12bca36 Reviewed-by: Eskil Abrahamsen Blomfeldt <[email protected]>
* Add more LTTNG tracing pointsJosé Dapena Paz2020-06-111-0/+4
| | | | | | | | | | | | * 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 <[email protected]> Reviewed-by: Eirik Aavitsland <[email protected]>
* Remove a bunch of deprecated members from src/gui/painting classesVolker Hilsheimer2020-05-061-8/+1
| | | | | | | | Also remove dead code that isn't compiled anymore in Qt 6 builds. Change-Id: I7a7ae35e61fb2ad9cc21180fb7224357ade1505f Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Eirik Aavitsland <[email protected]>
* Get rid of QT_OPENGL_ES*Eskil Abrahamsen Blomfeldt2020-04-171-6/+6
| | | | | | | | | | | 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 <[email protected]>
* Move QOpenGLPaintEngine and related classes from QtGui to QtOpenGLJohan Klokkhammer Helsing2020-01-221-0/+2702
Also moves the openglwindow test to the opengl folder, as it makes use of these classes. Task-number: QTBUG-74409 Change-Id: Id9f0013cedcc8bd1e87122c005641d7298525045 Reviewed-by: Laszlo Agocs <[email protected]>