diff options
author | Adam Jackson <[email protected]> | 2018-07-09 12:51:37 -0400 |
---|---|---|
committer | Adam Jackson <[email protected]> | 2018-07-09 16:09:58 -0400 |
commit | c1ec5820593184304d3ac3622b53f08ef610be4d (patch) | |
tree | 8e467e25f8306b0e90e699c96f17fa6d955a6677 /src/mesa/drivers/dri/swrast | |
parent | 7205bdf41f41fc3ec1c661a2974bb9c45631f042 (diff) |
swrast: Fix eglMakeCurrent(dpy, NULL, NULL, ctx) (v2)
Fixes 14 piglits, mostly in egl_khr_create_context.
v2: Also short-circuit the same-context-no-drawables case (Eric Anholt)
Fixes: https://github.com/anholt/libepoxy/issues/177
Reviewed-by: Eric Anholt <[email protected]>
Signed-off-by: Adam Jackson <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/swrast')
-rw-r--r-- | src/mesa/drivers/dri/swrast/swrast.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c index ae5874f5927..a88ece97f3b 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,26 @@ 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; - - draw = dri_drawable(driDrawPriv); - read = dri_drawable(driReadPriv); - mesaCtx = &ctx->Base; - 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; - } + mesaCtx = &dri_context(cPriv)->Base; + + if (driDrawPriv && driReadPriv) { + struct dri_drawable *draw = dri_drawable(driDrawPriv); + struct dri_drawable *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; + } _glapi_check_multithread(); |