[Mesa-dev] [PATCH] mesa: fix bad cast conversions in viewport()

Roland Scheidegger sroland at vmware.com
Mon Jul 31 23:01:53 UTC 2017


Am 31.07.2017 um 21:43 schrieb Samuel Pitoiset:
> Fixes: ddc32537d6 ("mesa: clamp viewport values only once when using glViewport()")

Reviewed-by: Roland Scheidegger <sroland at vmware.com>

FWIW there's quite some bogus function commens where the indicated
callers no longer match (e.g. "Usually called from _mesa_Viewport()."
when it's never called by that, or similarly "calls
_mesa_set_viewport()" when it doesn't do that.)

Roland

> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>  src/mesa/main/viewport.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/src/mesa/main/viewport.c b/src/mesa/main/viewport.c
> index 3dce320d1d..fc384909e6 100644
> --- a/src/mesa/main/viewport.c
> +++ b/src/mesa/main/viewport.c
> @@ -94,9 +94,10 @@ static void
>  viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei width,
>           GLsizei height)
>  {
> +   struct gl_viewport_inputs input = { x, y, width, height };
> +
>     /* Clamp the viewport to the implementation dependent values. */
> -   clamp_viewport(ctx, (GLfloat *)&x, (GLfloat *)&y,
> -                  (GLfloat *)&width, (GLfloat *)&height);
> +   clamp_viewport(ctx, &input.X, &input.Y, &input.Width, &input.Height);
>  
>     /* The GL_ARB_viewport_array spec says:
>      *
> @@ -110,7 +111,7 @@ viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei width,
>      * signal the driver once at the end.
>      */
>     for (unsigned i = 0; i < ctx->Const.MaxViewports; i++)
> -      set_viewport_no_notify(ctx, i, x, y, width, height);
> +      set_viewport_no_notify(ctx, i, input.X, input.Y, input.Width, input.Height);
>  
>     if (ctx->Driver.Viewport)
>        ctx->Driver.Viewport(ctx);
> 



More information about the mesa-dev mailing list