summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@vmware.com>2013-02-21 17:13:34 +0100
committerRoland Scheidegger <sroland@vmware.com>2013-02-22 04:34:07 +0100
commit66c3cd0be31aeee8953015f45cc36a85516f2fc6 (patch)
tree970c749a2adf5bacabaf7bb7b90462e627f146fd /src/gallium/drivers/llvmpipe
parent2cfee2295f1ea00cfd3bc5333c62150a05bff193 (diff)
downloadexternal_mesa3d-66c3cd0be31aeee8953015f45cc36a85516f2fc6.zip
external_mesa3d-66c3cd0be31aeee8953015f45cc36a85516f2fc6.tar.gz
external_mesa3d-66c3cd0be31aeee8953015f45cc36a85516f2fc6.tar.bz2
llvmpipe: simplify buffer allocation logic.
Now with buffer formats clarification don't need all that logic any longer. (Note that it never would have worked in any case, because blockwidth and blockheight were swapped any allocation with multi-byte format would have had zero size.) Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Diffstat (limited to 'src/gallium/drivers/llvmpipe')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_texture.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index 1c4f1dc..d55985b 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -311,13 +311,11 @@ llvmpipe_resource_create(struct pipe_screen *_screen,
}
else {
/* other data (vertex buffer, const buffer, etc) */
- const enum pipe_format format = templat->format;
- const uint w = templat->width0 / util_format_get_blockheight(format);
- /* XXX buffers should only have one dimension, those values should be 1 */
- const uint h = templat->height0 / util_format_get_blockwidth(format);
- const uint d = templat->depth0;
- const uint bpp = util_format_get_blocksize(format);
- const uint bytes = w * h * d * bpp;
+ const uint bytes = templat->width0;
+ assert(util_format_get_blocksize(templat->format) == 1);
+ assert(templat->height0 == 1);
+ assert(templat->depth0 == 1);
+ assert(templat->last_level == 0);
lpr->data = align_malloc(bytes, 16);
if (!lpr->data)
goto fail;