util: Use PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE in pipe_buffer_write.
authorJosé Fonseca <jfonseca@vmware.com>
Thu, 10 Feb 2011 20:54:18 +0000 (20:54 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Wed, 9 Mar 2011 11:17:45 +0000 (11:17 +0000)
src/gallium/auxiliary/util/u_inlines.h

index 98889fb70ac16d1fa03817b17a1de9dd912310fb..aed8ba7df43c096bd97ce1f99c62ecb67c623ddf 100644 (file)
@@ -299,13 +299,18 @@ pipe_buffer_write(struct pipe_context *pipe,
                   const void *data)
 {
    struct pipe_box box;
+   unsigned usage = PIPE_TRANSFER_WRITE;
+
+   if (offset == 0 && size == buf->width0) {
+      usage |= PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE;
+   }
 
    u_box_1d(offset, size, &box);
 
    pipe->transfer_inline_write( pipe,
                                 buf,
                                 0,
-                                PIPE_TRANSFER_WRITE,
+                                usage,
                                 &box,
                                 data,
                                 size,