kwin/logout: Add GLSL 1.40 versions of the shaders

This commit is contained in:
Fredrik Höglund 2013-03-22 12:48:57 +01:00
parent a3d907d748
commit 9006e0e465
3 changed files with 33 additions and 2 deletions

View file

@ -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;
}

View file

@ -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);
}

View file

@ -25,6 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "logoutconfig.h"
#include "kwinglutils.h"
#include "kwinglplatform.h"
#include <math.h>
#include <kdebug.h>
@ -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";
}