[Mesa-dev] [PATCH] mesa: check for no matrix change in _mesa_LoadMatrixf()
Kenneth Graunke
kenneth at whitecape.org
Thu Sep 15 17:45:24 UTC 2016
On Thursday, September 15, 2016 9:34:50 AM PDT Brian Paul wrote:
> Some apps issue redundant glLoadMatrixf() calls with the same matrix.
> Try to avoid setting dirty state in that situation.
>
> This reduces the number of constant buffer updates by about half in
> ET Quake Wars.
>
> Tested with Piglit, ETQW, Sauerbraten, Google Earth, etc.
^^^
Is that a texture compression test suite?
:)
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
> src/mesa/main/matrix.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c
> index b30b983..83f081e 100644
> --- a/src/mesa/main/matrix.c
> +++ b/src/mesa/main/matrix.c
> @@ -356,9 +356,11 @@ _mesa_LoadMatrixf( const GLfloat *m )
> m[2], m[6], m[10], m[14],
> m[3], m[7], m[11], m[15]);
>
> - FLUSH_VERTICES(ctx, 0);
> - _math_matrix_loadf( ctx->CurrentStack->Top, m );
> - ctx->NewState |= ctx->CurrentStack->DirtyFlag;
> + if (memcmp(m, ctx->CurrentStack->Top->m, 16 * sizeof(GLfloat)) != 0) {
> + FLUSH_VERTICES(ctx, 0);
> + _math_matrix_loadf( ctx->CurrentStack->Top, m );
> + ctx->NewState |= ctx->CurrentStack->DirtyFlag;
> + }
> }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160915/3cd385c0/attachment.sig>
More information about the mesa-dev
mailing list