From 086734502a614e7778533018846ee66a66df9821 Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 20 Sep 2007 13:42:37 -0600 Subject: Checkpoint: vertex attribute clean-up. Remove/disable the attrib/slot mapping arrays in a few places. Work in progress... --- src/mesa/pipe/softpipe/sp_context.h | 1 + src/mesa/pipe/softpipe/sp_prim_setup.c | 11 ++++------- src/mesa/pipe/softpipe/sp_state_derived.c | 7 +++++-- 3 files changed, 10 insertions(+), 9 deletions(-) (limited to 'src/mesa/pipe/softpipe') diff --git a/src/mesa/pipe/softpipe/sp_context.h b/src/mesa/pipe/softpipe/sp_context.h index 5c17c47b12..95215eb640 100644 --- a/src/mesa/pipe/softpipe/sp_context.h +++ b/src/mesa/pipe/softpipe/sp_context.h @@ -111,6 +111,7 @@ struct softpipe_context { unsigned nr_frag_attrs; /**< number of active fragment attribs */ boolean need_z; /**< produce quad/fragment Z values? */ boolean need_w; /**< produce quad/fragment W values? */ + int psize_slot; /** Feedback buffers */ struct pipe_feedback_buffer feedback_buffer[PIPE_MAX_FEEDBACK_ATTRIBS]; diff --git a/src/mesa/pipe/softpipe/sp_prim_setup.c b/src/mesa/pipe/softpipe/sp_prim_setup.c index 8a4be79d11..913ae44601 100644 --- a/src/mesa/pipe/softpipe/sp_prim_setup.c +++ b/src/mesa/pipe/softpipe/sp_prim_setup.c @@ -79,8 +79,6 @@ struct setup_stage { float oneoverarea; - const unsigned *lookup; /**< vertex attribute positions */ - struct tgsi_interp_coef coef[TGSI_ATTRIB_MAX]; struct quad_header quad; @@ -249,7 +247,7 @@ static void print_vertex(const struct setup_stage *setup, { int i; printf("Vertex:\n"); - for (i = 0; i < setup->softpipe->nr_attrs; i++) { + for (i = 0; i < setup->quad.nr_attrs; i++) { printf(" %d: %f %f %f\n", i, v->data[i][0], v->data[i][1], v->data[i][2]); } @@ -907,8 +905,7 @@ setup_point(struct draw_stage *stage, struct prim_header *prim) { struct setup_stage *setup = setup_stage( stage ); const struct vertex_header *v0 = prim->v[0]; - - const int sizeAttr = setup->lookup[TGSI_ATTRIB_POINTSIZE]; + const int sizeAttr = setup->softpipe->psize_slot; const float halfSize = sizeAttr ? (0.5f * v0->data[sizeAttr][0]) : (0.5f * setup->softpipe->rasterizer->point_size); @@ -917,6 +914,8 @@ setup_point(struct draw_stage *stage, struct prim_header *prim) const float y = v0->data[TGSI_ATTRIB_POS][1]; unsigned slot, j; + assert(sizeAttr >= 0); + /* For points, all interpolants are constant-valued. * However, for point sprites, we'll need to setup texcoords appropriately. * XXX: which coefficients are the texcoords??? @@ -1097,7 +1096,5 @@ struct draw_stage *sp_draw_render_stage( struct softpipe_context *softpipe ) setup->quad.coef = setup->coef; - setup->lookup = softpipe->draw->vertex_info.attrib_to_slot; - return &setup->stage; } diff --git a/src/mesa/pipe/softpipe/sp_state_derived.c b/src/mesa/pipe/softpipe/sp_state_derived.c index 0dd0eea0b8..03b5d7ea3f 100644 --- a/src/mesa/pipe/softpipe/sp_state_derived.c +++ b/src/mesa/pipe/softpipe/sp_state_derived.c @@ -59,6 +59,8 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe ) softpipe->need_z = FALSE; softpipe->need_w = FALSE; + softpipe->psize_slot = -1; + /* always emit vertex pos */ /* TODO - Figure out if we need to do perspective divide, etc. */ draw_emit_vertex_attr(vinfo, TGSI_ATTRIB_POS, FORMAT_4F, INTERP_LINEAR); @@ -93,6 +95,7 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe ) FORMAT_4F, INTERP_CONSTANT); break; #endif + softpipe->psize_slot = i; /*case TGSI_SEMANTIC_TEXCOORD:*/ case TGSI_SEMANTIC_TEX0: draw_emit_vertex_attr(vinfo, TGSI_ATTRIB_TEX0, @@ -131,10 +134,10 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe ) */ /* XXX we also need to do this when the shading mode (interp modes) change: */ if (1/*vinfo->attr_mask != softpipe->attr_mask*/) { - softpipe->attr_mask = vinfo->attr_mask; + /*softpipe->attr_mask = vinfo->attr_mask;*/ draw_set_vertex_attributes( softpipe->draw, - vinfo->slot_to_attrib, + NULL,/*vinfo->slot_to_attrib,*/ vinfo->interp_mode, vinfo->num_attribs); -- cgit v1.2.3