[Mesa-dev] [PATCH v2 2/6] mesa: add support for GL_EXT_polygon_offset_clamp

Ilia Mirkin imirkin at alum.mit.edu
Sun Feb 1 07:22:15 PST 2015


On Sun, Feb 1, 2015 at 10:18 AM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> diff --git a/src/mesa/main/polygon.c b/src/mesa/main/polygon.c
> index e3b9073..2aa8f31 100644
> --- a/src/mesa/main/polygon.c
> +++ b/src/mesa/main/polygon.c
> @@ -235,25 +235,33 @@ _mesa_GetPolygonStipple( GLubyte *dest )
>     _mesa_GetnPolygonStippleARB(INT_MAX, dest);
>  }
>
> -
> -void GLAPIENTRY
> -_mesa_PolygonOffset( GLfloat factor, GLfloat units )
> +void
> +_mesa_polygon_offset_clamp(struct gl_context *ctx,
> +                           GLfloat factor, GLfloat units, GLfloat clamp)
>  {
> -   GET_CURRENT_CONTEXT(ctx);
> -
> -   if (MESA_VERBOSE&VERBOSE_API)
> -      _mesa_debug(ctx, "glPolygonOffset %f %f\n", factor, units);
> -
>     if (ctx->Polygon.OffsetFactor == factor &&
> -       ctx->Polygon.OffsetUnits == units)
> +       ctx->Polygon.OffsetUnits == units &&
> +       ctx->Polygon.OffsetClamp == clamp)
>        return;
>
>     FLUSH_VERTICES(ctx, _NEW_POLYGON);
>     ctx->Polygon.OffsetFactor = factor;
>     ctx->Polygon.OffsetUnits = units;
> +   ctx->Polygon.OffsetClamp = clamp;
>
>     if (ctx->Driver.PolygonOffset)
> -      ctx->Driver.PolygonOffset( ctx, factor, units );
> +      ctx->Driver.PolygonOffset( ctx, factor, units, 0.0 );

That should, of course, be 'clamp', not 0.0. No driver really makes
good use of this callback though so it didn't come up in testing.
Fixed locally.

  -ilia


More information about the mesa-dev mailing list