[Mesa-dev] [PATCH 10/11] i965/gen6: Add support for point min/max size from ARB_point_parameters.

Eric Anholt eric at anholt.net
Sat May 14 10:44:48 PDT 2011


On Fri, 13 May 2011 15:56:28 -0700, Kenneth Graunke <kenneth at whitecape.org> wrote:
> On 05/12/2011 09:05 PM, Eric Anholt wrote:
> > Fixes glean pointAtten.
> > ---
> >   src/mesa/drivers/dri/i965/gen6_sf_state.c |    9 +++++++--
> >   1 files changed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/mesa/drivers/dri/i965/gen6_sf_state.c b/src/mesa/drivers/dri/i965/gen6_sf_state.c
> > index 50a5ad3..f96cfe5 100644
> > --- a/src/mesa/drivers/dri/i965/gen6_sf_state.c
> > +++ b/src/mesa/drivers/dri/i965/gen6_sf_state.c
> > @@ -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, in fixed point */
> > +   dw4 |= CLAMP(U_FIXED(point_size, 3), 1, 0x7ff);
> > +
> >      if (ctx->Point.SpriteOrigin == GL_LOWER_LEFT)
> >         dw1 |= GEN6_SF_POINT_SPRITE_LOWERLEFT;
> 
> Why the change to clamp in fixed point?  Unless it's necessary for 
> correctness, I'd prefer to stick with 0.125 and 255.875, since those are 
> directly readable/searchable in the hardware documentation, while 0x7ff 
> is not.

My concern was justifying to myself that 0.125 and 255.875 would produce
exactly 1 and 0x7ff after U_FIXED.  Since they do actually produce the
correct numbers, I went with your change.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20110514/b8f1d942/attachment.pgp>


More information about the mesa-dev mailing list