Mesa (master): mesa: only emit _NEW_MULTISAMPLE when coverage parameters change

Samuel Pitoiset hakzsam at kemper.freedesktop.org
Tue Jun 6 09:53:23 UTC 2017


Module: Mesa
Branch: master
Commit: 706e31fe5a228bd357a3d8e0495d3085a3953ccf
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=706e31fe5a228bd357a3d8e0495d3085a3953ccf

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Fri Jun  2 17:52:47 2017 +0200

mesa: only emit _NEW_MULTISAMPLE when coverage parameters change

We usually check that given parameters are different before
updating the state.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/mesa/main/multisample.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/multisample.c b/src/mesa/main/multisample.c
index 5453e38632..f0e7a61180 100644
--- a/src/mesa/main/multisample.c
+++ b/src/mesa/main/multisample.c
@@ -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;
 }
 
 




More information about the mesa-commit mailing list