glamor: Ignore destination alpha as necessary for composite operation
If the destination drawable is a window with effective depth 24 backed by a depth 32 pixmap. Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1575
This commit is contained in:
		
							parent
							
								
									8cce7f5d64
								
							
						
					
					
						commit
						d1f142891e
					
				|  | @ -111,6 +111,7 @@ enum shader_mask { | ||||||
| enum shader_dest_swizzle { | enum shader_dest_swizzle { | ||||||
|     SHADER_DEST_SWIZZLE_DEFAULT, |     SHADER_DEST_SWIZZLE_DEFAULT, | ||||||
|     SHADER_DEST_SWIZZLE_ALPHA_TO_RED, |     SHADER_DEST_SWIZZLE_ALPHA_TO_RED, | ||||||
|  |     SHADER_DEST_SWIZZLE_IGNORE_ALPHA, | ||||||
|     SHADER_DEST_SWIZZLE_COUNT, |     SHADER_DEST_SWIZZLE_COUNT, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -197,6 +197,11 @@ glamor_create_composite_fs(glamor_screen_private *glamor_priv, struct shader_key | ||||||
|         "	float undef;\n" |         "	float undef;\n" | ||||||
|         "	return vec4(color.a, undef, undef, undef);" |         "	return vec4(color.a, undef, undef, undef);" | ||||||
|         "}"; |         "}"; | ||||||
|  |     const char *dest_swizzle_ignore_alpha = | ||||||
|  |         "vec4 dest_swizzle(vec4 color)\n" | ||||||
|  |         "{" | ||||||
|  |         "	return vec4(color.xyz, 1.0);" | ||||||
|  |         "}"; | ||||||
| 
 | 
 | ||||||
|     const char *in_normal = |     const char *in_normal = | ||||||
|         "void main()\n" |         "void main()\n" | ||||||
|  | @ -286,6 +291,9 @@ glamor_create_composite_fs(glamor_screen_private *glamor_priv, struct shader_key | ||||||
|     case SHADER_DEST_SWIZZLE_ALPHA_TO_RED: |     case SHADER_DEST_SWIZZLE_ALPHA_TO_RED: | ||||||
|         dest_swizzle = dest_swizzle_alpha_to_red; |         dest_swizzle = dest_swizzle_alpha_to_red; | ||||||
|         break; |         break; | ||||||
|  |     case SHADER_DEST_SWIZZLE_IGNORE_ALPHA: | ||||||
|  |         dest_swizzle = dest_swizzle_ignore_alpha; | ||||||
|  |         break; | ||||||
|     default: |     default: | ||||||
|         FatalError("Bad composite shader dest swizzle"); |         FatalError("Bad composite shader dest swizzle"); | ||||||
|     } |     } | ||||||
|  | @ -938,7 +946,11 @@ glamor_composite_choose_shader(CARD8 op, | ||||||
|         glamor_priv->formats[8].format == GL_RED) { |         glamor_priv->formats[8].format == GL_RED) { | ||||||
|         key.dest_swizzle = SHADER_DEST_SWIZZLE_ALPHA_TO_RED; |         key.dest_swizzle = SHADER_DEST_SWIZZLE_ALPHA_TO_RED; | ||||||
|     } else { |     } else { | ||||||
|         key.dest_swizzle = SHADER_DEST_SWIZZLE_DEFAULT; |         if (dest_pixmap->drawable.depth == 32 && | ||||||
|  |             glamor_drawable_effective_depth(dest->pDrawable) == 24) | ||||||
|  |             key.dest_swizzle = SHADER_DEST_SWIZZLE_IGNORE_ALPHA; | ||||||
|  |         else | ||||||
|  |             key.dest_swizzle = SHADER_DEST_SWIZZLE_DEFAULT; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (source && source->alphaMap) { |     if (source && source->alphaMap) { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue