[cairo] [patch] gl: create BGRA texture and avoid conversion

Martin Robinson mrobinson at igalia.com
Wed Jan 30 13:07:33 PST 2013


On 01/30/2013 12:48 PM, Henry (Yu) Song - SISA wrote:
> ctx->supports_bgra is more meaningful, it means it supports both
> creating BGRA texture and can read that back into BGRA format.
> The GL_EXT_texture_format_BGRA888 is requirement of cairo, as
> checked at line 223 in cairo-gl-device.c .  There is no need
> to check it again.

Maybe I'm misunderstanding this: Cairo requires
GL_EXT_texture_format_BGRA888, which means that all drivers that support
Cairo support uploading BGRA data to textures. Thus the only distinction
necessary in the context is whether or not the hardware and driver
support reading BGRA data. That you can upload BGRA is implicit.

> ctx-supports_bgra == FALSE on desktop is to prevent create BGRA 
> texture on GL drivers, OpenGL does not allow to create texture
> of internal format of BGRA.

It seems better to simply check at the time you create the texture or to
add a helper method like _cairo_gl_can_create_bgra_textures. Desktop
always supports BGRA.

> The last point is something to do with stride difference of PIXMAN_a8b8g8r8
> vs. PIXMAN_x8b8g8r8.  At least I know some gles driver does not upload
> PIXMAN_x8b8g8r8 format correctly.

Driver bugs? Perhaps people who know pixman better have an idea. Seems
odd to punish all devices.

--Martin


More information about the cairo mailing list