OSDN Git Service

python: Cope with null surfaces.
authorJosé Fonseca <jfonseca@vmware.com>
Wed, 8 Apr 2009 14:30:53 +0000 (15:30 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Wed, 8 Apr 2009 15:26:05 +0000 (16:26 +0100)
src/gallium/state_trackers/python/p_state.i

index fc8607b..90f157e 100644 (file)
       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);
       
    {
       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);