diff options
-rw-r--r-- | src/gallium/state_trackers/python/p_state.i | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/gallium/state_trackers/python/p_state.i b/src/gallium/state_trackers/python/p_state.i index fc8607ba72f..90f157e0ab0 100644 --- a/src/gallium/state_trackers/python/p_state.i +++ b/src/gallium/state_trackers/python/p_state.i @@ -66,9 +66,11 @@ 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"); + if(surface) { + _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); @@ -81,9 +83,11 @@ { 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"); + if(surface) { + _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); |