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 2daa1636f36ec4e3dc1402693d868229b29ea237..ce6667d8ecf778c7c9b904fdb4ecd7b692a7f93b 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 c18dcb2927ab97ce08abd03e2c137ee2f8916a85..5cb7664c85dbc9f1cd10583be500cb0169035dd6 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 428b6209e05dea065760e89cf6eed752737fce01..bb64b50a1776789a0e132719d37361da0bc7d80c 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 ab87b4127c0e9567f5277ffdb223a68cc9ff8b3a..df63e91a22ddefdd287468b724ed17e4318020cf 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 c732d723a7f3f51edb2bf1e228cf6935b4ba1a01..25fa8c09c2f034df9472f1c4b774a7e83ec55976 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 cfd2b9820c10f283bd4b31f815f04e92f1292f48..5e7de905c16c4f15a5528f7b6cb22b3e7aab3133 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:
     */