summaryrefslogtreecommitdiffstats
path: root/src/opengl
Commit message (Collapse)AuthorAgeFilesLines
* Implement drawStaticTextItem() in OpenGL paint enginesEskil Abrahamsen Blomfeldt2010-01-144-54/+101
| | | | | | | | | | | | The OpenGL and OpenGL2 engines now have support for static text, as well as the QEmulationPaintEngine. Also contains an optimization: Instead of passing both the position and glyph positions to drawStaticTextItem() we add the position into the glyph position and update it only when it changes. Otherwise we would have to do this work in all engines for every call. This means we have to cache the position in QStaticTextPrivate as well, but it seems like a small price to pay, since it's a per-text overhead and only 16 bytes.
* Support transformations in drawStaticText() and optimize for spaceEskil Abrahamsen Blomfeldt2010-01-141-1/+1
| | | | | | | | | | 1. Support transformations on the painter in drawStaticText(). Transforming the painter will cause the text layout to be recalculated, except for translations, which are handled by shifting the position of the text items. 2. Make const length arrays of the internal data in QStaticTextItem in order to minimize the memory consumption.
* Optimize QStaticText for spaceEskil Abrahamsen Blomfeldt2010-01-141-1/+1
| | | | | | | | | | | By caching the results of getGlyphPositions() we can make a code path in the critical paint engines which is optimal both in space and speed. The engines where speed is of less importance (pdf engine etc.) which may need more information, we choose the slower code path of drawText() which lays out the text again. We should have optimal paths in raster, vg and GL2 paint engines. The others are less important. Memory consumption of static text is now 14 bytes per glyph, 8 bytes per item and a static overhead of 40 bytes per QStaticText object.
* Fix QGLWidget::renderPixmap() on Windows.Trond Kjernaasen2010-01-141-6/+6
| | | | | | | | Using renderPixmap() with scenes that contained textures might not work due to the wrong texture format being used under certain circumstances. Task-number: QTBUG-7213 Reviewed-by: Gunnar
* Rework how Qt handles GL extensions.Trond Kjernåsen2010-01-1315-428/+469
| | | | | | | | | | | | | | | | | | Qt used to store the GL extensions a particular implementation supported in a global cache, which was initialized once and never updated. This could cause problems because different types of context might support different kinds of extensions (e.g. the difference between sw and hw contexts). With this patch, the GL extensions are cached and updated within each QGLContext. It also makes the extension initialization lazy, which saves application initialization costs for embedded platforms. The patch introduces a internal cross platform QGLTemporaryContext class that is used to create a light-weight GL context without going via QGLWidget and friends (QWS and WinCE still have QGLWidget fallbacks for now). Reviewed-by: Kim Reviewed-by: Samuel
* Fixed tst_qgl multipleFBOInterleavedRendering.Samuel Rødal2010-01-131-1/+1
| | | | | | | | We need to clobber the vertex attribute pointers _before_ we call setState() to regenerate the clip, or we'll use invalid vertex pointers when writing the clip. Reviewed-by: Paul
* Merge remote branch 'qt/4.6' into oslo-staging-2/4.6Paul Olav Tvete2010-01-1266-71/+83
|\ | | | | | | | | Conflicts: dist/changes-4.6.1
| * Fix broken QGLWidget::renderPixmap on Mac/CarbonMorten Johan Sørvig2010-01-081-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Task: ed2a03b3bc85be056eca87928d18a746faa07bca Reviewed-by: Trond Commit ed2a03b3bc85be056eca87928d18a746faa07bca removed all QuickDraw code and made QPixmap::macQDHandle() return 0 in all cases. Unfortunately QGLWidget::renderPixmap() depended on macQDHandle returning a valid handle, causing it to break. Fix this by inserting the macQDHandle implementation were we would call macQDHandle before. This is the only place in Qt where macQDHandle is used.
| * Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt into 4.6Simon Hausmann2010-01-083-69/+70
| |\ | | | | | | | | | | | | Conflicts: src/multimedia/audio/qaudioformat.cpp
| * \ Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into ↵Qt Continuous Integration System2010-01-0766-67/+67
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4.6-integration * '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1: QIODevice: Fix readAll() Temporary hackiesh solution to prevent BOM in the xml data. Fixed qxmlstream autotest when using shadow builds. Attempt at readding the capital P headers for Phonon Remove special Phonon processing from syncqt. Use the lowercase/shortname.h headers for Phonon includes Fixes a crash when setting focus on a widget with a focus proxy. Update copyright year to 2010 doc: Clarified activeSubControls and subControls. Remove warning "statement with no effect" doc: Clarified that .lnk files are System files on Windows.
| | * | Update copyright year to 2010Jason McDonald2010-01-0666-67/+67
| | | | | | | | | | | | | | | | Reviewed-by: Trust Me
* | | | Fixed bug where QGLPixmapData::toImage() returned too dark image.Kim Motoyoshi Kalland2010-01-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QGLPixmapData::toImage() called qt_gl_read_texture() which didn't take into account that the texture was in a premultiplied format. Task-number: QTBUG-7190 Reviewed-by: Trond
* | | | Fixed justify aligned text drawing with the GL1 engine.Kim Motoyoshi Kalland2010-01-111-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The text was blurry because it wasn't pixel aligned. Fixed by using nearest-neighbour texture filtering when using only translations on the painter. Reviewed-by: Trond
* | | | Fixed subpixel antialiased text drawing with the GL2 engine.Kim Motoyoshi Kalland2010-01-111-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed bug where drawing subpixel antialiased glyphs on a translucent surface would cause all the pixels in the glyphs' bounding box to become opaque. Task-number: QTBUG-7190 Reviewed-by: Trond
* | | | Track the glVertexAttribPointer and only update it if it's changedTom Cooksey2010-01-113-34/+61
| |_|/ |/| | | | | | | | | | | | | | | | | | | | This removes a lot of unnecessary GL state changes resulting in an 18% performance boost on desktop and 5% on SGX for the 25920 3x3 solid rectangle test case. Reviewed-By: Samuel
* | | Reset the GL stencil mask, op and function in resetGLState().Trond Kjernåsen2010-01-071-0/+3
| | | | | | | | | | | | | | | Task-number: QTBUG-7203 Reviewed-by: Samuel
* | | Fixed indentation and typo.Trond Kjernåsen2010-01-071-67/+67
| | | | | | | | | | | | Reviewed-by: TrustMe
* | | Remove unnecessary call to QWidget::setAttribute().Trond Kjernåsen2010-01-071-2/+0
|/ / | | | | | | | | | | This is already done in the QGLWidget constructor. Reviewed-by: Kim
* | Revert "Add GLfloat[2][2] & GLfloat[3][3] uniform setters to QGLShaderProgram"Tom Cooksey2010-01-063-73/+3
| | | | | | | | | | | | | | | | | | | | | | We don't add new public methods in patch releases. This reverts commit 2b4d3391fd922dfc5ac28815bbd5f36c4041b658. This patch also fixes the paint engine to use glUniformMatrix3fv directly now it has been removed from 4.6. It is a 3 line change. Reviewed-By: Samuel
* | Improved initial startup time for a QGLWidget ontop of EGL/X11.Trond Kjernåsen2010-01-061-5/+111
| | | | | | | | | | | | | | Exchanged the temporary QGLWidget with a lightweight internal class. Measured on a device it can be upto 20 ms faster to construct. Reviewed-by: Tom Cooksey
* | Removed temporary QGLWidget created during QGLWidget/X11 initialization.Trond Kjernåsen2010-01-051-2/+67
| | | | | | | | | | | | ..and replace it with a much lighter, internal QGLTempContext. Reviewed-by: Samuel
* | fix compilation in GL2 paint engine for WindowsGunnar Sletta2010-01-051-0/+1
| |
* | Move QGLTextureGlyphCache into it's own fileTom Cooksey2010-01-055-240/+350
| | | | | | | | Reviewed-By: Samuel
* | Remove QGLShareRegister and transfer its functionality to QGLContextGroupRhys Weatherley2010-01-049-41/+39
| | | | | | | | | | Task-number: QT-2600 Reviewed-by: Samuel
* | Introduce new "snapToPixelGrid" flag to GL2 engine for drawTextTom Cooksey2010-01-042-5/+44
| | | | | | | | | | | | | | | | | | | | | | | | When we're rendering text, the glyphs need to be aligned to the pixel grid otherwise we get strange artifacts. Normally text is drawn at integer coordinates, however it is still possible to have a transform which translates by a non-integer offset. This patch adds a flag to the engine which can be used to snap any translate to the pixel grid. Task-number: QTBUG-7094 Reviewed-By: Kim
* | Also delete blitShader & simpleShader in ~QGLEngineSharedShadersTom Cooksey2009-12-301-0/+10
| | | | | | | | Reviewed-By: Trustme
* | fix a memory leak in QGLEngineSharedShadersjianliang792009-12-302-0/+8
| | | | | | | | | | Merge-request: 412 Reviewed-by: Tom Cooksey <thomas.cooksey@nokia.com>
* | Fixed QGLWidget::renderText().Trond Kjernaasen2009-12-303-109/+13
| | | | | | | | | | | | | | | | | | | | | | Fall back and use the GL 1 engine for the renderText() functions. Getting it to work with the GL 2 engine is a futile effort. Making it work with renderPixmap() in the GL 2 engine is not possible at all, since software contexts in general do not support shader programs. Task-number: QTBUG-5002, QTBUG-6931 Reviewed-by: Kim
* | Remove superfluous enable/disable vertex arrtib arraysTom Cooksey2009-12-301-34/+0
| | | | | | | | | | | | | | | | | | | | | | Now that the shader manager takes care of enabling/disabling the vertex attribute arrays for us, the GL2 paint engine doesn't have to do it. This reduces GL state changes within the paint engine and provides significant performance improvements. For a given test case (25,000 3x3px solid rects), the improvement is 67% on desktop (nVidia) and 9% on embedded (SGX). Reviewed-By: Kim
* | Track which vertex attrib arrays are enabled in QGLContextPrivateTom Cooksey2009-12-306-5/+79
|/ | | | | | | | | | | | | The GL2 engine (and probably Qt/3D) needs to track which vertex attribute arrays are currently enabled and which are disabled. As this is per-context state, the logical place to track this is in the context and not in the paint engine. This patch also makes the GL2 engine's shader manager enable/disable the appropriate attribute arrays for a given shader program when it is used. Reviewed-By: Kim
* Remove pointless const's from functions (internal API)Tom Cooksey2009-12-292-4/+4
| | | | | | | This change is in response to the review for b063135, but was missed from that patch. Reviewed-By: Kim
* Lots of mostly cosmetic cleanups to GL2 paint engineTom Cooksey2009-12-284-138/+133
| | | | | | | | | | | | | | | * Move most of drawPixmaps to private * Move most of stroke to private * Remove dead code: context() * Make optimiseForBrushTransform use xform type * Use GLuint for uniform location * Rename lastTexture -> lastTextureUsed * Move qopengl2paintengine_cleanup_vectorpath to private * Re-ordered declarations in header * Remove dead temporaryTransform * Rename use_system_clip -> useSystemClip Reviewed-By: Kim
* Move the 0.5 offset we add for aliased rendering to updateMatrix()Tom Cooksey2009-12-282-33/+47
| | | | | | | | | | | The old code set and unset a temporary matrix for every draw command when doing aliased rendering. Instead, we just use a flag to indicate that updateMatrix() should add the offset. This means the offset is added only once. When doing lots of small rendering operations on a (non-multisampled) QGLWidget, this gives up to 72% performance boost on the SGX. Reviewed-By: Kim
* Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into ↵Qt Continuous Integration System2009-12-272-5/+11
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4.6-integration * '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2: revert f36fb8b2b63b3734cc2bd66b329ca4fef1204845 Read QWS_SIZE from layer rather than screen Get rid of no_cast_from_ascii warning Docs: Amendments to latest changes to QImageReader docs. images: Document QImageReader::loopCount behaviour for infinite loops gif: Add unit test for QImageReader::size calls gif: 10% speedup on microbenchmark on QImageReader png: Avoid calling QImage::scanLine(int) from within a loop QImageReader: Avoid errorString creation in the normal case Fix text rendering on GL2 paint engine
| * Fix text rendering on GL2 paint engineTom Cooksey2009-12-232-5/+11
| | | | | | | | | | | | | | | | | | | | | | If you draw with a brush, then draw a pixmap, then draw with the same brush, the GL2 engine wouldn't update the fragment shader to use the brush. This is because it detected the brush hadn't changed and so didn't need updating. To fix this, we now set the current brush to noBrush when drawing an image/pixmap so the engine knows it needs to update the GL state for the brush. Reviewed-By: Kim
* | Merge branch '4.5' into 4.6-stagingThiago Macieira2009-12-261-3/+11
|\ \ | |/ |/| | | | | Conflicts: tests/benchmarks/benchmarks.pro
| * Fix memory leak of QGLGlyphCoord objects in the OpenGL1 paint engineRhys Weatherley2009-12-201-3/+11
| | | | | | | | | | Task-number: QTBUG-6936 Reviewed-by: Julian de Bhal
* | Use 3x3 PMV matrices rather than 4x4 in the GL2 engineTom Cooksey2009-12-223-64/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | QGraphicsView based applications will set a new transform for every item before it's painted. This leads to lots of updates to the PMV matrix. So switching to a 3x3 rather than a 4x4 gives us less data to pass to GL for each QGraphicsItem which gets rendered. It also means the vertex shader is more efficient. However, this patch only gives a maximum 2.5% speed improvement on the SGX, which seems to be only due to the faster vertex shader rather than the reduced amount of data we pass to GL. Reviewed-By: Kim
* | Handle broken shaders better in the GL2 engine's shader managerTom Cooksey2009-12-221-77/+114
| | | | | | | | | | | | | | The shader manager will now a) not seg-fault and b) actually tell you which shader has the error. Reviewed-By: Kim
* | Add GLfloat[2][2] & GLfloat[3][3] uniform setters to QGLShaderProgramTom Cooksey2009-12-222-0/+71
| | | | | | | | Reviewed-By: Rhys Weatherley
* | Prevent access to non-existent memory in triagulating strokerRhys Weatherley2009-12-181-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | In the triangulating stroker, the last point was being duplicated in dashed paths. But because QDataBuffer::add() takes a ref to a float rather than a float, it would resize the data buffer and then try to fetch the values out of a pointer to the original buffer memory. This change copies the values into temporary variables before resizing the array. Task-number: QTBUG-6045 Reviewed-by: Sarah Smith
* | Align GL_RGB lines on a 4-byte boundary when uploading pixmap texturesRhys Weatherley2009-12-181-13/+2
| | | | | | | | | | | | | | Previous code was aligning lines on a 3-byte boundary. Task-number: QTBUG-6902 Reviewed-by: Julian de Bhal
* | GL2Engine: Don't mark brush as dirty if it hasn't changedTom Cooksey2009-12-173-34/+41
| | | | | | | | | | | | | | | | If the same brush is used over and over again, this gives a huge performance boost (measured to be 25% faster on desktop and 73% faster on SGX). Reviewed-By: Samuel Rødal
* | Update FBO docs to describe how QPainter changes the GL stateRhys Weatherley2009-12-171-0/+6
| | | | | | | | | | | | | | | | | | Using a QPainter on a QGLFramebufferObject will not return the GL context to its original conditions, especially with the OpenGL2 paint engine. Update the docs to make this clearer. Task-number: QTBUG-6712 Reviewed-by: Daniel Pope
* | Disable depth testing during the 2D QGLWidget::renderText()Rhys Weatherley2009-12-171-0/+12
| | | | | | | | | | | | | | | | Also document the depth testing conditions for the 2D and 3D versions of the function. Task-number: QTBUG-5041 Reviewed-by: Daniel Pope
* | Fix EGL surface leaks when re-parenting QGLWidget on X11/EGLTom Cooksey2009-12-154-13/+28
| | | | | | | | | | | | | | | | | | | | | | | | When a QGLWidget is re-parented, it's native X11 window usually gets destroyed and re-created. This also happens when you set a window attribute or flag. On EGL, we must destroy the surface for the window before destroying the window itself, otherwise we can leak the surface. This also fixes lots of BadDrawable errors when running the autotests (which were due to surface leaks!). Reviewed-By: TrustMe
* | Fix QGLWidgets created with an alpha channel on X11/EGLTom Cooksey2009-12-151-1/+1
| | | | | | | | | | | | | | | | If the QGLWidget's QGLFormat says it should have an alpha channel, try to find an ARGB Visual. Reviewed-By: Trond Task-number: QT-2602
* | Add QT_DEBUG_X11_VISUAL_SELECTION to aid debugging X11/EGLTom Cooksey2009-12-151-15/+31
| |
* | Got rid of unused variable compiler warning.Samuel Rødal2009-12-151-2/+0
| |
* | Optimized blur / drop shadow effects for the GL 2 paint engine.Samuel Rødal2009-12-144-602/+198
| | | | | | | | | | | | | | | | | | Do the blur in half the resolution in software and then upload the result as a texture and smooth-scale it on the GPU. This leads to stable and decent performance regardless of the blur radius, and simplifies the implementation quite a bit. Reviewed-by: Bjørn Erik Nilsen