From cb7c2c9d65d8a1db31e65023175ee81e029ed041 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Thu, 22 Sep 2016 18:24:00 -0600 Subject: [PATCH] osmesa: Unbind the current context when given a null context and buffer. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This is needed to be consistent with other drivers. Signed-off-by: Emilio Cobos Álvarez Reviewed-by: Brian Paul --- src/mesa/drivers/osmesa/osmesa.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c index 8462ab6627d..356ba71ea83 100644 --- a/src/mesa/drivers/osmesa/osmesa.c +++ b/src/mesa/drivers/osmesa/osmesa.c @@ -966,6 +966,9 @@ OSMesaDestroyContext( OSMesaContext osmesa ) * If the context's viewport hasn't been initialized yet, it will now be * initialized to (0,0,width,height). * + * If both the context and the buffer are null, the current context will be + * unbound. + * * Input: osmesa - the rendering context * buffer - the image buffer memory * type - data type for pixel components @@ -983,6 +986,10 @@ GLAPI GLboolean GLAPIENTRY OSMesaMakeCurrent( OSMesaContext osmesa, void *buffer, GLenum type, GLsizei width, GLsizei height ) { + if (!osmesa && !buffer) { + return _mesa_make_current(NULL, NULL, NULL); + } + if (!osmesa || !buffer || width < 1 || height < 1 || width > SWRAST_MAX_WIDTH || height > SWRAST_MAX_HEIGHT) { -- 2.30.2