summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-05-14 13:24:24 -0600
committerBrian Paul <[email protected]>2009-05-21 09:17:08 -0600
commita185bcbdec856cc98c26098e4e447a683eed14d1 (patch)
treea880480e42ef18799b9f1bcee3ef00d26e5dc864 /src/mesa/main
parent899c524a49fe5dc7413656380ebd65bbd061c042 (diff)
mesa: move gl_array_attrib::_MaxElement to gl_array_object::_MaxElement
This value is per array object.
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/api_validate.c8
-rw-r--r--src/mesa/main/mtypes.h7
-rw-r--r--src/mesa/main/state.c2
3 files changed, 11 insertions, 6 deletions
diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
index d5c604c56a2..15076712502 100644
--- a/src/mesa/main/api_validate.c
+++ b/src/mesa/main/api_validate.c
@@ -182,10 +182,10 @@ _mesa_validate_DrawElements(GLcontext *ctx,
/* find max array index */
GLuint max = max_buffer_index(ctx, count, type, indices,
ctx->Array.ElementArrayBufferObj);
- if (max >= ctx->Array._MaxElement) {
+ if (max >= 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._MaxElement);
+ "out of bounds (max=%u)", max, ctx->Array.ArrayObj->_MaxElement);
return GL_FALSE;
}
}
@@ -254,7 +254,7 @@ _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode,
if (ctx->Const.CheckArrayBounds) {
GLuint max = max_buffer_index(ctx, count, type, indices,
ctx->Array.ElementArrayBufferObj);
- if (max >= ctx->Array._MaxElement) {
+ if (max >= ctx->Array.ArrayObj->_MaxElement) {
/* the max element is out of bounds of one or more enabled arrays */
return GL_FALSE;
}
@@ -293,7 +293,7 @@ _mesa_validate_DrawArrays(GLcontext *ctx,
return GL_FALSE;
if (ctx->Const.CheckArrayBounds) {
- if (start + count > (GLint) ctx->Array._MaxElement)
+ if (start + count > (GLint) ctx->Array.ArrayObj->_MaxElement)
return GL_FALSE;
}
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index d11df535f24..0df425c9131 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1578,6 +1578,12 @@ struct gl_array_object
/** Mask of _NEW_ARRAY_* values indicating which arrays are enabled */
GLbitfield _Enabled;
+
+ /**
+ * Min of all enabled arrays' _MaxElement. When arrays reside inside VBOs
+ * we can determine the max legal (in bounds) glDrawElements array index.
+ */
+ GLuint _MaxElement;
};
@@ -1602,7 +1608,6 @@ struct gl_array_attrib
struct gl_buffer_object *ArrayBufferObj;
struct gl_buffer_object *ElementArrayBufferObj;
#endif
- GLuint _MaxElement; /* Min of all enabled array's maxes */
};
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index a6411f7b621..bfbefa55d44 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -206,7 +206,7 @@ update_arrays( GLcontext *ctx )
}
/* _MaxElement is one past the last legal array element */
- ctx->Array._MaxElement = min;
+ arrayObj->_MaxElement = min;
}