From 8175eaa3b49f3b62f7ab251c4e0fbd14dd9f7e2b Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 20 Aug 2007 16:31:12 -0600 Subject: [PATCH] Checkpoint: remove more of the old draw_vb() code. --- src/mesa/pipe/draw/draw_arrays.c | 3 - src/mesa/pipe/draw/draw_context.c | 6 +- src/mesa/pipe/draw/draw_private.h | 7 +-- src/mesa/pipe/i915simple/i915_context.c | 28 ++------- src/mesa/pipe/p_context.h | 17 ----- src/mesa/pipe/softpipe/sp_context.c | 42 ------------- src/mesa/pipe/softpipe/sp_state_vertex.c | 4 ++ src/mesa/state_tracker/st_draw.c | 80 +----------------------- 8 files changed, 18 insertions(+), 169 deletions(-) diff --git a/src/mesa/pipe/draw/draw_arrays.c b/src/mesa/pipe/draw/draw_arrays.c index fe9ec444252..8cb34e8f8ed 100644 --- a/src/mesa/pipe/draw/draw_arrays.c +++ b/src/mesa/pipe/draw/draw_arrays.c @@ -354,9 +354,6 @@ do { \ } while (0) -/** - * XXX very similar to same func in draw_vb.c (which will go away) - */ void draw_set_vertex_attributes( struct draw_context *draw, const unsigned *slot_to_vf_attr, diff --git a/src/mesa/pipe/draw/draw_context.c b/src/mesa/pipe/draw/draw_context.c index cc00576c53b..0a3df37b7fa 100644 --- a/src/mesa/pipe/draw/draw_context.c +++ b/src/mesa/pipe/draw/draw_context.c @@ -60,7 +60,9 @@ struct draw_context *draw_create( void ) draw->nr_planes = 6; #ifdef MESA +#if 0 draw->vf = vf_create( GL_TRUE ); +#endif #endif /* Statically allocate maximum sized vertices for the cache - could be cleverer... @@ -79,7 +81,7 @@ struct draw_context *draw_create( void ) void draw_destroy( struct draw_context *draw ) { -#ifdef MESA +#if 0/*def MESA*/ if (draw->header.storage) { ALIGN_FREE( draw->header.storage ); } @@ -194,7 +196,9 @@ void draw_set_viewport_state( struct draw_context *draw, draw->viewport = *viewport; /* struct copy */ #ifdef MESA +#if 0 vf_set_vp_scale_translate( draw->vf, viewport->scale, viewport->translate ); +#endif #endif /* Using tnl/ and vf/ modules is temporary while getting started. diff --git a/src/mesa/pipe/draw/draw_private.h b/src/mesa/pipe/draw/draw_private.h index 5c3efb80e99..a9825e646b1 100644 --- a/src/mesa/pipe/draw/draw_private.h +++ b/src/mesa/pipe/draw/draw_private.h @@ -222,14 +222,11 @@ struct draw_context } pq; - /* Misc for draw_vb.c (XXX temporary) - */ -#ifdef MESA - GLvector4f header; -#endif +#if 0 ubyte *verts; boolean in_vb; struct vertex_fetch *vf; +#endif }; diff --git a/src/mesa/pipe/i915simple/i915_context.c b/src/mesa/pipe/i915simple/i915_context.c index c7d469583c7..b34899a8671 100644 --- a/src/mesa/pipe/i915simple/i915_context.c +++ b/src/mesa/pipe/i915simple/i915_context.c @@ -147,33 +147,16 @@ static void i915_destroy( struct pipe_context *pipe ) free( i915 ); } -static void i915_draw_vb( struct pipe_context *pipe, - struct vertex_buffer *VB ) -{ - struct i915_context *i915 = i915_context( pipe ); - - if (i915->dirty) - i915_update_derived( i915 ); - -#if 0 - draw_vb( i915->draw, VB ); -#endif -} - -static void -i915_draw_vertices(struct pipe_context *pipe, - unsigned mode, - unsigned numVertex, const float *verts, - unsigned numAttribs, const unsigned attribs[]) +static void i915_draw_arrays( struct pipe_context *pipe, + unsigned mode, unsigned start, unsigned count) { struct i915_context *i915 = i915_context( pipe ); if (i915->dirty) i915_update_derived( i915 ); -#if 0 - draw_vertices(i915->draw, mode, numVertex, verts, numAttribs, attribs); -#endif + + draw_arrays(i915->draw, mode, start, count); } @@ -217,12 +200,11 @@ struct pipe_context *i915_create( struct pipe_winsys *pipe_winsys, i915->pipe.destroy = i915_destroy; i915->pipe.supported_formats = i915_supported_formats; i915->pipe.max_texture_size = i915_max_texture_size; - i915->pipe.draw_vb = i915_draw_vb; - i915->pipe.draw_vertices = i915_draw_vertices; i915->pipe.clear = i915_clear; i915->pipe.reset_occlusion_counter = NULL; /* no support */ i915->pipe.get_occlusion_counter = NULL; + i915->pipe.draw_arrays = i915_draw_arrays; /* * Create drawing context and plug our rendering stage into it. diff --git a/src/mesa/pipe/p_context.h b/src/mesa/pipe/p_context.h index a3664a3b80c..c4496cda507 100644 --- a/src/mesa/pipe/p_context.h +++ b/src/mesa/pipe/p_context.h @@ -28,16 +28,10 @@ #ifndef PIPE_CONTEXT_H #define PIPE_CONTEXT_H -//#include "main/mtypes.h" #include "p_state.h" #include "p_compiler.h" -/* Drawing currently kludged up via the existing tnl/ module. - */ -struct vertex_buffer; - - /** * Software pipeline rendering context. Basically a collection of * state setting functions, plus VBO drawing entrypoint. @@ -68,17 +62,6 @@ struct pipe_context { /* * Drawing */ - /* XXX this is temporary */ - void (*draw_vb)( struct pipe_context *pipe, - struct vertex_buffer *VB ); - - /* XXX this is temporary */ - void (*draw_vertices)( struct pipe_context *pipe, - unsigned mode, - unsigned numVertex, const float *verts, - unsigned numAttribs, const unsigned attribs[]); - - /** this is basically what we want */ void (*draw_arrays)( struct pipe_context *pipe, unsigned mode, unsigned start, unsigned count); diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c index 91ede05c05a..ab9becc99e2 100644 --- a/src/mesa/pipe/softpipe/sp_context.c +++ b/src/mesa/pipe/softpipe/sp_context.c @@ -195,44 +195,6 @@ static void softpipe_destroy( struct pipe_context *pipe ) } -#if 0 -static void softpipe_draw_vb( struct pipe_context *pipe, - struct vertex_buffer *VB ) -{ - struct softpipe_context *softpipe = softpipe_context( pipe ); - - if (softpipe->dirty) - softpipe_update_derived( softpipe ); - - /* XXX move mapping/unmapping to higher/coarser level? */ - softpipe_map_surfaces(softpipe); - draw_vb( softpipe->draw, VB ); - softpipe_unmap_surfaces(softpipe); -} -#endif - - -static void -softpipe_draw_vertices(struct pipe_context *pipe, - unsigned mode, - unsigned numVertex, const float *verts, - unsigned numAttribs, const unsigned attribs[]) -{ - struct softpipe_context *softpipe = softpipe_context( pipe ); - - if (softpipe->dirty) - softpipe_update_derived( softpipe ); - - /* XXX move mapping/unmapping to higher/coarser level? */ - softpipe_map_surfaces(softpipe); -#if 0 - draw_vertices(softpipe->draw, mode, numVertex, verts, numAttribs, attribs); -#endif - softpipe_unmap_surfaces(softpipe); -} - - - static void softpipe_reset_occlusion_counter(struct pipe_context *pipe) { struct softpipe_context *softpipe = softpipe_context( pipe ); @@ -289,10 +251,6 @@ struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys, softpipe->pipe.set_vertex_buffer = softpipe_set_vertex_buffer; softpipe->pipe.set_vertex_element = softpipe_set_vertex_element; -#if 0 - softpipe->pipe.draw_vb = softpipe_draw_vb; - softpipe->pipe.draw_vertices = softpipe_draw_vertices; -#endif softpipe->pipe.draw_arrays = softpipe_draw_arrays; softpipe->pipe.draw_elements = softpipe_draw_elements; diff --git a/src/mesa/pipe/softpipe/sp_state_vertex.c b/src/mesa/pipe/softpipe/sp_state_vertex.c index 18852552eb3..09ff540ccfd 100644 --- a/src/mesa/pipe/softpipe/sp_state_vertex.c +++ b/src/mesa/pipe/softpipe/sp_state_vertex.c @@ -27,10 +27,14 @@ /* Authors: Keith Whitwell */ + + #include "sp_context.h" #include "sp_state.h" #include "sp_surface.h" +#include "pipe/draw/draw_context.h" + void softpipe_set_vertex_element(struct pipe_context *pipe, diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index a409dd97648..5a13fdd2bf7 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -33,10 +33,9 @@ #include "main/imports.h" #include "vbo/vbo.h" +#include "vbo/vbo_context.h" -#include "tnl/t_context.h" -#include "tnl/t_pipeline.h" -#include "tnl/t_vp_build.h" /* USE_NEW_DRAW */ +#include "tnl/t_vp_build.h" #include "st_context.h" #include "st_atom.h" @@ -46,72 +45,6 @@ #include "pipe/p_defines.h" #include "pipe/p_winsys.h" -#include "vbo/vbo_context.h" - -/* - * Enabling this causes the VBO module to call draw_vbo() below, - * bypassing the T&L module. This only works with VBO-based demos, - * such as progs/test/bufferobj.c - */ -#define USE_NEW_DRAW 01 - - -/* - * TNL stage which feeds into the above. - * - * XXX: this needs to go into each driver using this code, because we - * cannot make the leap from ctx->draw_context in this file. The - * driver needs to customize tnl anyway, so this isn't a big deal. - */ -static GLboolean draw( GLcontext * ctx, struct tnl_pipeline_stage *stage ) -{ - struct st_context *st = st_context(ctx); -#if 0 - struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; -#endif - - /* Validate driver and pipe state: - */ - st_validate_state( st ); - - /* Call into the new draw code to handle the VB: - */ -#if 0 - st->pipe->draw_vb( st->pipe, VB ); -#endif - - /* Finished - */ - return GL_FALSE; -} - -const struct tnl_pipeline_stage st_draw = { - "check state and draw", - NULL, - NULL, - NULL, - NULL, - draw -}; - -static const struct tnl_pipeline_stage *st_pipeline[] = { -#if USE_NEW_DRAW - &_tnl_vertex_program_stage, -#else - &_tnl_vertex_transform_stage, - &_tnl_vertex_cull_stage, - &_tnl_normal_transform_stage, - &_tnl_lighting_stage, - &_tnl_fog_coordinate_stage, - &_tnl_texgen_stage, - &_tnl_texture_transform_stage, - &_tnl_point_attenuation_stage, - &_tnl_vertex_program_stage, -#endif - &st_draw, /* ADD: escape to pipe */ - 0, -}; - static GLuint @@ -366,8 +299,6 @@ st_draw_vertices(GLcontext *ctx, unsigned prim, void st_init_draw( struct st_context *st ) { GLcontext *ctx = st->ctx; - -#if USE_NEW_DRAW struct vbo_context *vbo = (struct vbo_context *) ctx->swtnl_im; create_default_attribs_buffer(st); @@ -376,13 +307,6 @@ void st_init_draw( struct st_context *st ) assert(vbo->draw_prims); vbo->draw_prims = draw_vbo; -#endif -#if 0 - _tnl_destroy_pipeline( ctx ); - _tnl_install_pipeline( ctx, st_pipeline ); -#endif - - /* USE_NEW_DRAW */ _tnl_ProgramCacheInit( ctx ); } -- 2.30.2