diff options
author | José Fonseca <jrfonseca@tungstengraphics.com> | 2008-01-17 17:06:16 +0900 |
---|---|---|
committer | José Fonseca <jrfonseca@tungstengraphics.com> | 2008-01-26 11:46:49 +0900 |
commit | 65df0241465b2dae4979d71cad17b83cfd1fda11 (patch) | |
tree | 90d29be8a76f140765738dae9e13b2521e57254c /src/mesa/pipe/pipebuffer/pb_buffer_malloc.c | |
parent | ca01ed45e8dee7970c6eefb528b7576ce6717459 (diff) |
gallium: Aggregate all buffer allocation info into a single struct. Obey requested alignment.
Diffstat (limited to 'src/mesa/pipe/pipebuffer/pb_buffer_malloc.c')
-rw-r--r-- | src/mesa/pipe/pipebuffer/pb_buffer_malloc.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/mesa/pipe/pipebuffer/pb_buffer_malloc.c b/src/mesa/pipe/pipebuffer/pb_buffer_malloc.c index b80ee8dda3..f0ff1d347e 100644 --- a/src/mesa/pipe/pipebuffer/pb_buffer_malloc.c +++ b/src/mesa/pipe/pipebuffer/pb_buffer_malloc.c @@ -62,7 +62,7 @@ malloc_buffer(struct pb_buffer *buf) static void malloc_buffer_destroy(struct pb_buffer *buf) { - FREE(malloc_buffer(buf)->data); + align_free(malloc_buffer(buf)->data); FREE(buf); } @@ -102,9 +102,8 @@ malloc_buffer_vtbl = { struct pb_buffer * -pb_malloc_buffer_create( unsigned alignment, - unsigned usage, - unsigned size ) +pb_malloc_buffer_create(size_t size, + const struct pb_desc *desc) { struct malloc_buffer *buf; @@ -116,11 +115,11 @@ pb_malloc_buffer_create( unsigned alignment, return NULL; buf->base.vtbl = &malloc_buffer_vtbl; - buf->base.base.alignment = alignment; - buf->base.base.usage = usage; + buf->base.base.alignment = desc->alignment; + buf->base.base.usage = desc->usage; buf->base.base.size = size; - buf->data = MALLOC(size); + buf->data = align_malloc(size, desc->alignment < sizeof(void*) ? sizeof(void*) : desc->alignment); if(!buf->data) { FREE(buf); return NULL; |