From fbe68bf6b286056bb03f44907a078918d04cbdfd Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 21 Nov 2007 15:40:20 -0700 Subject: Simplify draw module's vertex_info. No longer store the vertex header and clip pos info in the draw module's vertex_info. The vertex_info just describes the data[] elements. This simplifies the code in several places. --- src/mesa/pipe/draw/draw_vertex.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'src/mesa/pipe/draw/draw_vertex.c') diff --git a/src/mesa/pipe/draw/draw_vertex.c b/src/mesa/pipe/draw/draw_vertex.c index dea26a3d0a1..983ed71ec0f 100644 --- a/src/mesa/pipe/draw/draw_vertex.c +++ b/src/mesa/pipe/draw/draw_vertex.c @@ -75,7 +75,6 @@ draw_compute_vertex_size(struct vertex_info *vinfo) vinfo->size += 3; break; case FORMAT_4F: - case FORMAT_4F_VIEWPORT: vinfo->size += 4; break; default: @@ -99,27 +98,26 @@ draw_set_vertex_attributes( struct draw_context *draw, struct vertex_info *vinfo = &draw->vertex_info; unsigned i; -#if 0 - assert(slot_to_vf_attr[0] == TGSI_ATTRIB_POS); -#endif + assert(interps[0] == INTERP_LINEAR); /* should be vert pos */ - memset(vinfo, 0, sizeof(*vinfo)); + assert(nr_attrs <= PIPE_MAX_SHADER_OUTPUTS); - /* - * First three attribs are always the same: header, clip pos, winpos + /* Note that draw-module vertices will consist of the attributes passed + * to this function, plus a header/prefix containing the vertex header + * flags and GLfloat[4] clip pos. */ - emit_vertex_attr(vinfo, FORMAT_1F, INTERP_NONE); - emit_vertex_attr(vinfo, FORMAT_4F, INTERP_LINEAR); - emit_vertex_attr(vinfo, FORMAT_4F_VIEWPORT, INTERP_LINEAR); - /* - * Remaining attribs (color, texcoords, etc) - */ - for (i = 1; i < nr_attrs; i++) { + memset(vinfo, 0, sizeof(*vinfo)); + + /* copy attrib info */ + for (i = 0; i < nr_attrs; i++) { emit_vertex_attr(vinfo, FORMAT_4F, interps[i]); } draw_compute_vertex_size(vinfo); + + /* add extra words for vertex header (uint), clip pos (float[4]) */ + vinfo->size += 5; } -- cgit v1.2.3