summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/draw
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2008-01-23 23:27:31 -0700
committerBrian <brian.paul@tungstengraphics.com>2008-01-23 23:27:31 -0700
commit2549d79ae5342a2b97c06e3b0db9da6eb7821d2e (patch)
treecdd4e62ff8287042157b0ed845bde1e54f251800 /src/mesa/pipe/draw
parent6000dcc973cdc1bd61621b432aed27d21059ae5d (diff)
gallium: rename FORMAT_x to EMIT_x and use EMIT_ALL to emit whole vertex as-is in vbuf code
Diffstat (limited to 'src/mesa/pipe/draw')
-rw-r--r--src/mesa/pipe/draw/draw_vbuf.c27
-rw-r--r--src/mesa/pipe/draw/draw_vertex.c21
-rw-r--r--src/mesa/pipe/draw/draw_vertex.h27
3 files changed, 37 insertions, 38 deletions
diff --git a/src/mesa/pipe/draw/draw_vbuf.c b/src/mesa/pipe/draw/draw_vbuf.c
index c179b5e9dd..82051d2e65 100644
--- a/src/mesa/pipe/draw/draw_vbuf.c
+++ b/src/mesa/pipe/draw/draw_vbuf.c
@@ -141,42 +141,43 @@ emit_vertex( struct vbuf_stage *vbuf,
for (i = 0; i < vinfo->num_attribs; i++) {
uint j = vinfo->src_index[i];
- switch (vinfo->format[i]) {
- case FORMAT_OMIT:
+ switch (vinfo->emit[i]) {
+ case EMIT_OMIT:
/* no-op */
break;
- case FORMAT_HEADER:
- memcpy(vbuf->vertex_ptr, vertex, sizeof(*vertex));
- vbuf->vertex_ptr += sizeof(*vertex) / 4;
- count += sizeof(*vertex) / 4;
- break;
- case FORMAT_1F:
+ case EMIT_ALL:
+ /* just copy the whole vertex as-is to the vbuf */
+ assert(i == 0);
+ memcpy(vbuf->vertex_ptr, vertex, vinfo->size * 4);
+ vbuf->vertex_ptr += vinfo->size;
+ return;
+ case EMIT_1F:
*vbuf->vertex_ptr++ = fui(vertex->data[j][0]);
count++;
break;
- case FORMAT_1F_PSIZE:
+ case EMIT_1F_PSIZE:
*vbuf->vertex_ptr++ = fui(vbuf->stage.draw->rasterizer->point_size);
count++;
break;
- case FORMAT_2F:
+ case EMIT_2F:
*vbuf->vertex_ptr++ = fui(vertex->data[j][0]);
*vbuf->vertex_ptr++ = fui(vertex->data[j][1]);
count += 2;
break;
- case FORMAT_3F:
+ case EMIT_3F:
*vbuf->vertex_ptr++ = fui(vertex->data[j][0]);
*vbuf->vertex_ptr++ = fui(vertex->data[j][1]);
*vbuf->vertex_ptr++ = fui(vertex->data[j][2]);
count += 3;
break;
- case FORMAT_4F:
+ case EMIT_4F:
*vbuf->vertex_ptr++ = fui(vertex->data[j][0]);
*vbuf->vertex_ptr++ = fui(vertex->data[j][1]);
*vbuf->vertex_ptr++ = fui(vertex->data[j][2]);
*vbuf->vertex_ptr++ = fui(vertex->data[j][3]);
count += 4;
break;
- case FORMAT_4UB:
+ case EMIT_4UB:
*vbuf->vertex_ptr++ = pack_ub4(float_to_ubyte( vertex->data[j][2] ),
float_to_ubyte( vertex->data[j][1] ),
float_to_ubyte( vertex->data[j][0] ),
diff --git a/src/mesa/pipe/draw/draw_vertex.c b/src/mesa/pipe/draw/draw_vertex.c
index 37d8b04ef9..2d6592150f 100644
--- a/src/mesa/pipe/draw/draw_vertex.c
+++ b/src/mesa/pipe/draw/draw_vertex.c
@@ -49,28 +49,27 @@ draw_compute_vertex_size(struct vertex_info *vinfo)
vinfo->size = 0;
for (i = 0; i < vinfo->num_attribs; i++) {
- switch (vinfo->format[i]) {
- case FORMAT_OMIT:
+ switch (vinfo->emit[i]) {
+ case EMIT_OMIT:
break;
- case FORMAT_HEADER:
- vinfo->size += sizeof(struct vertex_header) / 4;
- break;
- case FORMAT_4UB:
+ case EMIT_4UB:
/* fall-through */
- case FORMAT_1F_PSIZE:
+ case EMIT_1F_PSIZE:
/* fall-through */
- case FORMAT_1F:
+ case EMIT_1F:
vinfo->size += 1;
break;
- case FORMAT_2F:
+ case EMIT_2F:
vinfo->size += 2;
break;
- case FORMAT_3F:
+ case EMIT_3F:
vinfo->size += 3;
break;
- case FORMAT_4F:
+ case EMIT_4F:
vinfo->size += 4;
break;
+ case EMIT_ALL:
+ /* fall-through */
default:
assert(0);
}
diff --git a/src/mesa/pipe/draw/draw_vertex.h b/src/mesa/pipe/draw/draw_vertex.h
index 7e9d8abcce..f20b10f8d7 100644
--- a/src/mesa/pipe/draw/draw_vertex.h
+++ b/src/mesa/pipe/draw/draw_vertex.h
@@ -35,18 +35,17 @@
/**
- * Vertex attribute format
- * XXX rename to "EMIT"
+ * Vertex attribute emit modes
*/
-enum attrib_format {
- FORMAT_OMIT, /**< don't emit the attribute */
- FORMAT_HEADER, /**< The 5-byte vertex header */
- FORMAT_1F,
- FORMAT_1F_PSIZE, /**< insert constant point size */
- FORMAT_2F,
- FORMAT_3F,
- FORMAT_4F,
- FORMAT_4UB /**< XXX may need variations for RGBA vs BGRA, etc */
+enum attrib_emit {
+ EMIT_OMIT, /**< don't emit the attribute */
+ EMIT_ALL, /**< emit whole post-xform vertex, w/ header */
+ EMIT_1F,
+ EMIT_1F_PSIZE, /**< insert constant point size */
+ EMIT_2F,
+ EMIT_3F,
+ EMIT_4F,
+ EMIT_4UB /**< XXX may need variations for RGBA vs BGRA, etc */
};
@@ -70,7 +69,7 @@ struct vertex_info
uint num_attribs;
uint hwfmt[4]; /**< hardware format info for this format */
enum interp_mode interp_mode[PIPE_MAX_SHADER_OUTPUTS];
- enum attrib_format format[PIPE_MAX_SHADER_OUTPUTS]; /**< FORMAT_x */
+ enum attrib_emit emit[PIPE_MAX_SHADER_OUTPUTS]; /**< EMIT_x */
uint src_index[PIPE_MAX_SHADER_OUTPUTS]; /**< map to post-xform attribs */
uint size; /**< total vertex size in dwords */
};
@@ -85,12 +84,12 @@ struct vertex_info
*/
static INLINE uint
draw_emit_vertex_attr(struct vertex_info *vinfo,
- enum attrib_format format, enum interp_mode interp,
+ enum attrib_emit emit, enum interp_mode interp,
uint src_index)
{
const uint n = vinfo->num_attribs;
assert(n < PIPE_MAX_SHADER_OUTPUTS);
- vinfo->format[n] = format;
+ vinfo->emit[n] = emit;
vinfo->interp_mode[n] = interp;
vinfo->src_index[n] = src_index;
vinfo->num_attribs++;