Mesa (master): softpipe: enable clamping control

Dave Airlie airlied at kemper.freedesktop.org
Wed Jan 11 13:51:49 UTC 2012


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

Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Jan  5 15:36:43 2012 +0000

softpipe: enable clamping control

This enables fragment clamping in softpipe, it passes more
tests than it did previously with no regressions, There are still
a couple of failures in the SNORM types to investigate.

Signed-off-by: Dave Airlie <airlied at redhat.com>

---

 src/gallium/drivers/softpipe/sp_quad_blend.c |    9 ++++++---
 src/gallium/drivers/softpipe/sp_screen.c     |    2 ++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_quad_blend.c b/src/gallium/drivers/softpipe/sp_quad_blend.c
index 7180fa1..d546b14 100644
--- a/src/gallium/drivers/softpipe/sp_quad_blend.c
+++ b/src/gallium/drivers/softpipe/sp_quad_blend.c
@@ -894,7 +894,7 @@ blend_fallback(struct quad_stage *qs,
          /* If fixed-point dest color buffer, need to clamp the incoming
           * fragment colors now.
           */
-         if (clamp) {
+         if (clamp || softpipe->rasterizer->clamp_fragment_color) {
             clamp_colors(quadColor);
          }
 
@@ -982,7 +982,7 @@ blend_single_add_src_alpha_inv_src_alpha(struct quad_stage *qs,
       /* If fixed-point dest color buffer, need to clamp the incoming
        * fragment colors now.
        */
-      if (bqs->clamp[0]) {
+      if (bqs->clamp[0] || qs->softpipe->rasterizer->clamp_fragment_color) {
          clamp_colors(quadColor);
       }
 
@@ -1055,7 +1055,7 @@ blend_single_add_one_one(struct quad_stage *qs,
       /* If fixed-point dest color buffer, need to clamp the incoming
        * fragment colors now.
        */
-      if (bqs->clamp[0]) {
+      if (bqs->clamp[0] || qs->softpipe->rasterizer->clamp_fragment_color) {
          clamp_colors(quadColor);
       }
 
@@ -1111,6 +1111,9 @@ single_output_color(struct quad_stage *qs,
       const int itx = (quad->input.x0 & (TILE_SIZE-1));
       const int ity = (quad->input.y0 & (TILE_SIZE-1));
 
+      if (qs->softpipe->rasterizer->clamp_fragment_color)
+         clamp_colors(quadColor);
+
       rebase_colors(bqs->base_format[0], quadColor);
 
       for (j = 0; j < QUAD_SIZE; j++) {
diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
index a9d70f9..37aa585 100644
--- a/src/gallium/drivers/softpipe/sp_screen.c
+++ b/src/gallium/drivers/softpipe/sp_screen.c
@@ -128,6 +128,8 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
       return 7;
    case PIPE_CAP_CONDITIONAL_RENDER:
       return 1;
+   case PIPE_CAP_FRAGMENT_COLOR_CLAMP_CONTROL:
+      return 1;
    default:
       return 0;
    }




More information about the mesa-commit mailing list