Adam Jackson <a...@redhat.com> writes:

> Fixes 14 piglits, mostly in egl_khr_create_context.
>
> Fixes: https://github.com/anholt/libepoxy/issues/177
> Signed-off-by: Adam Jackson <a...@redhat.com>
> ---
>  src/mesa/drivers/dri/swrast/swrast.c | 34 +++++++++++++++-------------
>  1 file changed, 18 insertions(+), 16 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/swrast/swrast.c 
> b/src/mesa/drivers/dri/swrast/swrast.c
> index ae5874f5927..7f08107c24f 100644
> --- a/src/mesa/drivers/dri/swrast/swrast.c
> +++ b/src/mesa/drivers/dri/swrast/swrast.c
> @@ -675,6 +675,9 @@ swrast_check_and_update_window_size( struct gl_context 
> *ctx, struct gl_framebuff
>  {
>      GLsizei width, height;
>  
> +    if (!fb)
> +        return;
> +
>      get_window_size(fb, &width, &height);
>      if (fb->Width != width || fb->Height != height) {
>       _mesa_resize_framebuffer(ctx, fb, width, height);
> @@ -857,30 +860,29 @@ dri_make_current(__DRIcontext * cPriv,
>                __DRIdrawable * driReadPriv)
>  {
>      struct gl_context *mesaCtx;
> -    struct gl_framebuffer *mesaDraw;
> -    struct gl_framebuffer *mesaRead;
> +    struct gl_framebuffer *mesaDraw = NULL;
> +    struct gl_framebuffer *mesaRead = NULL;
>      TRACE;
>  
>      if (cPriv) {
> -     struct dri_context *ctx = dri_context(cPriv);
>       struct dri_drawable *draw;
>       struct dri_drawable *read;
>  
> -     if (!driDrawPriv || !driReadPriv)
> -         return GL_FALSE;
> +        mesaCtx = &dri_context(cPriv)->Base;
>  
> -     draw = dri_drawable(driDrawPriv);
> -     read = dri_drawable(driReadPriv);
> -     mesaCtx = &ctx->Base;
> -     mesaDraw = &draw->Base;
> -     mesaRead = &read->Base;
> +     if (driDrawPriv && driReadPriv) {
> +           draw = dri_drawable(driDrawPriv);
> +           read = dri_drawable(driReadPriv);
> +           mesaDraw = &draw->Base;
> +           mesaRead = &read->Base;
>  
> -     /* check for same context and buffer */
> -     if (mesaCtx == _mesa_get_current_context()
> -         && mesaCtx->DrawBuffer == mesaDraw
> -         && mesaCtx->ReadBuffer == mesaRead) {
> -         return GL_TRUE;
> -     }
> +           /* check for same context and buffer */
> +           if (mesaCtx == _mesa_get_current_context()
> +               && mesaCtx->DrawBuffer == mesaDraw
> +               && mesaCtx->ReadBuffer == mesaRead) {
> +               return GL_TRUE;
> +           }
> +        }

Didn't you mean for this block to be outside of the driDrawPriv &&
driReadPriv condition?  That way you can get the short-circuit in the
no-drawable case, too.

Other than that,

Reviewed-by: Eric Anholt <e...@anholt.net>

Attachment: signature.asc
Description: PGP signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to