From 4a170df50364f5c6f70fef826bb2b7b121e54674 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B6glund?= Date: Sat, 4 Dec 2010 16:55:43 +0000 Subject: [PATCH] Revert to always calling glXBindTexImageEXT() before rendering. The GLX implementation in the X server appears to have a hardcoded limit to how many pixmaps can be bound to textures simultaneously when using indirect rendering, which we can end up exceeding with the changes introduced in r1182198. BUG: 256359 FIXED-IN: 4.5.5 svn path=/trunk/KDE/kdebase/workspace/; revision=1203578 --- scene_opengl.cpp | 29 ++++++++++++++--------------- scene_opengl.h | 1 - 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/scene_opengl.cpp b/scene_opengl.cpp index 5fc5fc29af..a5277001ca 100644 --- a/scene_opengl.cpp +++ b/scene_opengl.cpp @@ -1006,7 +1006,6 @@ SceneOpenGL::Texture::~Texture() void SceneOpenGL::Texture::init() { - damaged = true; glxpixmap = None; } @@ -1026,7 +1025,8 @@ void SceneOpenGL::Texture::release() { if( tfp_mode && glxpixmap != None ) { - glXReleaseTexImageEXT( display(), glxpixmap, GLX_FRONT_LEFT_EXT ); + if ( !options->glStrictBinding ) + glXReleaseTexImageEXT( display(), glxpixmap, GLX_FRONT_LEFT_EXT ); glXDestroyPixmap( display(), glxpixmap ); glxpixmap = None; } @@ -1155,9 +1155,6 @@ bool SceneOpenGL::Texture::load( const Pixmap& pix, const QSize& size, if( !options->glStrictBinding ) glXBindTexImageEXT( display(), glxpixmap, GLX_FRONT_LEFT_EXT, NULL ); } - if( options->glStrictBinding ) - // Mark the texture as damaged so it will be updated on the next call to bind() - damaged = true; } else if( shm_mode ) { // copy pixmap contents to a texture via shared memory @@ -1295,17 +1292,12 @@ void SceneOpenGL::Texture::bind() { glEnable( mTarget ); glBindTexture( mTarget, mTexture ); - if( tfp_mode ) + if( tfp_mode && options->glStrictBinding ) { - if ( options->glStrictBinding && damaged ) - { - // Update the texture with the new pixmap contents - assert( glxpixmap != None ); - glXReleaseTexImageEXT( display(), glxpixmap, GLX_FRONT_LEFT_EXT ); - glXBindTexImageEXT( display(), glxpixmap, GLX_FRONT_LEFT_EXT, NULL ); - setDirty(); // Mipmaps have to be regenerated after updating the texture - } - damaged = false; + assert( glxpixmap != None ); + glXReleaseTexImageEXT( display(), glxpixmap, GLX_FRONT_LEFT_EXT ); + glXBindTexImageEXT( display(), glxpixmap, GLX_FRONT_LEFT_EXT, NULL ); + setDirty(); // Mipmaps have to be regenerated after updating the texture } enableFilter(); if( hasGLVersion( 1, 4, 0 )) @@ -1321,6 +1313,13 @@ void SceneOpenGL::Texture::unbind() { glTexEnvf( GL_TEXTURE_FILTER_CONTROL, GL_TEXTURE_LOD_BIAS, 0.0f ); } + if( tfp_mode && options->glStrictBinding ) + { + assert( glxpixmap != None ); + glBindTexture( mTarget, mTexture ); + glXReleaseTexImageEXT( display(), glxpixmap, GLX_FRONT_LEFT_EXT ); + } + GLTexture::unbind(); } diff --git a/scene_opengl.h b/scene_opengl.h index 58621ffb63..34693b4d8e 100644 --- a/scene_opengl.h +++ b/scene_opengl.h @@ -126,7 +126,6 @@ class SceneOpenGL::Texture void init(); GLXPixmap glxpixmap; // the glx pixmap the texture is bound to, only for tfp_mode - bool damaged; }; class SceneOpenGL::Window