Check that ActiveTextureARB doesn't overflow MaxTextureUnits
authorAlan Hourihane <alanh@tungstengraphics.com>
Mon, 30 Dec 2002 19:24:05 +0000 (19:24 +0000)
committerAlan Hourihane <alanh@tungstengraphics.com>
Mon, 30 Dec 2002 19:24:05 +0000 (19:24 +0000)
src/mesa/main/texstate.c

index 91e7ad96420f064a021928c45d571ddfc6c7a507..d234b176813946cc82e46dc84b27f4b63788f59c 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: texstate.c,v 1.89 2002/12/18 15:01:26 brianp Exp $ */
+/* $Id: texstate.c,v 1.90 2002/12/30 19:24:05 alanh Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -2427,7 +2427,8 @@ _mesa_ActiveTextureARB( GLenum target )
       _mesa_debug(ctx, "glActiveTexture %s\n",
                   _mesa_lookup_enum_by_nr(target));
 
-   if (texUnit > ctx->Const.MaxTextureUnits) {
+   /* Cater for texture unit 0 is first, therefore use >= */
+   if (texUnit >= ctx->Const.MaxTextureUnits) {
       _mesa_error(ctx, GL_INVALID_ENUM, "glActiveTextureARB(target)");
       return;
    }