llvmpipe: Fix resource_is_texture.
authorJosé Fonseca <jfonseca@vmware.com>
Thu, 22 Apr 2010 17:06:05 +0000 (18:06 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Thu, 22 Apr 2010 17:06:05 +0000 (18:06 +0100)
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

index cee170ec8343a35f980df48e368b821e244aa06b..4fce02ac713ae209989a78243516be5d40554a26 100644 (file)
 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;
+   }
 }