gallium: fix u_default_transfer_inline_write for textures
authorMarek Olšák <marek.olsak@amd.com>
Thu, 19 Jun 2014 21:34:27 +0000 (23:34 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 8 Jul 2014 18:46:23 +0000 (20:46 +0200)
This doesn't fix any known issue. In fact, radeon drivers ignore all
the discard flags for textures and implicitly do "discard range"
for any write transfer.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
src/gallium/auxiliary/util/u_transfer.c

index 7804f2a..71da35d 100644 (file)
@@ -25,8 +25,8 @@ void u_default_transfer_inline_write( struct pipe_context *pipe,
    usage |= PIPE_TRANSFER_WRITE;
 
    /* transfer_inline_write implicitly discards the rewritten buffer range */
-   /* XXX this looks very broken for non-buffer resources having more than one dim. */
-   if (box->x == 0 && box->width == resource->width0) {
+   if (resource->target == PIPE_BUFFER &&
+       box->x == 0 && box->width == resource->width0) {
       usage |= PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE;
    } else {
       usage |= PIPE_TRANSFER_DISCARD_RANGE;