pipebuffer: Malloc buffer provider.
authorJosé Fonseca <jrfonseca@tungstengraphics.com>
Mon, 26 May 2008 15:19:41 +0000 (00:19 +0900)
committerJosé Fonseca <jrfonseca@tungstengraphics.com>
Mon, 26 May 2008 15:19:41 +0000 (00:19 +0900)
Simple wrapper around pb_malloc_buffer_create for convenience.

src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c
src/gallium/auxiliary/pipebuffer/pb_bufmgr.h

index 9e8244f..6c3502e 100644 (file)
  * Implementation of malloc-based buffers to store data that can't be processed
  * by the hardware. 
  * 
- * \author José Fonseca <jrfonseca@tungstengraphics.com>
+ * \author Jose Fonseca <jrfonseca@tungstengraphics.com>
  */
 
 
 #include "pipe/p_debug.h"
 #include "pipe/p_util.h"
 #include "pb_buffer.h"
+#include "pb_bufmgr.h"
 
 
 struct malloc_buffer 
@@ -125,3 +126,33 @@ pb_malloc_buffer_create(size_t size,
 
    return &buf->base;
 }
+
+
+static struct pb_buffer *
+pb_malloc_buffer_create_buffer(struct pb_manager *mgr, 
+                               size_t size,
+                               const struct pb_desc *desc) 
+{
+   return pb_malloc_buffer_create(size, desc);
+}
+
+
+static void
+pb_malloc_bufmgr_destroy(struct pb_manager *mgr) 
+{
+   /* No-op */
+}
+
+
+static struct pb_manager 
+pb_malloc_bufmgr = {
+   pb_malloc_buffer_create_buffer,
+   pb_malloc_bufmgr_destroy
+};
+
+
+struct pb_manager *
+pb_malloc_bufmgr_create(void) 
+{
+  return &pb_malloc_bufmgr;
+}
index f6cc7a5..4a922d1 100644 (file)
@@ -79,6 +79,15 @@ struct pb_manager
 };
 
 
+/**
+ * Malloc buffer provider.
+ * 
+ * Simple wrapper around pb_malloc_buffer_create for convenience.
+ */
+struct pb_manager *
+pb_malloc_bufmgr_create(void);
+
+
 /** 
  * Static buffer pool sub-allocator.
  *