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

View File

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