diff options
author | marha <marha@users.sourceforge.net> | 2012-01-20 09:41:09 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-01-20 09:41:09 +0100 |
commit | c5f912c7b9248440bf9dff4b3c64513ec0f3ec98 (patch) | |
tree | 7986b288489dac6a8a70787dbdedfc0c064a0c02 /mesalib/src/mesa/main/arrayobj.c | |
parent | 27bec2ba601ec12334e6b7564034f87ab7c9522b (diff) | |
parent | a8ef69cc0c9e5281e6b745dd4a2be75f629eb8b8 (diff) | |
download | vcxsrv-c5f912c7b9248440bf9dff4b3c64513ec0f3ec98.tar.gz vcxsrv-c5f912c7b9248440bf9dff4b3c64513ec0f3ec98.tar.bz2 vcxsrv-c5f912c7b9248440bf9dff4b3c64513ec0f3ec98.zip |
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'mesalib/src/mesa/main/arrayobj.c')
-rw-r--r-- | mesalib/src/mesa/main/arrayobj.c | 41 |
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); } |