From 070072ad43bb41624d271f10697ea21a776b1ec1 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sun, 2 Apr 2017 19:07:49 +0200 Subject: mesa: replace _mesa_index_buffer::type with index_size This avoids repeated translations of the enum. Reviewed-by: Ilia Mirkin Reviewed-by: Kenneth Graunke --- src/mesa/tnl/t_draw.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/mesa/tnl/t_draw.c') diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c index 24d74c0e1f1..9fca4da1f4d 100644 --- a/src/mesa/tnl/t_draw.c +++ b/src/mesa/tnl/t_draw.c @@ -358,7 +358,7 @@ static void bind_indices( struct gl_context *ctx, bo[*nr_bo] = ib->obj; (*nr_bo)++; ptr = ctx->Driver.MapBufferRange(ctx, (GLsizeiptr) ib->ptr, - ib->count * vbo_sizeof_ib_type(ib->type), + ib->count * ib->index_size, GL_MAP_READ_BIT, ib->obj, MAP_INTERNAL); assert(ib->obj->Mappings[MAP_INTERNAL].Pointer); @@ -367,19 +367,19 @@ static void bind_indices( struct gl_context *ctx, ptr = ADD_POINTERS(ib->obj->Mappings[MAP_INTERNAL].Pointer, ib->ptr); } - if (ib->type == GL_UNSIGNED_INT && VB->Primitive[0].basevertex == 0) { + if (ib->index_size == 4 && VB->Primitive[0].basevertex == 0) { VB->Elts = (GLuint *) ptr; } else { GLuint *elts = (GLuint *)get_space(ctx, ib->count * sizeof(GLuint)); VB->Elts = elts; - if (ib->type == GL_UNSIGNED_INT) { + if (ib->index_size == 4) { const GLuint *in = (GLuint *)ptr; for (i = 0; i < ib->count; i++) *elts++ = (GLuint)(*in++) + VB->Primitive[0].basevertex; } - else if (ib->type == GL_UNSIGNED_SHORT) { + else if (ib->index_size == 2) { const GLushort *in = (GLushort *)ptr; for (i = 0; i < ib->count; i++) *elts++ = (GLuint)(*in++) + VB->Primitive[0].basevertex; -- cgit v1.2.3