[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kwin] effects: Removed the "fastblur" path
From:       Fredrik_Höglund <null () kde ! org>
Date:       2018-02-03 18:05:26
Message-ID: E1ei2Bq-0003Qr-Uy () code ! kde ! org
[Download RAW message or body]

Git commit f8ff40271e4d5e13646281244b5d259ee65b7669 by Fredrik Höglund, on behalf of \
Alex Nemeth. Committed on 03/02/2018 at 18:04.
Pushed by fredrik into branch 'master'.

Removed the "fastblur" path

Summary:
Since the new blur is more efficient "fastblur" or "simpleblur" is not needed anymore \
for fullscreen blur. Even my old low-end laptop from 2009 (with Intel T3300) can \
easily do fullscreen blur now with the new method without any hitch at all.

Reviewers: graesslin, #kwin, #plasma, #vdg, fredrik

Reviewed By: #vdg, fredrik

Subscribers: avaragic, fredrik, ngraham, plasma-devel, kwin, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D10181

M  +1    -50   effects/blur/blur.cpp
M  +0    -5    effects/blur/blur.h
M  +0    -3    effects/blur/blur.kcfg
M  +0    -10   effects/blur/blur_config.ui
D  +0    -9    effects/logout/data/1.10/logout-blur.frag
D  +0    -14   effects/logout/data/1.40/logout-blur.frag
M  +0    -2    effects/shaders.qrc

https://commits.kde.org/kwin/f8ff40271e4d5e13646281244b5d259ee65b7669

diff --git a/effects/blur/blur.cpp b/effects/blur/blur.cpp
index b4af21535..000285fb9 100644
--- a/effects/blur/blur.cpp
+++ b/effects/blur/blur.cpp
@@ -43,12 +43,6 @@ BlurEffect::BlurEffect()
 {
     initConfig<BlurConfig>();
     m_shader = BlurShader::create();
-    m_simpleShader = \
ShaderManager::instance()->generateShaderFromResources(ShaderTrait::MapTexture, \
                QString(), QStringLiteral("logout-blur.frag"));
-    m_simpleTarget = new GLRenderTarget();
-
-    if (!m_simpleShader->isValid()) {
-        qCDebug(KWINEFFECTS) << "Simple blur shader failed to load";
-    }
 
     initBlurStrengthValues();
     reconfigure(ReconfigureAll);
@@ -87,12 +81,6 @@ BlurEffect::~BlurEffect()
 {
     deleteFBOs();
 
-    delete m_simpleTarget;
-    m_simpleTarget = nullptr;
-
-    delete m_simpleShader;
-    m_simpleShader = nullptr;
-
     delete m_shader;
     m_shader = nullptr;
 }
@@ -235,8 +223,6 @@ void BlurEffect::reconfigure(ReconfigureFlags flags)
 
     BlurConfig::self()->read();
 
-    m_useSimpleBlur = BlurConfig::useSimpleBlur();
-
     int blurStrength = BlurConfig::blurStrength() - 1;
     m_downSampleIterations = blurStrengthValues[blurStrength].iteration;
     m_offset = blurStrengthValues[blurStrength].offset;
@@ -564,16 +550,7 @@ void BlurEffect::drawWindow(EffectWindow *w, int mask, QRegion \
region, WindowPai  }
 
         if (!shape.isEmpty()) {
-            if (m_useSimpleBlur &&
-                w->isFullScreen() &&
-                GLRenderTarget::blitSupported() &&
-                m_simpleShader->isValid() &&
-                !GLPlatform::instance()->supports(LimitedNPOT) &&
-                shape.boundingRect() == w->geometry()) {
-                    doSimpleBlur(w, data.opacity(), data.screenProjectionMatrix());
-            } else {
-                doBlur(shape, screen, data.opacity(), data.screenProjectionMatrix(), \
                w->isDock());
-            }
+            doBlur(shape, screen, data.opacity(), data.screenProjectionMatrix(), \
w->isDock());  }
     }
 
@@ -594,32 +571,6 @@ void BlurEffect::paintEffectFrame(EffectFrame *frame, QRegion \
region, double opa  effects->paintEffectFrame(frame, region, opacity, frameOpacity);
 }
 
-void BlurEffect::doSimpleBlur(EffectWindow *w, const float opacity, const QMatrix4x4 \
                &screenProjection)
