From: Keith Whitwell Date: Tue, 17 Feb 2009 12:20:05 +0000 (+0000) Subject: softpipe: update to new draw interfaces X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7ca78a07b37e4cce0e258f711c6f8bbe1d98a633;p=mesa.git softpipe: update to new draw interfaces --- diff --git a/configs/default b/configs/default index a90d46f18e1..2566a860a27 100644 --- a/configs/default +++ b/configs/default @@ -92,7 +92,7 @@ EGL_DRIVERS_DIRS = demo GALLIUM_DIRS = auxiliary drivers state_trackers GALLIUM_AUXILIARY_DIRS = draw translate cso_cache pipebuffer tgsi sct rtasm util indices GALLIUM_AUXILIARIES = $(foreach DIR,$(GALLIUM_AUXILIARY_DIRS),$(TOP)/src/gallium/auxiliary/$(DIR)/lib$(DIR).a) -GALLIUM_DRIVER_DIRS = softpipe i915simple i965simple failover trace +GALLIUM_DRIVER_DIRS = softpipe #i915simple i965simple failover trace GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVER_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a) GALLIUM_WINSYS_DIRS = xlib egl_xlib GALLIUM_WINSYS_DRM_DIRS = diff --git a/src/gallium/drivers/softpipe/sp_prim_vbuf.c b/src/gallium/drivers/softpipe/sp_prim_vbuf.c index 9cd5784e5bc..d56eed80a4f 100644 --- a/src/gallium/drivers/softpipe/sp_prim_vbuf.c +++ b/src/gallium/drivers/softpipe/sp_prim_vbuf.c @@ -60,6 +60,7 @@ struct softpipe_vbuf_render struct softpipe_context *softpipe; uint prim; uint vertex_size; + uint vertex_buffer_size; void *vertex_buffer; }; @@ -80,26 +81,44 @@ sp_vbuf_get_vertex_info(struct vbuf_render *vbr) } -static void * +static boolean sp_vbuf_allocate_vertices(struct vbuf_render *vbr, - ushort vertex_size, ushort nr_vertices) + ushort vertex_size, ushort nr_vertices) { struct softpipe_vbuf_render *cvbr = softpipe_vbuf_render(vbr); - assert(!cvbr->vertex_buffer); - cvbr->vertex_buffer = align_malloc(vertex_size * nr_vertices, 16); + unsigned size = vertex_size * nr_vertices; + + if (cvbr->vertex_buffer_size < size) { + align_free(cvbr->vertex_buffer); + cvbr->vertex_buffer = align_malloc(size, 16); + cvbr->vertex_buffer_size = size; + } + cvbr->vertex_size = vertex_size; - return cvbr->vertex_buffer; + return cvbr->vertex_buffer != NULL; } - static void -sp_vbuf_release_vertices(struct vbuf_render *vbr, void *vertices, - unsigned vertex_size, unsigned vertices_used) +sp_vbuf_release_vertices(struct vbuf_render *vbr) +{ + /* keep the old allocation for next time */ +} + +static void * +sp_vbuf_map_vertices(struct vbuf_render *vbr) { struct softpipe_vbuf_render *cvbr = softpipe_vbuf_render(vbr); - align_free(vertices); - assert(vertices == cvbr->vertex_buffer); - cvbr->vertex_buffer = NULL; + return cvbr->vertex_buffer; +} + +static void +sp_vbuf_unmap_vertices(struct vbuf_render *vbr, + ushort min_index, + ushort max_index ) +{ + struct softpipe_vbuf_render *cvbr = softpipe_vbuf_render(vbr); + assert( cvbr->vertex_buffer_size >= (max_index+1) * cvbr->vertex_size ); + /* do nothing */ } @@ -115,8 +134,6 @@ sp_vbuf_set_primitive(struct vbuf_render *vbr, unsigned prim) setup_prepare( setup_ctx ); - - cvbr->prim = prim; return TRUE; @@ -394,6 +411,8 @@ sp_init_vbuf(struct softpipe_context *sp) sp->vbuf_render->base.get_vertex_info = sp_vbuf_get_vertex_info; sp->vbuf_render->base.allocate_vertices = sp_vbuf_allocate_vertices; + sp->vbuf_render->base.map_vertices = sp_vbuf_map_vertices; + sp->vbuf_render->base.unmap_vertices = sp_vbuf_unmap_vertices; sp->vbuf_render->base.set_primitive = sp_vbuf_set_primitive; sp->vbuf_render->base.draw = sp_vbuf_draw; sp->vbuf_render->base.draw_arrays = sp_vbuf_draw_arrays;