summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/llvmpipe/lp_texture.c
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2010-04-25 16:59:09 +0100
committerJosé Fonseca <jfonseca@vmware.com>2010-04-25 23:41:48 +0100
commit43b85af56efbe6eb06f4e62d23e9f6f583c5ec2e (patch)
treee5d96cc5349ba5efbae081771f000d6c9f6ef5d3 /src/gallium/drivers/llvmpipe/lp_texture.c
parent8352983e2ab9523345f2b2b3db62db19f01fab62 (diff)
llvmpipe: Cleanup/improve llvmpipe_flush_resource usage.
Recognize PIPE_TRANSFER_UNSYNCHRONIZED and PIPE_TRANSFER_DONTBLOCK.
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_texture.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_texture.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index e1aed7fdb5..29bdfe36ae 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -492,6 +492,27 @@ llvmpipe_get_transfer(struct pipe_context *pipe,
assert(resource);
assert(sr.level <= resource->last_level);
+ /*
+ * Transfers, like other pipe operations, must happen in order, so flush the
+ * context if necessary.
+ */
+ if (!(usage & PIPE_TRANSFER_UNSYNCHRONIZED)) {
+ boolean read_only = !(usage & PIPE_TRANSFER_WRITE);
+ boolean do_not_block = !!(usage & PIPE_TRANSFER_DONTBLOCK);
+ if (!llvmpipe_flush_resource(pipe, resource,
+ sr.face, sr.level,
+ 0, /* flush_flags */
+ read_only,
+ TRUE, /* cpu_access */
+ do_not_block)) {
+ /*
+ * It would have blocked, but state tracker requested no to.
+ */
+ assert(do_not_block);
+ return NULL;
+ }
+ }
+
lpr = CALLOC_STRUCT(llvmpipe_transfer);
if (lpr) {
struct pipe_transfer *pt = &lpr->base;
@@ -562,19 +583,6 @@ llvmpipe_transfer_map( struct pipe_context *pipe,
lpr = llvmpipe_resource(transfer->resource);
format = lpr->base.format;
- /*
- * Transfers, like other pipe operations, must happen in order, so flush the
- * context if necessary.
- */
- llvmpipe_flush_resource(pipe,
- transfer->resource,
- transfer->sr.face,
- transfer->sr.level,
- 0, /* flush_flags */
- !(transfer->usage & PIPE_TRANSFER_WRITE), /* read_only */
- TRUE, /* cpu_access */
- FALSE); /* do_not_flush */
-
map = llvmpipe_resource_map(transfer->resource,
transfer->sr.face,
transfer->sr.level,