From 181a4bd0cc436f89582408196038ff37032f9bac Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 13 May 2016 16:19:38 -0700 Subject: glamor: Preserve GL_RED bits in R channel when destination is GL_RED [v2] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A1 and A8 pixmaps are usually stored in the Red channel to conform with more recent GL versions. When using these pixmaps as mask values, that works great. When using these pixmaps as source values, then the value we want depends on what the destination looks like. For RGBA or RGB destinations, then we want to use the Red channel for A values and leave RGB all set to zero. For A destinations, then we want to leave the R values in the Red channel so that they end up in the Red channel of the output. This patch adds a helper function, glamor_bind_texture, which performs the glBindTexture call along with setting the swizzle parameter correctly for the Red channel. The swizzle parameter for the Alpha channel doesn't depend on the destination as it's safe to leave it always swizzled from the Red channel. This fixes incorrect rendering in firefox for this page: https://gfycat.com/HoarseCheapAmericankestrel while not breaking rendering for this page: https://feedly.com v2: Add change accidentally left in patch for missing glDisable(GL_COLOR_LOGIC_OP). Found by Emil Velikov Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=63397 Signed-off-by: Keith Packard Tested-by: Michel Dänzer --- glamor/glamor_dash.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'glamor/glamor_dash.c') diff --git a/glamor/glamor_dash.c b/glamor/glamor_dash.c index a6a11c1a2..3c19dba32 100644 --- a/glamor/glamor_dash.c +++ b/glamor/glamor_dash.c @@ -188,8 +188,7 @@ glamor_dash_setup(DrawablePtr drawable, GCPtr gc) /* Set the dash pattern as texture 1 */ - glActiveTexture(GL_TEXTURE1); - glBindTexture(GL_TEXTURE_2D, dash_priv->fbo->tex); + glamor_bind_texture(glamor_priv, GL_TEXTURE1, dash_priv->fbo, FALSE); glUniform1i(prog->dash_uniform, 1); glUniform1f(prog->dash_length_uniform, dash_pixmap->drawable.width); -- cgit v1.2.3