draw: placeholder/prototype code for a passthrough draw path
authorKeith Whitwell <keith@tungstengraphics.com>
Mon, 10 Mar 2008 19:49:15 +0000 (19:49 +0000)
committerKeith Whitwell <keith@tungstengraphics.com>
Mon, 10 Mar 2008 23:31:50 +0000 (23:31 +0000)
src/gallium/auxiliary/draw/Makefile
src/gallium/auxiliary/draw/SConscript
src/gallium/auxiliary/draw/draw_context.c
src/gallium/auxiliary/draw/draw_context.h
src/gallium/auxiliary/draw/draw_private.h
src/gallium/auxiliary/draw/draw_vbuf.h

index 2daa163..ce6667d 100644 (file)
@@ -4,6 +4,7 @@ include $(TOP)/configs/current
 LIBNAME = draw
 
 C_SOURCES = \
+       draw_passthrough.c \
        draw_aaline.c \
        draw_aapoint.c \
        draw_clip.c \
index c18dcb2..5cb7664 100644 (file)
@@ -16,6 +16,7 @@ draw = env.ConvenienceLibrary(
                'draw_offset.c',
                'draw_prim.c',
                'draw_pstipple.c',
+               'draw_passthrough.c',
                'draw_stipple.c',
                'draw_twoside.c',
                'draw_unfilled.c',
index 428b620..bb64b50 100644 (file)
@@ -34,6 +34,7 @@
 #include "pipe/p_util.h"
 #include "draw_context.h"
 #include "draw_private.h"
+#include "draw_vbuf.h"
 
 
 
@@ -114,6 +115,10 @@ void draw_destroy( struct draw_context *draw )
       draw->pipeline.rasterize->destroy( draw->pipeline.rasterize );
    tgsi_exec_machine_free_data(&draw->machine);
    align_free( draw->vs.queue[0].vertex ); /* Frees all the vertices. */
+
+   if (draw->render)
+      draw->render->destroy( draw->render );
+
    FREE( draw );
 }
 
@@ -349,3 +354,10 @@ void draw_reset_vertex_ids(struct draw_context *draw)
 
    draw_vertex_cache_reset_vertex_ids(draw);
 }
+
+
+void draw_set_render( struct draw_context *draw, 
+                     struct vbuf_render *render )
+{
+   draw->render = render;
+}
index ab87b41..df63e91 100644 (file)
@@ -168,4 +168,9 @@ unsigned draw_trim_prim( unsigned mode, unsigned count );
 
 
 
+
+struct vbuf_render;
+void draw_set_render( struct draw_context *draw, 
+                     struct vbuf_render *render );
+
 #endif /* DRAW_CONTEXT_H */
index c732d72..25fa8c0 100644 (file)
@@ -162,8 +162,14 @@ typedef void (*full_fetch_func)( struct draw_context *draw,
                                 const unsigned *elts,
                                 unsigned count );
 
+typedef void (*pt_fetch_func)( struct draw_context *draw,
+                             float *out,
+                             unsigned start,
+                              unsigned count );
 
 
+struct vbuf_render;
+
 /**
  * Private context for the drawing module.
  */
@@ -191,6 +197,17 @@ struct draw_context
       struct draw_stage *rasterize;
    } pipeline;
 
+
+   struct vbuf_render *render;
+
+   /* Support prototype passthrough path:
+    */
+   struct {
+      unsigned prim;
+      unsigned hw_vertex_size;
+   } pt;
+
+
    /* pipe state that we need: */
    const struct pipe_rasterizer_state *rasterizer;
    struct pipe_viewport_state viewport;
@@ -244,6 +261,7 @@ struct draw_context
       fetch_func fetch[PIPE_ATTRIB_MAX];
       unsigned nr_attrs;
       full_fetch_func fetch_func;
+      pt_fetch_func pt_fetch;
    } vertex_fetch;
 
    /* Post-tnl vertex cache:
@@ -331,6 +349,15 @@ struct tgsi_exec_machine;
 extern void draw_update_vertex_fetch( struct draw_context *draw );
 
 
+/* Prototype/hack
+ */
+boolean
+draw_passthrough_arrays(struct draw_context *draw, 
+                        unsigned prim,
+                        unsigned start, 
+                        unsigned count);
+
+
 #define DRAW_FLUSH_SHADER_QUEUE              0x1 /* sized not to overflow, never raised */
 #define DRAW_FLUSH_PRIM_QUEUE                0x2
 #define DRAW_FLUSH_VERTEX_CACHE              0x4
index cfd2b98..5e7de90 100644 (file)
@@ -85,6 +85,12 @@ struct vbuf_render {
                 const ushort *indices,
                 uint nr_indices );
 
+   /* Draw Arrays path too.
+    */
+   void (*draw_arrays)( struct vbuf_render *,
+                       unsigned start,
+                       uint nr );
+
    /**
     * Called when vbuf is done with this set of vertices:
     */