diff options
author | Ben Skeggs <skeggsb@gmail.com> | 2008-08-14 00:20:52 +1000 |
---|---|---|
committer | Ben Skeggs <skeggsb@gmail.com> | 2008-08-14 00:20:52 +1000 |
commit | 56f5c0c001c476b813c94d071ac880fbe8d9768b (patch) | |
tree | 257e2d7c3870a741ad30ea7bc38621d9eb728483 /src/gallium/state_trackers/python/st_device.c | |
parent | df4228deddea36b9d5b41ea395a216137e046205 (diff) | |
parent | d8be393cb60d908f98f0edb74c1c7964e8f690fe (diff) |
Merge remote branch 'origin/gallium-0.1' into nouveau-gallium-0.1
Diffstat (limited to 'src/gallium/state_trackers/python/st_device.c')
-rw-r--r-- | src/gallium/state_trackers/python/st_device.c | 33 |
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; +} + |