Merge remote branch 'origin/master' into nvc0-new
[mesa.git] / src / gallium / include / pipe / p_context.h
index 7ec3d63a3fdfdbe80c12f67e3e4cbe3bce6f2911..589cac2ddd3b85da1621fed21168a49ded05f01f 100644 (file)
 #ifndef PIPE_CONTEXT_H
 #define PIPE_CONTEXT_H
 
-#include "p_state.h"
-
+#include "p_compiler.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-   
-struct pipe_screen;
+
+struct pipe_blend_color;
+struct pipe_blend_state;
+struct pipe_box;
+struct pipe_clip_state;
+struct pipe_depth_stencil_alpha_state;
+struct pipe_draw_info;
 struct pipe_fence_handle;
-struct pipe_state_cache;
+struct pipe_framebuffer_state;
+struct pipe_index_buffer;
 struct pipe_query;
-struct pipe_winsys;
+struct pipe_poly_stipple;
+struct pipe_rasterizer_state;
+struct pipe_resource;
+struct pipe_sampler_state;
+struct pipe_sampler_view;
+struct pipe_scissor_state;
+struct pipe_shader_state;
+struct pipe_stencil_ref;
+struct pipe_stream_output_state;
+struct pipe_surface;
+struct pipe_vertex_buffer;
+struct pipe_vertex_element;
+struct pipe_viewport_state;
 
 /**
  * Gallium rendering context.  Basically:
@@ -61,46 +78,8 @@ struct pipe_context {
     * VBO drawing
     */
    /*@{*/
-   void (*draw_arrays)( struct pipe_context *pipe,
-                        unsigned mode, unsigned start, unsigned count);
-
-   void (*draw_elements)( struct pipe_context *pipe,
-                          struct pipe_resource *indexBuffer,
-                          unsigned indexSize,
-                          int indexBias,
-                          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_resource *indexBuffer,
-                                   unsigned indexSize,
-                                   int indexBias,
-                                   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.
-    */
-   void (*draw_range_elements)( struct pipe_context *pipe,
-                                struct pipe_resource *indexBuffer,
-                                unsigned indexSize,
-                                int indexBias,
-                                unsigned minIndex,
-                                unsigned maxIndex,
-                                unsigned mode, 
-                                unsigned start, 
-                                unsigned count);
+   void (*draw_vbo)( struct pipe_context *pipe,
+                     const struct pipe_draw_info *info );
 
    /**
     * Draw the stream output buffer at index 0
@@ -249,6 +228,9 @@ struct pipe_context {
                                unsigned num_buffers,
                                const struct pipe_vertex_buffer * );
 
+   void (*set_index_buffer)( struct pipe_context *pipe,
+                             const struct pipe_index_buffer * );
+
    void (*set_stream_output_buffers)(struct pipe_context *,
                                      struct pipe_resource **buffers,
                                      int *offsets, /*array of offsets
@@ -273,12 +255,11 @@ struct pipe_context {
     */
    void (*resource_copy_region)(struct pipe_context *pipe,
                                 struct pipe_resource *dst,
-                                struct pipe_subresource subdst,
+                                unsigned dst_level,
                                 unsigned dstx, unsigned dsty, unsigned dstz,
                                 struct pipe_resource *src,
-                                struct pipe_subresource subsrc,
-                                unsigned srcx, unsigned srcy, unsigned srcz,
-                                unsigned width, unsigned height);
+                                unsigned src_level,
+                                const struct pipe_box *src_box);
 
    /**
     * Resolve a multisampled resource into a non-multisampled one.
@@ -286,9 +267,9 @@ struct pipe_context {
     */
    void (*resource_resolve)(struct pipe_context *pipe,
                             struct pipe_resource *dst,
-                            struct pipe_subresource subdst,
+                            unsigned dst_layer,
                             struct pipe_resource *src,
-                            struct pipe_subresource subsrc);
+                            unsigned src_layer);
 
    /*@}*/
 
@@ -345,13 +326,13 @@ struct pipe_context {
     * PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE.
     * \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.
+    * \param layer  cubemap face, 2d array or 3d slice, 0 otherwise. Use -1 for any layer.
     * \return mask of PIPE_REFERENCED_FOR_READ/WRITE or PIPE_UNREFERENCED
     */
    unsigned int (*is_resource_referenced)(struct pipe_context *pipe,
-                                         struct pipe_resource *texture,
-                                         unsigned face, unsigned level);
+                                          struct pipe_resource *texture,
+                                          unsigned level, int layer);
 
    /**
     * Create a view on a texture to be used by a shader stage.
@@ -364,6 +345,18 @@ struct pipe_context {
                                 struct pipe_sampler_view *view);
 
 
+   /**
+    * Get a surface which is a "view" into a resource, used by
+    * render target / depth stencil stages.
+    * \param usage  bitmaks of PIPE_BIND_* flags
+    */
+   struct pipe_surface *(*create_surface)(struct pipe_context *ctx,
+                                          struct pipe_resource *resource,
+                                          const struct pipe_surface *templat);
+
+   void (*surface_destroy)(struct pipe_context *ctx,
+                           struct pipe_surface *);
+
    /**
     * Get a transfer object for transferring data to/from a texture.
     *
@@ -371,14 +364,14 @@ struct pipe_context {
     * interleaved with
     */
    struct pipe_transfer *(*get_transfer)(struct pipe_context *,
-                                        struct pipe_resource *resource,
-                                        struct pipe_subresource,
-                                        unsigned usage,  /* a combination of PIPE_TRANSFER_x */
-                                        const struct pipe_box *);
+                                         struct pipe_resource *resource,
+                                         unsigned level,
+                                         unsigned usage,  /* a combination of PIPE_TRANSFER_x */
+                                         const struct pipe_box *);
 
    void (*transfer_destroy)(struct pipe_context *,
-                                struct pipe_transfer *);
-   
+                            struct pipe_transfer *);
+
    void *(*transfer_map)( struct pipe_context *,
                           struct pipe_transfer *transfer );
 
@@ -398,13 +391,13 @@ struct pipe_context {
     * pointer.  XXX: strides??
     */
    void (*transfer_inline_write)( struct pipe_context *,
-                                 struct pipe_resource *,
-                                 struct pipe_subresource,
-                                 unsigned usage, /* a combination of PIPE_TRANSFER_x */
-                                 const struct pipe_box *,
-                                 const void *data,
-                                 unsigned stride,
-                                 unsigned slice_stride);
+                                  struct pipe_resource *,
+                                  unsigned level,
+                                  unsigned usage, /* a combination of PIPE_TRANSFER_x */
+                                  const struct pipe_box *,
+                                  const void *data,
+                                  unsigned stride,
+                                  unsigned layer_stride);
 
 };