summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
diff options
context:
space:
mode:
authorJosé Fonseca <jrfonseca@tungstengraphics.com>2008-07-02 12:22:51 +0900
committerJosé Fonseca <jrfonseca@tungstengraphics.com>2008-07-02 12:29:07 +0900
commitea4ca10b1bec67c8a60db0e4e5581318ce9f62f9 (patch)
treedd815f4ea41b98cfba066a1aacc71da71a45e0f7 /src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
parent66b48202c221a25f3980df8f443ce63c2fb4119f (diff)
pipebuffer: Verify usage flag consistency. Minor cleanups.
Diffstat (limited to 'src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c')
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
index b9dff09804..598d9ce310 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
@@ -324,8 +324,10 @@ pb_slab_manager_create_buffer(struct pb_manager *_mgr,
if(!pb_check_alignment(desc->alignment, mgr->bufSize))
return NULL;
- /* XXX: check for compatible buffer usage too? */
-
+ assert(pb_check_usage(desc->usage, mgr->desc.usage));
+ if(!pb_check_usage(desc->usage, mgr->desc.usage))
+ return NULL;
+
_glthread_LOCK_MUTEX(mgr->mutex);
if (mgr->slabs.next == &mgr->slabs) {
(void) pb_slab_create(mgr);
@@ -438,6 +440,9 @@ pb_slab_range_manager_create(struct pb_manager *provider,
size_t bufSize;
unsigned i;
+ if(!provider)
+ return NULL;
+
mgr = CALLOC_STRUCT(pb_slab_range_manager);
if (!mgr)
goto out_err0;