draw/so: indicate overflow when buffer is missing
authorZack Rusin <zackr@vmware.com>
Sat, 27 Apr 2013 04:49:23 +0000 (00:49 -0400)
committerZack Rusin <zackr@vmware.com>
Sat, 27 Apr 2013 05:19:07 +0000 (01:19 -0400)
We were crashing if one of the buffers wasn't set, we should
just treat it as an overflow. It's useful when using so
statistics because it allows one to figure out how much data
would be generated by so without actually writing any of it.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
src/gallium/auxiliary/draw/draw_pt_so_emit.c

index cdfd13c64211a402c75bff818845c41c74e8eea7..1328e8658c44a029f23151a4cecd4e6bfa038761 100644 (file)
@@ -129,6 +129,10 @@ static void so_emit_prim(struct pt_so_emit *so,
 
    for (i = 0; i < draw->so.num_targets; i++) {
       struct draw_so_target *target = draw->so.targets[i];
+      /* If a buffer is missing then that's equivalent to
+       * an overflow */
+      if (!target)
+         return;
       buffer_total_bytes[i] = target->internal_offset + target->target.buffer_offset;
    }