[Cogl] [PATCH 5/6] framebuffer: Support the GL_RED texture workaround when querying bits
Robert Bragg
robert at sixbynine.org
Wed Jan 16 06:08:38 PST 2013
This looks good to land to me:
Reviewed-by: Robert Bragg <robert at linux.intel.com>
thanks,
- Robert
On Fri, Dec 14, 2012 at 11:43 AM, Neil Roberts <neil at linux.intel.com> wrote:
> When a component-alpha texture is made using a GL3 context a GL_RED
> texture is actually used and a swizzle is set up to hide it. However
> if a framebuffer is then bound to that texture then when the bits are
> queried this workaround will leak out of the API. To fix this it now
> detects the situation and reports the number of red bits as the number
> of alpha bits.
> ---
> cogl/driver/gl/cogl-framebuffer-gl.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/cogl/driver/gl/cogl-framebuffer-gl.c b/cogl/driver/gl/cogl-framebuffer-gl.c
> index 7e4aaca..41c6b1a 100644
> --- a/cogl/driver/gl/cogl-framebuffer-gl.c
> +++ b/cogl/driver/gl/cogl-framebuffer-gl.c
> @@ -947,6 +947,16 @@ _cogl_framebuffer_init_bits (CoglFramebuffer *framebuffer)
> GE( ctx, glGetIntegerv (GL_STENCIL_BITS, &framebuffer->bits.stencil) );
> }
>
> + /* If we don't have alpha textures then the alpha bits are actually
> + * stored in the red component */
> + if ((ctx->private_feature_flags &
> + COGL_PRIVATE_FEATURE_ALPHA_TEXTURES) == 0 &&
> + framebuffer->type == COGL_FRAMEBUFFER_TYPE_OFFSCREEN &&
> + framebuffer->format == COGL_PIXEL_FORMAT_A_8)
> + {
> + framebuffer->bits.alpha = framebuffer->bits.red;
> + framebuffer->bits.red = 0;
> + }
>
> COGL_NOTE (OFFSCREEN,
> "RGBA/D/S Bits for framebuffer[%p, %s]: %d, %d, %d, %d, %d, %d",
> --
> 1.7.11.3.g3c3efa5
>
> _______________________________________________
> Cogl mailing list
> Cogl at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/cogl
More information about the Cogl
mailing list