st/mesa: use Elements() instead of hard-coded number
authorBrian Paul <brianp@vmware.com>
Fri, 17 Aug 2012 20:33:31 +0000 (14:33 -0600)
committerBrian Paul <brianp@vmware.com>
Sat, 18 Aug 2012 13:39:52 +0000 (07:39 -0600)
And add a comment about the velems_util_draw[] array.

src/mesa/state_tracker/st_context.c

index 7735eee4f3d34f16acdb27b5bce3ae7491288024..2e14da2117b1141883cd47fc7081d7028a86e25b 100644 (file)
@@ -163,7 +163,10 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe )
    else
       st->internal_target = PIPE_TEXTURE_RECT;
 
-   for (i = 0; i < 3; i++) {
+   /* Vertex element objects used for drawing rectangles for glBitmap,
+    * glDrawPixels, glClear, etc.
+    */
+   for (i = 0; i < Elements(st->velems_util_draw); i++) {
       memset(&st->velems_util_draw[i], 0, sizeof(struct pipe_vertex_element));
       st->velems_util_draw[i].src_offset = i * 4 * sizeof(float);
       st->velems_util_draw[i].instance_divisor = 0;