mesa: replace _mesa_index_buffer::type with index_size
[mesa.git] / src / mesa / drivers / dri / nouveau / nouveau_vbo_t.c
index 51ffd5aef547edba3ec8dee0fecdaaf0cc0a6046..fdd135c5d7d1894b2ac98b0e7992f907a45aea0b 100644 (file)
@@ -59,9 +59,19 @@ vbo_init_arrays(struct gl_context *ctx, const struct _mesa_index_buffer *ib,
        GLboolean imm = (render->mode == IMM);
        int i, attr;
 
-       if (ib)
-               nouveau_init_array(&render->ib, 0, 0, ib->count, ib->type,
+       if (ib) {
+               GLenum ib_type;
+
+               if (ib->index_size == 4)
+                       ib_type = GL_UNSIGNED_INT;
+               else if (ib->index_size == 2)
+                       ib_type = GL_UNSIGNED_SHORT;
+               else
+                       ib_type = GL_UNSIGNED_BYTE;
+
+               nouveau_init_array(&render->ib, 0, 0, ib->count, ib_type,
                                   ib->obj, ib->ptr, GL_TRUE, ctx);
+       }
 
        FOR_EACH_BOUND_ATTR(render, i, attr) {
                const struct gl_vertex_array *array = arrays[attr];