[Mesa-dev] [PATCH] main: Fix deprecation of glLineWidth()
Matt Turner
mattst88 at gmail.com
Wed Aug 7 11:56:47 PDT 2013
On Wed, Aug 7, 2013 at 10:28 AM, Paul Berry <stereotype441 at gmail.com> wrote:
> From section E.1 (Profiles and Deprecated Features of OpenGL 3.0)
> of the OpenGL 3.0 spec:
>
> "LineWidth is not deprecated, but values greater than 1.0
> will generate an INVALID VALUE error"
>
> From context it is clear that values greater than 1.0 should only
> generate an INVALID VALUE error in a forward-compatible context.
>
> The code was correctly quoting this spec text, but it was disallowing
> all line widths in forward-compatible contexts, instead of just widths
> greater than 1.0.
>
> This patch introduces the correct check, so that setting a line width
> of 1.0 or less is permitted.
> ---
> src/mesa/main/lines.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/main/lines.c b/src/mesa/main/lines.c
> index 0df9d66..3c08ed2 100644
> --- a/src/mesa/main/lines.c
> +++ b/src/mesa/main/lines.c
> @@ -56,19 +56,20 @@ _mesa_LineWidth( GLfloat width )
> * "Wide lines and line stipple - LineWidth is not deprecated, but
> * values greater than 1.0 will generate an INVALID_VALUE error;"
> *
> * This is one of the very few cases where functionality was deprecated but
> * *NOT* removed in a later spec. Therefore, we only disallow this in a
> * forward compatible context.
> */
> if (ctx->API == API_OPENGL_CORE
> && ((ctx->Const.ContextFlags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT)
> - != 0)) {
> + != 0)
> + && width > 1.0) {
> _mesa_error( ctx, GL_INVALID_VALUE, "glLineWidth" );
> return;
> }
>
> if (ctx->Line.Width == width)
> return;
>
> FLUSH_VERTICES(ctx, _NEW_LINE);
> ctx->Line.Width = width;
> --
> 1.8.3.4
Reviewed-by: Matt Turner <mattst88 at gmail.com>
More information about the mesa-dev
mailing list