diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b93091b19..f40c44be3a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,7 @@ OPTION(KWIN_BUILD_TABBOX "Enable building of KWin Tabbox functionality" ON) OPTION(KWIN_BUILD_SCREENEDGES "Enable building of KWin with screen edge support" ON) OPTION(KWIN_BUILD_SCRIPTING "Enable building of KWin with scripting support" ON) OPTION(KWIN_BUILD_XRENDER_COMPOSITING "Enable building of KWin with XRender Compositing support" ON) +OPTION(KWIN_BUILD_OPENGL_1_COMPOSITING "Enable support for OpenGL 1.x, automatically disabled when building for OpenGL ES 2.0" ON) OPTION(KWIN_BUILD_ACTIVITIES "Enable building of KWin with kactivities support" ON) if(${KDE_PLATFORM_PROFILE} STREQUAL "Desktop") OPTION(KWIN_PLASMA_ACTIVE "Enable building KWin for Plasma Active." OFF) @@ -197,6 +198,9 @@ set_target_properties(kwin PROPERTIES OUTPUT_NAME ${KWIN_NAME}) set_target_properties(kdeinit_kwin PROPERTIES OUTPUT_NAME kdeinit4_${KWIN_NAME}) if(OPENGL_FOUND) + if( KWIN_BUILD_OPENGL_1_COMPOSITING ) + set_target_properties(kdeinit_kwin PROPERTIES COMPILE_FLAGS -DKWIN_HAVE_OPENGL_1) + endif( KWIN_BUILD_OPENGL_1_COMPOSITING ) add_subdirectory(opengltest) target_link_libraries(kdeinit_kwin kwinglutils ${OPENGL_gl_LIBRARY}) # -ldl used by OpenGL code diff --git a/effects/CMakeLists.txt b/effects/CMakeLists.txt index 1a6038fd70..9d0f73bfb4 100644 --- a/effects/CMakeLists.txt +++ b/effects/CMakeLists.txt @@ -13,6 +13,9 @@ macro( KWIN4_ADD_EFFECT name ) KWIN4_ADD_EFFECT_BACKEND(kwin4_effect_${name} ${ARGN}) if(OPENGL_FOUND) target_link_libraries(kwin4_effect_${name} kwinglutils) + if( KWIN_BUILD_OPENGL_1_COMPOSITING ) + set_target_properties(kwin4_effect_${name} PROPERTIES COMPILE_FLAGS -DKWIN_HAVE_OPENGL_1) + endif( KWIN_BUILD_OPENGL_1_COMPOSITING ) elseif(OPENGLES_FOUND) target_link_libraries(kwin4_effect_${name} kwinglesutils) set_target_properties(kwin4_effect_${name} PROPERTIES COMPILE_FLAGS "-DKWIN_HAVE_OPENGLES") diff --git a/effects/blur/blur.cpp b/effects/blur/blur.cpp index c32b4bc07e..e305985d82 100644 --- a/effects/blur/blur.cpp +++ b/effects/blur/blur.cpp @@ -442,7 +442,7 @@ void BlurEffect::doBlur(const QRegion& shape, const QRect& screen, const float o // Set up the texture matrix to transform from screen coordinates // to texture coordinates. -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 if (effects->compositingType() == OpenGL1Compositing) { glMatrixMode(GL_TEXTURE); pushMatrix(); @@ -484,7 +484,7 @@ void BlurEffect::doBlur(const QRegion& shape, const QRect& screen, const float o drawRegion(shape); -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 if (effects->compositingType() == OpenGL1Compositing) { popMatrix(); glMatrixMode(GL_MODELVIEW); @@ -531,7 +531,7 @@ void BlurEffect::doCachedBlur(EffectWindow *w, const QRegion& region, const floa shader->bind(); QMatrix4x4 textureMatrix; QMatrix4x4 modelViewProjectionMatrix; -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 if (effects->compositingType() == OpenGL1Compositing) { glMatrixMode(GL_MODELVIEW); pushMatrix(); @@ -603,7 +603,7 @@ void BlurEffect::doCachedBlur(EffectWindow *w, const QRegion& region, const floa // to texture coordinates. textureMatrix.scale(1.0 / tex.width(), -1.0 / tex.height(), 1); textureMatrix.translate(-updateRect.x(), -updateRect.height() - updateRect.y(), 0); -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 if (effects->compositingType() == OpenGL1Compositing) { glMatrixMode(GL_TEXTURE); loadMatrix(textureMatrix); @@ -644,7 +644,7 @@ void BlurEffect::doCachedBlur(EffectWindow *w, const QRegion& region, const floa textureMatrix.setToIdentity(); textureMatrix.scale(1.0 / targetTexture.width(), -1.0 / targetTexture.height(), 1); textureMatrix.translate(-r.x(), -targetTexture.height() - r.y(), 0); -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 if (effects->compositingType() == OpenGL1Compositing) { glMatrixMode(GL_TEXTURE); loadMatrix(textureMatrix); @@ -655,7 +655,7 @@ void BlurEffect::doCachedBlur(EffectWindow *w, const QRegion& region, const floa drawRegion(blurredRegion & region); -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 if (effects->compositingType() == OpenGL1Compositing) { popMatrix(); glMatrixMode(GL_TEXTURE); diff --git a/effects/blur/blurshader.cpp b/effects/blur/blurshader.cpp index 71d138cd47..a2d04f266f 100644 --- a/effects/blur/blurshader.cpp +++ b/effects/blur/blurshader.cpp @@ -134,7 +134,7 @@ bool GLSLBlurShader::supported() (void) glGetError(); // Clear the error state -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 // These are the minimum values the implementation is required to support int value = 0; @@ -312,7 +312,7 @@ ARBBlurShader::~ARBBlurShader() void ARBBlurShader::reset() { -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 if (program) { glDeleteProgramsARB(1, &program); program = 0; @@ -382,7 +382,7 @@ void ARBBlurShader::setPixelDistance(float val) void ARBBlurShader::bind() { -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 if (!isValid()) return; @@ -393,7 +393,7 @@ void ARBBlurShader::bind() void ARBBlurShader::unbind() { -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 int boundObject; glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_BINDING_ARB, &boundObject); if (boundObject == (int)program) { @@ -423,7 +423,7 @@ int ARBBlurShader::maxKernelSize() const void ARBBlurShader::init() { -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 QVector kernel = gaussianKernel(); const int size = kernel.size(); const int center = size / 2; diff --git a/effects/coverswitch/coverswitch.cpp b/effects/coverswitch/coverswitch.cpp index 3f6592687d..aab0ea5f15 100644 --- a/effects/coverswitch/coverswitch.cpp +++ b/effects/coverswitch/coverswitch.cpp @@ -191,7 +191,7 @@ void CoverSwitchEffect::paintScreen(int mask, QRegion region, ScreenPaintData& d shader->setUniform("modelview", origModelview * modelview); shaderManager->popShader(); } else { -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 glMatrixMode(GL_PROJECTION); pushMatrix(); loadMatrix(projection); @@ -333,7 +333,7 @@ void CoverSwitchEffect::paintScreen(int mask, QRegion region, ScreenPaintData& d shaderManager->popShader(); } else { -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 glPushMatrix(); QRect fullRect = effects->clientArea(FullArea, activeScreen, effects->currentDesktop()); if (effects->numScreens() > 1 && area.x() != fullRect.x()) { @@ -366,7 +366,7 @@ void CoverSwitchEffect::paintScreen(int mask, QRegion region, ScreenPaintData& d shader->setUniform("modelview", origModelview); shaderManager->popShader(); } else { -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 popMatrix(); // revert change of projection matrix glMatrixMode(GL_PROJECTION); @@ -754,7 +754,7 @@ void CoverSwitchEffect::paintWindowCover(EffectWindow* w, bool reflectedWindow, shader->setUniform("screenTransformation", origMatrix); ShaderManager::instance()->popShader(); } else { -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 glPushMatrix(); glScalef(1.0, -1.0, 1.0); data.setYTranslation(- area.height() - windowRect.y() - windowRect.height()); diff --git a/effects/cube/cube.cpp b/effects/cube/cube.cpp index dba9c135d1..965c9b93a2 100644 --- a/effects/cube/cube.cpp +++ b/effects/cube/cube.cpp @@ -451,7 +451,7 @@ void CubeEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data) popMatrix(); // call the inside cube effects -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 foreach (CubeInsideEffect * inside, m_cubeInsideEffects) { pushMatrix(m_rotationMatrix); glTranslatef(rect.width() / 2, rect.height() / 2, -point - zTranslate); @@ -518,7 +518,7 @@ void CubeEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data) vbo->setData(6, 3, verts.data(), texcoords.data()); vbo->render(GL_TRIANGLES); } else { -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 glColor4f(0.0, 0.0, 0.0, alpha); glPushMatrix(); glTranslatef(rect.x() + rect.width() * 0.5f, 0.0, 0.0); @@ -548,7 +548,7 @@ void CubeEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data) // call the inside cube effects -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 foreach (CubeInsideEffect * inside, m_cubeInsideEffects) { pushMatrix(m_rotationMatrix); glTranslatef(rect.width() / 2, rect.height() / 2, -point - zTranslate); @@ -798,14 +798,12 @@ void CubeEffect::paintCap(bool frontFirst, float zOffset) capTexture->bind(); } } else { +#ifdef KWIN_HAVE_OPENGL_1 pushMatrix(m_rotationMatrix * capMatrix); -#ifndef KWIN_HAVE_OPENGLES glMatrixMode(GL_TEXTURE); -#endif pushMatrix(); loadMatrix(m_textureMirrorMatrix); -#ifndef KWIN_HAVE_OPENGLES glMatrixMode(GL_MODELVIEW); glColor4f(capColor.redF(), capColor.greenF(), capColor.blueF(), cubeOpacity); diff --git a/effects/flipswitch/flipswitch.cpp b/effects/flipswitch/flipswitch.cpp index da5915af90..5db36febc4 100644 --- a/effects/flipswitch/flipswitch.cpp +++ b/effects/flipswitch/flipswitch.cpp @@ -272,7 +272,7 @@ void FlipSwitchEffect::paintScreen(int mask, QRegion region, ScreenPaintData& da shader->setUniform("projection", projection); shader->setUniform("modelview", origModelview * modelview); } else { -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 glMatrixMode(GL_PROJECTION); pushMatrix(); loadMatrix(projection); @@ -382,7 +382,7 @@ void FlipSwitchEffect::paintScreen(int mask, QRegion region, ScreenPaintData& da shader->setUniform("projection", origProjection); shader->setUniform("modelview", origModelview); } else { -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 popMatrix(); // revert change of projection matrix glMatrixMode(GL_PROJECTION); diff --git a/effects/logout/logout.cpp b/effects/logout/logout.cpp index 1d4023f9c6..a5a11672bf 100644 --- a/effects/logout/logout.cpp +++ b/effects/logout/logout.cpp @@ -339,7 +339,7 @@ void LogoutEffect::renderVignetting() void LogoutEffect::renderVignettingLegacy() { -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 glPushAttrib(GL_CURRENT_BIT | GL_ENABLE_BIT | GL_TEXTURE_BIT); glEnable(GL_BLEND); // If not already (Such as when rendered straight to the screen) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -400,7 +400,7 @@ void LogoutEffect::renderBlurTexture() void LogoutEffect::renderBlurTextureLegacy() { -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 glPushAttrib(GL_CURRENT_BIT | GL_ENABLE_BIT | GL_TEXTURE_BIT); // Unmodified base image blurTexture->bind(); diff --git a/effects/startupfeedback/startupfeedback.cpp b/effects/startupfeedback/startupfeedback.cpp index ea753a6a62..2cba06b617 100644 --- a/effects/startupfeedback/startupfeedback.cpp +++ b/effects/startupfeedback/startupfeedback.cpp @@ -199,7 +199,7 @@ void StartupFeedbackEffect::paintScreen(int mask, QRegion region, ScreenPaintDat ShaderManager::instance()->pushShader(m_blinkingShader); m_blinkingShader->setUniform("u_color", blinkingColor); } else { -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 // texture transformation float color[4] = { blinkingColor.redF(), blinkingColor.greenF(), blinkingColor.blueF(), 1.0f }; glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); @@ -225,7 +225,7 @@ void StartupFeedbackEffect::paintScreen(int mask, QRegion region, ScreenPaintDat ShaderManager::instance()->popShader(); } if (m_type == BlinkingFeedback && !useShader) { -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 // resture states glActiveTexture(GL_TEXTURE1); texture->unbind(); diff --git a/lanczosfilter.cpp b/lanczosfilter.cpp index 4f2bedfb4d..7091a029e6 100644 --- a/lanczosfilter.cpp +++ b/lanczosfilter.cpp @@ -400,7 +400,7 @@ void LanczosFilter::timerEvent(QTimerEvent *event) void LanczosFilter::prepareRenderStates(GLTexture* tex, double opacity, double brightness, double saturation) { -#ifdef KWIN_HAVE_OPENGLES +#ifndef KWIN_HAVE_OPENGL_1 Q_UNUSED(tex) Q_UNUSED(opacity) Q_UNUSED(brightness) @@ -519,7 +519,7 @@ void LanczosFilter::prepareRenderStates(GLTexture* tex, double opacity, double b void LanczosFilter::restoreRenderStates(GLTexture* tex, double opacity, double brightness, double saturation) { -#ifdef KWIN_HAVE_OPENGLES +#ifndef KWIN_HAVE_OPENGL_1 Q_UNUSED(tex) Q_UNUSED(opacity) Q_UNUSED(brightness) @@ -559,7 +559,7 @@ LanczosShader::LanczosShader(QObject* parent) LanczosShader::~LanczosShader() { delete m_shader; -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 if (m_arbProgram) { glDeleteProgramsARB(1, &m_arbProgram); m_arbProgram = 0; @@ -571,7 +571,7 @@ void LanczosShader::bind() { if (m_shader) ShaderManager::instance()->pushShader(m_shader); -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 else { glEnable(GL_FRAGMENT_PROGRAM_ARB); glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, m_arbProgram); @@ -583,7 +583,7 @@ void LanczosShader::unbind() { if (m_shader) ShaderManager::instance()->popShader(); -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 else { int boundObject; glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_BINDING_ARB, &boundObject); @@ -602,7 +602,7 @@ void LanczosShader::setUniforms() glUniform2fv(m_uOffsets, 16, (const GLfloat*)m_offsets); glUniform4fv(m_uKernel, 16, (const GLfloat*)m_kernel); } -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 else { for (int i = 0; i < 16; ++i) { glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, i, m_offsets[i].x(), m_offsets[i].y(), 0, 0); @@ -635,7 +635,7 @@ bool LanczosShader::init() } } -#ifdef KWIN_HAVE_OPENGLES +#ifndef KWIN_HAVE_OPENGL_1 // no ARB shader in GLES return false; #else diff --git a/libkwineffects/CMakeLists.txt b/libkwineffects/CMakeLists.txt index 4b99d2afed..f95d40e013 100644 --- a/libkwineffects/CMakeLists.txt +++ b/libkwineffects/CMakeLists.txt @@ -57,6 +57,10 @@ if(OPENGL_FOUND) KWIN4_ADD_GLUTILS_BACKEND(kwinglutils ${OPENGL_INCLUDE_DIR} ${OPENGL_gl_LIBRARY}) set_target_properties(kwinglutils PROPERTIES OUTPUT_NAME ${KWIN_NAME}glutils) + if( KWIN_BUILD_OPENGL_1_COMPOSITING ) + set_target_properties(kwinglutils PROPERTIES COMPILE_FLAGS -DKWIN_HAVE_OPENGL_1) + endif( KWIN_BUILD_OPENGL_1_COMPOSITING ) + target_link_libraries(kwinglutils ${OPENGL_gl_LIBRARY}) target_link_libraries(kwinglutils LINK_INTERFACE_LIBRARIES ${OPENGL_gl_LIBRARY}) # -ldl used by OpenGL code diff --git a/libkwineffects/kwingltexture.cpp b/libkwineffects/kwingltexture.cpp index f03d357acd..c1c3e9409f 100644 --- a/libkwineffects/kwingltexture.cpp +++ b/libkwineffects/kwingltexture.cpp @@ -239,7 +239,7 @@ void GLTexture::discard() void GLTexturePrivate::bind() { -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 if (!ShaderManager::instance()->isValid()) glEnable(m_target); #endif @@ -287,7 +287,7 @@ void GLTexture::bind() void GLTexturePrivate::unbind() { glBindTexture(m_target, 0); -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 if (!ShaderManager::instance()->isValid()) glDisable(m_target); #endif diff --git a/libkwineffects/kwinglutils.cpp b/libkwineffects/kwinglutils.cpp index 30ac03d78e..da0e7cc32d 100644 --- a/libkwineffects/kwinglutils.cpp +++ b/libkwineffects/kwinglutils.cpp @@ -185,7 +185,7 @@ int nearestPowerOfTwo(int x) void pushMatrix() { -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 if (ShaderManager::instance()->isValid()) { return; } @@ -195,7 +195,7 @@ void pushMatrix() void pushMatrix(const QMatrix4x4 &matrix) { -#ifdef KWIN_HAVE_OPENGLES +#ifndef KWIN_HAVE_OPENGL_1 Q_UNUSED(matrix) #else if (ShaderManager::instance()->isValid()) { @@ -208,7 +208,7 @@ void pushMatrix(const QMatrix4x4 &matrix) void multiplyMatrix(const QMatrix4x4 &matrix) { -#ifdef KWIN_HAVE_OPENGLES +#ifndef KWIN_HAVE_OPENGL_1 Q_UNUSED(matrix) #else if (ShaderManager::instance()->isValid()) { @@ -227,7 +227,7 @@ void multiplyMatrix(const QMatrix4x4 &matrix) void loadMatrix(const QMatrix4x4 &matrix) { -#ifdef KWIN_HAVE_OPENGLES +#ifndef KWIN_HAVE_OPENGL_1 Q_UNUSED(matrix) #else if (ShaderManager::instance()->isValid()) { @@ -246,7 +246,7 @@ void loadMatrix(const QMatrix4x4 &matrix) void popMatrix() { -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 if (ShaderManager::instance()->isValid()) { return; } @@ -1171,7 +1171,7 @@ GLVertexBuffer *GLVertexBufferPrivate::streamingBuffer = NULL; void GLVertexBufferPrivate::legacyPainting(QRegion region, GLenum primitiveMode, bool hardwareClipping) { -#ifdef KWIN_HAVE_OPENGLES +#ifndef KWIN_HAVE_OPENGL_1 Q_UNUSED(region) Q_UNUSED(primitiveMode) Q_UNUSED(hardwareClipping) @@ -1246,7 +1246,7 @@ void GLVertexBufferPrivate::corePainting(const QRegion& region, GLenum primitive void GLVertexBufferPrivate::fallbackPainting(const QRegion& region, GLenum primitiveMode, bool hardwareClipping) { -#ifdef KWIN_HAVE_OPENGLES +#ifndef KWIN_HAVE_OPENGL_1 Q_UNUSED(region) Q_UNUSED(primitiveMode) Q_UNUSED(hardwareClipping) diff --git a/libkwineffects/kwinglutils.h b/libkwineffects/kwinglutils.h index cbdab15c92..9b175b985a 100644 --- a/libkwineffects/kwinglutils.h +++ b/libkwineffects/kwinglutils.h @@ -446,7 +446,7 @@ inline ShaderBinder::ShaderBinder(ShaderManager::ShaderType type, bool reset) : m_shader(NULL) { -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 if (!ShaderManager::instance()->isValid()) { return; } @@ -458,7 +458,7 @@ inline ShaderBinder::ShaderBinder(GLShader *shader) : m_shader(shader) { -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 if (!ShaderManager::instance()->isValid()) { return; } @@ -469,7 +469,7 @@ ShaderBinder::ShaderBinder(GLShader *shader) inline ShaderBinder::~ShaderBinder() { -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 if (!ShaderManager::instance()->isValid()) { return; } diff --git a/scene_opengl.cpp b/scene_opengl.cpp index 81f1db521d..de7abd8160 100644 --- a/scene_opengl.cpp +++ b/scene_opengl.cpp @@ -246,7 +246,7 @@ SceneOpenGL *SceneOpenGL::createScene() return scene; } } -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 if (SceneOpenGL1::supported(backend)) { scene = new SceneOpenGL1(backend); if (scene->initFailed()) { @@ -442,7 +442,7 @@ bool SceneOpenGL2::supported(OpenGLBackend *backend) if (!backend->isDirectRendering()) { return false; } -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 if (!GLPlatform::instance()->supports(GLSL) || GLPlatform::instance()->supports(LimitedNPOT)) { return false; } @@ -507,7 +507,7 @@ SceneOpenGL::Window *SceneOpenGL2::createWindow(Toplevel *t) //**************************************** // SceneOpenGL1 //**************************************** -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 bool SceneOpenGL1::supported(OpenGLBackend *backend) { // any OpenGL context will do @@ -1239,7 +1239,7 @@ void SceneOpenGL2Window::restoreStates(TextureType type, qreal opacity, qreal br //*************************************** // SceneOpenGL1Window //*************************************** -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 SceneOpenGL1Window::SceneOpenGL1Window(Toplevel *c) : SceneOpenGL::Window(c) { @@ -1530,7 +1530,7 @@ void SceneOpenGL::EffectFrame::render(QRegion region, double opacity, double fra glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 if (!shader) glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); #endif @@ -1647,7 +1647,7 @@ void SceneOpenGL::EffectFrame::render(QRegion region, double opacity, double fra const float a = opacity * frameOpacity; shader->setUniform(GLShader::ModulationConstant, QVector4D(a, a, a, a)); } -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 else glColor4f(0.0, 0.0, 0.0, opacity * frameOpacity); #endif @@ -1682,7 +1682,7 @@ void SceneOpenGL::EffectFrame::render(QRegion region, double opacity, double fra const float a = opacity * frameOpacity; shader->setUniform(GLShader::ModulationConstant, QVector4D(a, a, a, a)); } -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 else glColor4f(1.0, 1.0, 1.0, opacity * frameOpacity); #endif @@ -1704,7 +1704,7 @@ void SceneOpenGL::EffectFrame::render(QRegion region, double opacity, double fra const float a = opacity * frameOpacity; shader->setUniform(GLShader::ModulationConstant, QVector4D(a, a, a, a)); } - #ifndef KWIN_HAVE_OPENGLES + #ifdef KWIN_HAVE_OPENGL_1 else glColor4f(1.0, 1.0, 1.0, opacity * frameOpacity); #endif @@ -1726,7 +1726,7 @@ void SceneOpenGL::EffectFrame::render(QRegion region, double opacity, double fra const float a = opacity * (1.0 - m_effectFrame->crossFadeProgress()); shader->setUniform(GLShader::ModulationConstant, QVector4D(a, a, a, a)); } -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 else glColor4f(1.0, 1.0, 1.0, opacity * (1.0 - m_effectFrame->crossFadeProgress())); #endif @@ -1738,7 +1738,7 @@ void SceneOpenGL::EffectFrame::render(QRegion region, double opacity, double fra const float a = opacity * m_effectFrame->crossFadeProgress(); shader->setUniform(GLShader::ModulationConstant, QVector4D(a, a, a, a)); } -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 else glColor4f(1.0, 1.0, 1.0, opacity * m_effectFrame->crossFadeProgress()); #endif @@ -1747,7 +1747,7 @@ void SceneOpenGL::EffectFrame::render(QRegion region, double opacity, double fra const QVector4D constant(opacity, opacity, opacity, opacity); shader->setUniform(GLShader::ModulationConstant, constant); } -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 else glColor4f(1.0, 1.0, 1.0, opacity); #endif @@ -1768,7 +1768,7 @@ void SceneOpenGL::EffectFrame::render(QRegion region, double opacity, double fra const float a = opacity * (1.0 - m_effectFrame->crossFadeProgress()); shader->setUniform(GLShader::ModulationConstant, QVector4D(a, a, a, a)); } -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 else glColor4f(1.0, 1.0, 1.0, opacity *(1.0 - m_effectFrame->crossFadeProgress())); #endif @@ -1780,7 +1780,7 @@ void SceneOpenGL::EffectFrame::render(QRegion region, double opacity, double fra const float a = opacity * m_effectFrame->crossFadeProgress(); shader->setUniform(GLShader::ModulationConstant, QVector4D(a, a, a, a)); } -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 else glColor4f(1.0, 1.0, 1.0, opacity * m_effectFrame->crossFadeProgress()); #endif @@ -1789,7 +1789,7 @@ void SceneOpenGL::EffectFrame::render(QRegion region, double opacity, double fra const QVector4D constant(opacity, opacity, opacity, opacity); shader->setUniform(GLShader::ModulationConstant, constant); } -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 else glColor4f(1.0, 1.0, 1.0, opacity); #endif diff --git a/scene_opengl.h b/scene_opengl.h index 102dae3e8a..dce2b7c092 100644 --- a/scene_opengl.h +++ b/scene_opengl.h @@ -99,7 +99,7 @@ protected: virtual SceneOpenGL::Window *createWindow(Toplevel *t); }; -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 class SceneOpenGL1 : public SceneOpenGL { public: @@ -270,7 +270,7 @@ protected: virtual void restoreStates(TextureType type, qreal opacity, qreal brightness, qreal saturation); }; -#ifndef KWIN_HAVE_OPENGLES +#ifdef KWIN_HAVE_OPENGL_1 class SceneOpenGL1Window : public SceneOpenGL::Window { public: