aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/arrayobj.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-01-20 09:35:29 +0100
committermarha <marha@users.sourceforge.net>2012-01-20 09:35:29 +0100
commita8ef69cc0c9e5281e6b745dd4a2be75f629eb8b8 (patch)
tree8bc980551565964e13d046f54ee3876ba2bb7f14 /mesalib/src/mesa/main/arrayobj.c
parent34c1e86406451a3604de4982339058088434ab40 (diff)
downloadvcxsrv-a8ef69cc0c9e5281e6b745dd4a2be75f629eb8b8.tar.gz
vcxsrv-a8ef69cc0c9e5281e6b745dd4a2be75f629eb8b8.tar.bz2
vcxsrv-a8ef69cc0c9e5281e6b745dd4a2be75f629eb8b8.zip
xserver xkeyboard-config git update 20 jan 2012
Diffstat (limited to 'mesalib/src/mesa/main/arrayobj.c')
-rw-r--r--mesalib/src/mesa/main/arrayobj.c41
1 files changed, 27 insertions, 14 deletions
diff --git a/mesalib/src/mesa/main/arrayobj.c b/mesalib/src/mesa/main/arrayobj.c
index 29bfed8f5..328774543 100644
--- a/mesalib/src/mesa/main/arrayobj.c
+++ b/mesalib/src/mesa/main/arrayobj.c
@@ -280,15 +280,26 @@ remove_array_object( struct gl_context *ctx, struct gl_array_object *obj )
/**
- * Helper for update_arrays().
- * \return min(current min, array->_MaxElement).
+ * Helper for _mesa_update_array_object_max_element().
+ * \return min(arrayObj->VertexAttrib[*]._MaxElement).
*/
static GLuint
-update_min(GLuint min, struct gl_client_array *array)
+compute_max_element(struct gl_array_object *arrayObj, GLbitfield64 enabled)
{
- assert(array->Enabled);
- _mesa_update_array_max_element(array);
- return MIN2(min, array->_MaxElement);
+ GLuint min = ~((GLuint)0);
+
+ while (enabled) {
+ struct gl_client_array *client_array;
+ GLint attrib = ffsll(enabled) - 1;
+ enabled ^= BITFIELD64_BIT(attrib);
+
+ client_array = &arrayObj->VertexAttrib[attrib];
+ assert(client_array->Enabled);
+ _mesa_update_array_max_element(client_array);
+ min = MIN2(min, client_array->_MaxElement);
+ }
+
+ return min;
}
@@ -299,17 +310,19 @@ void
_mesa_update_array_object_max_element(struct gl_context *ctx,
struct gl_array_object *arrayObj)
{
- GLbitfield64 enabled = arrayObj->_Enabled;
- GLuint min = ~0u;
-
- while (enabled) {
- GLint attrib = ffsll(enabled) - 1;
- enabled &= ~BITFIELD64_BIT(attrib);
- min = update_min(min, &arrayObj->VertexAttrib[attrib]);
+ GLbitfield64 enabled;
+
+ if (!ctx->VertexProgram._Current ||
+ ctx->VertexProgram._Current == ctx->VertexProgram._TnlProgram) {
+ enabled = _mesa_array_object_get_enabled_ff(arrayObj);
+ } else if (ctx->VertexProgram._Current->IsNVProgram) {
+ enabled = _mesa_array_object_get_enabled_nv(arrayObj);
+ } else {
+ enabled = _mesa_array_object_get_enabled_arb(arrayObj);
}
/* _MaxElement is one past the last legal array element */
- arrayObj->_MaxElement = min;
+ arrayObj->_MaxElement = compute_max_element(arrayObj, enabled);
}