From cf3bcc629400ef646e3f3a2806d6f9bf169361cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Sun, 13 Jun 2010 07:40:21 +0000 Subject: [PATCH] Try to get a FBO in the init method of GLRenderTarget. If the FBO is incomplete there is no need to claim that the driver supports FBO. This is a workaround to the problem that some drivers do not return a complete FBO, but support the extension. Which caused the blur effect to get loaded without working and in consequence Plasma to use the blur-optimized and very translucent backgrounds. CCBUG: 240956 svn path=/trunk/KDE/kdebase/workspace/; revision=1137490 --- lib/kwinglutils.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/kwinglutils.cpp b/lib/kwinglutils.cpp index 721e3284cd..3ec98028d0 100644 --- a/lib/kwinglutils.cpp +++ b/lib/kwinglutils.cpp @@ -971,6 +971,26 @@ bool GLRenderTarget::mSupported = false; void GLRenderTarget::initStatic() { mSupported = hasGLExtension("GL_EXT_framebuffer_object") && glFramebufferTexture2D; + if( mSupported ) + { + // some drivers claim to support the extension, but fail to return a complete FBO (see Bug 240956) + // generate a FBO and test if it is valid. If it isn't valid there's no need to claim that FBO's are supported + int w = displayWidth(); + int h = displayHeight(); + if ( !GLTexture::NPOTTextureSupported() ) + { + w = nearestPowerOfTwo( w ); + h = nearestPowerOfTwo( h ); + } + GLTexture* tex = new GLTexture( w, h ); + tex->setFilter( GL_LINEAR ); + tex->setWrapMode( GL_CLAMP_TO_EDGE ); + GLRenderTarget* target = new GLRenderTarget( tex ); + if( !target->valid() ) + mSupported = false; + delete target; + delete tex; + } } GLRenderTarget::GLRenderTarget(GLTexture* color)