gallium: add pipe_context::set_device_reset_callback
[mesa.git] / src / gallium / include / pipe / p_state.h
index 9c693555c7eae4d81fcbef9a77b0d7a8aad454d2..46df196b6ed9cb79e1e59dd89e61df9e1bb02cf9 100644 (file)
@@ -139,6 +139,13 @@ struct pipe_rasterizer_state
     */
    unsigned clip_halfz:1;
 
+   /**
+    * When true do not scale offset_units and use same rules for unorm and
+    * float depth buffers (D3D9). When false use GL/D3D1X behaviour.
+    * This depends on PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED.
+    */
+   unsigned offset_units_unscaled:1;
+
    /**
     * Enable bits for clipping half-spaces.
     * This applies to both user clip planes and shader clip distances.
@@ -370,6 +377,17 @@ struct pipe_sampler_state
    union pipe_color_union border_color;
 };
 
+union pipe_surface_desc {
+   struct {
+      unsigned level;
+      unsigned first_layer:16;
+      unsigned last_layer:16;
+   } tex;
+   struct {
+      unsigned first_element;
+      unsigned last_element;
+   } buf;
+};
 
 /**
  * A view into a texture that can be bound to a color render target /
@@ -388,17 +406,7 @@ struct pipe_surface
 
    unsigned writable:1;          /**< writable shader resource */
 
-   union {
-      struct {
-         unsigned level;
-         unsigned first_layer:16;
-         unsigned last_layer:16;
-      } tex;
-      struct {
-         unsigned first_element;
-         unsigned last_element;
-      } buf;
-   } u;
+   union pipe_surface_desc u;
 };
 
 
@@ -420,8 +428,8 @@ struct pipe_sampler_view
          unsigned last_level:8;    /**< last mipmap level to use */
       } tex;
       struct {
-         unsigned first_element;
-         unsigned last_element;
+         unsigned offset;   /**< offset in bytes */
+         unsigned size;     /**< size of the readable sub-range in bytes */
       } buf;
    } u;
    unsigned swizzle_r:3;         /**< PIPE_SWIZZLE_x for red component */
@@ -448,8 +456,8 @@ struct pipe_image_view
          unsigned level:8;            /**< mipmap level to use */
       } tex;
       struct {
-         unsigned first_element;
-         unsigned last_element;
+         unsigned offset;   /**< offset in bytes */
+         unsigned size;     /**< size of the accessible sub-range in bytes */
       } buf;
    } u;
 };
@@ -490,6 +498,12 @@ struct pipe_resource
 
    unsigned bind;            /**< bitmask of PIPE_BIND_x */
    unsigned flags;           /**< bitmask of PIPE_RESOURCE_FLAG_x */
+
+   /**
+    * For planar images, ie. YUV EGLImage external, etc, pointer to the
+    * next plane.
+    */
+   struct pipe_resource *next;
 };
 
 
@@ -738,6 +752,13 @@ struct pipe_grid_info
     */
    void *input;
 
+   /**
+    * Grid number of dimensions, 1-3, e.g. the work_dim parameter passed to
+    * clEnqueueNDRangeKernel. Note block[] and grid[] must be padded with
+    * 1 for non-used dimensions.
+    */
+   uint work_dim;
+
    /**
     * Determine the layout of the working block (in thread units) to be used.
     */
@@ -784,6 +805,12 @@ struct pipe_compute_state
  */
 struct pipe_debug_callback
 {
+   /**
+    * When set to \c true, the callback may be called asynchronously from a
+    * driver-created thread.
+    */
+   bool async;
+
    /**
     * Callback for the driver to report debug/performance/etc information back
     * to the state tracker.
@@ -803,6 +830,25 @@ struct pipe_debug_callback
    void *data;
 };
 
+/**
+ * Structure that contains a callback for device reset messages from the driver
+ * back to the state tracker.
+ *
+ * The callback must not be called from driver-created threads.
+ */
+struct pipe_device_reset_callback
+{
+   /**
+    * Callback for the driver to report when a device reset is detected.
+    *
+    * \param data   user-supplied data pointer
+    * \param status PIPE_*_RESET
+    */
+   void (*reset)(void *data, enum pipe_reset_status status);
+
+   void *data;
+};
+
 /**
  * Information about memory usage. All sizes are in kilobytes.
  */