From 382d5b15d3f8ac921ea238d3b317d446c0b924fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 1 Nov 2010 12:09:53 +0000 Subject: [PATCH] Ignore Paint Clipper when rendering to FBO. See Review Request http://svn.reviewboard.kde.org/r/4329/ svn path=/trunk/KDE/kdebase/workspace/; revision=1191903 --- effects.cpp | 9 +++++++++ effects.h | 1 + lib/kwineffects.cpp | 5 +++-- lib/kwineffects.h | 3 ++- lib/kwinglutils.cpp | 18 ++++++++++++++---- 5 files changed, 29 insertions(+), 7 deletions(-) diff --git a/effects.cpp b/effects.cpp index 56c4b5b8d8..14d7a6b2b8 100644 --- a/effects.cpp +++ b/effects.cpp @@ -784,6 +784,15 @@ GLRenderTarget* EffectsHandlerImpl::popRenderTarget() #endif } +bool EffectsHandlerImpl::isRenderTargetBound() + { +#ifdef KWIN_HAVE_OPENGL_COMPOSITING + return !render_targets.isEmpty(); +#else + return false; +#endif + } + void EffectsHandlerImpl::addRepaintFull() { Workspace::self()->addRepaintFull(); diff --git a/effects.h b/effects.h index 8a0fa7b0e6..ab07abe9bd 100644 --- a/effects.h +++ b/effects.h @@ -110,6 +110,7 @@ class EffectsHandlerImpl : public EffectsHandler virtual void pushRenderTarget(GLRenderTarget* target); virtual GLRenderTarget* popRenderTarget(); + virtual bool isRenderTargetBound(); virtual void addRepaintFull(); virtual void addRepaint( const QRect& r ); diff --git a/lib/kwineffects.cpp b/lib/kwineffects.cpp index 67c33f3dd7..e2e5b60b63 100644 --- a/lib/kwineffects.cpp +++ b/lib/kwineffects.cpp @@ -844,7 +844,8 @@ PaintClipper::Iterator::Iterator() if( clip() && effects->compositingType() == OpenGLCompositing ) { glPushAttrib( GL_SCISSOR_BIT ); - glEnable( GL_SCISSOR_TEST ); + if( !effects->isRenderTargetBound() ) + glEnable( GL_SCISSOR_TEST ); data->rects = paintArea().rects(); data->index = -1; next(); // move to the first one @@ -892,7 +893,7 @@ void PaintClipper::Iterator::next() { data->index++; #ifdef KWIN_HAVE_OPENGL_COMPOSITING - if( clip() && effects->compositingType() == OpenGLCompositing && data->index < data->rects.count()) + if( clip() && effects->compositingType() == OpenGLCompositing && !effects->isRenderTargetBound() && data->index < data->rects.count()) { const QRect& r = data->rects[ data->index ]; // Scissor rect has to be given in OpenGL coords diff --git a/lib/kwineffects.h b/lib/kwineffects.h index 7bb7c995a9..40e7922a84 100644 --- a/lib/kwineffects.h +++ b/lib/kwineffects.h @@ -171,7 +171,7 @@ X-KDE-Library=kwin4_effect_cooleffect #define KWIN_EFFECT_API_MAKE_VERSION( major, minor ) (( major ) << 8 | ( minor )) #define KWIN_EFFECT_API_VERSION_MAJOR 0 -#define KWIN_EFFECT_API_VERSION_MINOR 155 +#define KWIN_EFFECT_API_VERSION_MINOR 156 #define KWIN_EFFECT_API_VERSION KWIN_EFFECT_API_MAKE_VERSION( \ KWIN_EFFECT_API_VERSION_MAJOR, KWIN_EFFECT_API_VERSION_MINOR ) @@ -757,6 +757,7 @@ class KWIN_EXPORT EffectsHandler virtual void pushRenderTarget(GLRenderTarget* target) = 0; virtual GLRenderTarget* popRenderTarget() = 0; + virtual bool isRenderTargetBound() = 0; /** * Schedules the entire workspace to be repainted next time. diff --git a/lib/kwinglutils.cpp b/lib/kwinglutils.cpp index e9faa5fd0c..4b05764e9e 100644 --- a/lib/kwinglutils.cpp +++ b/lib/kwinglutils.cpp @@ -174,10 +174,20 @@ void renderGLGeometry( const QRegion& region, int count, } // Clip using scissoring - PaintClipper pc( region ); - for( PaintClipper::Iterator iterator; - !iterator.isDone(); - iterator.next()) + if( !effects->isRenderTargetBound() ) + { + PaintClipper pc( region ); + for( PaintClipper::Iterator iterator; + !iterator.isDone(); + iterator.next()) + { + if( use_arrays ) + glDrawArrays( GL_QUADS, 0, count ); + else + renderGLGeometryImmediate( count, vertices, texture, color, dim, stride ); + } + } + else { if( use_arrays ) glDrawArrays( GL_QUADS, 0, count );