ShaderEffect not available in OpenGL ES.

Deprecate the ShaderEffect, will probably be dropped in 4.7
icc-effect-5.14.5
Martin Gräßlin 2010-11-20 10:35:49 +01:00
parent 2cf5f79880
commit 2db7538891
2 changed files with 16 additions and 0 deletions

View File

@ -55,6 +55,9 @@ bool ShaderEffect::loadData(const QString& shadername)
{ {
#ifndef KWIN_HAVE_OPENGL_COMPOSITING #ifndef KWIN_HAVE_OPENGL_COMPOSITING
return false; return false;
#else
#ifdef KWIN_HAVE_OPENGLES
return false;
#else #else
// If NPOT textures are not supported, use nearest power-of-two sized // If NPOT textures are not supported, use nearest power-of-two sized
// texture. It wastes memory, but it's possible to support systems without // texture. It wastes memory, but it's possible to support systems without
@ -97,17 +100,22 @@ bool ShaderEffect::loadData(const QString& shadername)
return true; return true;
#endif #endif
#endif
} }
bool ShaderEffect::supported() bool ShaderEffect::supported()
{ {
#ifndef KWIN_HAVE_OPENGL_COMPOSITING #ifndef KWIN_HAVE_OPENGL_COMPOSITING
return false; return false;
#else
#ifdef KWIN_HAVE_OPENGLES
return false;
#else #else
return GLRenderTarget::supported() && return GLRenderTarget::supported() &&
GLShader::fragmentShaderSupported() && GLShader::fragmentShaderSupported() &&
(effects->compositingType() == OpenGLCompositing); (effects->compositingType() == OpenGLCompositing);
#endif #endif
#endif
} }
bool ShaderEffect::isEnabled() const bool ShaderEffect::isEnabled() const
@ -131,12 +139,14 @@ void ShaderEffect::prePaintScreen( ScreenPrePaintData& data, int time )
{ {
mTime += time / 1000.0f; mTime += time / 1000.0f;
#ifdef KWIN_HAVE_OPENGL_COMPOSITING #ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifndef KWIN_HAVE_OPENGLES
if( mValid && mEnabled ) if( mValid && mEnabled )
{ {
data.mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS; data.mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS;
// Start rendering to texture // Start rendering to texture
effects->pushRenderTarget(mRenderTarget); effects->pushRenderTarget(mRenderTarget);
} }
#endif
#endif #endif
effects->prePaintScreen(data, time); effects->prePaintScreen(data, time);
@ -148,6 +158,7 @@ void ShaderEffect::postPaintScreen()
effects->postPaintScreen(); effects->postPaintScreen();
#ifdef KWIN_HAVE_OPENGL_COMPOSITING #ifdef KWIN_HAVE_OPENGL_COMPOSITING
#ifndef KWIN_HAVE_OPENGLES
if( mValid && mEnabled ) if( mValid && mEnabled )
{ {
// Disable render texture // Disable render texture
@ -174,6 +185,7 @@ void ShaderEffect::postPaintScreen()
mTexture->unbind(); mTexture->unbind();
} }
#endif #endif
#endif
} }
} // namespace } // namespace

View File

@ -35,6 +35,10 @@ namespace KWin
class GLTexture; class GLTexture;
class GLRenderTarget; class GLRenderTarget;
class GLShader; class GLShader;
/**
* Unsupported in OpenGL ES
* @deprecated Use a normal Shader
*/
class KWIN_EXPORT ShaderEffect : public Effect class KWIN_EXPORT ShaderEffect : public Effect
{ {
public: public: