summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/draw/draw_vertex.c
diff options
context:
space:
mode:
authorJakob Bornecrantz <[email protected]>2010-03-25 00:18:30 +0100
committerJakob Bornecrantz <[email protected]>2010-03-26 01:21:52 +0100
commit84a8347b9f6ef0c1b2519e9bd5fef2ce3c85afb7 (patch)
tree69faa69e239d4295b7f058475b625be9764ef6f9 /src/gallium/auxiliary/draw/draw_vertex.c
parentbc88c95990f871a206a8fe93e7541f1f41841f7e (diff)
draw: Use translate function instead of switch cases
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_vertex.c')
-rw-r--r--src/gallium/auxiliary/draw/draw_vertex.c30
1 files changed, 6 insertions, 24 deletions
diff --git a/src/gallium/auxiliary/draw/draw_vertex.c b/src/gallium/auxiliary/draw/draw_vertex.c
index 3214213e445..18921ad7179 100644
--- a/src/gallium/auxiliary/draw/draw_vertex.c
+++ b/src/gallium/auxiliary/draw/draw_vertex.c
@@ -48,30 +48,12 @@ draw_compute_vertex_size(struct vertex_info *vinfo)
uint i;
vinfo->size = 0;
- for (i = 0; i < vinfo->num_attribs; i++) {
- switch (vinfo->attrib[i].emit) {
- case EMIT_OMIT:
- break;
- case EMIT_4UB:
- /* fall-through */
- case EMIT_1F_PSIZE:
- /* fall-through */
- case EMIT_1F:
- vinfo->size += 1;
- break;
- case EMIT_2F:
- vinfo->size += 2;
- break;
- case EMIT_3F:
- vinfo->size += 3;
- break;
- case EMIT_4F:
- vinfo->size += 4;
- break;
- default:
- assert(0);
- }
- }
+ for (i = 0; i < vinfo->num_attribs; i++)
+ vinfo->size += draw_translate_vinfo_size(vinfo->attrib[i].emit);
+
+ assert(vinfo->size % 4 == 0);
+ /* in dwords */
+ vinfo->size /= 4;
}