mesa: use _mesa_base_format_has_channel() in fbobject.c queries

Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
Brian Paul
2011-11-23 15:33:45 -07:00
parent 858d1f0b1c
commit f0b6e9a729
3 changed files with 28 additions and 45 deletions

View File

@@ -46,6 +46,7 @@
#include "state.h"
#include "teximage.h"
#include "texobj.h"
#include "texparam.h"
/** Set this to 1 to help debug FBO incompleteness problems */
@@ -1477,48 +1478,10 @@ _mesa_EGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image)
static GLint
get_component_bits(GLenum pname, GLenum baseFormat, gl_format format)
{
switch (pname) {
case GL_RENDERBUFFER_RED_SIZE_EXT:
case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE:
if (baseFormat == GL_RGB || baseFormat == GL_RGBA ||
baseFormat == GL_RG || baseFormat == GL_RED)
return _mesa_get_format_bits(format, pname);
else
return 0;
case GL_RENDERBUFFER_GREEN_SIZE_EXT:
case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:
if (baseFormat == GL_RGB || baseFormat == GL_RGBA || baseFormat == GL_RG)
return _mesa_get_format_bits(format, pname);
else
return 0;
case GL_RENDERBUFFER_BLUE_SIZE_EXT:
case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:
if (baseFormat == GL_RGB || baseFormat == GL_RGBA)
return _mesa_get_format_bits(format, pname);
else
return 0;
case GL_RENDERBUFFER_ALPHA_SIZE_EXT:
case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
if (baseFormat == GL_RGBA || baseFormat == GL_ALPHA ||
baseFormat == GL_LUMINANCE_ALPHA)
return _mesa_get_format_bits(format, pname);
else
return 0;
case GL_RENDERBUFFER_DEPTH_SIZE_EXT:
case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:
if (baseFormat == GL_DEPTH_COMPONENT || baseFormat == GL_DEPTH_STENCIL)
return _mesa_get_format_bits(format, pname);
else
return 0;
case GL_RENDERBUFFER_STENCIL_SIZE_EXT:
case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:
if (baseFormat == GL_STENCIL_INDEX || baseFormat == GL_DEPTH_STENCIL)
return _mesa_get_format_bits(format, pname);
else
return 0;
default:
if (_mesa_base_format_has_channel(baseFormat, pname))
return _mesa_get_format_bits(format, pname);
else
return 0;
}
}