Merge commit 'origin/gallium-0.1' into gallium-0.2
[mesa.git] / src / gallium / include / pipe / p_context.h
index f69b52f5e3f049dfd15cc1dc7ce0fc6be3382c53..2646706ff239ace09aefb94799cfe4c9ac2227fe 100644 (file)
@@ -36,45 +36,39 @@ extern "C" {
 #endif
 
    
+struct pipe_screen;
+struct pipe_fence_handle;
 struct pipe_state_cache;
-
-/* Opaque driver handles:
- */
 struct pipe_query;
 
+
 /**
  * Gallium rendering context.  Basically:
  *  - state setting functions
  *  - VBO drawing functions
  *  - surface functions
- *  - device queries
  */
 struct pipe_context {
    struct pipe_winsys *winsys;
+   struct pipe_screen *screen;
 
-   void *priv;  /** context private data (for DRI for example) */
+   void *priv;  /**< context private data (for DRI for example) */
+   void *draw;  /**< private, for draw module (temporary?) */
 
    void (*destroy)( struct pipe_context * );
 
-   /*
-    * Queries
+   
+   /* Possible interface for setting edgeflags.  These aren't really
+    * vertex elements, so don't fit there.
     */
-   /** type is one of PIPE_SURFACE, PIPE_TEXTURE, etc. */
-   boolean (*is_format_supported)( struct pipe_context *pipe,
-                                   enum pipe_format format, uint type );
-
-   const char *(*get_name)( struct pipe_context *pipe );
-
-   const char *(*get_vendor)( struct pipe_context *pipe );
-
-   int (*get_param)( struct pipe_context *pipe, int param );
-   float (*get_paramf)( struct pipe_context *pipe, int param );
+   void (*set_edgeflags)( struct pipe_context *,
+                          const unsigned *bitfield );
 
 
-   /*
-    * Drawing.  
-    * Return false on fallbacks (temporary??)
+   /**
+    * VBO drawing (return false on fallbacks (temporary??))
     */
+   /*@{*/
    boolean (*draw_arrays)( struct pipe_context *pipe,
                           unsigned mode, unsigned start, unsigned count);
 
@@ -83,10 +77,26 @@ struct pipe_context {
                             unsigned indexSize,
                             unsigned mode, unsigned start, unsigned count);
 
+   /* XXX: this is (probably) a temporary entrypoint, as the range
+    * information should be available from the vertex_buffer state.
+    * Using this to quickly evaluate a specialized path in the draw
+    * module.
+    */
+   boolean (*draw_range_elements)( struct pipe_context *pipe,
+                                   struct pipe_buffer *indexBuffer,
+                                   unsigned indexSize,
+                                   unsigned minIndex,
+                                   unsigned maxIndex,
+                                   unsigned mode, 
+                                   unsigned start, 
+                                   unsigned count);
+   /*@}*/
+
 
    /**
     * Query objects
     */
+   /*@{*/
    struct pipe_query *(*create_query)( struct pipe_context *pipe,
                                               unsigned query_type );
 
@@ -100,10 +110,12 @@ struct pipe_context {
                                struct pipe_query *q,
                                boolean wait,
                                uint64 *result);
+   /*@}*/
 
-   /*
-    * State functions
+   /**
+    * State functions (create/bind/destroy state objects)
     */
+   /*@{*/
    void * (*create_blend_state)(struct pipe_context *,
                                 const struct pipe_blend_state *);
    void   (*bind_blend_state)(struct pipe_context *, void *);
@@ -111,7 +123,7 @@ struct pipe_context {
 
    void * (*create_sampler_state)(struct pipe_context *,
                                   const struct pipe_sampler_state *);
-   void   (*bind_sampler_state)(struct pipe_context *, unsigned unit, void *);
+   void   (*bind_sampler_states)(struct pipe_context *, unsigned num, void **);
    void   (*delete_sampler_state)(struct pipe_context *, void *);
 
    void * (*create_rasterizer_state)(struct pipe_context *,
@@ -133,10 +145,12 @@ struct pipe_context {
                              const struct pipe_shader_state *);
    void   (*bind_vs_state)(struct pipe_context *, void *);
    void   (*delete_vs_state)(struct pipe_context *, void *);
+   /*@}*/
 
-   /* The following look more properties than states.
-    * maybe combine a few of them into states or pass them
-    * in the bind calls to the state */
+   /**
+    * Parameter-like state (or properties)
+    */
+   /*@{*/
    void (*set_blend_color)( struct pipe_context *,
                             const struct pipe_blend_color * );
 
@@ -156,34 +170,29 @@ struct pipe_context {
    void (*set_scissor_state)( struct pipe_context *,
                               const struct pipe_scissor_state * );
 
-
-   /* Currently a sampler is constrained to sample from a single texture:
-    */
-   void (*set_sampler_texture)( struct pipe_context *,
-                               unsigned sampler,
-                               struct pipe_texture * );
-
    void (*set_viewport_state)( struct pipe_context *,
                                const struct pipe_viewport_state * );
 
-   /*
-    * Vertex arrays
-    */
-   void (*set_vertex_buffer)( struct pipe_context *,
-                              unsigned index,
-                              const struct pipe_vertex_buffer * );
+   void (*set_sampler_textures)( struct pipe_context *,
+                                 unsigned num_textures,
+                                 struct pipe_texture ** );
+
+   void (*set_vertex_buffers)( struct pipe_context *,
+                               unsigned num_buffers,
+                               const struct pipe_vertex_buffer * );
 
-   void (*set_vertex_element)( struct pipe_context *,
-                              unsigned index,
-                              const struct pipe_vertex_element * );
+   void (*set_vertex_elements)( struct pipe_context *,
+                                unsigned num_elements,
+                                const struct pipe_vertex_element * );
+   /*@}*/
 
 
-   /*
+   /**
     * Surface functions
     */
-
+   /*@{*/
    void (*surface_copy)(struct pipe_context *pipe,
-                        unsigned do_flip,      /*<< flip surface contents vertically */
+                        boolean do_flip,/**< flip surface contents vertically */
                        struct pipe_surface *dest,
                        unsigned destx, unsigned desty,
                        struct pipe_surface *src, /* don't make this const - 
@@ -200,35 +209,13 @@ struct pipe_context {
    void (*clear)(struct pipe_context *pipe, 
                 struct pipe_surface *ps,
                 unsigned clearValue);
+   /*@}*/
 
 
-   /*
-    * Texture functions
-    */
-   struct pipe_texture * (*texture_create)(struct pipe_context *pipe,
-                                           const struct pipe_texture *templat);
-
-   void (*texture_release)(struct pipe_context *pipe,
-                          struct pipe_texture **pt);
-
-   /**
-    * Called when texture data is changed.
-    * Note: we could pass some hints about which mip levels or cube faces
-    * have changed...
-    */
-   void (*texture_update)(struct pipe_context *pipe,
-                          struct pipe_texture *texture);
-
-   /** Get a surface which is a "view" into a texture */
-   struct pipe_surface *(*get_tex_surface)(struct pipe_context *pipe,
-                                           struct pipe_texture *texture,
-                                           unsigned face, unsigned level,
-                                           unsigned zslice);
-
-   /* Flush rendering:
-    */
+   /** Flush rendering (flags = bitmask of PIPE_FLUSH_x tokens) */
    void (*flush)( struct pipe_context *pipe,
-                 unsigned flags );
+                  unsigned flags,
+                  struct pipe_fence_handle **fence );
 };