From: José Fonseca Date: Wed, 8 Apr 2009 14:30:53 +0000 (+0100) Subject: python: Cope with null surfaces. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=724929db3ca39ac63ca6f020b3f1faa31948f46b;p=mesa.git python: Cope with null surfaces. --- 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);