Mesa (master): mesa/swrast: Use SATURATE

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue May 26 22:57:28 UTC 2020


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

Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date:   Tue May 19 11:09:02 2020 -0400

mesa/swrast: Use SATURATE

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Reviewed-by: Eric Engestrom <eric at engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5100>

---

 src/mesa/swrast/s_chan.h    | 4 ++--
 src/mesa/swrast/s_copypix.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/swrast/s_chan.h b/src/mesa/swrast/s_chan.h
index 38daf657573..fa6c962b14c 100644
--- a/src/mesa/swrast/s_chan.h
+++ b/src/mesa/swrast/s_chan.h
@@ -94,8 +94,8 @@
 #elif CHAN_BITS == 32
 
 #define CHAN_TO_UBYTE(c)  FLOAT_TO_UBYTE(c)
-#define CHAN_TO_USHORT(c) ((GLushort) (CLAMP((c), 0.0f, 1.0f) * 65535.0))
-#define CHAN_TO_SHORT(c)  ((GLshort) (CLAMP((c), 0.0f, 1.0f) * 32767.0))
+#define CHAN_TO_USHORT(c) ((GLushort) (SATURATE((c)) * 65535.0))
+#define CHAN_TO_SHORT(c)  ((GLshort) (SATURATE((c)) * 32767.0))
 #define CHAN_TO_FLOAT(c)  (c)
 
 #define CLAMPED_FLOAT_TO_CHAN(c, f)  c = (f)
diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c
index fc378a657f7..d6ba44194bd 100644
--- a/src/mesa/swrast/s_copypix.c
+++ b/src/mesa/swrast/s_copypix.c
@@ -214,7 +214,7 @@ scale_and_bias_z(struct gl_context *ctx, GLuint width,
       const GLdouble depthMaxF = ctx->DrawBuffer->_DepthMaxF;
       for (i = 0; i < width; i++) {
          GLdouble d = depth[i] * ctx->Pixel.DepthScale + ctx->Pixel.DepthBias;
-         d = CLAMP(d, 0.0, 1.0) * depthMaxF;
+         d = SATURATE(d) * depthMaxF;
          if (d >= depthMaxF)
             z[i] = depthMax;
          else



More information about the mesa-commit mailing list