aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe/draw
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-11-21 16:00:57 -0700
committerBrian <[email protected]>2007-11-21 16:00:57 -0700
commit9f0b5bba707d6c36896b4b8afad4e6b459da5e99 (patch)
treec2064cc02554f19f77bceefbcefd3bb8f8c24101 /src/mesa/pipe/draw
parentfbe68bf6b286056bb03f44907a078918d04cbdfd (diff)
Replace draw_set_vertex_attributes() with simpler draw_set_vertex_info().
Just pass in the vertex_info object and make a copy of it.
Diffstat (limited to 'src/mesa/pipe/draw')
-rw-r--r--src/mesa/pipe/draw/draw_vertex.c35
-rw-r--r--src/mesa/pipe/draw/draw_vertex.h6
2 files changed, 18 insertions, 23 deletions
diff --git a/src/mesa/pipe/draw/draw_vertex.c b/src/mesa/pipe/draw/draw_vertex.c
index 983ed71ec0f..89f54ff1869 100644
--- a/src/mesa/pipe/draw/draw_vertex.c
+++ b/src/mesa/pipe/draw/draw_vertex.c
@@ -87,37 +87,34 @@ draw_compute_vertex_size(struct vertex_info *vinfo)
/**
- * Tell the drawing module about the layout of post-transformation vertices
+ * Tell the drawing module about the contents of post-transformation vertices.
+ * Note that the vertex attribute format info isn't used by 'draw'; all
+ * attributes are handled as float[4]. But when the driver emits vertices
+ * it'll use that info.
+ * We _do_ care about the number of attributes and their interpolation modes.
*/
void
-draw_set_vertex_attributes( struct draw_context *draw,
- const uint *slot_to_vf_attr,
- const enum interp_mode *interps,
- unsigned nr_attrs )
+draw_set_vertex_info( struct draw_context *draw,
+ const struct vertex_info *info)
{
- struct vertex_info *vinfo = &draw->vertex_info;
- unsigned i;
+ assert(info->interp_mode[0] == INTERP_LINEAR); /* should be vert pos */
- assert(interps[0] == INTERP_LINEAR); /* should be vert pos */
-
- assert(nr_attrs <= PIPE_MAX_SHADER_OUTPUTS);
+ assert(info->num_attribs <= PIPE_MAX_SHADER_OUTPUTS);
/* 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.
*/
- memset(vinfo, 0, sizeof(*vinfo));
-
- /* copy attrib info */
- for (i = 0; i < nr_attrs; i++) {
- emit_vertex_attr(vinfo, FORMAT_4F, interps[i]);
- }
+ memcpy(&draw->vertex_info, info, sizeof(*info));
- draw_compute_vertex_size(vinfo);
+ draw_compute_vertex_size(&draw->vertex_info);
- /* add extra words for vertex header (uint), clip pos (float[4]) */
- vinfo->size += 5;
+ /* Need to know vertex size (in words) for vertex copying elsewhere.
+ * Four words per attribute, plus vertex header (uint) and clip
+ * position (float[4]).
+ */
+ draw->vertex_info.size = draw->vertex_info.num_attribs * 4 + 5;
}
diff --git a/src/mesa/pipe/draw/draw_vertex.h b/src/mesa/pipe/draw/draw_vertex.h
index d9b5e7c8c0f..8bb328affa3 100644
--- a/src/mesa/pipe/draw/draw_vertex.h
+++ b/src/mesa/pipe/draw/draw_vertex.h
@@ -92,10 +92,8 @@ draw_emit_vertex_attr(struct vertex_info *vinfo,
}
-extern void draw_set_vertex_attributes( struct draw_context *draw,
- const uint *attrs,
- const enum interp_mode *interps,
- unsigned nr_attrs );
+extern void draw_set_vertex_info( struct draw_context *draw,
+ const struct vertex_info *info);
extern void draw_set_twoside_attributes(struct draw_context *draw,
uint front0, uint back0,