Merge branch 'gallium-newclear'
[mesa.git] / src / gallium / drivers / llvmpipe / lp_rast.h
index 2a97fe4c67bc5926ea40cfa2289220bfb9163621..80ca68f5a2f5161cfe38d676fbf7d75900c5efd1 100644 (file)
 
 struct lp_rasterizer;
 struct lp_scene;
-struct lp_scene_queue;
 struct lp_fence;
 struct cmd_bin;
-struct pipe_screen;
 
 /** For sub-pixel positioning */
 #define FIXED_ORDER 4
 #define FIXED_ONE (1<<FIXED_ORDER)
 
 
+struct lp_rasterizer_task;
+
+
 /**
  * Rasterization state.
  * Objects of this type are put into the shared data bin and pointed
@@ -65,13 +66,9 @@ struct lp_rast_state {
    struct lp_jit_context jit_context;
    
    /* The shader itself.  Probably we also need to pass a pointer to
-    * the tile color/z/stencil data somehow:
-    * jit_function[0] skips the triangle in/out test code
-    * jit_function[1] does triangle in/out testing
+    * the tile color/z/stencil data somehow
      */
-   lp_jit_frag_func jit_function[2];
-
-   boolean opaque;
+   struct lp_fragment_shader_variant *variant;
 };
 
 
