Commit f8ff4027 authored by Alex Nemeth's avatar Alex Nemeth Committed by Fredrik Höglund
Browse files

Removed the "fastblur" path

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:
parent dca80232
......@@ -43,12 +43,6 @@ BlurEffect::BlurEffect()
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";
......@@ -87,12 +81,6 @@ BlurEffect::~BlurEffect()
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)
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);
m_simpleTarget->blitFromFramebuffer(w->geometry(), QRect(QPoint(0, 0), w->size()));
// 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);
blurTexture.render(infiniteRegion(), w->geometry());
void BlurEffect::doBlur(const QRegion& shape, const QRect& screen, const float opacity, const QMatrix4x4 &screenProjection, bool isDock)
QRegion expandedBlurRegion = expand(shape) & expand(screen);
......@@ -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);
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;
......@@ -8,8 +8,5 @@
<entry name="BlurStrength" type="Int">
<entry name="UseSimpleBlur" type="Bool">
......@@ -77,16 +77,6 @@
<widget class="QCheckBox" name="kcfg_UseSimpleBlur">
<property name="text">
<string>Use simple fullscreen blur</string>
<property name="checked">
<spacer name="verticalSpacer">
<property name="orientation">
uniform sampler2D sampler;
uniform float u_alphaProgress;
varying vec2 texcoord0;
void main() {
gl_FragColor = texture2D(sampler, texcoord0, 1.75);
gl_FragColor.a = u_alphaProgress;
#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;
......@@ -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>
......@@ -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>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment