i965/gen6: Add support for point min/max size from ARB_point_parameters.
authorEric Anholt <eric@anholt.net>
Thu, 12 May 2011 21:19:51 +0000 (14:19 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 18 May 2011 20:57:17 +0000 (13:57 -0700)
Fixes glean pointAtten.

src/mesa/drivers/dri/i965/gen6_sf_state.c

index 8c06ff8f1901439c1ec06d430c862e96c8c2f7a2..84028e4e758c73e5071c26996dd02f858dbbc346 100644 (file)
@@ -103,6 +103,7 @@ upload_sf_state(struct brw_context *brw)
    int attr = 0;
    int urb_start;
    int two_side_color = (ctx->Light.Enabled && ctx->Light.Model.TwoSide);
+   float point_size;
 
    /* _NEW_TRANSFORM */
    if (ctx->Transform.ClipPlanesEnabled)
@@ -209,8 +210,12 @@ upload_sf_state(struct brw_context *brw)
         ctx->Point._Attenuated))
       dw4 |= GEN6_SF_USE_STATE_POINT_WIDTH;
 
-   dw4 |= U_FIXED(CLAMP(ctx->Point.Size, 0.125, 255.875), 3) <<
-      GEN6_SF_POINT_WIDTH_SHIFT;
+   /* Clamp to ARB_point_parameters user limits */
+   point_size = CLAMP(ctx->Point.Size, ctx->Point.MinSize, ctx->Point.MaxSize);
+
+   /* Clamp to the hardware limits and convert to fixed point */
+   dw4 |= U_FIXED(CLAMP(point_size, 0.125, 255.875), 3);
+
    if (ctx->Point.SpriteOrigin == GL_LOWER_LEFT)
       dw1 |= GEN6_SF_POINT_SPRITE_LOWERLEFT;