[Mesa-dev] [PATCH] mesa: allow FBO attachments of formats LUMINANCE, LUMINANCE_ALPHA, and INTENSITY

Brian Paul brianp at vmware.com
Tue Oct 5 08:34:34 PDT 2010


On 10/02/2010 03:20 PM, Marek Olšák wrote:
> As per the GL_ARB_framebuffer_object specification.
>
> Signed-off-by: Marek Olšák<maraeo at gmail.com>
> ---
>   src/mesa/main/fbobject.c |   10 ++++++++++
>   1 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index f28846c..016df1d 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -452,6 +452,12 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
>                baseFormat != GL_RGBA&&
>   	(!ctx->Extensions.ARB_framebuffer_object ||
>   	      baseFormat != GL_ALPHA)&&
> +	     (!ctx->Extensions.ARB_framebuffer_object ||
> +	      baseFormat != GL_LUMINANCE)&&
> +	     (!ctx->Extensions.ARB_framebuffer_object ||
> +	      baseFormat != GL_LUMINANCE_ALPHA)&&
> +	     (!ctx->Extensions.ARB_framebuffer_object ||
> +	      baseFormat != GL_INTENSITY)&&
>   	(!ctx->Extensions.ARB_texture_rg ||
>   	      baseFormat != GL_RED)&&
>   	(!ctx->Extensions.ARB_texture_rg ||
> @@ -636,6 +642,10 @@ _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb)
>            if (f != GL_RGB&&  f != GL_RGBA&&  f != GL_DEPTH_COMPONENT
>                &&  f != GL_DEPTH_STENCIL_EXT
>   	&&  (!ctx->Extensions.ARB_framebuffer_object || f != GL_ALPHA)
> +	&&  (!ctx->Extensions.ARB_framebuffer_object || f != GL_LUMINANCE)
> +	&&  (!ctx->Extensions.ARB_framebuffer_object ||
> +                 f != GL_LUMINANCE_ALPHA)
> +	&&  (!ctx->Extensions.ARB_framebuffer_object || f != GL_INTENSITY)
>   	&&  (!ctx->Extensions.ARB_texture_rg || f != GL_RED)
>   	&&  (!ctx->Extensions.ARB_texture_rg || f != GL_RG)) {
>               fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT;

This looks OK.  But the code's getting a bit messy in this area so it 
would be nice to refactor it with some "is_legal_format()"-like 
functions to make it more readable.

-Brian



More information about the mesa-dev mailing list