Skip to content

Commit 8f67d90

Browse files
Pauli JarvinenPasi Pentikäinen
Pauli Jarvinen
authored and
Pasi Pentikäinen
committed
Performance fix for OpenGL drawing
Excessive calling of glFlush() was causing a performance problem when QML application was being run in the OpenGL graphics mode. There was an unnecessary call to glFlush() in the function QGLWindowSurfaceGLPaintDevice::endPaint(). This function gets called each time a QPainter instance is destroyed, which may happen several times per each painted screen frame (at least 4 times per frame can easily happen). Calling glFlush() from endPaint() is not necessary at all since it will be anyway called from QGLWindowSurface::flush() (either directly if single-buffered context is used or indirectly by swapping buffers if double-buffered context is used). Task-number: ou1cimx1#957423 Change-Id: I89509d8935ad31cc47bfed41a1900b6bb76c2af8 Reviewed-by: Gunnar Sletta <[email protected]> Reviewed-by: Pasi Pentikäinen <[email protected]> (cherry picked from commit a56ff23)
1 parent d254d27 commit 8f67d90

File tree

2 files changed

+0
-7
lines changed

2 files changed

+0
-7
lines changed

src/opengl/qwindowsurface_gl.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -321,12 +321,6 @@ struct QGLWindowSurfacePrivate
321321
QGLFormat QGLWindowSurface::surfaceFormat;
322322
QGLWindowSurface::SwapMode QGLWindowSurface::swapBehavior = QGLWindowSurface::AutomaticSwap;
323323

324-
void QGLWindowSurfaceGLPaintDevice::endPaint()
325-
{
326-
glFlush();
327-
QGLPaintDevice::endPaint();
328-
}
329-
330324
QSize QGLWindowSurfaceGLPaintDevice::size() const
331325
{
332326
return d->size;

src/opengl/qwindowsurface_gl_p.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ class QGLWindowSurfaceGLPaintDevice : public QGLPaintDevice
7474
{
7575
public:
7676
QPaintEngine* paintEngine() const;
77-
void endPaint();
7877
QSize size() const;
7978
int metric(PaintDeviceMetric m) const;
8079
QGLContext* context() const;

0 commit comments

Comments
 (0)