llvmpipe: fix bogus assertions for buffer surfaces
authorRoland Scheidegger <sroland@vmware.com>
Sat, 1 Jun 2013 14:48:03 +0000 (16:48 +0200)
committerRoland Scheidegger <sroland@vmware.com>
Sat, 1 Jun 2013 18:03:59 +0000 (20:03 +0200)
One of the assertion made no sense for buffer rendertargets
(due to the union), so drop it. (The same assertion is present already in
the path for texture surfaces later.).

v2: make assertion completely accurate (suggested by Jose).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
src/gallium/drivers/llvmpipe/lp_texture.c

index 56eb4999a1cc293c44c5759373d7b3205bf6137b..22f952c8924593feb6723311cf853d8139507855 100644 (file)
@@ -477,7 +477,6 @@ llvmpipe_create_surface(struct pipe_context *pipe,
 {
    struct pipe_surface *ps;
 
-   assert(surf_tmpl->u.tex.level <= pt->last_level);
    if (!(pt->bind & (PIPE_BIND_DEPTH_STENCIL | PIPE_BIND_RENDER_TARGET)))
       debug_printf("Illegal surface creation without bind flag\n");
 
@@ -505,7 +504,8 @@ llvmpipe_create_surface(struct pipe_context *pipe,
          ps->u.buf.first_element = surf_tmpl->u.buf.first_element;
          ps->u.buf.last_element = surf_tmpl->u.buf.last_element;
          assert(ps->u.buf.first_element <= ps->u.buf.last_element);
-         assert(ps->u.buf.last_element < ps->width);
+         assert(util_format_get_blocksize(surf_tmpl->format) *
+                (ps->u.buf.last_element + 1) <= pt->width0);
       }
    }
    return ps;