mesa: treat glPopMatrix as a no-op state change if it doesn't change the matrix

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
This commit is contained in:
Marek Olšák
2020-10-05 20:10:31 -04:00
committed by Marge Bot
parent 0d7347105f
commit e08b3b74e7

View File

@@ -371,8 +371,17 @@ pop_matrix( struct gl_context *ctx, struct gl_matrix_stack *stack )
return GL_FALSE;
stack->Depth--;
/* If the popped matrix is the same as the current one, treat it as
* a no-op change.
*/
if (memcmp(stack->Top, &stack->Stack[stack->Depth],
sizeof(GLmatrix))) {
FLUSH_VERTICES(ctx, 0);
ctx->NewState |= stack->DirtyFlag;
}
stack->Top = &(stack->Stack[stack->Depth]);
ctx->NewState |= stack->DirtyFlag;
return GL_TRUE;
}
@@ -392,8 +401,6 @@ _mesa_PopMatrix( void )
GET_CURRENT_CONTEXT(ctx);
struct gl_matrix_stack *stack = ctx->CurrentStack;
FLUSH_VERTICES(ctx, 0);
if (MESA_VERBOSE&VERBOSE_API)
_mesa_debug(ctx, "glPopMatrix %s\n",
_mesa_enum_to_string(ctx->Transform.MatrixMode));