@@ -81,12 +78,19 @@ struct lp_rast_state {
  * These pointers point into the bin data buffer.
  */
 struct lp_rast_shader_inputs {
+   float facing;     /** Positive for front-facing, negative for back-facing */
+
    float (*a0)[4];
    float (*dadx)[4];
    float (*dady)[4];
 
    /* edge/step info for 3 edges and 4x4 block of pixels */
-   int ALIGN16_ATTRIB step[3][16];
+   PIPE_ALIGN_VAR(16) int step[3][16];
+};
+
+struct lp_rast_clearzs {
+   unsigned clearzs_value;
+   unsigned clearzs_mask;
 };
 
 
@@ -94,14 +98,12 @@ struct lp_rast_shader_inputs {
  * Rasterization information for a triangle known to be in this bin,
  * plus inputs to run the shader:
  * These fields are tile- and bin-independent.
- * Objects of this type are put into the setup_context::data buffer.
+ * Objects of this type are put into the lp_setup_context::data buffer.
  */
 struct lp_rast_triangle {
-   /* bounding box of tri (in pixels) */
-   int minx;
-   int maxx;
-   int miny;
-   int maxy;
+#ifdef DEBUG
+   float v[3][2];
+#endif
 
    /* one-pixel sized trivial accept offsets for each plane */
    int ei1;                   
@@ -127,23 +129,26 @@ struct lp_rast_triangle {
    int c1, c2, c3;
 
    /* inputs for the shader */
-   struct lp_rast_shader_inputs ALIGN16_ATTRIB inputs;
+   PIPE_ALIGN_VAR(16) struct lp_rast_shader_inputs inputs;
 };
 
 
 
-struct lp_rasterizer *lp_rast_create( struct pipe_screen *screen,
-                                      struct lp_scene_queue *empty );
+struct lp_rasterizer *
+lp_rast_create( unsigned num_threads );
 
-void lp_rast_destroy( struct lp_rasterizer * );
+void
+lp_rast_destroy( struct lp_rasterizer * );
 
-unsigned lp_rast_get_num_threads( struct lp_rasterizer * );
+unsigned
+lp_rast_get_num_threads( struct lp_rasterizer * );
 
-void lp_rasterize_scene( struct lp_rasterizer *rast,
-                        struct lp_scene *scene,
-                        const struct pipe_framebuffer_state *fb,
-                        bool write_depth );
+void 
+lp_rast_queue_scene( struct lp_rasterizer *rast,
+                     struct lp_scene *scene );
 
+void
+lp_rast_finish( struct lp_rasterizer *rast );
 
 
 union lp_rast_cmd_arg {
@@ -151,14 +156,15 @@ union lp_rast_cmd_arg {
    const struct lp_rast_triangle *triangle;
    const struct lp_rast_state *set_state;
    uint8_t clear_color[4];
-   unsigned clear_zstencil;
+   const struct lp_rast_clearzs *clear_zstencil;
    struct lp_fence *fence;
+   struct llvmpipe_query *query_obj;
 };
 
 
 /* Cast wrappers.  Hopefully these compile to noops!
  */
-static INLINE const union lp_rast_cmd_arg
+static INLINE union lp_rast_cmd_arg
 lp_rast_arg_inputs( const struct lp_rast_shader_inputs *shade_tile )
 {
    union lp_rast_cmd_arg arg;
@@ -166,7 +172,7 @@ lp_rast_arg_inputs( const struct lp_rast_shader_inputs *shade_tile )
    return arg;
 }
 
-static INLINE const union lp_rast_cmd_arg
+static INLINE union lp_rast_cmd_arg
 lp_rast_arg_triangle( const struct lp_rast_triangle *triangle )
 {
    union lp_rast_cmd_arg arg;
@@ -174,7 +180,7 @@ lp_rast_arg_triangle( const struct lp_rast_triangle *triangle )
    return arg;
 }
 
-static INLINE const union lp_rast_cmd_arg
+static INLINE union lp_rast_cmd_arg
 lp_rast_arg_state( const struct lp_rast_state *state )
 {
    union lp_rast_cmd_arg arg;
@@ -182,7 +188,7 @@ lp_rast_arg_state( const struct lp_rast_state *state )
    return arg;
 }
 
-static INLINE const union lp_rast_cmd_arg
+static INLINE union lp_rast_cmd_arg
 lp_rast_arg_fence( struct lp_fence *fence )
 {
    union lp_rast_cmd_arg arg;
@@ -191,7 +197,15 @@ lp_rast_arg_fence( struct lp_fence *fence )
 }
 
 
-static INLINE const union lp_rast_cmd_arg
+static INLINE union lp_rast_cmd_arg
+lp_rast_arg_clearzs( const struct lp_rast_clearzs *clearzs )
+{
+   union lp_rast_cmd_arg arg;
+   arg.clear_zstencil = clearzs;
+   return arg;
+}
+
+static INLINE union lp_rast_cmd_arg
 lp_rast_arg_null( void )
 {
    union lp_rast_cmd_arg arg;
@@ -200,43 +214,39 @@ lp_rast_arg_null( void )
 }
 
 
-
 /**
  * Binnable Commands.
  * These get put into bins by the setup code and are called when
  * the bins are executed.
  */
 
-void lp_rast_clear_color( struct lp_rasterizer *, 
-                          unsigned thread_index,
+void lp_rast_clear_color( struct lp_rasterizer_task *, 
                           const union lp_rast_cmd_arg );
 
-void lp_rast_clear_zstencil( struct lp_rasterizer *, 
-                             unsigned thread_index,
+void lp_rast_clear_zstencil( struct lp_rasterizer_task *, 
                              const union lp_rast_cmd_arg );
 
-void lp_rast_load_color( struct lp_rasterizer *, 
-                         unsigned thread_index,
-                         const union lp_rast_cmd_arg );
-
-void lp_rast_load_zstencil( struct lp_rasterizer *, 
-                            unsigned thread_index,
-                            const union lp_rast_cmd_arg );
-
-void lp_rast_set_state( struct lp_rasterizer *, 
-                        unsigned thread_index,
+void lp_rast_set_state( struct lp_rasterizer_task *, 
                         const union lp_rast_cmd_arg );
 
-void lp_rast_triangle( struct lp_rasterizer *, 
-                       unsigned thread_index,
+void lp_rast_triangle( struct lp_rasterizer_task *, 
                        const union lp_rast_cmd_arg );
 
-void lp_rast_shade_tile( struct lp_rasterizer *,
-                         unsigned thread_index,
+void lp_rast_shade_tile( struct lp_rasterizer_task *,
                          const union lp_rast_cmd_arg );
 
-void lp_rast_fence( struct lp_rasterizer *,
-                    unsigned thread_index,
+void lp_rast_fence( struct lp_rasterizer_task *,
                     const union lp_rast_cmd_arg );
 
+void lp_rast_store_color( struct lp_rasterizer_task *,
+                          const union lp_rast_cmd_arg );
+
+
+void lp_rast_begin_query(struct lp_rasterizer_task *,
+                         const union lp_rast_cmd_arg );
+
+void lp_rast_end_query(struct lp_rasterizer_task *,
+                       const union lp_rast_cmd_arg );
+
+
 #endif