mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-29 21:00:16 +01:00
tnl: Only map the necessary buffer range in bind_indices
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Brian Paul <brianp@vmware.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
parent
655c7d7498
commit
2ea1ff3816
1 changed files with 21 additions and 5 deletions
|
|
@ -347,16 +347,32 @@ static void bind_indices( struct gl_context *ctx,
|
|||
}
|
||||
|
||||
if (ib->obj->Name && !ib->obj->Pointer) {
|
||||
unsigned map_size;
|
||||
|
||||
switch (ib->type) {
|
||||
case GL_UNSIGNED_BYTE:
|
||||
map_size = ib->count * sizeof(GLubyte);
|
||||
break;
|
||||
case GL_UNSIGNED_SHORT:
|
||||
map_size = ib->count * sizeof(GLushort);
|
||||
break;
|
||||
case GL_UNSIGNED_INT:
|
||||
map_size = ib->count * sizeof(GLuint);
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
map_size = 0;
|
||||
}
|
||||
|
||||
bo[*nr_bo] = ib->obj;
|
||||
(*nr_bo)++;
|
||||
ctx->Driver.MapBufferRange(ctx, 0, ib->obj->Size, GL_MAP_READ_BIT,
|
||||
ib->obj);
|
||||
|
||||
ptr = ctx->Driver.MapBufferRange(ctx, (GLsizeiptr) ib->ptr, map_size,
|
||||
GL_MAP_READ_BIT, ib->obj);
|
||||
assert(ib->obj->Pointer);
|
||||
} else {
|
||||
ptr = ib->ptr;
|
||||
}
|
||||
|
||||
ptr = ADD_POINTERS(ib->obj->Pointer, ib->ptr);
|
||||
|
||||
if (ib->type == GL_UNSIGNED_INT && VB->Primitive[0].basevertex == 0) {
|
||||
VB->Elts = (GLuint *) ptr;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue