diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2009-08-21 10:34:46 (GMT) |
---|---|---|
committer | Samuel Rødal <sroedal@trolltech.com> | 2009-08-21 10:51:05 (GMT) |
commit | c2688467c1b9b3543627a7fbb2382a95580b2f8a (patch) | |
tree | b264320434e4c111e7d5356419ccde0e2d4447e7 | |
parent | 161b86b962f3bfb3e9663eaf3e00bd6849f03211 (diff) | |
download | Qt-c2688467c1b9b3543627a7fbb2382a95580b2f8a.zip Qt-c2688467c1b9b3543627a7fbb2382a95580b2f8a.tar.gz Qt-c2688467c1b9b3543627a7fbb2382a95580b2f8a.tar.bz2 |
Removed PBO texture upload from QGLContextPrivate::bindTexture().
The PBO code path causes a crash on certain AMD graphics cards, plus
seems to perform worse than the straight forward glTexImage2D code path
on several configurations.
Task-number: 257353
Reviewed-by: Gunnar Sletta
-rw-r--r-- | src/opengl/qgl.cpp | 44 | ||||
-rw-r--r-- | src/opengl/qgl_p.h | 1 |
2 files changed, 4 insertions, 41 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index e031fb5..af807dd 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1302,7 +1302,6 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format) #if defined(QT_OPENGL_ES) eglContext = 0; #endif - pbo = 0; fbo = 0; crWin = false; initDone = false; @@ -1646,12 +1645,6 @@ QGLContext::~QGLContext() void QGLContextPrivate::cleanup() { - Q_Q(QGLContext); - if (pbo) { - QGLContext *ctx = q; - glDeleteBuffers(1, &pbo); - pbo = 0; - } } typedef QHash<QString, GLuint> QGLDDSCache; @@ -1915,14 +1908,6 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G QGLContext *ctx = q; - bool use_pbo = false; - if (QGLExtensions::glExtensions & QGLExtensions::PixelBufferObject) { - - use_pbo = qt_resolve_buffer_extensions(ctx); - if (use_pbo && pbo == 0) - glGenBuffers(1, &pbo); - } - // the GL_BGRA format is only present in GL version >= 1.2 GLenum texture_format = (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_1_2) ? GL_BGRA : GL_RGBA; @@ -1957,20 +1942,10 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G glTexParameterf(target, GL_GENERATE_MIPMAP_SGIS, GL_TRUE); #endif glTexParameterf(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - - // Mipmap generation causes huge slowdown with PBO's for some reason - use_pbo = false; } else { glTexParameterf(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); } - uchar *ptr = 0; - if (use_pbo) { - glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, pbo); - glBufferData(GL_PIXEL_UNPACK_BUFFER_ARB, img.width() * img.height() * 4, 0, GL_STREAM_DRAW_ARB); - ptr = reinterpret_cast<uchar *>(glMapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, GL_WRITE_ONLY_ARB)); - } - QImage::Format target_format = img.format(); // Note: the clean param is only true when a texture is bound // from the QOpenGLPaintEngine - in that case we have to force @@ -1980,21 +1955,10 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G if (img.format() != target_format) img = img.convertToFormat(target_format); - if (ptr) { - QImage buffer(ptr, img.width(), img.height(), target_format); - convertToGLFormatHelper(buffer, img, texture_format); - glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB); - glTexImage2D(target, 0, format, img.width(), img.height(), 0, texture_format, - GL_UNSIGNED_BYTE, 0); - } else { - QImage tx(scale ? QSize(tx_w, tx_h) : img.size(), target_format); - convertToGLFormatHelper(tx, img, texture_format); - glTexImage2D(target, 0, format, tx.width(), tx.height(), 0, texture_format, - GL_UNSIGNED_BYTE, tx.bits()); - } - - if (use_pbo) - glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, 0); + QImage tx(scale ? QSize(tx_w, tx_h) : img.size(), target_format); + convertToGLFormatHelper(tx, img, texture_format); + glTexImage2D(target, 0, format, tx.width(), tx.height(), 0, texture_format, + GL_UNSIGNED_BYTE, tx.bits()); // this assumes the size of a texture is always smaller than the max cache size int cost = img.width()*img.height()*4/1024; diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 92aea6c..ab040ed 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -252,7 +252,6 @@ public: #endif QGLFormat glFormat; QGLFormat reqFormat; - GLuint pbo; GLuint fbo; uint valid : 1; |