swrast: simplify assertion to silence warning
[mesa.git] / src / gallium / state_trackers / python / p_device.i
index 84fd2e4349bc46e58773c23669b395d1acfd614f..61f6b3bb739f8496676fd9725958cb0dcae7599c 100644 (file)
@@ -81,17 +81,21 @@ struct st_device {
    /**
     * Check if the given pipe_format is supported as a texture or
     * drawing surface.
-    * \param type  one of PIPE_TEXTURE, PIPE_SURFACE
+    * \param bind bitmask of PIPE_BIND flags
     */
    int is_format_supported( enum pipe_format format, 
                             enum pipe_texture_target target,
-                            unsigned tex_usage, 
-                            unsigned geom_flags ) {
-      return $self->screen->is_format_supported( $self->screen, 
-                                                 format, 
-                                                 target, 
-                                                 tex_usage, 
-                                                 geom_flags );
+                            unsigned sample_count,
+                            unsigned bind ) {
+      /* We can't really display surfaces with the python statetracker so mask
+       * out that usage */
+      bind &= ~PIPE_BIND_DISPLAY_TARGET;
+
+      return $self->screen->is_format_supported( $self->screen,
+                                                 format,
+                                                 target,
+                                                 sample_count,
+                                                 bind );
    }
 
    struct st_context *
@@ -99,32 +103,36 @@ struct st_device {
       return st_context_create($self);
    }
 
-   struct pipe_texture * 
-   texture_create(
+   struct pipe_resource * 
+   resource_create(
          enum pipe_format format,
          unsigned width,
          unsigned height,
          unsigned depth = 1,
          unsigned last_level = 0,
          enum pipe_texture_target target = PIPE_TEXTURE_2D,
-         unsigned tex_usage = 0
+         unsigned bind = 0
       ) {
-      struct pipe_texture templat;
+      struct pipe_resource templat;
+
+      /* We can't really display surfaces with the python statetracker so mask
+       * out that usage */
+      bind &= ~PIPE_BIND_DISPLAY_TARGET;
+
       memset(&templat, 0, sizeof(templat));
       templat.format = format;
-      pf_get_block(templat.format, &templat.block);
-      templat.width[0] = width;
-      templat.height[0] = height;
-      templat.depth[0] = depth;
+      templat.width0 = width;
+      templat.height0 = height;
+      templat.depth0 = depth;
       templat.last_level = last_level;
       templat.target = target;
-      templat.tex_usage = tex_usage;
-      return $self->screen->texture_create($self->screen, &templat);
-   }
-   
-   struct st_buffer *
-   buffer_create(unsigned size, unsigned alignment = 0, unsigned usage = 0) {
-      return st_buffer_create($self, alignment, usage, size);
+      templat.bind = bind;
+
+      return $self->screen->resource_create($self->screen, &templat);
    }
 
+   struct pipe_resource *
+   buffer_create(unsigned size, unsigned usage, unsigned bind = 0) {
+      return pipe_buffer_create($self->screen, bind, usage, size);
+   }
 };