gallium/xlib: silence unitialized var warning
[mesa.git] / src / gallium / state_trackers / python / p_state.i
index 9834229b4b590422fe17549ad4b680ec4b704940..90f157e0ab0adcc24e2a5259974f8be478d35065 100644 (file)
 
 %module gallium;
 
+%ignore winsys;
+%ignore pipe_vertex_buffer::buffer;
+
+%include "pipe/p_compiler.h";
 %include "pipe/p_state.h";
 
 
+%array_class(struct pipe_stencil_state, StencilArray);
+
+
 %extend pipe_framebuffer_state {
    
    pipe_framebuffer_state(void) {
    }
    
    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");
+      
+      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);
+      
+   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;
+
+      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);
+
+   fail:
+      return;
    }
    
 };