trace: Don't dump texture transfers.
[mesa.git] / src / gallium / drivers / trace / tr_dump.c
index 7111e0d174dea5ef68bbdcf6b3ededf43c70104e..b6ab5038197fcfe49052ff462aab84f4ac860325 100644 (file)
@@ -495,19 +495,28 @@ void trace_dump_bytes(const void *data,
 }
 
 void trace_dump_box_bytes(const void *data,
-                         enum pipe_format format,
+                          struct pipe_resource *resource,
                          const struct pipe_box *box,
                          unsigned stride,
                          unsigned slice_stride)
 {
    size_t size;
 
-   if (slice_stride)
-      size = box->depth * slice_stride;
-   else if (stride)
-      size = util_format_get_nblocksy(format, box->height) * stride;
-   else {
-      size = util_format_get_nblocksx(format, box->width) * util_format_get_blocksize(format);
+   /*
+    * Only dump buffer transfers to avoid huge files.
+    * TODO: Make this run-time configurable
+    */
+   if (resource->target != PIPE_BUFFER) {
+      size = 0;
+   } else {
+      enum pipe_format format = resource->format;
+      if (slice_stride)
+         size = box->depth * slice_stride;
+      else if (stride)
+         size = util_format_get_nblocksy(format, box->height) * stride;
+      else {
+         size = util_format_get_nblocksx(format, box->width) * util_format_get_blocksize(format);
+      }
    }
 
    trace_dump_bytes(data, size);