Mesa (master): llvmpipe: Fix resource_is_texture.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Thu Apr 22 17:06:26 UTC 2010


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

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

llvmpipe: Fix resource_is_texture.

It was missing PIPE_BIND_RENDER_TARGET, causing assertion failures for
pure render targets.

Also bind flags are too variable and complex for a good assessment for
whether the resource is a texture or not. Target is more concise.

---

 src/gallium/drivers/llvmpipe/lp_texture.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index cee170e..4fce02a 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -55,14 +55,18 @@
 static INLINE boolean
 resource_is_texture(const struct pipe_resource *resource)
 {
-   const unsigned tex_binds = (PIPE_BIND_DISPLAY_TARGET |
-                               PIPE_BIND_SCANOUT |
-                               PIPE_BIND_SHARED |
-                               PIPE_BIND_DEPTH_STENCIL |
-                               PIPE_BIND_SAMPLER_VIEW);
-   const struct llvmpipe_resource *lpr = llvmpipe_resource_const(resource);
-
-   return (lpr->base.bind & tex_binds) ? TRUE : FALSE;
+   switch (resource->target) {
+   case PIPE_BUFFER:
+      return FALSE;
+   case PIPE_TEXTURE_1D:
+   case PIPE_TEXTURE_2D:
+   case PIPE_TEXTURE_3D:
+   case PIPE_TEXTURE_CUBE:
+      return TRUE;
+   default:
+      assert(0);
+      return FALSE;
+   }
 }
 
 




More information about the mesa-commit mailing list