Merge branch 'mesa_7_6_branch'
[mesa.git] / src / gallium / include / pipe / p_context.h
index 2646706ff239ace09aefb94799cfe4c9ac2227fe..39620a7198027dfefe846401b5b761fda5cc97be 100644 (file)
@@ -40,7 +40,7 @@ struct pipe_screen;
 struct pipe_fence_handle;
 struct pipe_state_cache;
 struct pipe_query;
-
+struct pipe_winsys;
 
 /**
  * Gallium rendering context.  Basically:
@@ -98,7 +98,7 @@ struct pipe_context {
     */
    /*@{*/
    struct pipe_query *(*create_query)( struct pipe_context *pipe,
-                                              unsigned query_type );
+                                       unsigned query_type );
 
    void (*destroy_query)(struct pipe_context *pipe,
                          struct pipe_query *q);
@@ -109,7 +109,7 @@ struct pipe_context {
    boolean (*get_query_result)(struct pipe_context *pipe, 
                                struct pipe_query *q,
                                boolean wait,
-                               uint64 *result);
+                               uint64_t *result);
    /*@}*/
 
    /**
@@ -191,31 +191,76 @@ struct pipe_context {
     * Surface functions
     */
    /*@{*/
+
+   /**
+    * Copy a block of pixels from one surface to another.
+    * The surfaces must be of the same format.
+    */
    void (*surface_copy)(struct pipe_context *pipe,
-                        boolean do_flip,/**< flip surface contents vertically */
                        struct pipe_surface *dest,
                        unsigned destx, unsigned desty,
-                       struct pipe_surface *src, /* don't make this const - 
-                                                    need to map/unmap */
+                       struct pipe_surface *src,
                        unsigned srcx, unsigned srcy,
                        unsigned width, unsigned height);
 
+   /**
+    * Fill a region of a surface with a constant value.
+    */
    void (*surface_fill)(struct pipe_context *pipe,
                        struct pipe_surface *dst,
                        unsigned dstx, unsigned dsty,
                        unsigned width, unsigned height,
                        unsigned value);
-
-   void (*clear)(struct pipe_context *pipe, 
-                struct pipe_surface *ps,
-                unsigned clearValue);
    /*@}*/
 
-
-   /** Flush rendering (flags = bitmask of PIPE_FLUSH_x tokens) */
+   /**
+    * Clear the specified set of currently bound buffers to specified values.
+    * The entire buffers are cleared (no scissor, no colormask, etc).
+    *
+    * \param buffers  bitfield of PIPE_CLEAR_* values.
+    * \param rgba  pointer to an array of one float for each of r, g, b, a.
+    * \param depth  depth clear value in [0,1].
+    * \param stencil  stencil clear value
+    */
+   void (*clear)(struct pipe_context *pipe,
+                 unsigned buffers,
+                const float *rgba,
+                 double depth,
+                unsigned stencil);
+
+   /** Flush rendering
+    * \param flags  bitmask of PIPE_FLUSH_x tokens)
+    */
    void (*flush)( struct pipe_context *pipe,
                   unsigned flags,
                   struct pipe_fence_handle **fence );
+
+   /**
+    * 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.
+    * 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 texture  texture to check.
+    * \param face  cubemap face. Use 0 for non-cubemap texture.
+    */
+   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
+    * 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.
+    */
+   unsigned int (*is_buffer_referenced) (struct pipe_context *pipe,
+                                        struct pipe_buffer *buf);
 };