gallium: Make sure we flush before some texture / buffer operations.
[mesa.git] / src / gallium / include / pipe / p_context.h
index c5c839799ea2a25b1733d858645ff687fc458159..57e966ac3b04b42043da066b9125c3be2922edab 100644 (file)
@@ -42,7 +42,6 @@ struct pipe_state_cache;
 struct pipe_query;
 struct pipe_winsys;
 
-
 /**
  * Gallium rendering context.  Basically:
  *  - state setting functions
@@ -231,6 +230,34 @@ struct pipe_context {
    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);
 };