diff --git a/effects/logout/data/logout-blur-140.frag b/effects/logout/data/logout-blur-140.frag new file mode 100644 index 0000000000..3c6f3622af --- /dev/null +++ b/effects/logout/data/logout-blur-140.frag @@ -0,0 +1,14 @@ +#version 140 + +uniform sampler2D sampler; +uniform float u_alphaProgress; + +in vec2 varyingTexCoords; +out vec4 fragColor; + +void main() { + vec4 texel = texture(sampler, varyingTexCoords, 1.75); + texel.a = u_alphaProgress; + + fragColor = texel; +} diff --git a/effects/logout/data/vignetting-140.frag b/effects/logout/data/vignetting-140.frag new file mode 100644 index 0000000000..af25ae3395 --- /dev/null +++ b/effects/logout/data/vignetting-140.frag @@ -0,0 +1,12 @@ +#version 140 + +uniform vec2 u_center; +uniform float u_radius; +uniform float u_progress; + +out vec4 fragColor; + +void main() { + float d = smoothstep(0, u_radius, distance(gl_FragCoord.xy, u_center)); + fragColor = vec4(0.0, 0.0, 0.0, d * u_progress); +} diff --git a/effects/logout/logout.cpp b/effects/logout/logout.cpp index 3c8ee5aced..86ccc4e7ea 100644 --- a/effects/logout/logout.cpp +++ b/effects/logout/logout.cpp @@ -25,6 +25,7 @@ along with this program. If not, see . #include "logoutconfig.h" #include "kwinglutils.h" +#include "kwinglplatform.h" #include #include @@ -295,8 +296,10 @@ void LogoutEffect::renderVignetting() return; } if (!m_vignettingShader) { + const char *shader = GLPlatform::instance()->glslVersion() >= kVersionNumber(1, 40) ? + "kwin/vignetting-140.frag" : "kwin/vignetting.frag"; m_vignettingShader = ShaderManager::instance()->loadFragmentShader(KWin::ShaderManager::ColorShader, - KGlobal::dirs()->findResource("data", "kwin/vignetting.frag")); + KGlobal::dirs()->findResource("data", shader)); if (!m_vignettingShader->isValid()) { kDebug(1212) << "Vignetting Shader failed to load"; return; @@ -375,8 +378,10 @@ void LogoutEffect::renderBlurTexture() return; } if (!m_blurShader) { + const char *shader = GLPlatform::instance()->glslVersion() >= kVersionNumber(1, 40) ? + "kwin/logout-blur-140.frag" : "kwin/logout-blur.frag"; m_blurShader = ShaderManager::instance()->loadFragmentShader(KWin::ShaderManager::SimpleShader, - KGlobal::dirs()->findResource("data", "kwin/logout-blur.frag")); + KGlobal::dirs()->findResource("data", shader)); if (!m_blurShader->isValid()) { kDebug(1212) << "Logout blur shader failed to load"; }