2010-03-05 20:42:10 +00:00
|
|
|
/*
|
|
|
|
* Copyright © 2010 Fredrik Höglund <fredrik@kde.org>
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
* Copyright © 2018 Alex Nemeth <alex.nemeth329@gmail.com>
|
2010-03-05 20:42:10 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; see the file COPYING. if not, write to
|
|
|
|
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "blurshader.h"
|
|
|
|
|
2011-01-08 18:56:22 +00:00
|
|
|
#include <kwineffects.h>
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
#include "kwinglutils.h"
|
2011-02-19 10:08:43 +00:00
|
|
|
#include <kwinglplatform.h>
|
2011-01-08 18:56:22 +00:00
|
|
|
|
2010-03-05 20:42:10 +00:00
|
|
|
#include <QByteArray>
|
2011-01-08 18:56:22 +00:00
|
|
|
#include <QMatrix4x4>
|
2010-03-05 20:42:10 +00:00
|
|
|
#include <QTextStream>
|
2011-01-08 18:56:22 +00:00
|
|
|
#include <QVector2D>
|
2010-03-05 20:42:10 +00:00
|
|
|
|
|
|
|
#include <cmath>
|
|
|
|
|
|
|
|
using namespace KWin;
|
|
|
|
|
|
|
|
|
|
|
|
BlurShader::BlurShader()
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
: mValid(false)
|
2010-03-05 20:42:10 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
BlurShader::~BlurShader()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-03-08 20:45:58 +00:00
|
|
|
BlurShader *BlurShader::create()
|
2010-03-05 20:42:10 +00:00
|
|
|
{
|
2014-06-10 15:09:20 +00:00
|
|
|
return new GLSLBlurShader();
|
2010-03-05 20:42:10 +00:00
|
|
|
}
|
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2010-03-05 20:42:10 +00:00
|
|
|
|
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
GLSLBlurShader::GLSLBlurShader()
|
2010-03-05 20:42:10 +00:00
|
|
|
{
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
init();
|
2010-03-05 20:42:10 +00:00
|
|
|
}
|
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
GLSLBlurShader::~GLSLBlurShader()
|
2010-03-05 20:42:10 +00:00
|
|
|
{
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
reset();
|
2010-03-05 20:42:10 +00:00
|
|
|
}
|
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
void GLSLBlurShader::reset()
|
2010-03-05 20:42:10 +00:00
|
|
|
{
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
delete m_shaderDownsample;
|
|
|
|
m_shaderDownsample = nullptr;
|
2010-03-10 18:16:18 +00:00
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
delete m_shaderUpsample;
|
|
|
|
m_shaderUpsample = nullptr;
|
2010-03-05 20:42:10 +00:00
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
delete m_shaderCopysample;
|
|
|
|
m_shaderCopysample = nullptr;
|
|
|
|
|
Added noise blur effect
Summary:
Added the option to turn on noise behind the blurred area.
The lowest strength value disables it completely, so it is optional and is disabled by default.
Test Plan:
Edit: this new screenshot shows the updated noise generation.
Edit2: separated the screenshots so you can flick through them to clearly see the differences
{F5694024}
{F5694031}
{F5694025}
{F5694028}
Reviewers: #kwin, #vdg, fredrik
Reviewed By: #vdg, fredrik
Subscribers: davidedmundson, matheusm, romangg, ivan, zzag, ngraham, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D10281
2018-02-13 23:12:39 +00:00
|
|
|
delete m_shaderNoisesample;
|
|
|
|
m_shaderNoisesample = nullptr;
|
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
setIsValid(false);
|
|
|
|
}
|
2013-03-13 17:16:58 +00:00
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
void GLSLBlurShader::setModelViewProjectionMatrix(const QMatrix4x4 &matrix)
|
|
|
|
{
|
|
|
|
if (!isValid())
|
|
|
|
return;
|
2013-03-13 17:16:58 +00:00
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
switch (m_activeSampleType) {
|
|
|
|
case CopySampleType:
|
|
|
|
if (matrix == m_matrixCopysample)
|
|
|
|
return;
|
2013-03-13 17:16:58 +00:00
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
m_matrixCopysample = matrix;
|
|
|
|
m_shaderCopysample->setUniform(m_mvpMatrixLocationCopysample, matrix);
|
|
|
|
break;
|
2013-03-13 17:16:58 +00:00
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
case UpSampleType:
|
|
|
|
if (matrix == m_matrixUpsample)
|
|
|
|
return;
|
2010-03-05 20:42:10 +00:00
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
m_matrixUpsample = matrix;
|
|
|
|
m_shaderUpsample->setUniform(m_mvpMatrixLocationUpsample, matrix);
|
|
|
|
break;
|
2010-03-05 20:42:10 +00:00
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
case DownSampleType:
|
|
|
|
if (matrix == m_matrixDownsample)
|
|
|
|
return;
|
2010-03-05 20:42:10 +00:00
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
m_matrixDownsample = matrix;
|
|
|
|
m_shaderDownsample->setUniform(m_mvpMatrixLocationDownsample, matrix);
|
|
|
|
break;
|
Added noise blur effect
Summary:
Added the option to turn on noise behind the blurred area.
The lowest strength value disables it completely, so it is optional and is disabled by default.
Test Plan:
Edit: this new screenshot shows the updated noise generation.
Edit2: separated the screenshots so you can flick through them to clearly see the differences
{F5694024}
{F5694031}
{F5694025}
{F5694028}
Reviewers: #kwin, #vdg, fredrik
Reviewed By: #vdg, fredrik
Subscribers: davidedmundson, matheusm, romangg, ivan, zzag, ngraham, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D10281
2018-02-13 23:12:39 +00:00
|
|
|
|
|
|
|
case NoiseSampleType:
|
|
|
|
if (matrix == m_matrixNoisesample)
|
|
|
|
return;
|
|
|
|
|
|
|
|
m_matrixNoisesample = matrix;
|
|
|
|
m_shaderNoisesample->setUniform(m_mvpMatrixLocationNoisesample, matrix);
|
|
|
|
break;
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
}
|
2010-03-05 20:42:10 +00:00
|
|
|
}
|
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
void GLSLBlurShader::setOffset(float offset)
|
|
|
|
{
|
|
|
|
if (!isValid())
|
|
|
|
return;
|
2010-03-08 20:45:58 +00:00
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
switch (m_activeSampleType) {
|
|
|
|
case UpSampleType:
|
|
|
|
if (offset == m_offsetUpsample)
|
|
|
|
return;
|
2010-03-08 20:45:58 +00:00
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
m_offsetUpsample = offset;
|
|
|
|
m_shaderUpsample->setUniform(m_offsetLocationUpsample, offset);
|
|
|
|
break;
|
2010-03-08 20:45:58 +00:00
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
case DownSampleType:
|
|
|
|
if (offset == m_offsetDownsample)
|
|
|
|
return;
|
2010-03-08 20:45:58 +00:00
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
m_offsetDownsample = offset;
|
|
|
|
m_shaderDownsample->setUniform(m_offsetLocationDownsample, offset);
|
|
|
|
break;
|
Added noise blur effect
Summary:
Added the option to turn on noise behind the blurred area.
The lowest strength value disables it completely, so it is optional and is disabled by default.
Test Plan:
Edit: this new screenshot shows the updated noise generation.
Edit2: separated the screenshots so you can flick through them to clearly see the differences
{F5694024}
{F5694031}
{F5694025}
{F5694028}
Reviewers: #kwin, #vdg, fredrik
Reviewed By: #vdg, fredrik
Subscribers: davidedmundson, matheusm, romangg, ivan, zzag, ngraham, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D10281
2018-02-13 23:12:39 +00:00
|
|
|
|
|
|
|
case NoiseSampleType:
|
|
|
|
if (offset == m_offsetNoisesample)
|
|
|
|
return;
|
|
|
|
|
|
|
|
m_offsetNoisesample = offset;
|
|
|
|
m_shaderNoisesample->setUniform(m_offsetLocationNoisesample, offset);
|
|
|
|
break;
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
}
|
2010-03-08 20:45:58 +00:00
|
|
|
}
|
|
|
|
|
Added noise blur effect
Summary:
Added the option to turn on noise behind the blurred area.
The lowest strength value disables it completely, so it is optional and is disabled by default.
Test Plan:
Edit: this new screenshot shows the updated noise generation.
Edit2: separated the screenshots so you can flick through them to clearly see the differences
{F5694024}
{F5694031}
{F5694025}
{F5694028}
Reviewers: #kwin, #vdg, fredrik
Reviewed By: #vdg, fredrik
Subscribers: davidedmundson, matheusm, romangg, ivan, zzag, ngraham, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D10281
2018-02-13 23:12:39 +00:00
|
|
|
void GLSLBlurShader::setTargetTextureSize(QSize renderTextureSize)
|
2010-03-08 20:45:58 +00:00
|
|
|
{
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
if (!isValid())
|
|
|
|
return;
|
2010-03-08 20:45:58 +00:00
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
QVector2D texSize = QVector2D(renderTextureSize.width(), renderTextureSize.height());
|
2010-03-12 15:56:19 +00:00
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
switch (m_activeSampleType) {
|
|
|
|
case CopySampleType:
|
|
|
|
m_shaderCopysample->setUniform(m_renderTextureSizeLocationCopysample, texSize);
|
|
|
|
break;
|
2010-03-12 15:56:19 +00:00
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
case UpSampleType:
|
|
|
|
m_shaderUpsample->setUniform(m_renderTextureSizeLocationUpsample, texSize);
|
|
|
|
m_shaderUpsample->setUniform(m_halfpixelLocationUpsample, QVector2D(0.5 / texSize.x(), 0.5 / texSize.y()));
|
|
|
|
break;
|
2010-03-08 20:45:58 +00:00
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
case DownSampleType:
|
|
|
|
m_shaderDownsample->setUniform(m_renderTextureSizeLocationDownsample, texSize);
|
|
|
|
m_shaderDownsample->setUniform(m_halfpixelLocationDownsample, QVector2D(0.5 / texSize.x(), 0.5 / texSize.y()));
|
|
|
|
break;
|
Added noise blur effect
Summary:
Added the option to turn on noise behind the blurred area.
The lowest strength value disables it completely, so it is optional and is disabled by default.
Test Plan:
Edit: this new screenshot shows the updated noise generation.
Edit2: separated the screenshots so you can flick through them to clearly see the differences
{F5694024}
{F5694031}
{F5694025}
{F5694028}
Reviewers: #kwin, #vdg, fredrik
Reviewed By: #vdg, fredrik
Subscribers: davidedmundson, matheusm, romangg, ivan, zzag, ngraham, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D10281
2018-02-13 23:12:39 +00:00
|
|
|
|
|
|
|
case NoiseSampleType:
|
|
|
|
m_shaderNoisesample->setUniform(m_renderTextureSizeLocationNoisesample, texSize);
|
|
|
|
m_shaderNoisesample->setUniform(m_halfpixelLocationNoisesample, QVector2D(0.5 / texSize.x(), 0.5 / texSize.y()));
|
|
|
|
break;
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
}
|
2010-03-08 20:45:58 +00:00
|
|
|
}
|
|
|
|
|
Added noise blur effect
Summary:
Added the option to turn on noise behind the blurred area.
The lowest strength value disables it completely, so it is optional and is disabled by default.
Test Plan:
Edit: this new screenshot shows the updated noise generation.
Edit2: separated the screenshots so you can flick through them to clearly see the differences
{F5694024}
{F5694031}
{F5694025}
{F5694028}
Reviewers: #kwin, #vdg, fredrik
Reviewed By: #vdg, fredrik
Subscribers: davidedmundson, matheusm, romangg, ivan, zzag, ngraham, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D10281
2018-02-13 23:12:39 +00:00
|
|
|
void GLSLBlurShader::setNoiseTextureSize(QSize noiseTextureSize)
|
|
|
|
{
|
|
|
|
QVector2D noiseTexSize = QVector2D(noiseTextureSize.width(), noiseTextureSize.height());
|
|
|
|
|
|
|
|
if (noiseTexSize != m_noiseTextureSizeNoisesample) {
|
|
|
|
m_noiseTextureSizeNoisesample = noiseTexSize;
|
|
|
|
m_shaderNoisesample->setUniform(m_noiseTextureSizeLocationNoisesample, noiseTexSize);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void GLSLBlurShader::setTexturePosition(QPoint texPos)
|
|
|
|
{
|
|
|
|
m_shaderNoisesample->setUniform(m_texStartPosLocationNoisesample, QVector2D(-texPos.x(), texPos.y()));
|
|
|
|
}
|
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
void GLSLBlurShader::setBlurRect(QRect blurRect, QSize screenSize)
|
2011-07-17 15:57:30 +00:00
|
|
|
{
|
2018-05-29 13:28:27 +00:00
|
|
|
if (!isValid())
|
2011-07-17 15:57:30 +00:00
|
|
|
return;
|
2013-03-25 22:54:24 +00:00
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
QVector4D rect = QVector4D(
|
|
|
|
blurRect.bottomLeft().x() / float(screenSize.width()),
|
2018-05-29 13:28:27 +00:00
|
|
|
1.0 - blurRect.bottomLeft().y() / float(screenSize.height()),
|
|
|
|
blurRect.topRight().x() / float(screenSize.width()),
|
|
|
|
1.0 - blurRect.topRight().y() / float(screenSize.height())
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
m_shaderCopysample->setUniform(m_blurRectLocationCopysample, rect);
|
2011-07-17 15:57:30 +00:00
|
|
|
}
|
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
void GLSLBlurShader::bind(SampleType sampleType)
|
2010-03-08 20:45:58 +00:00
|
|
|
{
|
2010-03-12 15:56:19 +00:00
|
|
|
if (!isValid())
|
|
|
|
return;
|
2010-03-08 20:45:58 +00:00
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
switch (sampleType) {
|
|
|
|
case CopySampleType:
|
|
|
|
ShaderManager::instance()->pushShader(m_shaderCopysample);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case UpSampleType:
|
|
|
|
ShaderManager::instance()->pushShader(m_shaderUpsample);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DownSampleType:
|
|
|
|
ShaderManager::instance()->pushShader(m_shaderDownsample);
|
|
|
|
break;
|
Added noise blur effect
Summary:
Added the option to turn on noise behind the blurred area.
The lowest strength value disables it completely, so it is optional and is disabled by default.
Test Plan:
Edit: this new screenshot shows the updated noise generation.
Edit2: separated the screenshots so you can flick through them to clearly see the differences
{F5694024}
{F5694031}
{F5694025}
{F5694028}
Reviewers: #kwin, #vdg, fredrik
Reviewed By: #vdg, fredrik
Subscribers: davidedmundson, matheusm, romangg, ivan, zzag, ngraham, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D10281
2018-02-13 23:12:39 +00:00
|
|
|
|
|
|
|
case NoiseSampleType:
|
|
|
|
ShaderManager::instance()->pushShader(m_shaderNoisesample);
|
|
|
|
break;
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m_activeSampleType = sampleType;
|
2010-03-08 20:45:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void GLSLBlurShader::unbind()
|
|
|
|
{
|
2011-01-08 18:56:22 +00:00
|
|
|
ShaderManager::instance()->popShader();
|
2010-03-08 20:45:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void GLSLBlurShader::init()
|
|
|
|
{
|
2015-11-09 09:38:49 +00:00
|
|
|
const bool gles = GLPlatform::instance()->isGLES();
|
|
|
|
const bool glsl_140 = !gles && GLPlatform::instance()->glslVersion() >= kVersionNumber(1, 40);
|
|
|
|
const bool core = glsl_140 || (gles && GLPlatform::instance()->glslVersion() >= kVersionNumber(3, 0));
|
2013-03-13 17:29:02 +00:00
|
|
|
|
2010-03-08 20:45:58 +00:00
|
|
|
QByteArray vertexSource;
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
QByteArray fragmentDownSource;
|
|
|
|
QByteArray fragmentUpSource;
|
|
|
|
QByteArray fragmentCopySource;
|
Added noise blur effect
Summary:
Added the option to turn on noise behind the blurred area.
The lowest strength value disables it completely, so it is optional and is disabled by default.
Test Plan:
Edit: this new screenshot shows the updated noise generation.
Edit2: separated the screenshots so you can flick through them to clearly see the differences
{F5694024}
{F5694031}
{F5694025}
{F5694028}
Reviewers: #kwin, #vdg, fredrik
Reviewed By: #vdg, fredrik
Subscribers: davidedmundson, matheusm, romangg, ivan, zzag, ngraham, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D10281
2018-02-13 23:12:39 +00:00
|
|
|
QByteArray fragmentNoiseSource;
|
2010-03-08 20:45:58 +00:00
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
const QByteArray attribute = core ? "in" : "attribute";
|
|
|
|
const QByteArray texture2D = core ? "texture" : "texture2D";
|
|
|
|
const QByteArray fragColor = core ? "fragColor" : "gl_FragColor";
|
2013-03-13 17:29:02 +00:00
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
QString glHeaderString;
|
2010-03-08 20:45:58 +00:00
|
|
|
|
2015-11-09 09:38:49 +00:00
|
|
|
if (gles) {
|
|
|
|
if (core) {
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
glHeaderString += "#version 300 es\n\n";
|
2015-11-09 09:38:49 +00:00
|
|
|
}
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
|
|
|
|
glHeaderString += "precision highp float;\n";
|
2015-11-09 09:38:49 +00:00
|
|
|
} else if (glsl_140) {
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
glHeaderString += "#version 140\n\n";
|
2015-11-09 09:38:49 +00:00
|
|
|
}
|
2013-03-13 17:29:02 +00:00
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
QString glUniformString = "uniform sampler2D texUnit;\n"
|
|
|
|
"uniform float offset;\n"
|
|
|
|
"uniform vec2 renderTextureSize;\n"
|
|
|
|
"uniform vec2 halfpixel;\n";
|
|
|
|
|
|
|
|
if (core) {
|
|
|
|
glUniformString += "out vec4 fragColor;\n\n";
|
2011-05-15 19:19:42 +00:00
|
|
|
}
|
2010-03-08 20:45:58 +00:00
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
|
|
|
|
// Vertex shader
|
2010-03-08 20:45:58 +00:00
|
|
|
// ===================================================================
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
QTextStream streamVert(&vertexSource);
|
2010-03-08 20:45:58 +00:00
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
streamVert << glHeaderString;
|
|
|
|
|
|
|
|
streamVert << "uniform mat4 modelViewProjectionMatrix;\n";
|
|
|
|
streamVert << attribute << " vec4 vertex;\n\n";
|
|
|
|
streamVert << "\n";
|
|
|
|
streamVert << "void main(void)\n";
|
|
|
|
streamVert << "{\n";
|
|
|
|
streamVert << " gl_Position = modelViewProjectionMatrix * vertex;\n";
|
|
|
|
streamVert << "}\n";
|
|
|
|
|
|
|
|
streamVert.flush();
|
|
|
|
|
|
|
|
// Fragment shader (Dual Kawase Blur) - Downsample
|
|
|
|
// ===================================================================
|
|
|
|
QTextStream streamFragDown(&fragmentDownSource);
|
|
|
|
|
|
|
|
streamFragDown << glHeaderString << glUniformString;
|
|
|
|
|
|
|
|
streamFragDown << "void main(void)\n";
|
|
|
|
streamFragDown << "{\n";
|
|
|
|
streamFragDown << " vec2 uv = vec2(gl_FragCoord.xy / renderTextureSize);\n";
|
|
|
|
streamFragDown << " \n";
|
|
|
|
streamFragDown << " vec4 sum = " << texture2D << "(texUnit, uv) * 4.0;\n";
|
|
|
|
streamFragDown << " sum += " << texture2D << "(texUnit, uv - halfpixel.xy * offset);\n";
|
|
|
|
streamFragDown << " sum += " << texture2D << "(texUnit, uv + halfpixel.xy * offset);\n";
|
|
|
|
streamFragDown << " sum += " << texture2D << "(texUnit, uv + vec2(halfpixel.x, -halfpixel.y) * offset);\n";
|
|
|
|
streamFragDown << " sum += " << texture2D << "(texUnit, uv - vec2(halfpixel.x, -halfpixel.y) * offset);\n";
|
|
|
|
streamFragDown << " \n";
|
|
|
|
streamFragDown << " " << fragColor << " = sum / 8.0;\n";
|
|
|
|
streamFragDown << "}\n";
|
|
|
|
|
|
|
|
streamFragDown.flush();
|
|
|
|
|
|
|
|
// Fragment shader (Dual Kawase Blur) - Upsample
|
|
|
|
// ===================================================================
|
|
|
|
QTextStream streamFragUp(&fragmentUpSource);
|
|
|
|
|
|
|
|
streamFragUp << glHeaderString << glUniformString;
|
|
|
|
|
|
|
|
streamFragUp << "void main(void)\n";
|
|
|
|
streamFragUp << "{\n";
|
|
|
|
streamFragUp << " vec2 uv = vec2(gl_FragCoord.xy / renderTextureSize);\n";
|
|
|
|
streamFragUp << " \n";
|
|
|
|
streamFragUp << " vec4 sum = " << texture2D << "(texUnit, uv + vec2(-halfpixel.x * 2.0, 0.0) * offset);\n";
|
|
|
|
streamFragUp << " sum += " << texture2D << "(texUnit, uv + vec2(-halfpixel.x, halfpixel.y) * offset) * 2.0;\n";
|
|
|
|
streamFragUp << " sum += " << texture2D << "(texUnit, uv + vec2(0.0, halfpixel.y * 2.0) * offset);\n";
|
|
|
|
streamFragUp << " sum += " << texture2D << "(texUnit, uv + vec2(halfpixel.x, halfpixel.y) * offset) * 2.0;\n";
|
|
|
|
streamFragUp << " sum += " << texture2D << "(texUnit, uv + vec2(halfpixel.x * 2.0, 0.0) * offset);\n";
|
|
|
|
streamFragUp << " sum += " << texture2D << "(texUnit, uv + vec2(halfpixel.x, -halfpixel.y) * offset) * 2.0;\n";
|
|
|
|
streamFragUp << " sum += " << texture2D << "(texUnit, uv + vec2(0.0, -halfpixel.y * 2.0) * offset);\n";
|
|
|
|
streamFragUp << " sum += " << texture2D << "(texUnit, uv + vec2(-halfpixel.x, -halfpixel.y) * offset) * 2.0;\n";
|
|
|
|
streamFragUp << " \n";
|
|
|
|
streamFragUp << " " << fragColor << " = sum / 12.0;\n";
|
|
|
|
streamFragUp << "}\n";
|
|
|
|
|
|
|
|
streamFragUp.flush();
|
|
|
|
|
|
|
|
// Fragment shader - Copy texture
|
|
|
|
// ===================================================================
|
|
|
|
QTextStream streamFragCopy(&fragmentCopySource);
|
2013-03-13 17:29:02 +00:00
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
streamFragCopy << glHeaderString;
|
2011-05-15 19:19:42 +00:00
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
streamFragCopy << "uniform sampler2D texUnit;\n";
|
|
|
|
streamFragCopy << "uniform vec2 renderTextureSize;\n";
|
|
|
|
streamFragCopy << "uniform vec4 blurRect;\n";
|
2013-03-13 17:29:02 +00:00
|
|
|
|
2015-11-09 09:38:49 +00:00
|
|
|
if (core)
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
streamFragCopy << "out vec4 fragColor;\n\n";
|
|
|
|
|
|
|
|
streamFragCopy << "void main(void)\n";
|
|
|
|
streamFragCopy << "{\n";
|
|
|
|
streamFragCopy << " vec2 uv = vec2(gl_FragCoord.xy / renderTextureSize);\n";
|
|
|
|
streamFragCopy << " " << fragColor << " = " << texture2D << "(texUnit, clamp(uv, blurRect.xy, blurRect.zw));\n";
|
|
|
|
streamFragCopy << "}\n";
|
|
|
|
|
|
|
|
streamFragCopy.flush();
|
|
|
|
|
Added noise blur effect
Summary:
Added the option to turn on noise behind the blurred area.
The lowest strength value disables it completely, so it is optional and is disabled by default.
Test Plan:
Edit: this new screenshot shows the updated noise generation.
Edit2: separated the screenshots so you can flick through them to clearly see the differences
{F5694024}
{F5694031}
{F5694025}
{F5694028}
Reviewers: #kwin, #vdg, fredrik
Reviewed By: #vdg, fredrik
Subscribers: davidedmundson, matheusm, romangg, ivan, zzag, ngraham, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D10281
2018-02-13 23:12:39 +00:00
|
|
|
// Fragment shader - Noise texture
|
|
|
|
// ===================================================================
|
|
|
|
QTextStream streamFragNoise(&fragmentNoiseSource);
|
|
|
|
|
|
|
|
streamFragNoise << glHeaderString << glUniformString;
|
|
|
|
|
|
|
|
streamFragNoise << "uniform sampler2D noiseTexUnit;\n";
|
|
|
|
streamFragNoise << "uniform vec2 noiseTextureSize;\n";
|
|
|
|
streamFragNoise << "uniform vec2 texStartPos;\n";
|
|
|
|
|
|
|
|
// Upsampling + Noise
|
|
|
|
streamFragNoise << "void main(void)\n";
|
|
|
|
streamFragNoise << "{\n";
|
|
|
|
streamFragNoise << " vec2 uv = vec2(gl_FragCoord.xy / renderTextureSize);\n";
|
|
|
|
streamFragNoise << " vec2 uvNoise = vec2((texStartPos.xy + gl_FragCoord.xy) / noiseTextureSize);\n";
|
|
|
|
streamFragNoise << " \n";
|
|
|
|
streamFragNoise << " vec4 sum = " << texture2D << "(texUnit, uv + vec2(-halfpixel.x * 2.0, 0.0) * offset);\n";
|
|
|
|
streamFragNoise << " sum += " << texture2D << "(texUnit, uv + vec2(-halfpixel.x, halfpixel.y) * offset) * 2.0;\n";
|
|
|
|
streamFragNoise << " sum += " << texture2D << "(texUnit, uv + vec2(0.0, halfpixel.y * 2.0) * offset);\n";
|
|
|
|
streamFragNoise << " sum += " << texture2D << "(texUnit, uv + vec2(halfpixel.x, halfpixel.y) * offset) * 2.0;\n";
|
|
|
|
streamFragNoise << " sum += " << texture2D << "(texUnit, uv + vec2(halfpixel.x * 2.0, 0.0) * offset);\n";
|
|
|
|
streamFragNoise << " sum += " << texture2D << "(texUnit, uv + vec2(halfpixel.x, -halfpixel.y) * offset) * 2.0;\n";
|
|
|
|
streamFragNoise << " sum += " << texture2D << "(texUnit, uv + vec2(0.0, -halfpixel.y * 2.0) * offset);\n";
|
|
|
|
streamFragNoise << " sum += " << texture2D << "(texUnit, uv + vec2(-halfpixel.x, -halfpixel.y) * offset) * 2.0;\n";
|
|
|
|
streamFragNoise << " \n";
|
|
|
|
streamFragNoise << " " << fragColor << " = sum / 12.0 - (vec4(0.5, 0.5, 0.5, 0) - vec4(" << texture2D << "(noiseTexUnit, uvNoise).rrr, 0));\n";
|
|
|
|
streamFragNoise << "}\n";
|
|
|
|
|
|
|
|
streamFragNoise.flush();
|
|
|
|
|
|
|
|
|
|
|
|
m_shaderDownsample = ShaderManager::instance()->loadShaderFromCode(vertexSource, fragmentDownSource);
|
|
|
|
m_shaderUpsample = ShaderManager::instance()->loadShaderFromCode(vertexSource, fragmentUpSource);
|
|
|
|
m_shaderCopysample = ShaderManager::instance()->loadShaderFromCode(vertexSource, fragmentCopySource);
|
|
|
|
m_shaderNoisesample = ShaderManager::instance()->loadShaderFromCode(vertexSource, fragmentNoiseSource);
|
|
|
|
|
|
|
|
bool areShadersValid = m_shaderDownsample->isValid() &&
|
|
|
|
m_shaderUpsample->isValid() &&
|
|
|
|
m_shaderCopysample->isValid() &&
|
|
|
|
m_shaderNoisesample->isValid();
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
setIsValid(areShadersValid);
|
|
|
|
|
|
|
|
if (areShadersValid) {
|
|
|
|
m_mvpMatrixLocationDownsample = m_shaderDownsample->uniformLocation("modelViewProjectionMatrix");
|
|
|
|
m_offsetLocationDownsample = m_shaderDownsample->uniformLocation("offset");
|
|
|
|
m_renderTextureSizeLocationDownsample = m_shaderDownsample->uniformLocation("renderTextureSize");
|
|
|
|
m_halfpixelLocationDownsample = m_shaderDownsample->uniformLocation("halfpixel");
|
|
|
|
|
|
|
|
m_mvpMatrixLocationUpsample = m_shaderUpsample->uniformLocation("modelViewProjectionMatrix");
|
|
|
|
m_offsetLocationUpsample = m_shaderUpsample->uniformLocation("offset");
|
|
|
|
m_renderTextureSizeLocationUpsample = m_shaderUpsample->uniformLocation("renderTextureSize");
|
|
|
|
m_halfpixelLocationUpsample = m_shaderUpsample->uniformLocation("halfpixel");
|
|
|
|
|
|
|
|
m_mvpMatrixLocationCopysample = m_shaderCopysample->uniformLocation("modelViewProjectionMatrix");
|
|
|
|
m_renderTextureSizeLocationCopysample = m_shaderCopysample->uniformLocation("renderTextureSize");
|
|
|
|
m_blurRectLocationCopysample = m_shaderCopysample->uniformLocation("blurRect");
|
2013-03-25 22:54:24 +00:00
|
|
|
|
Added noise blur effect
Summary:
Added the option to turn on noise behind the blurred area.
The lowest strength value disables it completely, so it is optional and is disabled by default.
Test Plan:
Edit: this new screenshot shows the updated noise generation.
Edit2: separated the screenshots so you can flick through them to clearly see the differences
{F5694024}
{F5694031}
{F5694025}
{F5694028}
Reviewers: #kwin, #vdg, fredrik
Reviewed By: #vdg, fredrik
Subscribers: davidedmundson, matheusm, romangg, ivan, zzag, ngraham, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D10281
2018-02-13 23:12:39 +00:00
|
|
|
m_mvpMatrixLocationNoisesample = m_shaderNoisesample->uniformLocation("modelViewProjectionMatrix");
|
|
|
|
m_offsetLocationNoisesample = m_shaderNoisesample->uniformLocation("offset");
|
|
|
|
m_renderTextureSizeLocationNoisesample = m_shaderNoisesample->uniformLocation("renderTextureSize");
|
|
|
|
m_noiseTextureSizeLocationNoisesample = m_shaderNoisesample->uniformLocation("noiseTextureSize");
|
|
|
|
m_texStartPosLocationNoisesample = m_shaderNoisesample->uniformLocation("texStartPos");
|
|
|
|
m_halfpixelLocationNoisesample = m_shaderNoisesample->uniformLocation("halfpixel");
|
|
|
|
|
2011-01-08 18:56:22 +00:00
|
|
|
QMatrix4x4 modelViewProjection;
|
2014-02-24 15:13:30 +00:00
|
|
|
const QSize screenSize = effects->virtualScreenSize();
|
|
|
|
modelViewProjection.ortho(0, screenSize.width(), screenSize.height(), 0, 0, 65535);
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
|
|
|
|
//Add default values to the uniforms of the shaders
|
|
|
|
ShaderManager::instance()->pushShader(m_shaderDownsample);
|
|
|
|
m_shaderDownsample->setUniform(m_mvpMatrixLocationDownsample, modelViewProjection);
|
|
|
|
m_shaderDownsample->setUniform(m_offsetLocationDownsample, float(1.0));
|
|
|
|
m_shaderDownsample->setUniform(m_renderTextureSizeLocationDownsample, QVector2D(1.0, 1.0));
|
|
|
|
m_shaderDownsample->setUniform(m_halfpixelLocationDownsample, QVector2D(1.0, 1.0));
|
2011-01-08 18:56:22 +00:00
|
|
|
ShaderManager::instance()->popShader();
|
2010-03-12 15:56:19 +00:00
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
ShaderManager::instance()->pushShader(m_shaderUpsample);
|
|
|
|
m_shaderUpsample->setUniform(m_mvpMatrixLocationUpsample, modelViewProjection);
|
|
|
|
m_shaderUpsample->setUniform(m_offsetLocationUpsample, float(1.0));
|
|
|
|
m_shaderUpsample->setUniform(m_renderTextureSizeLocationUpsample, QVector2D(1.0, 1.0));
|
|
|
|
m_shaderUpsample->setUniform(m_halfpixelLocationUpsample, QVector2D(1.0, 1.0));
|
|
|
|
ShaderManager::instance()->popShader();
|
|
|
|
|
|
|
|
ShaderManager::instance()->pushShader(m_shaderCopysample);
|
|
|
|
m_shaderCopysample->setUniform(m_mvpMatrixLocationCopysample, modelViewProjection);
|
|
|
|
m_shaderCopysample->setUniform(m_renderTextureSizeLocationCopysample, QVector2D(1.0, 1.0));
|
|
|
|
m_shaderCopysample->setUniform(m_blurRectLocationCopysample, QVector4D(1.0, 1.0, 1.0, 1.0));
|
|
|
|
ShaderManager::instance()->popShader();
|
|
|
|
|
Added noise blur effect
Summary:
Added the option to turn on noise behind the blurred area.
The lowest strength value disables it completely, so it is optional and is disabled by default.
Test Plan:
Edit: this new screenshot shows the updated noise generation.
Edit2: separated the screenshots so you can flick through them to clearly see the differences
{F5694024}
{F5694031}
{F5694025}
{F5694028}
Reviewers: #kwin, #vdg, fredrik
Reviewed By: #vdg, fredrik
Subscribers: davidedmundson, matheusm, romangg, ivan, zzag, ngraham, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D10281
2018-02-13 23:12:39 +00:00
|
|
|
ShaderManager::instance()->pushShader(m_shaderNoisesample);
|
|
|
|
m_shaderNoisesample->setUniform(m_mvpMatrixLocationNoisesample, modelViewProjection);
|
|
|
|
m_shaderNoisesample->setUniform(m_offsetLocationNoisesample, float(1.0));
|
|
|
|
m_shaderNoisesample->setUniform(m_renderTextureSizeLocationNoisesample, QVector2D(1.0, 1.0));
|
|
|
|
m_shaderNoisesample->setUniform(m_noiseTextureSizeLocationNoisesample, QVector2D(1.0, 1.0));
|
|
|
|
m_shaderNoisesample->setUniform(m_texStartPosLocationNoisesample, QVector2D(1.0, 1.0));
|
|
|
|
m_shaderNoisesample->setUniform(m_halfpixelLocationNoisesample, QVector2D(1.0, 1.0));
|
|
|
|
|
|
|
|
glUniform1i(m_shaderNoisesample->uniformLocation("texUnit"), 0);
|
|
|
|
glUniform1i(m_shaderNoisesample->uniformLocation("noiseTexUnit"), 1);
|
|
|
|
|
|
|
|
ShaderManager::instance()->popShader();
|
|
|
|
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
m_activeSampleType = -1;
|
Added noise blur effect
Summary:
Added the option to turn on noise behind the blurred area.
The lowest strength value disables it completely, so it is optional and is disabled by default.
Test Plan:
Edit: this new screenshot shows the updated noise generation.
Edit2: separated the screenshots so you can flick through them to clearly see the differences
{F5694024}
{F5694031}
{F5694025}
{F5694028}
Reviewers: #kwin, #vdg, fredrik
Reviewed By: #vdg, fredrik
Subscribers: davidedmundson, matheusm, romangg, ivan, zzag, ngraham, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D10281
2018-02-13 23:12:39 +00:00
|
|
|
|
|
|
|
m_offsetDownsample = 0.0;
|
|
|
|
m_matrixDownsample = QMatrix4x4();
|
|
|
|
|
|
|
|
m_offsetUpsample = 0.0;
|
|
|
|
m_matrixUpsample = QMatrix4x4();
|
|
|
|
|
|
|
|
m_matrixCopysample = QMatrix4x4();
|
|
|
|
|
|
|
|
m_offsetNoisesample = 0.0;
|
|
|
|
m_noiseTextureSizeNoisesample = QVector2D();
|
|
|
|
m_matrixNoisesample = QMatrix4x4();
|
Updated the blur method to use the more efficient dual kawase blur algorithm.
Summary:
Updated the old and outdated blur method to use the much more efficient dual kawase blur method.
Now with this we can do virtually infinite blur with very very little performance cost.
The dual kawase blur method is basically downscaling and upscaling an image, but combined with the kawase blur shader.
Comparison: https://i.imgur.com/mh6Cw61.png
Left is old, right is new.
Comparison was done with the strongest blur setting in a VM running on an Intel i7-4790 and a GTX980
We can see here that the performance is even better with this new method.
Reviewers: #plasma, #kwin, graesslin, fredrik
Reviewed By: fredrik
Subscribers: hein, dos, luebking, broulik, romangg, zzag, anthonyfieroni, mart, davidedmundson, fredrik, ngraham, plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9848
2018-01-25 17:31:11 +00:00
|
|
|
}
|
2010-03-08 20:45:58 +00:00
|
|
|
}
|