aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/api_validate.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-04-12 09:53:17 +0000
committermarha <marha@users.sourceforge.net>2010-04-12 09:53:17 +0000
commit29b86f9852b2b7ecc31cdfee56679537e40bc6e2 (patch)
tree1e6ec8ccf2dbf773260a1953b8e13c49f9b7c5f5 /mesalib/src/mesa/main/api_validate.c
parent529236591df7366479a6fac30b387667678fd1ba (diff)
downloadvcxsrv-29b86f9852b2b7ecc31cdfee56679537e40bc6e2.tar.gz
vcxsrv-29b86f9852b2b7ecc31cdfee56679537e40bc6e2.tar.bz2
vcxsrv-29b86f9852b2b7ecc31cdfee56679537e40bc6e2.zip
svn merge -r524:HEAD "^/branches/released" .
Diffstat (limited to 'mesalib/src/mesa/main/api_validate.c')
-rw-r--r--mesalib/src/mesa/main/api_validate.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/mesalib/src/mesa/main/api_validate.c b/mesalib/src/mesa/main/api_validate.c
index e71e5a6ce..4fb7b5ad6 100644
--- a/mesalib/src/mesa/main/api_validate.c
+++ b/mesalib/src/mesa/main/api_validate.c
@@ -28,7 +28,6 @@
#include "context.h"
#include "imports.h"
#include "mtypes.h"
-#include "state.h"
#include "vbo/vbo.h"
@@ -124,6 +123,12 @@ check_valid_to_render(GLcontext *ctx, const char *function)
return GL_TRUE;
}
+
+/**
+ * Do bounds checking on array element indexes. Check that the vertices
+ * pointed to by the indices don't lie outside buffer object bounds.
+ * \return GL_TRUE if OK, GL_FALSE if any indexed vertex goes is out of bounds
+ */
static GLboolean
check_index_bounds(GLcontext *ctx, GLsizei count, GLenum type,
const GLvoid *indices, GLint basevertex)
@@ -148,17 +153,18 @@ check_index_bounds(GLcontext *ctx, GLsizei count, GLenum type,
vbo_get_minmax_index(ctx, &prim, &ib, &min, &max);
- if (min + basevertex < 0 ||
+ if ((int)(min + basevertex) < 0 ||
max + basevertex > ctx->Array.ArrayObj->_MaxElement) {
/* the max element is out of bounds of one or more enabled arrays */
- _mesa_warning(ctx, "glDrawElements() index=%u is "
- "out of bounds (max=%u)", max, ctx->Array.ArrayObj->_MaxElement);
+ _mesa_warning(ctx, "glDrawElements() index=%u is out of bounds (max=%u)",
+ max, ctx->Array.ArrayObj->_MaxElement);
return GL_FALSE;
}
return GL_TRUE;
}
+
/**
* Error checking for glDrawElements(). Includes parameter checking
* and VBO bounds checking.
@@ -190,9 +196,6 @@ _mesa_validate_DrawElements(GLcontext *ctx,
return GL_FALSE;
}
- if (ctx->NewState)
- _mesa_update_state(ctx);
-
if (!check_valid_to_render(ctx, "glDrawElements"))
return GL_FALSE;
@@ -254,9 +257,6 @@ _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode,
return GL_FALSE;
}
- if (ctx->NewState)
- _mesa_update_state(ctx);
-
if (!check_valid_to_render(ctx, "glDrawRangeElements"))
return GL_FALSE;
@@ -304,9 +304,6 @@ _mesa_validate_DrawArrays(GLcontext *ctx,
return GL_FALSE;
}
- if (ctx->NewState)
- _mesa_update_state(ctx);
-
if (!check_valid_to_render(ctx, "glDrawArrays"))
return GL_FALSE;