i965: Update brw_save_primitives_written_counters for pre-Gen7.
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 17 Feb 2017 05:17:44 +0000 (21:17 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 21 Feb 2017 20:38:13 +0000 (12:38 -0800)
Sandybridge and earlier only have a single counter.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
src/mesa/drivers/dri/i965/gen6_sol.c

index 41158bd580c7d4111770a9a851631aa395ac37f8..8adac92d07d89d855ec4c44f2c728da9d5c32651 100644 (file)
@@ -297,11 +297,17 @@ brw_save_primitives_written_counters(struct brw_context *brw,
    brw_emit_mi_flush(brw);
 
    /* Emit MI_STORE_REGISTER_MEM commands to write the values. */
-   for (int i = 0; i < streams; i++) {
-      int offset = (obj->prim_count_buffer_index + i) * sizeof(uint64_t);
+   if (brw->gen >= 7) {
+      for (int i = 0; i < streams; i++) {
+         int offset = (obj->prim_count_buffer_index + i) * sizeof(uint64_t);
+         brw_store_register_mem64(brw, obj->prim_count_bo,
+                                  GEN7_SO_NUM_PRIMS_WRITTEN(i),
+                                  offset);
+      }
+   } else {
       brw_store_register_mem64(brw, obj->prim_count_bo,
-                               GEN7_SO_NUM_PRIMS_WRITTEN(i),
-                               offset);
+                               GEN6_SO_NUM_PRIMS_WRITTEN,
+                               obj->prim_count_buffer_index * sizeof(uint64_t));
    }
 
    /* Update where to write data to. */