Consolidate texObj->Pos/Neg/X/Y/Z and texObj->Image into a single
[mesa.git] / src / mesa / swrast / s_readpix.c
index 11bb6265b6f33adee69c3dd315d76bcb27e9298f..f2b91e0528259f9954f865179d4627e9bee4223d 100644 (file)
@@ -1,10 +1,8 @@
-/* $Id: s_readpix.c,v 1.18 2003/03/25 02:23:47 brianp Exp $ */
-
 /*
  * Mesa 3-D graphics library
- * Version:  4.1
+ * Version:  5.1
  *
- * Copyright (C) 1999-2002  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2003  Brian Paul   All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -62,6 +60,17 @@ read_index_pixels( GLcontext *ctx,
       return;
    }
 
+   if (type != GL_BYTE &&
+       type != GL_UNSIGNED_BYTE &&
+       type != GL_SHORT &&
+       type != GL_UNSIGNED_SHORT &&
+       type != GL_INT &&
+       type != GL_UNSIGNED_INT &&
+       type != GL_FLOAT) {
+      _mesa_error( ctx, GL_INVALID_OPERATION, "glReadPixels(index type)");
+      return;
+   }
+
    _swrast_use_read_buffer(ctx);
 
    readWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width;