From 683a222233f69897bf3455372bab01e3f3d56fb4 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Sat, 7 May 2022 11:24:48 +0300 Subject: [PATCH] Drop lanczos filter The lanczos filter depends on the effect system. It makes very difficult changing painting code from SceneWindow to Item. Given that the last big users of the laczos filter - present windows and desktop grid effects were re-written in QML. The only remaining user of the lanczos filter is the thumbnail aside effect. Given that it's a really obscure usecase, switching to the linear filter won't be very noticeable. As a backup plan, one can reimplement the thumbnailaside effect using QML. The lanczos filter is already implemented in plasma-framework. --- src/effects.cpp | 5 - src/effects/thumbnailaside/thumbnailaside.cpp | 3 +- src/libkwineffects/kwineffects.h | 7 - src/scene.h | 4 - src/scenes/opengl/CMakeLists.txt | 2 - src/scenes/opengl/lanczosfilter.cpp | 435 ------------------ src/scenes/opengl/lanczosfilter.h | 67 --- src/scenes/opengl/lanczosresources.qrc | 6 - src/scenes/opengl/scene_opengl.cpp | 17 - src/scenes/opengl/scene_opengl.h | 3 - src/scenes/opengl/shaders/lanczos.frag | 16 - src/scenes/opengl/shaders/lanczos_core.frag | 19 - src/scripting/scriptedeffect.h | 1 - 13 files changed, 1 insertion(+), 584 deletions(-) delete mode 100644 src/scenes/opengl/lanczosfilter.cpp delete mode 100644 src/scenes/opengl/lanczosfilter.h delete mode 100644 src/scenes/opengl/lanczosresources.qrc delete mode 100644 src/scenes/opengl/shaders/lanczos.frag delete mode 100644 src/scenes/opengl/shaders/lanczos_core.frag diff --git a/src/effects.cpp b/src/effects.cpp index 6db127cf73..b090d8834f 100644 --- a/src/effects.cpp +++ b/src/effects.cpp @@ -1914,11 +1914,6 @@ EffectWindowImpl::EffectWindowImpl(Window *window) EffectWindowImpl::~EffectWindowImpl() { - QVariant cachedTextureVariant = data(LanczosCacheRole); - if (cachedTextureVariant.isValid()) { - GLTexture *cachedTexture = static_cast(cachedTextureVariant.value()); - delete cachedTexture; - } } void EffectWindowImpl::refVisible(int reason) diff --git a/src/effects/thumbnailaside/thumbnailaside.cpp b/src/effects/thumbnailaside/thumbnailaside.cpp index 1b41303489..01688537ff 100644 --- a/src/effects/thumbnailaside/thumbnailaside.cpp +++ b/src/effects/thumbnailaside/thumbnailaside.cpp @@ -61,8 +61,7 @@ void ThumbnailAsideEffect::paintScreen(int mask, const QRegion ®ion, ScreenPa data.multiplyOpacity(opacity); QRect region; setPositionTransformations(data, region, d.window, d.rect, Qt::KeepAspectRatio); - effects->drawWindow(d.window, PAINT_WINDOW_OPAQUE | PAINT_WINDOW_TRANSLUCENT | PAINT_WINDOW_TRANSFORMED | PAINT_WINDOW_LANCZOS, - region, data); + effects->drawWindow(d.window, PAINT_WINDOW_OPAQUE | PAINT_WINDOW_TRANSLUCENT | PAINT_WINDOW_TRANSFORMED, region, data); } } } diff --git a/src/libkwineffects/kwineffects.h b/src/libkwineffects/kwineffects.h index de9a7ace5d..3109b07283 100644 --- a/src/libkwineffects/kwineffects.h +++ b/src/libkwineffects/kwineffects.h @@ -199,7 +199,6 @@ enum DataRole { WindowBlurBehindRole, ///< For single windows to blur behind WindowForceBackgroundContrastRole, ///< For fullscreen effects to enforce the background contrast, WindowBackgroundContrastRole, ///< For single windows to enable Background contrast - LanczosCacheRole }; /** @@ -324,12 +323,6 @@ public: * Clear whole background as the very first step, without optimizing it */ PAINT_SCREEN_BACKGROUND_FIRST = 1 << 6, - // PAINT_DECORATION_ONLY = 1 << 7 has been deprecated - /** - * Window will be painted with a lanczos filter. - */ - PAINT_WINDOW_LANCZOS = 1 << 8 - // PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_WITHOUT_FULL_REPAINTS = 1 << 9 has been removed }; enum Feature { diff --git a/src/scene.h b/src/scene.h index 252569a0e2..83f472d86d 100644 --- a/src/scene.h +++ b/src/scene.h @@ -146,10 +146,6 @@ public: PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS = 1 << 5, // Clear whole background as the very first step, without optimizing it PAINT_SCREEN_BACKGROUND_FIRST = 1 << 6, - // PAINT_DECORATION_ONLY = 1 << 7 has been removed - // SceneWindow will be painted with a lanczos filter. - PAINT_WINDOW_LANCZOS = 1 << 8 - // PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_WITHOUT_FULL_REPAINTS = 1 << 9 has been removed }; virtual bool makeOpenGLContextCurrent(); diff --git a/src/scenes/opengl/CMakeLists.txt b/src/scenes/opengl/CMakeLists.txt index b61ff5bd98..dbe4b53d98 100644 --- a/src/scenes/opengl/CMakeLists.txt +++ b/src/scenes/opengl/CMakeLists.txt @@ -1,5 +1,3 @@ target_sources(kwin PRIVATE - lanczosfilter.cpp - lanczosresources.qrc scene_opengl.cpp ) diff --git a/src/scenes/opengl/lanczosfilter.cpp b/src/scenes/opengl/lanczosfilter.cpp deleted file mode 100644 index 1fd38df063..0000000000 --- a/src/scenes/opengl/lanczosfilter.cpp +++ /dev/null @@ -1,435 +0,0 @@ -/* - KWin - the KDE window manager - This file is part of the KDE project. - - SPDX-FileCopyrightText: 2010 Fredrik Höglund - SPDX-FileCopyrightText: 2010 Martin Gräßlin - - SPDX-License-Identifier: GPL-2.0-or-later -*/ - -#include "lanczosfilter.h" -#include "effects.h" -#include "options.h" -#include "workspace.h" - -#include -#include - -#include - -#include -#include - -#include - -namespace KWin -{ - -LanczosFilter::LanczosFilter(Scene *parent) - : QObject(parent) - , m_offscreenTex(nullptr) - , m_offscreenTarget(nullptr) - , m_inited(false) - , m_shader(nullptr) - , m_uOffsets(0) - , m_uKernel(0) - , m_scene(parent) -{ -} - -LanczosFilter::~LanczosFilter() -{ - delete m_offscreenTarget; - delete m_offscreenTex; -} - -void LanczosFilter::init() -{ - if (m_inited) { - return; - } - m_inited = true; - const bool force = (qstrcmp(qgetenv("KWIN_FORCE_LANCZOS"), "1") == 0); - if (force) { - qCWarning(KWIN_OPENGL) << "Lanczos Filter forced on by environment variable"; - } - - if (!force && options->glSmoothScale() != 2) { - return; // disabled by config - } - if (!GLFramebuffer::supported()) { - return; - } - - GLPlatform *gl = GLPlatform::instance(); - if (!force) { - // The lanczos filter is reported to be broken with the Intel driver prior SandyBridge - if (gl->driver() == Driver_Intel && gl->chipClass() < SandyBridge) { - return; - } - // also radeon before R600 has trouble - if (gl->isRadeon() && gl->chipClass() < R600) { - return; - } - // and also for software emulation (e.g. llvmpipe) - if (gl->isSoftwareEmulation()) { - return; - } - } - - m_shader.reset(ShaderManager::instance()->generateShaderFromFile(ShaderTrait::MapTexture, QString(), QStringLiteral(":/scenes/opengl/shaders/lanczos.frag"))); - if (m_shader->isValid()) { - ShaderBinder binder(m_shader.data()); - m_uKernel = m_shader->uniformLocation("kernel"); - m_uOffsets = m_shader->uniformLocation("offsets"); - } else { - qCDebug(KWIN_OPENGL) << "Shader is not valid"; - m_shader.reset(); - } -} - -void LanczosFilter::updateOffscreenSurfaces() -{ - const QSize &s = m_scene->geometry().size(); - int w = s.width(); - int h = s.height(); - - if (!m_offscreenTex || m_offscreenTex->width() != w || m_offscreenTex->height() != h) { - if (m_offscreenTex) { - delete m_offscreenTex; - delete m_offscreenTarget; - } - m_offscreenTex = new GLTexture(GL_RGBA8, w, h); - m_offscreenTex->setFilter(GL_LINEAR); - m_offscreenTex->setWrapMode(GL_CLAMP_TO_EDGE); - m_offscreenTarget = new GLFramebuffer(m_offscreenTex); - } -} - -static float sinc(float x) -{ - return std::sin(x * M_PI) / (x * M_PI); -} - -static float lanczos(float x, float a) -{ - if (qFuzzyCompare(x + 1.0, 1.0)) { - return 1.0; - } - - if (qAbs(x) >= a) { - return 0.0; - } - - return sinc(x) * sinc(x / a); -} - -void LanczosFilter::createKernel(float delta, int *size) -{ - const float a = 2.0; - - // The two outermost samples always fall at points where the lanczos - // function returns 0, so we'll skip them. - const int sampleCount = qBound(3, qCeil(delta * a) * 2 + 1 - 2, 29); - const int center = sampleCount / 2; - const int kernelSize = center + 1; - const float factor = 1.0 / delta; - - QVector values(kernelSize); - float sum = 0; - - for (int i = 0; i < kernelSize; i++) { - const float val = lanczos(i * factor, a); - sum += i > 0 ? val * 2 : val; - values[i] = val; - } - - m_kernel.fill(QVector4D()); - - // Normalize the kernel - for (int i = 0; i < kernelSize; i++) { - const float val = values[i] / sum; - m_kernel[i] = QVector4D(val, val, val, val); - } - - *size = kernelSize; -} - -void LanczosFilter::createOffsets(int count, float width, Qt::Orientation direction) -{ - m_offsets.fill(QVector2D()); - for (int i = 0; i < count; i++) { - m_offsets[i] = (direction == Qt::Horizontal) ? QVector2D(i / width, 0) : QVector2D(0, i / width); - } -} - -void LanczosFilter::performPaint(EffectWindowImpl *w, int mask, QRegion region, WindowPaintData &data) -{ - if (data.xScale() < 0.9 || data.yScale() < 0.9) { - if (!m_inited) { - init(); - } - const QRect screenRect = Workspace::self()->clientArea(ScreenArea, w->window()); - // window geometry may not be bigger than screen geometry to fit into the FBO - QRect winGeo(w->expandedGeometry()); - if (m_shader && winGeo.width() <= screenRect.width() && winGeo.height() <= screenRect.height()) { - winGeo.translate(-w->geometry().topLeft()); - double left = winGeo.left(); - double top = winGeo.top(); - double width = winGeo.right() - left; - double height = winGeo.bottom() - top; - - int tx = data.xTranslation() + w->x() + left * data.xScale(); - int ty = data.yTranslation() + w->y() + top * data.yScale(); - int tw = width * data.xScale(); - int th = height * data.yScale(); - const QRect textureRect(tx, ty, tw, th); - const bool hardwareClipping = !(QRegion(textureRect) - region).isEmpty(); - - int sw = width; - int sh = height; - - QRegion scissor = infiniteRegion(); - if (hardwareClipping) { - scissor = m_scene->mapToRenderTarget(region); - } - - GLTexture *cachedTexture = static_cast(w->data(LanczosCacheRole).value()); - if (cachedTexture) { - if (cachedTexture->width() == tw && cachedTexture->height() == th) { - cachedTexture->bind(); - if (hardwareClipping) { - glEnable(GL_SCISSOR_TEST); - } - - glEnable(GL_BLEND); - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - - const qreal rgb = data.brightness() * data.opacity(); - const qreal a = data.opacity(); - - ShaderBinder binder(ShaderTrait::MapTexture | ShaderTrait::Modulate | ShaderTrait::AdjustSaturation); - GLShader *shader = binder.shader(); - QMatrix4x4 mvp = data.screenProjectionMatrix(); - mvp.translate(textureRect.x(), textureRect.y()); - shader->setUniform(GLShader::ModelViewProjectionMatrix, mvp); - shader->setUniform(GLShader::ModulationConstant, QVector4D(rgb, rgb, rgb, a)); - shader->setUniform(GLShader::Saturation, data.saturation()); - - cachedTexture->render(scissor, textureRect, hardwareClipping); - - glDisable(GL_BLEND); - if (hardwareClipping) { - glDisable(GL_SCISSOR_TEST); - } - cachedTexture->unbind(); - m_timer.start(5000, this); - return; - } else { - // offscreen texture not matching - delete - delete cachedTexture; - cachedTexture = nullptr; - w->setData(LanczosCacheRole, QVariant()); - } - } - - WindowPaintData thumbData = data; - thumbData.setXScale(1.0); - thumbData.setYScale(1.0); - thumbData.setXTranslation(-w->x() - left); - thumbData.setYTranslation(-w->y() - top); - thumbData.setBrightness(1.0); - thumbData.setOpacity(1.0); - thumbData.setSaturation(1.0); - - // Bind the offscreen FBO and draw the window on it unscaled - updateOffscreenSurfaces(); - GLFramebuffer::pushFramebuffer(m_offscreenTarget); - - QMatrix4x4 modelViewProjectionMatrix; - modelViewProjectionMatrix.ortho(0, m_offscreenTex->width(), m_offscreenTex->height(), 0, 0, 65535); - thumbData.setProjectionMatrix(modelViewProjectionMatrix); - - glClearColor(0.0, 0.0, 0.0, 0.0); - glClear(GL_COLOR_BUFFER_BIT); - w->sceneWindow()->performPaint(mask, infiniteRegion(), thumbData); - - // Create a scratch texture and copy the rendered window into it - GLTexture tex(GL_RGBA8, sw, sh); - tex.setFilter(GL_LINEAR); - tex.setWrapMode(GL_CLAMP_TO_EDGE); - tex.bind(); - - glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, m_offscreenTex->height() - sh, sw, sh); - - // Set up the shader for horizontal scaling - float dx = sw / float(tw); - int kernelSize; - createKernel(dx, &kernelSize); - createOffsets(kernelSize, sw, Qt::Horizontal); - - ShaderManager::instance()->pushShader(m_shader.data()); - m_shader->setUniform(GLShader::ModelViewProjectionMatrix, modelViewProjectionMatrix); - setUniforms(); - - // Draw the window back into the FBO, this time scaled horizontally - glClear(GL_COLOR_BUFFER_BIT); - QVector verts; - QVector texCoords; - verts.reserve(12); - texCoords.reserve(12); - - texCoords << 1.0 << 0.0; - verts << tw << 0.0; // Top right - texCoords << 0.0 << 0.0; - verts << 0.0 << 0.0; // Top left - texCoords << 0.0 << 1.0; - verts << 0.0 << sh; // Bottom left - texCoords << 0.0 << 1.0; - verts << 0.0 << sh; // Bottom left - texCoords << 1.0 << 1.0; - verts << tw << sh; // Bottom right - texCoords << 1.0 << 0.0; - verts << tw << 0.0; // Top right - GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); - vbo->reset(); - vbo->setData(6, 2, verts.constData(), texCoords.constData()); - vbo->render(GL_TRIANGLES); - - // At this point we don't need the scratch texture anymore - tex.unbind(); - tex.discard(); - - // create scratch texture for second rendering pass - GLTexture tex2(GL_RGBA8, tw, sh); - tex2.setFilter(GL_LINEAR); - tex2.setWrapMode(GL_CLAMP_TO_EDGE); - tex2.bind(); - - glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, m_offscreenTex->height() - sh, tw, sh); - - // Set up the shader for vertical scaling - float dy = sh / float(th); - createKernel(dy, &kernelSize); - createOffsets(kernelSize, m_offscreenTex->height(), Qt::Vertical); - setUniforms(); - - // Now draw the horizontally scaled window in the FBO at the right - // coordinates on the screen, while scaling it vertically and blending it. - glClear(GL_COLOR_BUFFER_BIT); - - verts.clear(); - - verts << tw << 0.0; // Top right - verts << 0.0 << 0.0; // Top left - verts << 0.0 << th; // Bottom left - verts << 0.0 << th; // Bottom left - verts << tw << th; // Bottom right - verts << tw << 0.0; // Top right - vbo->setData(6, 2, verts.constData(), texCoords.constData()); - vbo->render(GL_TRIANGLES); - - tex2.unbind(); - tex2.discard(); - ShaderManager::instance()->popShader(); - - // create cache texture - GLTexture *cache = new GLTexture(GL_RGBA8, tw, th); - - cache->setFilter(GL_LINEAR); - cache->setWrapMode(GL_CLAMP_TO_EDGE); - cache->bind(); - glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, m_offscreenTex->height() - th, tw, th); - GLFramebuffer::popFramebuffer(); - - if (hardwareClipping) { - glEnable(GL_SCISSOR_TEST); - } - - glEnable(GL_BLEND); - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - - const qreal rgb = data.brightness() * data.opacity(); - const qreal a = data.opacity(); - - ShaderBinder binder(ShaderTrait::MapTexture | ShaderTrait::Modulate | ShaderTrait::AdjustSaturation); - GLShader *shader = binder.shader(); - QMatrix4x4 mvp = data.screenProjectionMatrix(); - mvp.translate(textureRect.x(), textureRect.y()); - shader->setUniform(GLShader::ModelViewProjectionMatrix, mvp); - shader->setUniform(GLShader::ModulationConstant, QVector4D(rgb, rgb, rgb, a)); - shader->setUniform(GLShader::Saturation, data.saturation()); - - cache->render(scissor, textureRect, hardwareClipping); - - glDisable(GL_BLEND); - - if (hardwareClipping) { - glDisable(GL_SCISSOR_TEST); - } - - cache->unbind(); - w->setData(LanczosCacheRole, QVariant::fromValue(static_cast(cache))); - - connect(effects, &EffectsHandler::windowDamaged, - this, &LanczosFilter::safeDiscardCacheTexture, - Qt::UniqueConnection); - - // Delete the offscreen surface after 5 seconds - m_timer.start(5000, this); - return; - } - } // if ( effects->compositingType() == KWin::OpenGLCompositing ) - w->sceneWindow()->performPaint(mask, region, data); -} // End of function - -void LanczosFilter::timerEvent(QTimerEvent *event) -{ - if (event->timerId() == m_timer.timerId()) { - m_timer.stop(); - - disconnect(effects, &EffectsHandler::windowDamaged, - this, &LanczosFilter::safeDiscardCacheTexture); - - m_scene->makeOpenGLContextCurrent(); - - delete m_offscreenTarget; - delete m_offscreenTex; - m_offscreenTarget = nullptr; - m_offscreenTex = nullptr; - - workspace()->forEachToplevel([this](Window *window) { - discardCacheTexture(window->effectWindow()); - }); - - m_scene->doneOpenGLContextCurrent(); - } -} - -void LanczosFilter::discardCacheTexture(EffectWindow *w) -{ - QVariant cachedTextureVariant = w->data(LanczosCacheRole); - if (cachedTextureVariant.isValid()) { - delete static_cast(cachedTextureVariant.value()); - w->setData(LanczosCacheRole, QVariant()); - } -} - -void LanczosFilter::safeDiscardCacheTexture(EffectWindow *w) -{ - QVariant cachedTextureVariant = w->data(LanczosCacheRole); - if (cachedTextureVariant.isValid()) { - m_scene->makeOpenGLContextCurrent(); - delete static_cast(cachedTextureVariant.value()); - w->setData(LanczosCacheRole, QVariant()); - } -} - -void LanczosFilter::setUniforms() -{ - glUniform2fv(m_uOffsets, m_offsets.size(), (const GLfloat *)m_offsets.data()); - glUniform4fv(m_uKernel, m_kernel.size(), (const GLfloat *)m_kernel.data()); -} - -} // namespace diff --git a/src/scenes/opengl/lanczosfilter.h b/src/scenes/opengl/lanczosfilter.h deleted file mode 100644 index 43183b58c5..0000000000 --- a/src/scenes/opengl/lanczosfilter.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - KWin - the KDE window manager - This file is part of the KDE project. - - SPDX-FileCopyrightText: 2010 Fredrik Höglund - SPDX-FileCopyrightText: 2010 Martin Gräßlin - - SPDX-License-Identifier: GPL-2.0-or-later -*/ - -#ifndef KWIN_LANCZOSFILTER_P_H -#define KWIN_LANCZOSFILTER_P_H - -#include -#include -#include -#include -#include -#include - -namespace KWin -{ - -class EffectWindow; -class EffectWindowImpl; -class WindowPaintData; -class GLTexture; -class GLFramebuffer; -class GLShader; -class Scene; - -class LanczosFilter : public QObject -{ - Q_OBJECT - -public: - explicit LanczosFilter(Scene *parent); - ~LanczosFilter() override; - void performPaint(EffectWindowImpl *w, int mask, QRegion region, WindowPaintData &data); - -protected: - void timerEvent(QTimerEvent *) override; - -private: - void init(); - void updateOffscreenSurfaces(); - void setUniforms(); - void discardCacheTexture(EffectWindow *w); - void safeDiscardCacheTexture(EffectWindow *w); - - void createKernel(float delta, int *kernelSize); - void createOffsets(int count, float width, Qt::Orientation direction); - GLTexture *m_offscreenTex; - GLFramebuffer *m_offscreenTarget; - QBasicTimer m_timer; - bool m_inited; - QScopedPointer m_shader; - int m_uOffsets; - int m_uKernel; - std::array m_offsets; - std::array m_kernel; - Scene *m_scene; -}; - -} // namespace - -#endif // KWIN_LANCZOSFILTER_P_H diff --git a/src/scenes/opengl/lanczosresources.qrc b/src/scenes/opengl/lanczosresources.qrc deleted file mode 100644 index 4f3b85e087..0000000000 --- a/src/scenes/opengl/lanczosresources.qrc +++ /dev/null @@ -1,6 +0,0 @@ - - - shaders/lanczos.frag - shaders/lanczos_core.frag - - diff --git a/src/scenes/opengl/scene_opengl.cpp b/src/scenes/opengl/scene_opengl.cpp index 3e82aacf27..1a4baa9f2a 100644 --- a/src/scenes/opengl/scene_opengl.cpp +++ b/src/scenes/opengl/scene_opengl.cpp @@ -24,7 +24,6 @@ #include "cursor.h" #include "decorations/decoratedclient.h" #include "effects.h" -#include "lanczosfilter.h" #include "main.h" #include "output.h" #include "overlaywindow.h" @@ -76,10 +75,6 @@ SceneOpenGL::~SceneOpenGL() if (init_ok) { makeOpenGLContextCurrent(); } - if (m_lanczosFilter) { - delete m_lanczosFilter; - m_lanczosFilter = nullptr; - } SceneOpenGL::EffectFrame::cleanup(); } @@ -302,18 +297,6 @@ SceneWindow *SceneOpenGL::createWindow(Window *t) return new OpenGLWindow(t, this); } -void SceneOpenGL::performPaintWindow(EffectWindowImpl *w, int mask, const QRegion ®ion, WindowPaintData &data) -{ - if (mask & PAINT_WINDOW_LANCZOS) { - if (!m_lanczosFilter) { - m_lanczosFilter = new LanczosFilter(this); - } - m_lanczosFilter->performPaint(w, mask, region, data); - } else { - w->sceneWindow()->performPaint(mask, region, data); - } -} - //**************************************** // OpenGLWindow //**************************************** diff --git a/src/scenes/opengl/scene_opengl.h b/src/scenes/opengl/scene_opengl.h index a667900aa3..0276522ff4 100644 --- a/src/scenes/opengl/scene_opengl.h +++ b/src/scenes/opengl/scene_opengl.h @@ -21,7 +21,6 @@ namespace KWin { -class LanczosFilter; class OpenGLBackend; class KWIN_EXPORT SceneOpenGL @@ -72,11 +71,9 @@ protected: private: void doPaintBackground(const QVector &vertices); - void performPaintWindow(EffectWindowImpl *w, int mask, const QRegion ®ion, WindowPaintData &data); bool init_ok = true; OpenGLBackend *m_backend; - LanczosFilter *m_lanczosFilter = nullptr; QMatrix4x4 m_screenProjectionMatrix; GLuint vao = 0; }; diff --git a/src/scenes/opengl/shaders/lanczos.frag b/src/scenes/opengl/shaders/lanczos.frag deleted file mode 100644 index b6b135cdbb..0000000000 --- a/src/scenes/opengl/shaders/lanczos.frag +++ /dev/null @@ -1,16 +0,0 @@ -uniform sampler2D sampler; -uniform vec2 offsets[16]; -uniform vec4 kernel[16]; - -varying vec2 texcoord0; - -void main(void) -{ - vec4 sum = texture2D(sampler, texcoord0.st) * kernel[0]; - for (int i = 1; i < 16; i++) { - sum += texture2D(sampler, texcoord0.st - offsets[i]) * kernel[i]; - sum += texture2D(sampler, texcoord0.st + offsets[i]) * kernel[i]; - } - gl_FragColor = sum; -} - diff --git a/src/scenes/opengl/shaders/lanczos_core.frag b/src/scenes/opengl/shaders/lanczos_core.frag deleted file mode 100644 index a77d560674..0000000000 --- a/src/scenes/opengl/shaders/lanczos_core.frag +++ /dev/null @@ -1,19 +0,0 @@ -#version 140 - -uniform sampler2D sampler; -uniform vec2 offsets[16]; -uniform vec4 kernel[16]; - -in vec2 texcoord0; -out vec4 fragColor; - -void main(void) -{ - vec4 sum = texture(sampler, texcoord0.st) * kernel[0]; - for (int i = 1; i < 16; i++) { - sum += texture(sampler, texcoord0.st - offsets[i]) * kernel[i]; - sum += texture(sampler, texcoord0.st + offsets[i]) * kernel[i]; - } - fragColor = sum; -} - diff --git a/src/scripting/scriptedeffect.h b/src/scripting/scriptedeffect.h index a73815e393..55853b92dd 100644 --- a/src/scripting/scriptedeffect.h +++ b/src/scripting/scriptedeffect.h @@ -55,7 +55,6 @@ public: WindowBlurBehindRole, ///< For single windows to blur behind WindowForceBackgroundContrastRole, ///< For fullscreen effects to enforce the background contrast, WindowBackgroundContrastRole, ///< For single windows to enable Background contrast - LanczosCacheRole }; enum EasingCurve { GaussianCurve = 128