draw: allow driver-override of draw_need_pipeline()
authorKeith Whitwell <keith@tungstengraphics.com>
Tue, 23 Dec 2008 13:26:25 +0000 (13:26 +0000)
committerKeith Whitwell <keithw@vmware.com>
Tue, 23 Dec 2008 15:11:41 +0000 (15:11 +0000)
src/gallium/auxiliary/draw/draw_pipe_validate.c
src/gallium/auxiliary/draw/draw_vbuf.h

index f34c68728ef1f4bf58bcccd6fd5a3ba45a0cd083..03e842ce082bc49a663f46289a917bcf04575b94 100644 (file)
@@ -33,6 +33,7 @@
 #include "draw_private.h"
 #include "draw_pipe.h"
 #include "draw_context.h"
+#include "draw_vbuf.h"
 
 static boolean points( unsigned prim )
 {
@@ -52,16 +53,28 @@ static boolean triangles( unsigned prim )
 }
 
 /**
- * Check if we need any special pipeline stages, or whether
- * prims/verts can go through untouched.  Don't test for bypass
- * clipping or vs modes, this function is just about the primitive
- * pipeline stages.
+ * Default version of a function to check if we need any special
+ * pipeline stages, or whether prims/verts can go through untouched.
+ * Don't test for bypass clipping or vs modes, this function is just
+ * about the primitive pipeline stages.
+ *
+ * This can be overridden by the driver.
  */
 boolean
 draw_need_pipeline(const struct draw_context *draw,
                    const struct pipe_rasterizer_state *rasterizer,
                    unsigned int prim )
 {
+   /* If the driver has overridden this, use that version: 
+    */
+   if (draw->render &&
+       draw->render->need_pipeline) 
+   {
+      return draw->render->need_pipeline( draw->render,
+                                          rasterizer,
+                                          prim );
+   }
+
    /* Don't have to worry about triangles turning into lines/points
     * and triggering the pipeline, because we have to trigger the
     * pipeline *anyway* if unfilled mode is active.
index b0aa2df309918cc887c74e074fac0c5202923cf4..9ac068c47b807d296e4fa29f079ea27c702c8705 100644 (file)
@@ -54,6 +54,17 @@ struct vbuf_render {
    unsigned max_indices;
    unsigned max_vertex_buffer_bytes;
 
+   /**
+    * Query if the hardware driver needs assistance for a particular
+    * combination of rasterizer state and primitive.
+    *
+    * Currently optional.
+    */
+   boolean (*need_pipeline)(const struct vbuf_render *render,
+                            const struct pipe_rasterizer_state *rasterizer,
+                            unsigned int prim );
+
+
    /**
     * Get the hardware vertex format.
     *