From 15318c8d8eb97cec8c8528cc91aaeab8858f33c6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 30 Apr 2008 10:43:09 -0600 Subject: [PATCH] gallium: new pipe_buffer alloc/map/unmap/ref wrappers --- src/gallium/include/pipe/p_inlines.h | 50 ++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/src/gallium/include/pipe/p_inlines.h b/src/gallium/include/pipe/p_inlines.h index 274f76a..8eb604e 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 -- 2.7.4