Merge branch 'master' into gallium-sampler-view
[mesa.git] / src / gallium / include / pipe / p_context.h
index 60fa9cef82492fdcfd05b051e9f9e12ab99aa24b..17fad1fa2435e4eda0c22d2b320dcce2b746363b 100644 (file)
@@ -61,33 +61,49 @@ struct pipe_context {
     * VBO drawing (return false on fallbacks (temporary??))
     */
    /*@{*/
-   boolean (*draw_arrays)( struct pipe_context *pipe,
-                          unsigned mode, unsigned start, unsigned count);
-
-   boolean (*draw_elements)( struct pipe_context *pipe,
-                            struct pipe_buffer *indexBuffer,
-                            unsigned indexSize,
-                            unsigned mode, unsigned start, unsigned count);
+   void (*draw_arrays)( struct pipe_context *pipe,
+                        unsigned mode, unsigned start, unsigned count);
+
+   void (*draw_elements)( struct pipe_context *pipe,
+                          struct pipe_buffer *indexBuffer,
+                          unsigned indexSize,
+                          unsigned mode, unsigned start, unsigned count);
+
+   void (*draw_arrays_instanced)(struct pipe_context *pipe,
+                                 unsigned mode,
+                                 unsigned start,
+                                 unsigned count,
+                                 unsigned startInstance,
+                                 unsigned instanceCount);
+
+   void (*draw_elements_instanced)(struct pipe_context *pipe,
+                                   struct pipe_buffer *indexBuffer,
+                                   unsigned indexSize,
+                                   unsigned mode,
+                                   unsigned start,
+                                   unsigned count,
+                                   unsigned startInstance,
+                                   unsigned instanceCount);
 
    /* 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);
+   void (*draw_range_elements)( struct pipe_context *pipe,
+                                struct pipe_buffer *indexBuffer,
+                                unsigned indexSize,
+                                unsigned minIndex,
+                                unsigned maxIndex,
+                                unsigned mode, 
+                                unsigned start, 
+                                unsigned count);
    /*@}*/
 
    /**
     * Predicate subsequent rendering on occlusion query result
     * \param query  the query predicate, or NULL if no predicate
-    * \param mode  one of PIPE_COND_RENDER_x
+    * \param mode  one of PIPE_RENDER_COND_x
     */
    void (*render_condition)( struct pipe_context *pipe,
                              struct pipe_query *query,
@@ -106,6 +122,11 @@ struct pipe_context {
    void (*begin_query)(struct pipe_context *pipe, struct pipe_query *q);
    void (*end_query)(struct pipe_context *pipe, struct pipe_query *q);
 
+   /**
+    * Get results of a query.
+    * \param wait  if true, this query will block until the result is ready
+    * \return TRUE if results are ready, FALSE otherwise
+    */
    boolean (*get_query_result)(struct pipe_context *pipe, 
                                struct pipe_query *q,
                                boolean wait,
@@ -156,6 +177,12 @@ struct pipe_context {
    void   (*bind_gs_state)(struct pipe_context *, void *);
    void   (*delete_gs_state)(struct pipe_context *, void *);
 
+   void * (*create_vertex_elements_state)(struct pipe_context *,
+                                          unsigned num_elements,
+                                          const struct pipe_vertex_element *);
+   void   (*bind_vertex_elements_state)(struct pipe_context *, void *);
+   void   (*delete_vertex_elements_state)(struct pipe_context *, void *);
+
    /*@}*/
 
    /**
@@ -165,12 +192,15 @@ struct pipe_context {
    void (*set_blend_color)( struct pipe_context *,
                             const struct pipe_blend_color * );
 
+   void (*set_stencil_ref)( struct pipe_context *,
+                            const struct pipe_stencil_ref * );
+
    void (*set_clip_state)( struct pipe_context *,
-                          const struct pipe_clip_state * );
+                            const struct pipe_clip_state * );
 
    void (*set_constant_buffer)( struct pipe_context *,
                                 uint shader, uint index,
-                                const struct pipe_constant_buffer *buf );
+                                struct pipe_buffer *buf );
 
    void (*set_framebuffer_state)( struct pipe_context *,
                                   const struct pipe_framebuffer_state * );
@@ -184,21 +214,18 @@ struct pipe_context {
    void (*set_viewport_state)( struct pipe_context *,
                                const struct pipe_viewport_state * );
 
-   void (*set_fragment_sampler_textures)(struct pipe_context *,
-                                         unsigned num_textures,
-                                         struct pipe_texture **);
+   void (*set_fragment_sampler_views)(struct pipe_context *,
+                                      unsigned num_views,
+                                      struct pipe_sampler_view **);
 
-   void (*set_vertex_sampler_textures)(struct pipe_context *,
-                                       unsigned num_textures,
-                                       struct pipe_texture **);
+   void (*set_vertex_sampler_views)(struct pipe_context *,
+                                    unsigned num_views,
+                                    struct pipe_sampler_view **);
 
    void (*set_vertex_buffers)( struct pipe_context *,
                                unsigned num_buffers,
                                const struct pipe_vertex_buffer * );
 
-   void (*set_vertex_elements)( struct pipe_context *,
-                                unsigned num_elements,
-                                const struct pipe_vertex_element * );
    /*@}*/
 
 
@@ -255,30 +282,40 @@ struct pipe_context {
 
    /**
     * Check whether a texture is referenced by an unflushed hw command.
-    * The state-tracker uses this function to optimize away unnecessary
-    * flushes. It is safe (but wasteful) to always return.
+    * The state-tracker uses this function to avoid unnecessary flushes.
+    * It is safe (but wasteful) to always return
     * PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE.
-    * \param pipe  The pipe context whose unflushed hw commands will be
-    *              checked.
-    * \param level  mipmap level.
+    * \param pipe  context whose unflushed hw commands will be checked.
     * \param texture  texture to check.
     * \param face  cubemap face. Use 0 for non-cubemap texture.
+    * \param level  mipmap level.
+    * \return mask of PIPE_REFERENCED_FOR_READ/WRITE or PIPE_UNREFERENCED
     */
-   unsigned int (*is_texture_referenced) (struct pipe_context *pipe,
-                                         struct pipe_texture *texture,
-                                         unsigned face, unsigned level);
+   unsigned int (*is_texture_referenced)(struct pipe_context *pipe,
+                                        struct pipe_texture *texture,
+                                        unsigned face, unsigned level);
 
    /**
     * Check whether a buffer is referenced by an unflushed hw command.
-    * The state-tracker uses this function to optimize away unnecessary
-    * flushes. It is safe (but wasteful) to always return
+    * The state-tracker uses this function to avoid unnecessary flushes.
+    * It is safe (but wasteful) to always return
     * PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE.
-    * \param pipe  The pipe context whose unflushed hw commands will be
-    *              checked.
-    * \param buf  Buffer to check.
+    * \param pipe  context whose unflushed hw commands will be checked.
+    * \param buf  buffer to check.
+    * \return mask of PIPE_REFERENCED_FOR_READ/WRITE or PIPE_UNREFERENCED
     */
-   unsigned int (*is_buffer_referenced) (struct pipe_context *pipe,
-                                        struct pipe_buffer *buf);
+   unsigned int (*is_buffer_referenced)(struct pipe_context *pipe,
+                                       struct pipe_buffer *buf);
+
+   /**
+    * Create a view on a texture to be used by a shader stage.
+    */
+   struct pipe_sampler_view * (*create_sampler_view)(struct pipe_context *ctx,
+                                                     struct pipe_texture *texture,
+                                                     const struct pipe_sampler_view *templat);
+
+   void (*sampler_view_destroy)(struct pipe_context *ctx,
+                                struct pipe_sampler_view *view);
 };