diff options
author | Brian <[email protected]> | 2007-11-21 15:40:20 -0700 |
---|---|---|
committer | Brian <[email protected]> | 2007-11-21 15:40:20 -0700 |
commit | fbe68bf6b286056bb03f44907a078918d04cbdfd (patch) | |
tree | 40535ef7aab0350bce053e3f3b432f2c454461d6 /src/mesa/pipe | |
parent | 5a6017d496ccce94d7e3cf9a6cfe1db886dcc767 (diff) |
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.
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r-- | src/mesa/pipe/draw/draw_clip.c | 14 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_flatshade.c | 5 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_vertex.c | 26 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_vertex.h | 1 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_vertex_shader.c | 4 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_vertex_shader_llvm.c | 4 |
6 files changed, 20 insertions, 34 deletions
diff --git a/src/mesa/pipe/draw/draw_clip.c b/src/mesa/pipe/draw/draw_clip.c index bc62d422a42..e4c257a0ee2 100644 --- a/src/mesa/pipe/draw/draw_clip.c +++ b/src/mesa/pipe/draw/draw_clip.c @@ -128,12 +128,8 @@ static void interp( const struct clipper *clip, /* Other attributes * Note: start at 1 to skip winpos (data[0]) since we just computed * it above. - * Subtract two from nr_attrs since the first two attribs (always - * VF_ATTRIB_VERTEX_HEADER and VF_ATTRIB_CLIP_POS, see - * draw_set_vertex_attributes()) are in the vertex_header struct, - * not in the data[] array. */ - for (j = 1; j < nr_attrs - 2; j++) { + for (j = 1; j < nr_attrs; j++) { interp_attr(dst->data[j], t, in->data[j], out->data[j]); } } @@ -352,12 +348,8 @@ do_clip_line( struct draw_stage *stage, static void clip_begin( struct draw_stage *stage ) { - /* sanity checks. If these fail, review the clip/interp code! */ - assert(stage->draw->vertex_info.num_attribs >= 3); -#if 0 - assert(stage->draw->vertex_info.slot_to_attrib[0] == TGSI_ATTRIB_VERTEX_HEADER); - assert(stage->draw->vertex_info.slot_to_attrib[1] == TGSI_ATTRIB_CLIP_POS); -#endif + /* should always have position, at least */ + assert(stage->draw->vertex_info.num_attribs >= 1); stage->next->begin( stage->next ); } diff --git a/src/mesa/pipe/draw/draw_flatshade.c b/src/mesa/pipe/draw/draw_flatshade.c index 3b22c01b34e..d46e53f2be2 100644 --- a/src/mesa/pipe/draw/draw_flatshade.c +++ b/src/mesa/pipe/draw/draw_flatshade.c @@ -60,8 +60,9 @@ static INLINE void copy_colors( struct draw_stage *stage, uint i; /* Look for constant/flat attribs and duplicate from src to dst vertex */ - for (i = 1; i < num_attribs - 2; i++) { - if (interp[i + 2] == INTERP_CONSTANT) { + /* skip attrib[0] which is vert pos */ + for (i = 1; i < num_attribs; i++) { + if (interp[i] == INTERP_CONSTANT) { copy_attr( i, dst, src ); } } 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; } diff --git a/src/mesa/pipe/draw/draw_vertex.h b/src/mesa/pipe/draw/draw_vertex.h index a1fa7aae5a1..d9b5e7c8c0f 100644 --- a/src/mesa/pipe/draw/draw_vertex.h +++ b/src/mesa/pipe/draw/draw_vertex.h @@ -46,7 +46,6 @@ enum attrib_format { FORMAT_2F, FORMAT_3F, FORMAT_4F, - FORMAT_4F_VIEWPORT, FORMAT_4UB }; diff --git a/src/mesa/pipe/draw/draw_vertex_shader.c b/src/mesa/pipe/draw/draw_vertex_shader.c index e8801addac3..52fb2d85962 100644 --- a/src/mesa/pipe/draw/draw_vertex_shader.c +++ b/src/mesa/pipe/draw/draw_vertex_shader.c @@ -158,10 +158,8 @@ run_vertex_program(struct draw_context *draw, #endif /* Remaining attributes are packed into sequential post-transform * vertex attrib slots. - * Skip 0 since we just did it above. - * Subtract two because of the VERTEX_HEADER, CLIP_POS attribs. */ - for (slot = 1; slot < draw->vertex_info.num_attribs - 2; slot++) { + for (slot = 1; slot < draw->vertex_info.num_attribs; slot++) { vOut[j]->data[slot][0] = machine->Outputs[slot].xyzw[0].f[j]; vOut[j]->data[slot][1] = machine->Outputs[slot].xyzw[1].f[j]; vOut[j]->data[slot][2] = machine->Outputs[slot].xyzw[2].f[j]; diff --git a/src/mesa/pipe/draw/draw_vertex_shader_llvm.c b/src/mesa/pipe/draw/draw_vertex_shader_llvm.c index 3e005a76f31..53a1776ffcb 100644 --- a/src/mesa/pipe/draw/draw_vertex_shader_llvm.c +++ b/src/mesa/pipe/draw/draw_vertex_shader_llvm.c @@ -173,10 +173,8 @@ void draw_vertex_shader_queue_flush_llvm(struct draw_context *draw) /* Remaining attributes are packed into sequential post-transform * vertex attrib slots. - * Skip 0 since we just did it above. - * Subtract two because of the VERTEX_HEADER, CLIP_POS attribs. */ - for (slot = 1; slot < draw->vertex_info.num_attribs - 2; slot++) { + for (slot = 1; slot < draw->vertex_info.num_attribs; slot++) { vOut->data[slot][0] = dests[slot][0]; vOut->data[slot][1] = dests[slot][1]; vOut->data[slot][2] = dests[slot][2]; |