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 27464e5c866080a0bbf29de4cfcbb4ed152d579a..080311a6672d44183fc829768b3510067c5f7763 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 7af65c3c0578c866ae73a014e3bd6113f7a384d5..238e3f7d28468452ffbf3c30015f0cc2fe8788fb 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 51b69503344500df63ac6babc22e3621e59c68a9..d61cd2524321e2177cab33146ddfe4bb751dc664 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 941f6efbe48af4ddf734ce85e3e17f5052009fb9..ecaed84070096c1edcb222fed7890716d27dca5f 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;
+   }
+}