mesa: remove unused _mesa_error_check_format_type() function
authorBrian Paul <brianp@vmware.com>
Tue, 7 Feb 2012 14:42:33 +0000 (07:42 -0700)
committerBrian Paul <brianp@vmware.com>
Tue, 7 Feb 2012 14:45:40 +0000 (07:45 -0700)
This was only used by glReadPixels and glDrawPixels.  Now those
functions do the corresponding error checks.

Signed-off-by: Brian Paul <brianp@vmware.com>
src/mesa/main/readpix.c
src/mesa/main/readpix.h

index 9b9663af5ac18263c9cb75144072851d2500ebc8..48708a6eb9e41ed3ac4ab3087dbd0c643a75a4fb 100644 (file)
@@ -575,123 +575,6 @@ _mesa_readpixels(struct gl_context *ctx,
 }
 
 
-/**
- * Do error checking of the format/type parameters to glReadPixels and
- * glDrawPixels.
- * \param drawing if GL_TRUE do checking for DrawPixels, else do checking
- *                for ReadPixels.
- * \return GL_TRUE if error detected, GL_FALSE if no errors
- */
-GLboolean
-_mesa_error_check_format_type(struct gl_context *ctx, GLenum format,
-                              GLenum type, GLboolean drawing)
-{
-   const char *readDraw = drawing ? "Draw" : "Read";
-   const GLboolean reading = !drawing;
-   GLenum err;
-
-   /* state validation should have already been done */
-   ASSERT(ctx->NewState == 0x0);
-
-   err = _mesa_error_check_format_and_type(ctx, format, type);
-   if (err != GL_NO_ERROR) {
-      _mesa_error(ctx, err, "gl%sPixels(format or type)", readDraw);
-      return GL_TRUE;
-   }
-
-   /* additional checks */
-   switch (format) {
-   case GL_RG:
-   case GL_RED:
-   case GL_GREEN:
-   case GL_BLUE:
-   case GL_ALPHA:
-   case GL_LUMINANCE:
-   case GL_LUMINANCE_ALPHA:
-   case GL_RGB:
-   case GL_BGR:
-   case GL_RGBA:
-   case GL_BGRA:
-   case GL_ABGR_EXT:
-   case GL_RED_INTEGER_EXT:
-   case GL_GREEN_INTEGER_EXT:
-   case GL_BLUE_INTEGER_EXT:
-   case GL_ALPHA_INTEGER_EXT:
-   case GL_RGB_INTEGER_EXT:
-   case GL_RGBA_INTEGER_EXT:
-   case GL_BGR_INTEGER_EXT:
-   case GL_BGRA_INTEGER_EXT:
-   case GL_LUMINANCE_INTEGER_EXT:
-   case GL_LUMINANCE_ALPHA_INTEGER_EXT:
-      if (!drawing) {
-         /* reading */
-         if (!_mesa_source_buffer_exists(ctx, GL_COLOR)) {
-            _mesa_error(ctx, GL_INVALID_OPERATION,
-                        "glReadPixels(no color buffer)");
-            return GL_TRUE;
-         }
-      }
-      break;
-   case GL_COLOR_INDEX:
-      if (drawing) {
-         if (ctx->PixelMaps.ItoR.Size == 0 ||
-            ctx->PixelMaps.ItoG.Size == 0 ||
-            ctx->PixelMaps.ItoB.Size == 0) {
-            _mesa_error(ctx, GL_INVALID_OPERATION,
-                   "glDrawPixels(drawing color index pixels into RGB buffer)");
-            return GL_TRUE;
-         }
-      }
-      else {
-         /* reading */
-         if (!_mesa_source_buffer_exists(ctx, GL_COLOR)) {
-            _mesa_error(ctx, GL_INVALID_OPERATION,
-                        "glReadPixels(no color buffer)");
-            return GL_TRUE;
-         }
-         /* We no longer support CI-mode color buffers so trying to read
-          * GL_COLOR_INDEX pixels is always an error.
-          */
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glReadPixels(color buffer is RGB)");
-         return GL_TRUE;
-      }
-      break;
-   case GL_STENCIL_INDEX:
-      if ((drawing && !_mesa_dest_buffer_exists(ctx, format)) ||
-          (reading && !_mesa_source_buffer_exists(ctx, format))) {
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "gl%sPixels(no stencil buffer)", readDraw);
-         return GL_TRUE;
-      }
-      break;
-   case GL_DEPTH_COMPONENT:
-      if ((drawing && !_mesa_dest_buffer_exists(ctx, format))) {
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "gl%sPixels(no depth buffer)", readDraw);
-         return GL_TRUE;
-      }
-      break;
-   case GL_DEPTH_STENCIL_EXT:
-      if ((drawing && !_mesa_dest_buffer_exists(ctx, format)) ||
-          (reading && !_mesa_source_buffer_exists(ctx, format))) {
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "gl%sPixels(no depth or stencil buffer)", readDraw);
-         return GL_TRUE;
-      }
-      break;
-   default:
-      /* this should have been caught in _mesa_error_check_format_type() */
-      _mesa_problem(ctx, "unexpected format in _mesa_%sPixels", readDraw);
-      return GL_TRUE;
-   }
-
-   /* no errors */
-   return GL_FALSE;
-}
-      
-
-
 void GLAPIENTRY
 _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
                      GLenum format, GLenum type, GLsizei bufSize,
index 6caaf3adce1f1e981b5d344d1ad4db627c6b7e05..5a5f73f52950b099712dab8a6e7a667b501e9b12 100644 (file)
@@ -33,10 +33,6 @@ struct gl_context;
 struct gl_pixelstore_attrib;
 
 
-extern GLboolean
-_mesa_error_check_format_type(struct gl_context *ctx, GLenum format, GLenum type,
-                              GLboolean drawing);
-
 extern void
 _mesa_readpixels(struct gl_context *ctx,
                  GLint x, GLint y, GLsizei width, GLsizei height,