mutter/cogl/driver
Neil Roberts ff11a2b207 Use GL_ARB_texture_swizzle to emulate GL_ALPHA textures
The core profile of GL3 has removed support for component-alpha
textures. Previously the GL3 driver would just ignore this and try to
create them anyway. This would generate a GL error on Mesa.

To fix this the GL texture driver will now create a GL_RED texture
when GL_ALPHA textures are not supported natively. It will then set a
texture swizzle using the GL_ARB_texture_swizzle extension so that the
alpha component will be taken from the red component of the texture.
The swizzle is part of the texture object state so it only needs to be
set once when the texture is created.

The ‘gen’ virtual function of the texture driver has been changed to
also take the internal format as a parameter. The GL driver will now
set the swizzle as appropriate here.

The GL3 driver now reports an error if the texture swizzle extension
is not available because Cogl can't really work properly without out
it. The extension is part of GL 3.3 so it is quite likely that it has
wide support from drivers. Eventually we could get rid of this
requirement if we have our own GLSL front-end and we could generate
the swizzle ourselves.

When uploading or downloading texture data to or from a
component-alpha texture, we can no longer rely on GL to do the
conversion. The swizzle doesn't have any effect on the texture data
functions. In these cases Cogl will now force an intermediate buffer
to be used and it will manually do the conversion as it does for the
GLES drivers.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 32bacf81ebaa3be21a8f26af07d8f6eed6607652)
2013-01-22 17:48:04 +00:00
..
gl Use GL_ARB_texture_swizzle to emulate GL_ALPHA textures 2013-01-22 17:48:04 +00:00
nop Adds a NOP driver 2013-01-22 17:47:59 +00:00