diff options
author | José Fonseca <jfonseca@vmware.com> | 2009-03-30 16:02:21 +0100 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2009-03-30 17:19:10 +0100 |
commit | 28de69d6819eab289a400482d15797b662e4d633 (patch) | |
tree | 7e55515a03d72ae68872bfd373d3607a5ebc0edc /src/gallium/state_trackers/python/p_state.i | |
parent | 68342f9036d3c94ee50c4cbe5c7b36439eeb6825 (diff) |
python: Set the surface GPU access flags.
Make python surface just a dumb (texture, face, level, zslice) tuple.
Diffstat (limited to 'src/gallium/state_trackers/python/p_state.i')
-rw-r--r-- | src/gallium/state_trackers/python/p_state.i | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/src/gallium/state_trackers/python/p_state.i b/src/gallium/state_trackers/python/p_state.i index 110b3d5da4..fc8607ba72 100644 --- a/src/gallium/state_trackers/python/p_state.i +++ b/src/gallium/state_trackers/python/p_state.i @@ -59,13 +59,36 @@ } void - set_cbuf(unsigned index, struct pipe_surface *surface) { - pipe_surface_reference(&$self->cbufs[index], surface); + set_cbuf(unsigned index, struct st_surface *surface) + { + struct pipe_surface *_surface = NULL; + + if(index >= PIPE_MAX_COLOR_BUFS) + SWIG_exception(SWIG_ValueError, "index out of bounds"); + + _surface = st_pipe_surface(surface, PIPE_BUFFER_USAGE_GPU_WRITE); + if(!_surface) + SWIG_exception(SWIG_ValueError, "couldn't acquire surface for writing"); + + pipe_surface_reference(&$self->cbufs[index], _surface); + + fail: + return; } void - set_zsbuf(struct pipe_surface *surface) { - pipe_surface_reference(&$self->zsbuf, surface); + set_zsbuf(struct st_surface *surface) + { + struct pipe_surface *_surface = NULL; + + _surface = st_pipe_surface(surface, PIPE_BUFFER_USAGE_GPU_WRITE); + if(!_surface) + SWIG_exception(SWIG_ValueError, "couldn't acquire surface for writing"); + + pipe_surface_reference(&$self->zsbuf, _surface); + + fail: + return; } }; |