summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/draw
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-09-20 13:42:37 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-09-20 13:43:23 -0600
commit086734502a614e7778533018846ee66a66df9821 (patch)
tree80fc84b09af1915693bb6cf2c8596fb61a6cb1b4 /src/mesa/pipe/draw
parent745f0cbe0528ac925096f5c1b85de7280fee7fbc (diff)
Checkpoint: vertex attribute clean-up.
Remove/disable the attrib/slot mapping arrays in a few places. Work in progress...
Diffstat (limited to 'src/mesa/pipe/draw')
-rw-r--r--src/mesa/pipe/draw/draw_clip.c2
-rw-r--r--src/mesa/pipe/draw/draw_feedback.c3
-rw-r--r--src/mesa/pipe/draw/draw_private.h2
-rw-r--r--src/mesa/pipe/draw/draw_vertex.c19
-rw-r--r--src/mesa/pipe/draw/draw_vertex.h16
-rw-r--r--src/mesa/pipe/draw/draw_vertex_fetch.c5
6 files changed, 25 insertions, 22 deletions
diff --git a/src/mesa/pipe/draw/draw_clip.c b/src/mesa/pipe/draw/draw_clip.c
index 1396b60f45..e2af69e048 100644
--- a/src/mesa/pipe/draw/draw_clip.c
+++ b/src/mesa/pipe/draw/draw_clip.c
@@ -382,8 +382,10 @@ 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
stage->next->begin( stage->next );
}
diff --git a/src/mesa/pipe/draw/draw_feedback.c b/src/mesa/pipe/draw/draw_feedback.c
index ecdd98e83d..3b8400233e 100644
--- a/src/mesa/pipe/draw/draw_feedback.c
+++ b/src/mesa/pipe/draw/draw_feedback.c
@@ -78,7 +78,7 @@ feedback_vertex(struct draw_stage *stage, const struct vertex_header *vertex)
* we can either address output buffer 0 (for interleaving) or
* output buffer i (for non-interleaved).
*/
-
+#if 0
for (i = 0; i < feedback->num_attribs; i++) {
const uint attr = feedback->attrib[i];
const uint slot = stage->draw->vertex_info.attrib_to_slot[attr];
@@ -104,6 +104,7 @@ feedback_vertex(struct draw_stage *stage, const struct vertex_header *vertex)
}
fs->dest[i * select] += size;
}
+#endif
fs->num_vert_emitted++;
}
diff --git a/src/mesa/pipe/draw/draw_private.h b/src/mesa/pipe/draw/draw_private.h
index bd8c11eb94..1285f3200c 100644
--- a/src/mesa/pipe/draw/draw_private.h
+++ b/src/mesa/pipe/draw/draw_private.h
@@ -62,7 +62,7 @@ struct vertex_header {
};
/* XXX This is too large */
-#define MAX_VERTEX_SIZE ((2 + TGSI_ATTRIB_MAX) * 4 * sizeof(float))
+#define MAX_VERTEX_SIZE ((2 + PIPE_MAX_SHADER_OUTPUTS) * 4 * sizeof(float))
diff --git a/src/mesa/pipe/draw/draw_vertex.c b/src/mesa/pipe/draw/draw_vertex.c
index 1c7e1d8662..ab4e6c7864 100644
--- a/src/mesa/pipe/draw/draw_vertex.c
+++ b/src/mesa/pipe/draw/draw_vertex.c
@@ -45,17 +45,10 @@
static INLINE void
-emit_vertex_attr(struct vertex_info *vinfo, uint vfAttr,
+emit_vertex_attr(struct vertex_info *vinfo, /*uint vfAttr,*/
attrib_format format, interp_mode interp)
{
const uint n = vinfo->num_attribs;
- vinfo->attr_mask |= (1 << vfAttr);
- vinfo->slot_to_attrib[n] = vfAttr;
- if (n >= 2) {
- /* the first two slots are the vertex header & clippos */
- assert(vfAttr < Elements(vinfo->attrib_to_slot));
- vinfo->attrib_to_slot[vfAttr] = n - 2;
- }
vinfo->interp_mode[n] = interp;
vinfo->format[n] = format;
vinfo->num_attribs++;
@@ -110,22 +103,24 @@ 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
memset(vinfo, 0, sizeof(*vinfo));
/*
* First three attribs are always the same: header, clip pos, winpos
*/
- emit_vertex_attr(vinfo, TGSI_ATTRIB_VERTEX_HEADER, FORMAT_1F, INTERP_NONE);
- emit_vertex_attr(vinfo, TGSI_ATTRIB_CLIP_POS, FORMAT_4F, INTERP_LINEAR);
- emit_vertex_attr(vinfo, TGSI_ATTRIB_POS, FORMAT_4F_VIEWPORT, INTERP_LINEAR);
+ emit_vertex_attr(vinfo, /*TGSI_ATTRIB_VERTEX_HEADER,*/ FORMAT_1F, INTERP_NONE);
+ emit_vertex_attr(vinfo, /*TGSI_ATTRIB_CLIP_POS,*/ FORMAT_4F, INTERP_LINEAR);
+ emit_vertex_attr(vinfo, /*TGSI_ATTRIB_POS,*/ FORMAT_4F_VIEWPORT, INTERP_LINEAR);
/*
* Remaining attribs (color, texcoords, etc)
*/
for (i = 1; i < nr_attrs; i++) {
- emit_vertex_attr(vinfo, slot_to_vf_attr[i], FORMAT_4F, interps[i]);
+ emit_vertex_attr(vinfo, /*slot_to_vf_attr[i],*/ FORMAT_4F, interps[i]);
}
draw_compute_vertex_size(vinfo);
diff --git a/src/mesa/pipe/draw/draw_vertex.h b/src/mesa/pipe/draw/draw_vertex.h
index 4e3e86d86e..1d900b3a4e 100644
--- a/src/mesa/pipe/draw/draw_vertex.h
+++ b/src/mesa/pipe/draw/draw_vertex.h
@@ -68,16 +68,15 @@ typedef enum {
} interp_mode;
-
+/**
+ * Information about post-transformed vertex layout.
+ */
struct vertex_info
{
uint num_attribs;
uint hwfmt[4]; /**< hardware format info for this format */
- uint attr_mask; /**< mask of VF_ATTR_ bits */
- uint slot_to_attrib[MAX_VERT_ATTRIBS];
- uint attrib_to_slot[TGSI_ATTRIB_MAX];
- interp_mode interp_mode[MAX_VERT_ATTRIBS];
- attrib_format format[MAX_VERT_ATTRIBS]; /**< FORMAT_x */
+ interp_mode interp_mode[PIPE_MAX_SHADER_OUTPUTS];
+ attrib_format format[PIPE_MAX_SHADER_OUTPUTS]; /**< FORMAT_x */
uint size; /**< total vertex size in dwords */
};
@@ -92,9 +91,10 @@ draw_emit_vertex_attr(struct vertex_info *vinfo, uint vfAttr,
attrib_format format, interp_mode interp)
{
const uint n = vinfo->num_attribs;
- assert(n < MAX_VERT_ATTRIBS);
+ assert(n < PIPE_MAX_SHADER_OUTPUTS);
+ /*
vinfo->attr_mask |= (1 << vfAttr);
- vinfo->slot_to_attrib[n] = vfAttr;
+ */
vinfo->format[n] = format;
vinfo->interp_mode[n] = interp;
vinfo->num_attribs++;
diff --git a/src/mesa/pipe/draw/draw_vertex_fetch.c b/src/mesa/pipe/draw/draw_vertex_fetch.c
index ce402d681f..62e8d61be4 100644
--- a/src/mesa/pipe/draw/draw_vertex_fetch.c
+++ b/src/mesa/pipe/draw/draw_vertex_fetch.c
@@ -81,6 +81,9 @@ void draw_vertex_fetch( struct draw_context *draw,
/* loop over vertices */
for (j = 0; j < count; j++) {
uint attr;
+
+ /*printf("fetch vertex %u: \n", j);*/
+
/* loop over vertex attributes (vertex shader inputs) */
for (attr = 0; attr < draw->vertex_shader.num_inputs; attr++) {
@@ -94,6 +97,8 @@ void draw_vertex_fetch( struct draw_context *draw,
fetch_attrib4(src, draw->vertex_element[attr].src_format, p);
+ /*printf(" %u: %f %f %f %f\n", attr, p[0], p[1], p[2], p[3]);*/
+
machine->Inputs[attr].xyzw[0].f[j] = p[0]; /*X*/
machine->Inputs[attr].xyzw[1].f[j] = p[1]; /*Y*/
machine->Inputs[attr].xyzw[2].f[j] = p[2]; /*Z*/