From 22569f7eb9505de4d2047dac3c0b0834926f3245 Mon Sep 17 00:00:00 2001 From: Casian Andrei Date: Sun, 28 Oct 2012 12:34:02 +0200 Subject: [PATCH] Remove forceAlpha uniform, which is no longer needed This was originally added by d467fc1bdbcf69bd6ef213bd909633c2edfb6878, to prevent alpha ending up to be 0 with blending disabled. Apparently, that was a driver issue that is no longer present. REVIEW: 107090 --- effects/logout/logout.cpp | 1 - effects/trackmouse/trackmouse.cpp | 1 - lanczosfilter.cpp | 2 -- libkwineffects/kwinglutils.cpp | 3 --- libkwineffects/kwinglutils.h | 5 +---- scene-fragment.glsl | 3 --- scene_opengl.cpp | 3 --- 7 files changed, 1 insertion(+), 17 deletions(-) diff --git a/effects/logout/logout.cpp b/effects/logout/logout.cpp index a5a11672bf..0628e37ca8 100644 --- a/effects/logout/logout.cpp +++ b/effects/logout/logout.cpp @@ -387,7 +387,6 @@ void LogoutEffect::renderBlurTexture() m_blurShader->setUniform(GLShader::Offset, QVector2D(0, 0)); m_blurShader->setUniform(GLShader::ModulationConstant, QVector4D(1.0, 1.0, 1.0, 1.0)); m_blurShader->setUniform(GLShader::Saturation, 1.0); - m_blurShader->setUniform(GLShader::AlphaToOne, 1); m_blurShader->setUniform("u_alphaProgress", (float)progress * 0.4f); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); diff --git a/effects/trackmouse/trackmouse.cpp b/effects/trackmouse/trackmouse.cpp index 602c9a5353..1c0e0b6ac0 100644 --- a/effects/trackmouse/trackmouse.cpp +++ b/effects/trackmouse/trackmouse.cpp @@ -143,7 +143,6 @@ void TrackMouseEffect::paintScreen(int mask, QRegion region, ScreenPaintData& da shader->setUniform(GLShader::ModelViewMatrix, matrix); shader->setUniform(GLShader::Saturation, 1.0); shader->setUniform(GLShader::ModulationConstant, QVector4D(1.0, 1.0, 1.0, 1.0)); - shader->setUniform(GLShader::AlphaToOne, 0); } else pushMatrix(matrix); m_texture[i]->bind(); diff --git a/lanczosfilter.cpp b/lanczosfilter.cpp index f011c13e65..75b9f9247a 100644 --- a/lanczosfilter.cpp +++ b/lanczosfilter.cpp @@ -215,7 +215,6 @@ void LanczosFilter::performPaint(EffectWindowImpl* w, int mask, QRegion region, shader->setUniform(GLShader::Offset, QVector2D(0, 0)); shader->setUniform(GLShader::ModulationConstant, QVector4D(rgb, rgb, rgb, a)); shader->setUniform(GLShader::Saturation, data.saturation()); - shader->setUniform(GLShader::AlphaToOne, 0); cachedTexture->render(region, textureRect, hardwareClipping); @@ -352,7 +351,6 @@ void LanczosFilter::performPaint(EffectWindowImpl* w, int mask, QRegion region, shader->setUniform(GLShader::Offset, QVector2D(0, 0)); shader->setUniform(GLShader::ModulationConstant, QVector4D(rgb, rgb, rgb, a)); shader->setUniform(GLShader::Saturation, data.saturation()); - shader->setUniform(GLShader::AlphaToOne, 0); cache->render(region, textureRect, hardwareClipping); diff --git a/libkwineffects/kwinglutils.cpp b/libkwineffects/kwinglutils.cpp index 32e275ec64..3301b34ffc 100644 --- a/libkwineffects/kwinglutils.cpp +++ b/libkwineffects/kwinglutils.cpp @@ -430,8 +430,6 @@ void GLShader::resolveLocations() mFloatLocation[Saturation] = uniformLocation("saturation"); - mIntLocation[AlphaToOne] = uniformLocation("u_forceAlpha"); - mLocationsResolved = true; } @@ -895,7 +893,6 @@ void ShaderManager::resetShader(ShaderType type) shader->setUniform(GLShader::ModulationConstant, QVector4D(1.0, 1.0, 1.0, 1.0)); shader->setUniform(GLShader::Saturation, 1.0f); - shader->setUniform(GLShader::AlphaToOne, 0); } /*** GLRenderTarget ***/ diff --git a/libkwineffects/kwinglutils.h b/libkwineffects/kwinglutils.h index 9b175b985a..f0237a33c1 100644 --- a/libkwineffects/kwinglutils.h +++ b/libkwineffects/kwinglutils.h @@ -190,7 +190,7 @@ public: }; enum IntUniform { - AlphaToOne, + AlphaToOne, ///< @deprecated no longer used IntUniformCount }; @@ -247,9 +247,6 @@ public: * normalized texture coordinates. Defaults to @c (1.0/1.0). And expects a @c vec3 * uniform @c colorManiuplation, with @c x being opacity, @c y being brightness and * @c z being saturation. All three values default to @c 1.0. - * The fragment shader takes a uniform @c u_forceAlpha to force the alpha component - * to @c 1.0 if it is set to a value not @c 0. This uniform is useful when rendering - * a RGB-only window and the alpha channel is required in a later step. * The sampler uniform is @c sample and defaults to @c 0. * The shader uses two vertex attributes @c vertex and @c texCoord. **/ diff --git a/scene-fragment.glsl b/scene-fragment.glsl index 4b5424be16..314bf5a65b 100644 --- a/scene-fragment.glsl +++ b/scene-fragment.glsl @@ -1,7 +1,6 @@ uniform sampler2D sampler; uniform vec4 modulation; uniform float saturation; -uniform int u_forceAlpha; varying vec2 varyingTexCoords; @@ -10,8 +9,6 @@ varying vec2 varyingTexCoords; void main() { vec4 tex = texture2D(sampler, varyingTexCoords); - tex.a += float(u_forceAlpha); - if (saturation != 1.0) { tex.rgb = mix(vec3(dot( vec3( 0.30, 0.59, 0.11 ), tex.rgb )), tex.rgb, saturation); } diff --git a/scene_opengl.cpp b/scene_opengl.cpp index f2a2c3697e..d8f9c62764 100644 --- a/scene_opengl.cpp +++ b/scene_opengl.cpp @@ -1256,7 +1256,6 @@ void SceneOpenGL2Window::prepareStates(TextureType type, qreal opacity, qreal br GLShader *shader = ShaderManager::instance()->getBoundShader(); shader->setUniform(GLShader::ModulationConstant, QVector4D(rgb, rgb, rgb, a)); shader->setUniform(GLShader::Saturation, saturation); - shader->setUniform(GLShader::AlphaToOne, opaque ? 1 : 0); } void SceneOpenGL2Window::restoreStates(TextureType type, qreal opacity, qreal brightness, qreal saturation) @@ -1269,7 +1268,6 @@ void SceneOpenGL2Window::restoreStates(TextureType type, qreal opacity, qreal br if (m_blendingEnabled) { glDisable(GL_BLEND); } - ShaderManager::instance()->getBoundShader()->setUniform(GLShader::AlphaToOne, 0); } //*************************************** @@ -1561,7 +1559,6 @@ void SceneOpenGL::EffectFrame::render(QRegion region, double opacity, double fra shader->setUniform(GLShader::ModulationConstant, QVector4D(1.0, 1.0, 1.0, 1.0)); shader->setUniform(GLShader::Saturation, 1.0f); - shader->setUniform(GLShader::AlphaToOne, 0); } glEnable(GL_BLEND);