diff options
author | Eric Anholt <[email protected]> | 2008-02-02 02:54:13 -0800 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2008-02-04 18:24:16 -0800 |
commit | 5857e988be9317810cf713478195b4ed849eea4a (patch) | |
tree | 68477757d608fe7b4ed250ff4bfb038bb95e5dd7 /src/mesa | |
parent | 2abcc512a3ce81bc11ff2b45a2208d3400a2385d (diff) |
Allow first != 0 in mesa CVA handling, and add more error checking.
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/attrib.c | 6 | ||||
-rw-r--r-- | src/mesa/main/varray.c | 25 | ||||
-rw-r--r-- | src/mesa/main/varray.h | 5 |
3 files changed, 27 insertions, 9 deletions
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 07ec285eeb7..66e6aadc0f0 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1399,8 +1399,10 @@ _mesa_PopClientAttrib(void) adjust_buffer_object_ref_counts(&ctx->Array, -1); ctx->Array.ActiveTexture = data->ActiveTexture; - ctx->Array.LockFirst = data->LockFirst; - ctx->Array.LockCount = data->LockCount; + if (data->LockCount != 0) + _mesa_LockArraysEXT(data->LockFirst, data->LockCount); + else + _mesa_UnlockArraysEXT(); _mesa_BindVertexArrayAPPLE( data->ArrayObj->Name ); diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index fe4a7c684f6..11720e4073b 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -809,16 +809,22 @@ _mesa_LockArraysEXT(GLint first, GLsizei count) if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glLockArrays %d %d\n", first, count); - if (first == 0 && count > 0 && - count <= (GLint) ctx->Const.MaxArrayLockSize) { - ctx->Array.LockFirst = first; - ctx->Array.LockCount = count; + if (first < 0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glLockArraysEXT(first)" ); + return; } - else { - ctx->Array.LockFirst = 0; - ctx->Array.LockCount = 0; + if (count <= 0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glLockArraysEXT(count)" ); + return; + } + if (ctx->Array.LockCount != 0) { + _mesa_error( ctx, GL_INVALID_OPERATION, "glLockArraysEXT(reentry)" ); + return; } + ctx->Array.LockFirst = first; + ctx->Array.LockCount = count; + ctx->NewState |= _NEW_ARRAY; ctx->Array.NewState |= _NEW_ARRAY_ALL; @@ -836,6 +842,11 @@ _mesa_UnlockArraysEXT( void ) if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glUnlockArrays\n"); + if (ctx->Array.LockCount == 0) { + _mesa_error( ctx, GL_INVALID_OPERATION, "glUnlockArraysEXT(reexit)" ); + return; + } + ctx->Array.LockFirst = 0; ctx->Array.LockCount = 0; ctx->NewState |= _NEW_ARRAY; diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h index 3589735f684..bb2d21b469b 100644 --- a/src/mesa/main/varray.h +++ b/src/mesa/main/varray.h @@ -146,6 +146,11 @@ _mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride ); +extern void GLAPIENTRY +_mesa_LockArraysEXT(GLint first, GLsizei count); + +extern void GLAPIENTRY +_mesa_UnlockArraysEXT( void ); extern void _mesa_init_varray( GLcontext * ctx ); |