Use GLSL 1.40 shaders as GLSL 300 es shaders for effects

Like for the scene shaders. Makes the effects work again when using
GLES 3.
This commit is contained in:
Martin Gräßlin 2013-05-23 09:55:16 +02:00
parent 5c78f7eabe
commit 4f2f8bda11
4 changed files with 24 additions and 12 deletions

View file

@ -68,10 +68,13 @@ CoverSwitchEffect::CoverSwitchEffect()
captionFont.setPointSize(captionFont.pointSize() * 2);
QString shadersDir = "kwin/shaders/1.10/";
#ifndef KWIN_HAVE_OPENGLES
if (GLPlatform::instance()->glslVersion() >= kVersionNumber(1, 40))
shadersDir = "kwin/shaders/1.40/";
#ifdef KWIN_HAVE_OPENGLES
const qint64 coreVersionNumber = kVersionNumber(3, 0);
#else
const qint64 coreVersionNumber = kVersionNumber(1, 40);
#endif
if (GLPlatform::instance()->glslVersion() >= coreVersionNumber)
shadersDir = "kwin/shaders/1.40/";
const QString fragmentshader = KGlobal::dirs()->findResource("data", shadersDir + "coverswitch-reflection.glsl");
m_reflectionShader = ShaderManager::instance()->loadFragmentShader(ShaderManager::GenericShader, fragmentshader);
connect(effects, SIGNAL(windowClosed(KWin::EffectWindow*)), this, SLOT(slotWindowClosed(KWin::EffectWindow*)));

View file

@ -100,10 +100,13 @@ CubeEffect::CubeEffect()
desktopNameFont.setBold(true);
desktopNameFont.setPointSize(14);
#ifndef KWIN_HAVE_OPENGLES
if (GLPlatform::instance()->glslVersion() >= kVersionNumber(1, 40))
m_shadersDir = "kwin/shaders/1.40/";
#ifdef KWIN_HAVE_OPENGLES
const qint64 coreVersionNumber = kVersionNumber(3, 0);
#else
const qint64 coreVersionNumber = kVersionNumber(1, 40);
#endif
if (GLPlatform::instance()->glslVersion() >= coreVersionNumber)
m_shadersDir = "kwin/shaders/1.40/";
const QString fragmentshader = KGlobal::dirs()->findResource("data", m_shadersDir + "cube-reflection.glsl");
m_reflectionShader = ShaderManager::instance()->loadFragmentShader(ShaderManager::GenericShader, fragmentshader);

View file

@ -73,10 +73,13 @@ bool InvertEffect::loadData()
m_inited = true;
QString shadersDir = "kwin/shaders/1.10/";
#ifndef KWIN_HAVE_OPENGLES
if (GLPlatform::instance()->glslVersion() >= kVersionNumber(1, 40))
shadersDir = "kwin/shaders/1.40/";
#ifdef KWIN_HAVE_OPENGLES
const qint64 coreVersionNumber = kVersionNumber(3, 0);
#else
const qint64 coreVersionNumber = kVersionNumber(1, 40);
#endif
if (GLPlatform::instance()->glslVersion() >= coreVersionNumber)
shadersDir = "kwin/shaders/1.40/";
const QString fragmentshader = KGlobal::dirs()->findResource("data", shadersDir + "invert.frag");
m_shader = ShaderManager::instance()->loadFragmentShader(ShaderManager::GenericShader, fragmentshader);

View file

@ -117,10 +117,13 @@ bool LookingGlassEffect::loadData()
}
QString shadersDir = "kwin/shaders/1.10/";
#ifndef KWIN_HAVE_OPENGLES
if (GLPlatform::instance()->glslVersion() >= kVersionNumber(1, 40))
shadersDir = "kwin/shaders/1.40/";
#ifdef KWIN_HAVE_OPENGLES
const qint64 coreVersionNumber = kVersionNumber(3, 0);
#else
const qint64 coreVersionNumber = kVersionNumber(1, 40);
#endif
if (GLPlatform::instance()->glslVersion() >= coreVersionNumber)
shadersDir = "kwin/shaders/1.40/";
const QString fragmentshader = KGlobal::dirs()->findResource("data", shadersDir + "lookingglass.frag");
m_shader = ShaderManager::instance()->loadFragmentShader(ShaderManager::SimpleShader, fragmentshader);
if (m_shader->isValid()) {