[Mesa-dev] [PATCH] llvmpipe: check buffers in llvmpipe_is_resource_referenced

sroland at vmware.com sroland at vmware.com
Wed Feb 27 11:12:28 PST 2013


From: Roland Scheidegger <sroland at vmware.com>

Now that buffers can be used as textures or render targets
make sure they aren't skipped.

Fix suggested by Jose Fonseca.
---
 src/gallium/drivers/llvmpipe/lp_surface.c |   14 +++++++-------
 src/gallium/drivers/llvmpipe/lp_texture.c |    4 +++-
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_surface.c b/src/gallium/drivers/llvmpipe/lp_surface.c
index a83a903..5e6a6eb 100644
--- a/src/gallium/drivers/llvmpipe/lp_surface.c
+++ b/src/gallium/drivers/llvmpipe/lp_surface.c
@@ -65,13 +65,6 @@ lp_resource_copy(struct pipe_context *pipe,
    unsigned depth = src_box->depth;
    unsigned z;
 
-   /* Fallback for buffers. */
-   if (dst->target == PIPE_BUFFER && src->target == PIPE_BUFFER) {
-      util_resource_copy_region(pipe, dst, dst_level, dstx, dsty, dstz,
-                                src, src_level, src_box);
-      return;
-   }
-
    llvmpipe_flush_resource(pipe,
                            dst, dst_level,
                            FALSE, /* read_only */
@@ -86,6 +79,13 @@ lp_resource_copy(struct pipe_context *pipe,
                            FALSE, /* do_not_block */
                            "blit src");
 
+   /* Fallback for buffers. */
+   if (dst->target == PIPE_BUFFER && src->target == PIPE_BUFFER) {
+      util_resource_copy_region(pipe, dst, dst_level, dstx, dsty, dstz,
+                                src, src_level, src_box);
+      return;
+   }
+
    /*
    printf("surface copy from %u lvl %u to %u lvl %u: %u,%u,%u to %u,%u,%u %u x %u x %u\n",
           src_tex->id, src_level, dst_tex->id, dst_level,
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index a64139f..75104bb 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -755,7 +755,9 @@ llvmpipe_is_resource_referenced( struct pipe_context *pipe,
 {
    struct llvmpipe_context *llvmpipe = llvmpipe_context( pipe );
 
-   if (presource->target == PIPE_BUFFER)
+   if (!(presource->bind & (PIPE_BIND_DEPTH_STENCIL |
+                            PIPE_BIND_RENDER_TARGET |
+                            PIPE_BIND_SAMPLER_VIEW)))
       return LP_UNREFERENCED;
 
    return lp_setup_is_resource_referenced(llvmpipe->setup, presource);
-- 
1.7.9.5



More information about the mesa-dev mailing list