From 367c91bebcdc1f5ba4278b68eb8715218d9640ad Mon Sep 17 00:00:00 2001 From: marha Date: Sun, 16 Jan 2011 16:08:57 +0000 Subject: mesalib git update 16/1/2011 --- mesalib/src/mesa/main/varray.c | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) (limited to 'mesalib/src/mesa/main/varray.c') diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c index 2d4a6b54b..39855cbb0 100644 --- a/mesalib/src/mesa/main/varray.c +++ b/mesalib/src/mesa/main/varray.c @@ -534,11 +534,19 @@ get_vertex_array_attrib(struct gl_context *ctx, GLuint index, GLenum pname, if (ctx->Extensions.EXT_gpu_shader4) { return array->Integer; } - /* fall-through */ + goto error; + case GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB: + if (ctx->Extensions.ARB_instanced_arrays) { + return array->InstanceDivisor; + } + goto error; default: - _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=0x%x)", caller, pname); - return 0; + ; /* fall-through */ } + +error: + _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=0x%x)", caller, pname); + return 0; } @@ -1065,6 +1073,33 @@ _mesa_PrimitiveRestartIndex(GLuint index) } +/** + * See GL_ARB_instanced_arrays. + * Note that the instance divisor only applies to generic arrays, not + * the legacy vertex arrays. + */ +void GLAPIENTRY +_mesa_VertexAttribDivisor(GLuint index, GLuint divisor) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (!ctx->Extensions.ARB_instanced_arrays) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glVertexAttribDivisor()"); + return; + } + + if (index >= ctx->Const.VertexProgram.MaxAttribs) { + _mesa_error(ctx, GL_INVALID_ENUM, "glVertexAttribDivisor(index = %u)", + index); + return; + } + + ctx->Array.ArrayObj->VertexAttrib[index].InstanceDivisor = divisor; +} + + + /** * Copy one client vertex array to another. */ @@ -1082,6 +1117,7 @@ _mesa_copy_client_array(struct gl_context *ctx, dst->Enabled = src->Enabled; dst->Normalized = src->Normalized; dst->Integer = src->Integer; + dst->InstanceDivisor = src->InstanceDivisor; dst->_ElementSize = src->_ElementSize; _mesa_reference_buffer_object(ctx, &dst->BufferObj, src->BufferObj); dst->_MaxElement = src->_MaxElement; -- cgit v1.2.3