diff options
author | Brian Paul <[email protected]> | 2004-01-09 15:31:08 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2004-01-09 15:31:08 +0000 |
commit | ed98b867af836d7b87529716e95bc611a5695d4d (patch) | |
tree | 512690ffa57e012f75e1fa22c181a0e6aa07f2f7 /src/mesa/tnl | |
parent | a05b1549f7b6da7d9313b9addf2d01b9c61f34d7 (diff) |
Change < to <= when testing counts against ctx->Const.MaxArrayLockSize,
per Daniel Borca.
Also, added XXX comments to mark where there may be a problem with the
calls to _tnl_vb_bind_arrays(). Is the last parameter a count or index?
Diffstat (limited to 'src/mesa/tnl')
-rw-r--r-- | src/mesa/tnl/t_array_api.c | 18 | ||||
-rw-r--r-- | src/mesa/tnl/t_array_import.c | 11 |
2 files changed, 18 insertions, 11 deletions
diff --git a/src/mesa/tnl/t_array_api.c b/src/mesa/tnl/t_array_api.c index 802133dc2d8..4322419effb 100644 --- a/src/mesa/tnl/t_array_api.c +++ b/src/mesa/tnl/t_array_api.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 5.1 + * Version: 6.0 * - * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -90,6 +90,9 @@ static void _tnl_draw_range_elements( GLcontext *ctx, GLenum mode, if (tnl->pipeline.build_state_changes) _tnl_validate_pipeline( ctx ); + /* XXX is "end" correct? Looking at the implementation of + * _tnl_vb_bind_arrays(), perhaps we should pass end-start. + */ _tnl_vb_bind_arrays( ctx, start, end ); tnl->vb.Primitive = &prim; @@ -157,7 +160,7 @@ _tnl_DrawArrays(GLenum mode, GLint start, GLsizei count) fallback_drawarrays( ctx, mode, start, start + count ); } else if (ctx->Array.LockCount && - count < (GLint) ctx->Const.MaxArrayLockSize) { + count <= (GLint) ctx->Const.MaxArrayLockSize) { struct tnl_prim prim; @@ -234,7 +237,7 @@ _tnl_DrawArrays(GLenum mode, GLint start, GLsizei count) * must use the slow path if they cannot fit in a single * vertex buffer. */ - if (count < (GLint) ctx->Const.MaxArrayLockSize) { + if (count <= (GLint) ctx->Const.MaxArrayLockSize) { bufsz = ctx->Const.MaxArrayLockSize; minimum = 0; modulo = 1; @@ -258,6 +261,7 @@ _tnl_DrawArrays(GLenum mode, GLint start, GLsizei count) nr = MIN2( bufsz, count - j ); + /* XXX is the last parameter a count or index into the array??? */ _tnl_vb_bind_arrays( ctx, j - minimum, j + nr ); tnl->vb.Primitive = &prim; @@ -352,12 +356,13 @@ _tnl_DrawRangeElements(GLenum mode, "elements outside locked range."); } } - else if (end + 1 - start < ctx->Const.MaxArrayLockSize) { + else if (end - start + 1 <= ctx->Const.MaxArrayLockSize) { /* The arrays aren't locked but we can still fit them inside a * single vertexbuffer. */ _tnl_draw_range_elements( ctx, mode, start, end + 1, count, ui_indices ); - } else { + } + else { /* Range is too big to optimize: */ fallback_drawelements( ctx, mode, count, ui_indices ); @@ -411,6 +416,7 @@ _tnl_DrawElements(GLenum mode, GLsizei count, GLenum type, if (ui_indices[i] > max_elt) max_elt = ui_indices[i]; + /* XXX should this < really be <= ??? */ if (max_elt < ctx->Const.MaxArrayLockSize && /* can we use it? */ max_elt < (GLuint) count) /* do we want to use it? */ _tnl_draw_range_elements( ctx, mode, 0, max_elt+1, count, ui_indices ); diff --git a/src/mesa/tnl/t_array_import.c b/src/mesa/tnl/t_array_import.c index 44ca2663c82..bac7936ba5d 100644 --- a/src/mesa/tnl/t_array_import.c +++ b/src/mesa/tnl/t_array_import.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 5.1 + * Version: 6.0 * - * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -238,9 +238,10 @@ static void _tnl_import_attrib( GLcontext *ctx, - - - +/* + * XXX Is count correct? From some of the callers, it appears that + * this should perhaps be an "end" index, ala the "start" index. + */ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLsizei count ) { TNLcontext *tnl = TNL_CONTEXT(ctx); |