summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util/u_transfer.c
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2012-02-26 18:48:42 +0100
committerMarek Olšák <maraeo@gmail.com>2012-02-27 16:22:13 +0100
commit615baedc778039a2dcd08bbc1b3006c9e5a111dc (patch)
tree4a6224826288051cd44f2f2ebb4ffa9a65f0251e /src/gallium/auxiliary/util/u_transfer.c
parent4c02baade9d590787acae157ce9b2d09c6a9bf55 (diff)
downloadexternal_mesa3d-615baedc778039a2dcd08bbc1b3006c9e5a111dc.zip
external_mesa3d-615baedc778039a2dcd08bbc1b3006c9e5a111dc.tar.gz
external_mesa3d-615baedc778039a2dcd08bbc1b3006c9e5a111dc.tar.bz2
gallium/util: set correct usage flags in u_default_transfer_inline_write
The DISCARD flags should improve performance in drivers which handle them.
Diffstat (limited to 'src/gallium/auxiliary/util/u_transfer.c')
-rw-r--r--src/gallium/auxiliary/util/u_transfer.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_transfer.c b/src/gallium/auxiliary/util/u_transfer.c
index 7e72a59..1fa8d94 100644
--- a/src/gallium/auxiliary/util/u_transfer.c
+++ b/src/gallium/auxiliary/util/u_transfer.c
@@ -21,6 +21,18 @@ void u_default_transfer_inline_write( struct pipe_context *pipe,
const uint8_t *src_data = data;
unsigned i;
+ assert(!(usage & PIPE_TRANSFER_READ));
+
+ /* the write flag is implicit by the nature of transfer_inline_write */
+ usage |= PIPE_TRANSFER_WRITE;
+
+ /* transfer_inline_write implicitly discards the rewritten buffer range */
+ if (box->x == 0 && box->width == resource->width0) {
+ usage |= PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE;
+ } else {
+ usage |= PIPE_TRANSFER_DISCARD_RANGE;
+ }
+
transfer = pipe->get_transfer(pipe,
resource,
level,