summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/varray.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2012-02-27 20:28:09 -0700
committerBrian Paul <[email protected]>2012-02-29 08:39:20 -0700
commit738482eec91f0898749d73bd97c5e864dd36bfb8 (patch)
tree6c8387b9c9013e2f3b8a562f6b4e7e214f6f49f1 /src/mesa/main/varray.c
parent9e68a8fa728c5d737a8b0c66aba066afddd67e9a (diff)
mesa: check for no state change in VertexAttribDivisor()
Reviewed-by: José Fonseca <[email protected]>
Diffstat (limited to 'src/mesa/main/varray.c')
-rw-r--r--src/mesa/main/varray.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 39d3a27e053..a402c7b22dc 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -1117,8 +1117,9 @@ _mesa_PrimitiveRestartIndex(GLuint index)
void GLAPIENTRY
_mesa_VertexAttribDivisor(GLuint index, GLuint divisor)
{
+ struct gl_client_array *array;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (!ctx->Extensions.ARB_instanced_arrays) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glVertexAttribDivisor()");
@@ -1133,7 +1134,12 @@ _mesa_VertexAttribDivisor(GLuint index, GLuint divisor)
ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(ctx->Array.ArrayObj->VertexAttrib));
- ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)].InstanceDivisor = divisor;
+ array = &ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)];
+ if (array->InstanceDivisor != divisor) {
+ FLUSH_VERTICES(ctx, _NEW_ARRAY);
+ array->InstanceDivisor = divisor;
+ ctx->Array.NewState |= VERT_BIT(VERT_ATTRIB_GENERIC(index));
+ }
}