llvmpipe: allocate regular texture memory upfront
authorRoland Scheidegger <sroland@vmware.com>
Tue, 1 Jul 2014 15:06:48 +0000 (17:06 +0200)
committerRoland Scheidegger <sroland@vmware.com>
Tue, 1 Jul 2014 23:55:59 +0000 (01:55 +0200)
The deferred allocation doesn't really make much sense anymore, since we no
longer allocate swizzled/linear memory in chunks and not per level / slice
neither.
This means we could fail resource creation a bit more (could already fail in
theory anyway) but should not fail maps later (right now, callers can't deal
with neither really).

Reviewed-by: Brian Paul <brianp@vmware.com>
src/gallium/drivers/llvmpipe/lp_texture.c

index a156449a002f4ed36154fa866dacd927eee49d9a..f95b2a2b47e583ec978d1006a65f6a4d759726b5 100644 (file)
@@ -59,6 +59,8 @@ static struct llvmpipe_resource resource_list;
 #endif
 static unsigned id_counter = 0;
 
+static void
+alloc_image_data(struct llvmpipe_resource *lpr);
 
 /**
  * Conventional allocation path for non-display textures:
@@ -247,6 +249,11 @@ llvmpipe_resource_create(struct pipe_screen *_screen,
          /* texture map */
          if (!llvmpipe_texture_layout(screen, lpr))
             goto fail;
+
+         alloc_image_data(lpr);
+         if (!lpr->tex_data) {
+            goto fail;
+         }
       }
    }
    else {