-
-/* $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)
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)" );
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_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)
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;
}
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)" );
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;
}
-