render/gles2: set has_alpha for DMA-BUFs
Use our internal pixel format table to figure out whether an imported DMA-BUF has alpha.
This commit is contained in:
		
							parent
							
								
									9b70eab194
								
							
						
					
					
						commit
						9dba176e8d
					
				|  | @ -248,11 +248,19 @@ static struct wlr_texture *gles2_texture_from_dmabuf( | |||
| 	if (texture == NULL) { | ||||
| 		return NULL; | ||||
| 	} | ||||
| 	texture->has_alpha = true; | ||||
| 	texture->drm_format = DRM_FORMAT_INVALID; // texture can't be written anyways
 | ||||
| 	texture->inverted_y = | ||||
| 		(attribs->flags & WLR_DMABUF_ATTRIBUTES_FLAGS_Y_INVERT) != 0; | ||||
| 
 | ||||
| 	const struct wlr_pixel_format_info *drm_fmt = | ||||
| 		drm_get_pixel_format_info(attribs->format); | ||||
| 	if (drm_fmt != NULL) { | ||||
| 		texture->has_alpha = drm_fmt->has_alpha; | ||||
| 	} else { | ||||
| 		// We don't know, assume the texture has an alpha channel
 | ||||
| 		texture->has_alpha = true; | ||||
| 	} | ||||
| 
 | ||||
| 	struct wlr_egl_context prev_ctx; | ||||
| 	wlr_egl_save_context(&prev_ctx); | ||||
| 	wlr_egl_make_current(renderer->egl); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue