diff options
author | Keith Whitwell <[email protected]> | 2008-01-25 20:53:31 +0000 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2008-01-25 20:53:31 +0000 |
commit | 1e0d30a515e4cac891b6c590f12a33e0e8a8e295 (patch) | |
tree | 72ffec9e89bd0bd9202fcfc39f5e7bdf881adcf2 /src/mesa/pipe/pipebuffer/pb_buffer.c | |
parent | 756d52ec12c41ee90ee9598dc9028cc134806bd2 (diff) |
gallium: rename pipe_buffer_handle to pipe_buffer, rework pipebuffer/ code
Provide an actual definition of the pipe_buffer struct, containing
the parameters used to create the buffer, and its refcount.
Shift refcounting buffers out of the winsys interface, similar to
surfaces & textures.
Rework pipebuffer/ to reflect the fact these changes, and also Michel's
reworking of the buffer interface.
Diffstat (limited to 'src/mesa/pipe/pipebuffer/pb_buffer.c')
-rw-r--r-- | src/mesa/pipe/pipebuffer/pb_buffer.c | 49 |
1 files changed, 37 insertions, 12 deletions
diff --git a/src/mesa/pipe/pipebuffer/pb_buffer.c b/src/mesa/pipe/pipebuffer/pb_buffer.c index 99c960b6979..90ab9044ffb 100644 --- a/src/mesa/pipe/pipebuffer/pb_buffer.c +++ b/src/mesa/pipe/pipebuffer/pb_buffer.c @@ -34,19 +34,44 @@ #include "pb_buffer.h" +#include "pipe/p_winsys.h" -void -buffer_reference(struct pipe_buffer **dst, - struct pipe_buffer *src) + +static void * +pb_winsys_map(struct pipe_winsys *winsys, + struct pipe_buffer *ws_buf, + unsigned flags) +{ + struct pb_buffer *buf = pb_buffer(ws_buf); + + return buf->vtbl->map(buf, flags); +} + +static void +pb_winsys_unmap(struct pipe_winsys *winsys, + struct pipe_buffer *ws_buf) +{ + struct pb_buffer *buf = pb_buffer(ws_buf); + + buf->vtbl->unmap(buf); +} + +static void +pb_winsys_destroy(struct pipe_winsys *winsys, + struct pipe_buffer *ws_buf) +{ + struct pb_buffer *buf = pb_buffer(ws_buf); + + buf->vtbl->destroy(buf); +} + + + +void +pb_init_winsys(struct pipe_winsys *winsys) { - if(*dst != src) { - if (src) - src->vtbl->reference(src); - - if (*dst) - (*dst)->vtbl->release(*dst); - - *dst = src; - } + winsys->buffer_map = pb_winsys_map; + winsys->buffer_unmap = pb_winsys_unmap; + winsys->buffer_destroy = pb_winsys_destroy; } |