From: Brian Date: Thu, 16 Aug 2007 01:03:20 +0000 (-0600) Subject: Hook in new draw_arrays() code, disabled for now. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d9a230f30a98eb677bba869a6f7bb9a840e36354;p=mesa.git Hook in new draw_arrays() code, disabled for now. --- diff --git a/src/mesa/pipe/softpipe/Makefile b/src/mesa/pipe/softpipe/Makefile index 9c6d78c290e..ffa31102d55 100644 --- a/src/mesa/pipe/softpipe/Makefile +++ b/src/mesa/pipe/softpipe/Makefile @@ -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 \ diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c index 1ea6bbbf7fe..4c0dacd4588 100644 --- a/src/mesa/pipe/softpipe/sp_context.c +++ b/src/mesa/pipe/softpipe/sp_context.c @@ -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); diff --git a/src/mesa/pipe/softpipe/sp_state.h b/src/mesa/pipe/softpipe/sp_state.h index 9e5ed96901e..d754acaa38a 100644 --- a/src/mesa/pipe/softpipe/sp_state.h +++ b/src/mesa/pipe/softpipe/sp_state.h @@ -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 diff --git a/src/mesa/pipe/softpipe/sp_state_derived.c b/src/mesa/pipe/softpipe/sp_state_derived.c index cd67d1c46fb..44beb9c3eb7 100644 --- a/src/mesa/pipe/softpipe/sp_state_derived.c +++ b/src/mesa/pipe/softpipe/sp_state_derived.c @@ -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 } }