Hook in new draw_arrays() code, disabled for now.
authorBrian <brian.paul@tungstengraphics.com>
Thu, 16 Aug 2007 01:03:20 +0000 (19:03 -0600)
committerBrian <brian.paul@tungstengraphics.com>
Thu, 16 Aug 2007 01:04:45 +0000 (19:04 -0600)
src/mesa/pipe/softpipe/Makefile
src/mesa/pipe/softpipe/sp_context.c
src/mesa/pipe/softpipe/sp_state.h
src/mesa/pipe/softpipe/sp_state_derived.c

index 9c6d78c290ecd450d9e006ea849fe97b5efe0c71..ffa31102d55cce390a1bc71cacc2d02a3f60abfc 100644 (file)
@@ -8,6 +8,7 @@ DRIVER_SOURCES = \
        sp_clear.c \
        sp_flush.c \
        sp_context.c \
+       sp_draw_arrays.c \
        sp_prim_setup.c \
        sp_quad.c \
        sp_quad_alpha_test.c \
index 1ea6bbbf7fe22ad0d2864b7f7b08f11eeca270d7..4c0dacd45889e8dd2c840c310c72d19b760aaba2 100644 (file)
@@ -108,7 +108,8 @@ softpipe_max_texture_size(struct pipe_context *pipe, unsigned textureType,
 }
 
 
-static void map_surfaces(struct softpipe_context *sp)
+void
+softpipe_map_surfaces(struct softpipe_context *sp)
 {
    struct pipe_context *pipe = &sp->pipe;
    unsigned i;
@@ -143,7 +144,8 @@ static void map_surfaces(struct softpipe_context *sp)
 }
 
 
-static void unmap_surfaces(struct softpipe_context *sp)
+void
+softpipe_unmap_surfaces(struct softpipe_context *sp)
 {
    struct pipe_context *pipe = &sp->pipe;
    unsigned i;
@@ -197,9 +199,9 @@ static void softpipe_draw_vb( struct pipe_context *pipe,
       softpipe_update_derived( softpipe );
 
    /* XXX move mapping/unmapping to higher/coarser level? */
-   map_surfaces(softpipe);
+   softpipe_map_surfaces(softpipe);
    draw_vb( softpipe->draw, VB );
-   unmap_surfaces(softpipe);
+   softpipe_unmap_surfaces(softpipe);
 }
 
 
@@ -215,9 +217,9 @@ softpipe_draw_vertices(struct pipe_context *pipe,
       softpipe_update_derived( softpipe );
 
    /* XXX move mapping/unmapping to higher/coarser level? */
-   map_surfaces(softpipe);
+   softpipe_map_surfaces(softpipe);
    draw_vertices(softpipe->draw, mode, numVertex, verts, numAttribs, attribs);
-   unmap_surfaces(softpipe);
+   softpipe_unmap_surfaces(softpipe);
 }
 
 
@@ -274,8 +276,13 @@ struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys,
    softpipe->pipe.set_stencil_state = softpipe_set_stencil_state;
    softpipe->pipe.set_texture_state = softpipe_set_texture_state;
    softpipe->pipe.set_viewport_state = softpipe_set_viewport_state;
+   softpipe->pipe.set_vertex_buffer = softpipe_set_vertex_buffer;
+   softpipe->pipe.set_vertex_element = softpipe_set_vertex_element;
+
    softpipe->pipe.draw_vb = softpipe_draw_vb;
    softpipe->pipe.draw_vertices = softpipe_draw_vertices;
+   softpipe->pipe.draw_arrays = softpipe_draw_arrays;
+
    softpipe->pipe.clear = softpipe_clear;
    softpipe->pipe.flush = softpipe_flush;
    softpipe->pipe.reset_occlusion_counter = softpipe_reset_occlusion_counter;
@@ -309,6 +316,10 @@ struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys,
    assert(softpipe->draw);
    draw_set_setup_stage(softpipe->draw, sp_draw_render_stage(softpipe));
 
+   draw_set_vertex_array_info(softpipe->draw,
+                              softpipe->vertex_buffer, 
+                              softpipe->vertex_element);
+
    sp_init_region_functions(softpipe);
    sp_init_surface_functions(softpipe);
 
index 9e5ed96901e79470450f4683f7af04b086f6af35..d754acaa38a27cae25d6c02079947762b90c9129 100644 (file)
@@ -91,4 +91,15 @@ void softpipe_set_vertex_buffer(struct pipe_context *,
 
 void softpipe_update_derived( struct softpipe_context *softpipe );
 
+
+void softpipe_draw_arrays(struct pipe_context *pipe, unsigned mode,
+                          unsigned start, unsigned count);
+
+
+void
+softpipe_map_surfaces(struct softpipe_context *sp);
+
+void
+softpipe_unmap_surfaces(struct softpipe_context *sp);
+
 #endif
index cd67d1c46fb87cda93a91100f2032d7b6dd2d8e9..44beb9c3eb76d521ab5515603848c947b3498734 100644 (file)
@@ -156,9 +156,16 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe )
    if (attr_mask != softpipe->attr_mask) {
       softpipe->attr_mask = attr_mask;
 
+#define USE_NEW_DRAW 0
+#if USE_NEW_DRAW
+      draw_set_vertex_attributes2( softpipe->draw,
+                                 slot_to_vf_attr,
+                                 softpipe->nr_attrs );
+#else
       draw_set_vertex_attributes( softpipe->draw,
                                  slot_to_vf_attr,
                                  softpipe->nr_attrs );
+#endif
    }
 }