diff options
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_flush.c')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_flush.c | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_flush.c b/src/gallium/drivers/llvmpipe/lp_flush.c index 3627dbd..644b821 100644 --- a/src/gallium/drivers/llvmpipe/lp_flush.c +++ b/src/gallium/drivers/llvmpipe/lp_flush.c @@ -96,41 +96,40 @@ llvmpipe_flush( struct pipe_context *pipe, /** * Flush context if necessary. * - * TODO: move this logic to an auxiliary library? + * Returns FALSE if it would have block, but do_not_block was set, TRUE + * otherwise. * - * FIXME: We must implement DISCARD/DONTBLOCK/UNSYNCHRONIZED/etc for - * textures to avoid blocking. + * TODO: move this logic to an auxiliary library? */ boolean -llvmpipe_flush_texture(struct pipe_context *pipe, - struct pipe_resource *texture, - unsigned face, - unsigned level, - unsigned flush_flags, - boolean read_only, - boolean cpu_access, - boolean do_not_flush) +llvmpipe_flush_resource(struct pipe_context *pipe, + struct pipe_resource *resource, + unsigned face, + unsigned level, + unsigned flush_flags, + boolean read_only, + boolean cpu_access, + boolean do_not_block) { unsigned referenced; - referenced = pipe->is_resource_referenced(pipe, texture, face, level); + referenced = pipe->is_resource_referenced(pipe, resource, face, level); if ((referenced & PIPE_REFERENCED_FOR_WRITE) || ((referenced & PIPE_REFERENCED_FOR_READ) && !read_only)) { - if (do_not_flush) - return FALSE; - - /* - * TODO: The semantics of these flush flags are too obtuse. They should - * disappear and the pipe driver should just ensure that all visible - * side-effects happen when they need to happen. - */ - if (referenced & PIPE_REFERENCED_FOR_WRITE) - flush_flags |= PIPE_FLUSH_RENDER_CACHE; + if (resource->target != PIPE_BUFFER) { + /* + * TODO: The semantics of these flush flags are too obtuse. They should + * disappear and the pipe driver should just ensure that all visible + * side-effects happen when they need to happen. + */ + if (referenced & PIPE_REFERENCED_FOR_WRITE) + flush_flags |= PIPE_FLUSH_RENDER_CACHE; - if (referenced & PIPE_REFERENCED_FOR_READ) - flush_flags |= PIPE_FLUSH_TEXTURE_CACHE; + if (referenced & PIPE_REFERENCED_FOR_READ) + flush_flags |= PIPE_FLUSH_TEXTURE_CACHE; + } if (cpu_access) { /* @@ -139,6 +138,9 @@ llvmpipe_flush_texture(struct pipe_context *pipe, struct pipe_fence_handle *fence = NULL; + if (do_not_block) + return FALSE; + pipe->flush(pipe, flush_flags, &fence); if (fence) { |