Mesa (master): python: Cope with null surfaces.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Wed Apr 8 15:26:12 UTC 2009


Module: Mesa
Branch: master
Commit: 724929db3ca39ac63ca6f020b3f1faa31948f46b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=724929db3ca39ac63ca6f020b3f1faa31948f46b

Author: José Fonseca <jfonseca at vmware.com>
Date:   Wed Apr  8 15:30:53 2009 +0100

python: Cope with null surfaces.

---

 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 fc8607b..90f157e 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);
 




More information about the mesa-commit mailing list