Header file clean-up:
[mesa.git] / src / mesa / main / api_validate.c
index 8d3cbafc64c0a301acddb7646bc69be825687a55..33e3ea140fae4c68c7f1bf7f5d68fc780eba07f7 100644 (file)
@@ -1,11 +1,10 @@
-
-/* $Id: api_validate.c,v 1.4 2001/03/03 20:33:27 brianp Exp $ */
+/* $Id: api_validate.c,v 1.7 2002/10/24 23:57:19 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
- * Version:  3.5
+ * Version:  4.1
  *
- * Copyright (C) 1999-2000  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2002  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"),
 #include "glheader.h"
 #include "api_validate.h"
 #include "context.h"
+#include "imports.h"
 #include "mtypes.h"
 #include "state.h"
 
 
 GLboolean
 _mesa_validate_DrawElements(GLcontext *ctx,
-                           GLenum mode, GLsizei count, GLenum type, 
+                           GLenum mode, GLsizei count, GLenum type,
                            const GLvoid *indices)
 {
-   ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx,  GL_FALSE); 
+   ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx,  GL_FALSE);
 
    if (count <= 0) {
       if (count < 0)
@@ -45,14 +45,14 @@ _mesa_validate_DrawElements(GLcontext *ctx,
       return GL_FALSE;
    }
 
-   if (mode < 0 || 
+   if (mode < 0 ||
        mode > GL_POLYGON) {
       _mesa_error(ctx, GL_INVALID_ENUM, "glDrawArrays(mode)" );
       return GL_FALSE;
    }
 
-   if (type != GL_UNSIGNED_INT && 
-       type != GL_UNSIGNED_BYTE && 
+   if (type != GL_UNSIGNED_INT &&
+       type != GL_UNSIGNED_BYTE &&
        type != GL_UNSIGNED_SHORT)
    {
       _mesa_error(ctx, GL_INVALID_ENUM, "glDrawElements(type)" );
@@ -62,7 +62,10 @@ _mesa_validate_DrawElements(GLcontext *ctx,
    if (ctx->NewState)
       _mesa_update_state( ctx );
 
-   if (!ctx->Array.Vertex.Enabled)
+   if (ctx->Array.Vertex.Enabled
+       || (ctx->VertexProgram.Enabled && ctx->Array.VertexAttrib[0].Enabled))
+      return GL_TRUE;
+   else
       return GL_FALSE;
 
    return GL_TRUE;
@@ -70,12 +73,12 @@ _mesa_validate_DrawElements(GLcontext *ctx,
 
 
 GLboolean
-_mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode, 
-                                GLuint start, GLuint end, 
-                                GLsizei count, GLenum type, 
+_mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode,
+                                GLuint start, GLuint end,
+                                GLsizei count, GLenum type,
                                 const GLvoid *indices)
 {
-   ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); 
+   ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
 
    if (count <= 0) {
       if (count < 0)
@@ -93,10 +96,9 @@ _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode,
       return GL_FALSE;
    }
 
-   if (type != GL_UNSIGNED_INT && 
-       type != GL_UNSIGNED_BYTE && 
-       type != GL_UNSIGNED_SHORT)
-   {
+   if (type != GL_UNSIGNED_INT &&
+       type != GL_UNSIGNED_BYTE &&
+       type != GL_UNSIGNED_SHORT) {
       _mesa_error(ctx, GL_INVALID_ENUM, "glDrawElements(type)" );
       return GL_FALSE;
    }
@@ -104,19 +106,20 @@ _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode,
    if (ctx->NewState)
       _mesa_update_state( ctx );
 
-   if (!ctx->Array.Vertex.Enabled)
+   if (ctx->Array.Vertex.Enabled
+       || (ctx->VertexProgram.Enabled && ctx->Array.VertexAttrib[0].Enabled))
+      return GL_TRUE;
+   else
       return GL_FALSE;
-
-   return GL_TRUE;
 }
 
 
 
 GLboolean
-_mesa_validate_DrawArrays(GLcontext *ctx, 
+_mesa_validate_DrawArrays(GLcontext *ctx,
                          GLenum mode, GLint start, GLsizei count)
 {
-   ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); 
+   ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
 
    if (count<0) {
       _mesa_error(ctx, GL_INVALID_VALUE, "glDrawArrays(count)" );
@@ -131,9 +134,9 @@ _mesa_validate_DrawArrays(GLcontext *ctx,
    if (ctx->NewState)
       _mesa_update_state( ctx );
 
-   if (!ctx->Array.Vertex.Enabled) 
+   if (ctx->Array.Vertex.Enabled
+       || (ctx->VertexProgram.Enabled && ctx->Array.VertexAttrib[0].Enabled))
+      return GL_TRUE;
+   else
       return GL_FALSE;
-
-   return GL_TRUE;
 }
-