-{
-    // The fragment shader uses a LOD bias of 1.75, so we need 3 mipmap levels.
-    GLTexture blurTexture = GLTexture(GL_RGBA8, w->size(), 3);
-    blurTexture.setFilter(GL_LINEAR_MIPMAP_LINEAR);
-    blurTexture.setWrapMode(GL_CLAMP_TO_EDGE);
-
-    m_simpleTarget->attachTexture(blurTexture);
-    m_simpleTarget->blitFromFramebuffer(w->geometry(), QRect(QPoint(0, 0), \
                w->size()));
-    m_simpleTarget->detachTexture();
-
-    // Unmodified base image
-    ShaderBinder binder(m_simpleShader);
-    QMatrix4x4 mvp = screenProjection;
-    mvp.translate(w->x(), w->y());
-    m_simpleShader->setUniform(GLShader::ModelViewProjectionMatrix, mvp);
-    m_simpleShader->setUniform("u_alphaProgress", opacity);
-    glEnable(GL_BLEND);
-    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-    blurTexture.bind();
-    blurTexture.generateMipmaps();
-    blurTexture.render(infiniteRegion(), w->geometry());
-    blurTexture.unbind();
-    glDisable(GL_BLEND);
-}
-
 void BlurEffect::doBlur(const QRegion& shape, const QRect& screen, const float \
opacity, const QMatrix4x4 &screenProjection, bool isDock)  {
     QRegion expandedBlurRegion = expand(shape) & expand(screen);
diff --git a/effects/blur/blur.h b/effects/blur/blur.h
index 2c865187f..334352317 100644
--- a/effects/blur/blur.h
+++ b/effects/blur/blur.h
@@ -83,7 +83,6 @@ private:
     QRegion blurRegion(const EffectWindow *w) const;
     bool shouldBlur(const EffectWindow *w, int mask, const WindowPaintData &data) \
const;  void updateBlurRegion(EffectWindow *w) const;
-    void doSimpleBlur(EffectWindow *w, const float opacity, const QMatrix4x4 \
                &screenProjection);
     void doBlur(const QRegion &shape, const QRect &screen, const float opacity, \
                const QMatrix4x4 &screenProjection, bool isDock);
     void uploadRegion(QVector2D *&map, const QRegion &region, const int \
                downSampleIterations);
     void uploadGeometry(GLVertexBuffer *vbo, const QRegion &blurRegion, const \
QRegion &windowRegion); @@ -93,9 +92,6 @@ private:
     void copyScreenSampleTexture(GLVertexBuffer *vbo, int blurRectCount, QRegion \
blurShape, QSize screenSize, QMatrix4x4 screenProjection);  
 private:
-    GLShader *m_simpleShader;
-    GLRenderTarget *m_simpleTarget;
-
     BlurShader *m_shader;
     QVector <GLRenderTarget*> m_renderTargets;
     QVector <GLTexture> m_renderTextures;
@@ -105,7 +101,6 @@ private:
     QRegion m_damagedArea; // keeps track of the area which has been damaged (from \
                bottom to top)
     QRegion m_paintedArea; // actually painted area which is greater than \
                m_damagedArea
     QRegion m_currentBlur; // keeps track of the currently blured area of the \
                windows(from bottom to top)
-    bool m_useSimpleBlur;
 
     int m_downSampleIterations; // number of times the texture will be downsized to \
half size  int m_offset;
diff --git a/effects/blur/blur.kcfg b/effects/blur/blur.kcfg
index cc3a9f700..7e0c26332 100644
--- a/effects/blur/blur.kcfg
+++ b/effects/blur/blur.kcfg
@@ -8,8 +8,5 @@
         <entry name="BlurStrength" type="Int">
             <default>10</default>
         </entry>
-        <entry name="UseSimpleBlur" type="Bool">
-            <default>false</default>
-        </entry>
     </group>
 </kcfg>
diff --git a/effects/blur/blur_config.ui b/effects/blur/blur_config.ui
index a5629a0fc..a5da6ed7c 100644
--- a/effects/blur/blur_config.ui
+++ b/effects/blur/blur_config.ui
@@ -77,16 +77,6 @@
      </item>
     </layout>
    </item>
-   <item>
-    <widget class="QCheckBox" name="kcfg_UseSimpleBlur">
-     <property name="text">
-      <string>Use simple fullscreen blur</string>
-     </property>
-     <property name="checked">
-      <bool>false</bool>
-     </property>
-    </widget>
-   </item>
    <item>
     <spacer name="verticalSpacer">
      <property name="orientation">
diff --git a/effects/logout/data/1.10/logout-blur.frag \
b/effects/logout/data/1.10/logout-blur.frag deleted file mode 100644
index e06b56fca..000000000
--- a/effects/logout/data/1.10/logout-blur.frag
+++ /dev/null
@@ -1,9 +0,0 @@
-uniform sampler2D sampler;
-uniform float u_alphaProgress;
-
-varying vec2 texcoord0;
-
-void main() {
-    gl_FragColor = texture2D(sampler, texcoord0, 1.75);
-    gl_FragColor.a = u_alphaProgress;
-}
diff --git a/effects/logout/data/1.40/logout-blur.frag \
b/effects/logout/data/1.40/logout-blur.frag deleted file mode 100644
index 8f9e40867..000000000
--- a/effects/logout/data/1.40/logout-blur.frag
+++ /dev/null
@@ -1,14 +0,0 @@
-#version 140
-
-uniform sampler2D sampler;
-uniform float u_alphaProgress;
-
-in vec2 texcoord0;
-out vec4 fragColor;
-
-void main() {
-    vec4 texel = texture(sampler, texcoord0, 1.75);
-    texel.a = u_alphaProgress;
-
-    fragColor = texel;
-}
diff --git a/effects/shaders.qrc b/effects/shaders.qrc
index cf19e34c8..ddb715d69 100644
--- a/effects/shaders.qrc
+++ b/effects/shaders.qrc
@@ -6,7 +6,6 @@
   <file alias="cylinder.vert">cube/data/1.10/cylinder.vert</file>
   <file alias="sphere.vert">cube/data/1.10/sphere.vert</file>
   <file alias="invert.frag">invert/data/1.10/invert.frag</file>
-  <file alias="logout-blur.frag">logout/data/1.10/logout-blur.frag</file>
   <file alias="lookingglass.frag">lookingglass/data/1.10/lookingglass.frag</file>
   <file alias="blinking-startup-fragment.glsl">startupfeedback/data/blinking-startup-fragment.glsl</file>
  </qresource>
@@ -17,7 +16,6 @@
   <file alias="cylinder.vert">cube/data/1.40/cylinder.vert</file>
   <file alias="sphere.vert">cube/data/1.40/sphere.vert</file>
   <file alias="invert.frag">invert/data/1.40/invert.frag</file>
-  <file alias="logout-blur.frag">logout/data/1.40/logout-blur.frag</file>
   <file alias="lookingglass.frag">lookingglass/data/1.40/lookingglass.frag</file>
 </qresource>
 </RCC>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic