summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/python/st_device.c
diff options
context:
space:
mode:
authorJosé Fonseca <jrfonseca@tungstengraphics.com>2008-08-10 18:52:00 +0100
committerJosé Fonseca <jrfonseca@tungstengraphics.com>2008-08-12 11:34:40 +0100
commita304d271185af935974850055da74ec8263b00e2 (patch)
treee9bb1f947ea408e60ccd2c0828529c394bb49e13 /src/gallium/state_trackers/python/st_device.c
parente5a606883f24980dd8e2378c25e6fb3b8f1937ce (diff)
python: Allow writing to buffers.
Diffstat (limited to 'src/gallium/state_trackers/python/st_device.c')
-rw-r--r--src/gallium/state_trackers/python/st_device.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/python/st_device.c b/src/gallium/state_trackers/python/st_device.c
index 2e53a83eea..fbd56712e0 100644
--- a/src/gallium/state_trackers/python/st_device.c
+++ b/src/gallium/state_trackers/python/st_device.c
@@ -266,3 +266,36 @@ st_context_create(struct st_device *st_dev)
return st_ctx;
}
+
+
+void
+st_buffer_destroy(struct st_buffer *st_buf)
+{
+ if(st_buf) {
+ struct pipe_winsys *winsys = st_buf->st_dev->screen->winsys;
+ pipe_buffer_reference(winsys, &st_buf->buffer, NULL);
+ FREE(st_buf);
+ }
+}
+
+
+struct st_buffer *
+st_buffer_create(struct st_device *st_dev,
+ unsigned alignment, unsigned usage, unsigned size)
+{
+ struct pipe_winsys *winsys = st_dev->screen->winsys;
+ struct st_buffer *st_buf;
+
+ st_buf = CALLOC_STRUCT(st_buffer);
+ if(!st_buf)
+ return NULL;
+
+ st_buf->st_dev = st_dev;
+
+ st_buf->buffer = winsys->buffer_create(winsys, alignment, usage, size);
+ if(!st_buf->buffer)
+ st_buffer_destroy(st_buf);
+
+ return st_buf;
+}
+