mesa: Also report renderbuffer red/green size for GL_RED and GL_RG.
authorEric Anholt <eric@anholt.net>
Mon, 3 Jan 2011 02:11:34 +0000 (18:11 -0800)
committerEric Anholt <eric@anholt.net>
Mon, 3 Jan 2011 21:28:26 +0000 (13:28 -0800)
Noticed by code inspection.

src/mesa/main/fbobject.c

index 5a93b0f03af9ebe901ba7c1d66c40d8b0bc9aa88..f7b772335004cdf2d2f5b5a5b9243723f2005e50 100644 (file)
@@ -1171,8 +1171,17 @@ 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)