If the size is lower than the alignment, we must use the alignment to
select the bucket.

Otherwise, the selected bucket won't be able to satisfy our request
and will fail.
---
 src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c 
b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
index c445cb5..24e2820 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
@@ -483,11 +483,15 @@ pb_slab_range_manager_create_buffer(struct pb_manager 
*_mgr,
 {
    struct pb_slab_range_manager *mgr = pb_slab_range_manager(_mgr);
    pb_size bufSize;
+   pb_size reqSize = size;
    unsigned i;
 
+   if(desc->alignment > reqSize)
+          reqSize = desc->alignment;
+
    bufSize = mgr->minBufSize;
    for (i = 0; i < mgr->numBuckets; ++i) {
-      if(bufSize >= size)
+      if(bufSize >= reqSize)
         return mgr->buckets[i]->create_buffer(mgr->buckets[i], size, desc);
       bufSize *= 2;
    }
-- 
1.6.6.1.476.g01ddb


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to