[Mesa-dev] [PATCH 3/6] i965: Use the proper element of the prim array in brw_try_draw_prims.

Kenneth Graunke kenneth at whitecape.org
Wed Aug 28 16:49:11 PDT 2013


The VBO module actually calls us with an array of _mesa_prim objects.
For example, it may break up a DrawArrays() call into multiple
primitives when primitive restart is enabled.

Previously, we treated prim like a pointer, always accessing element 0.
This worked because all of the primitive objects in a single draw call
have the same value for num_instances and basevertex.

However, accessing an array as a pointer and using the wrong object's
fields is misleading.  For stylistic reasons alone, we should use the
right object.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/drivers/dri/i965/brw_draw.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c
index df9b750..2583a6f 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -386,12 +386,12 @@ static bool brw_try_draw_prims( struct gl_context *ctx,
       intel_batchbuffer_require_space(brw, estimated_max_prim_size, false);
       intel_batchbuffer_save_state(brw);
 
-      if (brw->num_instances != prim->num_instances) {
-         brw->num_instances = prim->num_instances;
+      if (brw->num_instances != prim[i].num_instances) {
+         brw->num_instances = prim[i].num_instances;
          brw->state.dirty.brw |= BRW_NEW_VERTICES;
       }
-      if (brw->basevertex != prim->basevertex) {
-         brw->basevertex = prim->basevertex;
+      if (brw->basevertex != prim[i].basevertex) {
+         brw->basevertex = prim[i].basevertex;
          brw->state.dirty.brw |= BRW_NEW_VERTICES;
       }
       if (brw->gen < 6)
-- 
1.8.3.4



More information about the mesa-dev mailing list