softpipe: enable clamping control
authorDave Airlie <airlied@redhat.com>
Thu, 5 Jan 2012 15:36:43 +0000 (15:36 +0000)
committerDave Airlie <airlied@redhat.com>
Wed, 11 Jan 2012 13:49:02 +0000 (13:49 +0000)
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@redhat.com>
src/gallium/drivers/softpipe/sp_quad_blend.c
src/gallium/drivers/softpipe/sp_screen.c

index 7180fa11c82e61dcce97e134247f57e8badaa72d..d546b14957398e5675d1504d04d35c3fc8108f56 100644 (file)
@@ -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++) {
index a9d70f94790d0b58e6c14e7bc3ee526236a891ff..37aa5852f626724c32a430702c801ab29bb1082c 100644 (file)
@@ -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;
    }