projects
/
mesa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
mesa: refactor: move _mesa_update_minmax/histogram() into image.c
[mesa.git]
/
src
/
mesa
/
main
/
api_validate.c
diff --git
a/src/mesa/main/api_validate.c
b/src/mesa/main/api_validate.c
index d1c8f42e7472c53d1910cc274cd876825237e506..9144b4bc6637e2bb956d8b8c91fe5990ac5d21fe 100644
(file)
--- a/
src/mesa/main/api_validate.c
+++ b/
src/mesa/main/api_validate.c
@@
-1,8
+1,8
@@
/*
* Mesa 3-D graphics library
/*
* Mesa 3-D graphics library
- * Version:
6
.1
+ * Version:
7.0
.1
*
*
- * Copyright (C) 1999-200
3
Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-200
7
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"),
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@
-60,8
+60,8
@@
_mesa_validate_DrawElements(GLcontext *ctx,
_mesa_update_state(ctx);
/* Always need vertex positions */
_mesa_update_state(ctx);
/* Always need vertex positions */
- if (!ctx->Array.Vertex.Enabled
- && !(ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[0].Enabled))
+ if (!ctx->Array.
ArrayObj->
Vertex.Enabled
+ && !(ctx->VertexProgram._Enabled && ctx->Array.
ArrayObj->
VertexAttrib[0].Enabled))
return GL_FALSE;
/* Vertex buffer object tests */
return GL_FALSE;
/* Vertex buffer object tests */
@@
-69,8
+69,9
@@
_mesa_validate_DrawElements(GLcontext *ctx,
GLuint indexBytes;
/* use indices in the buffer object */
GLuint indexBytes;
/* use indices in the buffer object */
- if (!ctx->Array.ElementArrayBufferObj->Data) {
- _mesa_warning(ctx, "DrawElements with empty vertex elements buffer!");
+ if (!ctx->Array.ElementArrayBufferObj->Size) {
+ _mesa_warning(ctx,
+ "glDrawElements called with empty array elements buffer");
return GL_FALSE;
}
return GL_FALSE;
}
@@
-86,25
+87,31
@@
_mesa_validate_DrawElements(GLcontext *ctx,
indexBytes = count * sizeof(GLushort);
}
indexBytes = count * sizeof(GLushort);
}
- if ((GLubyte *) indices + indexBytes >
- ctx->Array.ElementArrayBufferObj->Data +
- ctx->Array.ElementArrayBufferObj->Size) {
+ if (indexBytes > (GLuint) ctx->Array.ElementArrayBufferObj->Size) {
_mesa_warning(ctx, "glDrawElements index out of buffer bounds");
return GL_FALSE;
}
_mesa_warning(ctx, "glDrawElements index out of buffer bounds");
return GL_FALSE;
}
-
- /* Actual address is the sum of pointers. Indices may be used below. */
- if (ctx->Const.CheckArrayBounds) {
- indices = (const GLvoid *)
- ADD_POINTERS(ctx->Array.ElementArrayBufferObj->Data,
- (const GLubyte *) indices);
- }
+ }
+ else {
+ /* not using a VBO */
+ if (!indices)
+ return GL_FALSE;
}
if (ctx->Const.CheckArrayBounds) {
/* find max array index */
}
if (ctx->Const.CheckArrayBounds) {
/* find max array index */
+ const GLubyte *map;
GLuint max = 0;
GLint i;
GLuint max = 0;
GLint i;
+
+ map = ctx->Driver.MapBuffer(ctx,
+ GL_ELEMENT_ARRAY_BUFFER_ARB,
+ GL_READ_ONLY,
+ ctx->Array.ElementArrayBufferObj);
+
+ /* Actual address is the sum of pointers */
+ indices = (const GLvoid *) ADD_POINTERS(map, (const GLubyte *) indices);
+
if (type == GL_UNSIGNED_INT) {
for (i = 0; i < count; i++)
if (((GLuint *) indices)[i] > max)
if (type == GL_UNSIGNED_INT) {
for (i = 0; i < count; i++)
if (((GLuint *) indices)[i] > max)
@@
-121,6
+128,11
@@
_mesa_validate_DrawElements(GLcontext *ctx,
if (((GLubyte *) indices)[i] > max)
max = ((GLubyte *) indices)[i];
}
if (((GLubyte *) indices)[i] > max)
max = ((GLubyte *) indices)[i];
}
+
+ ctx->Driver.UnmapBuffer(ctx,
+ GL_ELEMENT_ARRAY_BUFFER_ARB,
+ ctx->Array.ElementArrayBufferObj);
+
if (max >= ctx->Array._MaxElement) {
/* the max element is out of bounds of one or more enabled arrays */
return GL_FALSE;
if (max >= ctx->Array._MaxElement) {
/* the max element is out of bounds of one or more enabled arrays */
return GL_FALSE;
@@
-166,10
+178,20
@@
_mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode,
_mesa_update_state(ctx);
/* Always need vertex positions */
_mesa_update_state(ctx);
/* Always need vertex positions */
- if (!ctx->Array.Vertex.Enabled
- && !(ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[0].Enabled))
+ if (!ctx->Array.
ArrayObj->
Vertex.Enabled
+ && !(ctx->VertexProgram._Enabled && ctx->Array.
ArrayObj->
VertexAttrib[0].Enabled))
return GL_FALSE;
return GL_FALSE;
+ /* Vertex buffer object tests */
+ if (ctx->Array.ElementArrayBufferObj->Name) {
+ /* XXX re-use code from above? */
+ }
+ else {
+ /* not using VBO */
+ if (!indices)
+ return GL_FALSE;
+ }
+
if (ctx->Const.CheckArrayBounds) {
/* Find max array index.
* We don't trust the user's start and end values.
if (ctx->Const.CheckArrayBounds) {
/* Find max array index.
* We don't trust the user's start and end values.
@@
-226,7
+248,7
@@
_mesa_validate_DrawArrays(GLcontext *ctx,
_mesa_update_state(ctx);
/* Always need vertex positions */
_mesa_update_state(ctx);
/* Always need vertex positions */
- if (!ctx->Array.
Vertex.Enabled && !ctx->Array.
VertexAttrib[0].Enabled)
+ if (!ctx->Array.
ArrayObj->Vertex.Enabled && !ctx->Array.ArrayObj->
VertexAttrib[0].Enabled)
return GL_FALSE;
if (ctx->Const.CheckArrayBounds) {
return GL_FALSE;
if (ctx->Const.CheckArrayBounds) {