draw: remove draw_prim.c
authorKeith Whitwell <keith@tungstengraphics.com>
Fri, 18 Apr 2008 19:36:38 +0000 (20:36 +0100)
committerKeith Whitwell <keith@tungstengraphics.com>
Fri, 18 Apr 2008 19:36:38 +0000 (20:36 +0100)
src/gallium/auxiliary/draw/Makefile
src/gallium/auxiliary/draw/SConscript
src/gallium/auxiliary/draw/draw_prim.c
src/gallium/auxiliary/draw/draw_pt.c

index 27464e5..080311a 100644 (file)
@@ -24,7 +24,6 @@ C_SOURCES = \
        draw_pt_emit.c \
        draw_pt_pipeline.c \
        draw_pt_elts.c \
-       draw_prim.c \
        draw_pstipple.c \
        draw_stipple.c \
        draw_twoside.c \
index 7af65c3..238e3f7 100644 (file)
@@ -11,7 +11,6 @@ draw = env.ConvenienceLibrary(
                'draw_debug.c',
                'draw_flatshade.c',
                'draw_offset.c',
-               'draw_prim.c',
                'draw_pstipple.c',
                'draw_pt.c',
                'draw_pt_elts.c',
index 51b6950..d61cd25 100644 (file)
@@ -497,27 +497,4 @@ draw_prim( struct draw_context *draw,
 
 
 
-/**
- * Draw vertex arrays
- * This is the main entrypoint into the drawing module.
- * \param prim  one of PIPE_PRIM_x
- * \param start  index of first vertex to draw
- * \param count  number of vertices to draw
- */
-void
-draw_arrays(struct draw_context *draw, unsigned prim,
-            unsigned start, unsigned count)
-{
-   if (reduced_prim[prim] != draw->reduced_prim) {
-      draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE );
-      draw->reduced_prim = reduced_prim[prim];
-   }
-
-   /* drawing done here: */
-   if (!draw_pt_arrays(draw, prim, start, count)) {
-      /* we have to run the whole pipeline */
-      draw_prim(draw, prim, start, count);
-   }
-}
-
 
index 941f6ef..ecaed84 100644 (file)
@@ -128,3 +128,58 @@ void draw_pt_destroy( struct draw_context *draw )
       draw->pt.front.vcache = NULL;
    }
 }
+
+
+
+static unsigned reduced_prim[PIPE_PRIM_POLYGON + 1] = {
+   PIPE_PRIM_POINTS,
+   PIPE_PRIM_LINES,
+   PIPE_PRIM_LINES,
+   PIPE_PRIM_LINES,
+   PIPE_PRIM_TRIANGLES,
+   PIPE_PRIM_TRIANGLES,
+   PIPE_PRIM_TRIANGLES,
+   PIPE_PRIM_TRIANGLES,
+   PIPE_PRIM_TRIANGLES,
+   PIPE_PRIM_TRIANGLES
+};
+
+
+/**
+ * Draw vertex arrays
+ * This is the main entrypoint into the drawing module.
+ * \param prim  one of PIPE_PRIM_x
+ * \param start  index of first vertex to draw
+ * \param count  number of vertices to draw
+ */
+void
+draw_arrays(struct draw_context *draw, unsigned prim,
+            unsigned start, unsigned count)
+{
+   if (reduced_prim[prim] != draw->reduced_prim) {
+      draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE );
+      draw->reduced_prim = reduced_prim[prim];
+   }
+
+   /* drawing done here: */
+   draw_pt_arrays(draw, prim, start, count);
+}
+
+
+/* Revamp me please:
+ */
+void draw_do_flush( struct draw_context *draw, unsigned flags )
+{
+   if (!draw->flushing) 
+   {
+      draw->flushing = TRUE;
+
+      if (flags >= DRAW_FLUSH_STATE_CHANGE) {
+        draw->pipeline.first->flush( draw->pipeline.first, flags );
+        draw->pipeline.first = draw->pipeline.validate;
+        draw->reduced_prim = ~0;
+      }
+      
+      draw->flushing = FALSE;
+   }
+}