mesa: only emit _NEW_MULTISAMPLE when coverage parameters change
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 2 Jun 2017 15:52:47 +0000 (17:52 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 6 Jun 2017 09:47:16 +0000 (11:47 +0200)
We usually check that given parameters are different before
updating the state.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/main/multisample.c

index 5453e38632e3b73f0c90aa3be60d0ebcb77c0a36..f0e7a611805f12399e92c80b86ceb3792ae0a5c0 100644 (file)
@@ -41,11 +41,15 @@ _mesa_SampleCoverage(GLclampf value, GLboolean invert)
 {
    GET_CURRENT_CONTEXT(ctx);
 
-   FLUSH_VERTICES(ctx, 0);
+   value = CLAMP(value, 0.0f, 1.0f);
+
+   if (ctx->Multisample.SampleCoverageInvert == invert &&
+       ctx->Multisample.SampleCoverageValue == value)
+      return;
 
-   ctx->Multisample.SampleCoverageValue = CLAMP(value, 0.0f, 1.0f);
+   FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
+   ctx->Multisample.SampleCoverageValue = value;
    ctx->Multisample.SampleCoverageInvert = invert;
-   ctx->NewState |= _NEW_MULTISAMPLE;
 }