summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-04-30 10:43:09 -0600
committerBrian Paul <[email protected]>2008-04-30 10:43:09 -0600
commit15318c8d8eb97cec8c8528cc91aaeab8858f33c6 (patch)
tree0a31268326909e82d7341636435ec749c299a90b /src
parent7146a1a29d3897fc0bd46dd56f3b36f2351d0f88 (diff)
gallium: new pipe_buffer alloc/map/unmap/ref wrappers
Diffstat (limited to 'src')
-rw-r--r--src/gallium/include/pipe/p_inlines.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/gallium/include/pipe/p_inlines.h b/src/gallium/include/pipe/p_inlines.h
index 274f76a383f..8eb604e73f1 100644
--- a/src/gallium/include/pipe/p_inlines.h
+++ b/src/gallium/include/pipe/p_inlines.h
@@ -129,6 +129,56 @@ pipe_texture_release(struct pipe_texture **ptr)
}
+/**
+ * Convenience wrappers for winsys buffer functions.
+ */
+
+static INLINE struct pipe_buffer *
+pipe_buffer_create( struct pipe_context *pipe,
+ unsigned alignment, unsigned usage, unsigned size )
+{
+ return pipe->winsys->buffer_create(pipe->winsys, alignment, usage, size);
+}
+
+static INLINE struct pipe_buffer *
+pipe_user_buffer_create( struct pipe_context *pipe, void *ptr, unsigned size )
+{
+ return pipe->winsys->user_buffer_create(pipe->winsys, ptr, size);
+}
+
+static INLINE void
+pipe_buffer_destroy( struct pipe_context *pipe, struct pipe_buffer *buf )
+{
+ pipe->winsys->buffer_destroy(pipe->winsys, buf);
+}
+
+static INLINE void *
+pipe_buffer_map(struct pipe_context *pipe,
+ struct pipe_buffer *buf,
+ unsigned usage)
+{
+ return pipe->winsys->buffer_map(pipe->winsys, buf, usage);
+}
+
+static INLINE void
+pipe_buffer_unmap(struct pipe_context *pipe,
+ struct pipe_buffer *buf)
+{
+ pipe->winsys->buffer_unmap(pipe->winsys, buf);
+}
+
+/* XXX when we're using this everywhere, get rid of
+ * pipe_buffer_reference() above.
+ */
+static INLINE void
+pipe_reference_buffer(struct pipe_context *pipe,
+ struct pipe_buffer **ptr,
+ struct pipe_buffer *buf)
+{
+ pipe_buffer_reference(pipe->winsys, ptr, buf);
+}
+
+
#ifdef __cplusplus
}
#endif