Mesa (master): llvmpipe: Use resource_is_texture() consistently.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Thu Apr 22 17:42:05 UTC 2010


Module: Mesa
Branch: master
Commit: 8bee4c7718a3bd57e3d99f0913d9081cd13fe5fd
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8bee4c7718a3bd57e3d99f0913d9081cd13fe5fd

Author: José Fonseca <jfonseca at vmware.com>
Date:   Thu Apr 22 18:22:22 2010 +0100

llvmpipe: Use resource_is_texture() consistently.

Otherwise slightly difference order causes assertion failures.

Also remove mentions of PIPE_BIND_SCANOUT/PIPE_BIND_SHARED. They are not
propoer bind flags and will likely be deprecated. If surfaces should
be passed to the winsys then they should have the DISPLAY_TARGET flag
set, which is a proper bind flag.

---

 src/gallium/drivers/llvmpipe/lp_screen.c  |    4 +--
 src/gallium/drivers/llvmpipe/lp_texture.c |   37 +++++++++++-----------------
 2 files changed, 16 insertions(+), 25 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
index f453b9f..7d2cd0c 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -194,9 +194,7 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
          return FALSE;
    }
 
-   if(tex_usage & (PIPE_BIND_DISPLAY_TARGET |
-                   PIPE_BIND_SCANOUT |
-                   PIPE_BIND_SHARED)) {
+   if(tex_usage & PIPE_BIND_DISPLAY_TARGET) {
       if(!winsys->is_displaytarget_format_supported(winsys, tex_usage, format))
          return FALSE;
    }
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index 4fce02a..336a4e4 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -193,20 +193,20 @@ llvmpipe_resource_create(struct pipe_screen *_screen,
 
    assert(lpr->base.bind);
 
-   if (lpr->base.bind & (PIPE_BIND_DISPLAY_TARGET |
-                         PIPE_BIND_SCANOUT |
-                         PIPE_BIND_SHARED)) {
-      /* displayable surface */
-      if (!llvmpipe_displaytarget_layout(screen, lpr))
-         goto fail;
-      assert(lpr->layout[0][0] == LP_TEX_LAYOUT_NONE);
-   }
-   else if (lpr->base.bind & (PIPE_BIND_SAMPLER_VIEW |
-                              PIPE_BIND_DEPTH_STENCIL)) {
-      /* texture map */
-      if (!llvmpipe_texture_layout(screen, lpr))
-         goto fail;
-      assert(lpr->layout[0][0] == LP_TEX_LAYOUT_NONE);
+   if (resource_is_texture(&lpr->base)) {
+      if (lpr->base.bind & PIPE_BIND_DISPLAY_TARGET) {
+         /* displayable surface */
+         if (!llvmpipe_displaytarget_layout(screen, lpr))
+            goto fail;
+         assert(lpr->layout[0][0] == LP_TEX_LAYOUT_NONE);
+      }
+      else {
+         /* texture map */
+         if (!llvmpipe_texture_layout(screen, lpr))
+            goto fail;
+         assert(lpr->layout[0][0] == LP_TEX_LAYOUT_NONE);
+      }
+      assert(lpr->layout[0]);
    }
    else {
       /* other data (vertex buffer, const buffer, etc) */
@@ -221,10 +221,6 @@ llvmpipe_resource_create(struct pipe_screen *_screen,
          goto fail;
    }
 
-   if (resource_is_texture(&lpr->base)) {
-      assert(lpr->layout[0]);
-   }
-
    lpr->id = id_counter++;
 
    return &lpr->base;
@@ -393,10 +389,7 @@ llvmpipe_resource_data(struct pipe_resource *resource)
 {
    struct llvmpipe_resource *lpr = llvmpipe_resource(resource);
 
-   assert((lpr->base.bind & (PIPE_BIND_DISPLAY_TARGET |
-                             PIPE_BIND_SCANOUT |
-                             PIPE_BIND_SHARED |
-                             PIPE_BIND_SAMPLER_VIEW)) == 0);
+   assert(!resource_is_texture(resource));
 
    return lpr->data;
 }




More information about the mesa-commit mailing list