diff options
author | marha <marha@users.sourceforge.net> | 2012-01-06 19:27:25 +0100 |
---|---|---|
committer | Marc Haesen <marc@hc-consult.be> | 2012-01-06 19:27:25 +0100 |
commit | 7e9f4ea970e8f7008c212d7d3918a974eb0066da (patch) | |
tree | 92cf7fcdf6e8093e743346af2397f3caa17cffe3 /mesalib/src/mesa/vbo/vbo_exec_array.c | |
parent | 9715b7fab0757c86e1bb151f3dce0b324bcff692 (diff) | |
download | vcxsrv-7e9f4ea970e8f7008c212d7d3918a974eb0066da.tar.gz vcxsrv-7e9f4ea970e8f7008c212d7d3918a974eb0066da.tar.bz2 vcxsrv-7e9f4ea970e8f7008c212d7d3918a974eb0066da.zip |
libX11 mesa pixman git update 6 jan 2012
Diffstat (limited to 'mesalib/src/mesa/vbo/vbo_exec_array.c')
-rw-r--r-- | mesalib/src/mesa/vbo/vbo_exec_array.c | 52 |
1 files changed, 19 insertions, 33 deletions
diff --git a/mesalib/src/mesa/vbo/vbo_exec_array.c b/mesalib/src/mesa/vbo/vbo_exec_array.c index 2db85e2e5..fec49d35e 100644 --- a/mesalib/src/mesa/vbo/vbo_exec_array.c +++ b/mesalib/src/mesa/vbo/vbo_exec_array.c @@ -75,6 +75,22 @@ vbo_check_buffers_are_unmapped(struct gl_context *ctx) assert(!_mesa_bufferobj_mapped(exec->vtx.bufferobj)); } +int +vbo_sizeof_ib_type(GLenum type) +{ + switch (type) { + case GL_UNSIGNED_INT: + return sizeof(GLuint); + case GL_UNSIGNED_SHORT: + return sizeof(GLushort); + case GL_UNSIGNED_BYTE: + return sizeof(GLubyte); + default: + assert(!"unsupported index data type"); + /* In case assert is turned off */ + return 0; + } +} /** @@ -96,24 +112,8 @@ vbo_get_minmax_index(struct gl_context *ctx, GLuint i; if (_mesa_is_bufferobj(ib->obj)) { - unsigned map_size; - - switch (ib->type) { - case GL_UNSIGNED_INT: - map_size = count * sizeof(GLuint); - break; - case GL_UNSIGNED_SHORT: - map_size = count * sizeof(GLushort); - break; - case GL_UNSIGNED_BYTE: - map_size = count * sizeof(GLubyte); - break; - default: - assert(0); - map_size = 0; - } - - indices = ctx->Driver.MapBufferRange(ctx, (GLsizeiptr) ib->ptr, map_size, + indices = ctx->Driver.MapBufferRange(ctx, (GLsizeiptr) ib->ptr, + count * vbo_sizeof_ib_type(ib->type), GL_MAP_READ_BIT, ib->obj); } else { indices = ib->ptr; @@ -1053,7 +1053,7 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode, struct vbo_exec_context *exec = &vbo->exec; struct _mesa_index_buffer ib; struct _mesa_prim *prim; - unsigned int index_type_size = 0; + unsigned int index_type_size = vbo_sizeof_ib_type(type); uintptr_t min_index_ptr, max_index_ptr; GLboolean fallback = GL_FALSE; int i; @@ -1083,20 +1083,6 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode, if (ctx->NewState) _mesa_update_state( ctx ); - switch (type) { - case GL_UNSIGNED_INT: - index_type_size = 4; - break; - case GL_UNSIGNED_SHORT: - index_type_size = 2; - break; - case GL_UNSIGNED_BYTE: - index_type_size = 1; - break; - default: - assert(0); - } - min_index_ptr = (uintptr_t)indices[0]; max_index_ptr = 0; for (i = 0; i < primcount; i++) { |