Mesa (master): mesa: use Elements() macro to limit loops instead of constants

Brian Paul brianp at kemper.freedesktop.org
Fri May 22 15:41:33 UTC 2009


Module: Mesa
Branch: master
Commit: 42ae2a8648923b6fa11e29ad0f6ff7555534e390
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=42ae2a8648923b6fa11e29ad0f6ff7555534e390

Author: Brian Paul <brianp at vmware.com>
Date:   Fri May 22 07:51:13 2009 -0600

mesa: use Elements() macro to limit loops instead of constants

---

 src/mesa/main/arrayobj.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index f9b11ee..c03353b 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -89,10 +89,10 @@ unbind_array_object_vbos(GLcontext *ctx, struct gl_array_object *obj)
    _mesa_reference_buffer_object(ctx, &obj->Index.BufferObj, NULL);
    _mesa_reference_buffer_object(ctx, &obj->EdgeFlag.BufferObj, NULL);
 
-   for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++)
+   for (i = 0; i < Elements(obj->TexCoord); i++)
       _mesa_reference_buffer_object(ctx, &obj->TexCoord[i].BufferObj, NULL);
 
-   for (i = 0; i < VERT_ATTRIB_MAX; i++)
+   for (i = 0; i < Elements(obj->VertexAttrib); i++)
       _mesa_reference_buffer_object(ctx, &obj->VertexAttrib[i].BufferObj,NULL);
 }
 
@@ -230,11 +230,11 @@ _mesa_initialize_array_object( GLcontext *ctx,
    init_array(ctx, &obj->SecondaryColor, 4, GL_FLOAT);
    init_array(ctx, &obj->FogCoord, 1, GL_FLOAT);
    init_array(ctx, &obj->Index, 1, GL_FLOAT);
-   for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) {
+   for (i = 0; i < Elements(obj->TexCoord); i++) {
       init_array(ctx, &obj->TexCoord[i], 4, GL_FLOAT);
    }
    init_array(ctx, &obj->EdgeFlag, 1, GL_BOOL);
-   for (i = 0; i < VERT_ATTRIB_MAX; i++) {
+   for (i = 0; i < Elements(obj->VertexAttrib); i++) {
       init_array(ctx, &obj->VertexAttrib[i], 4, GL_FLOAT);
    }
 
@@ -340,7 +340,7 @@ _mesa_update_array_object_max_element(GLcontext *ctx,
 #endif
    for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++)
       min = update_min(min, &arrayObj->TexCoord[i]);
-   for (i = 0; i < VERT_ATTRIB_MAX; i++)
+   for (i = 0; i < Elements(arrayObj->VertexAttrib); i++)
       min = update_min(min, &arrayObj->VertexAttrib[i]);
 
    /* _MaxElement is one past the last legal array element */




More information about the mesa-commit mailing list