summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/osmesa/osmesa.c
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <me@emiliocobos.me>2016-09-22 18:24:00 -0600
committerBrian Paul <brianp@vmware.com>2016-09-23 19:55:50 -0600
commitcb7c2c9d65d8a1db31e65023175ee81e029ed041 (patch)
tree3110b3cfd407debff39fee73838e3e8371a16eae /src/mesa/drivers/osmesa/osmesa.c
parent07d1f8faf9a7b4bdf6989de7df928105cd248251 (diff)
downloadexternal_mesa3d-cb7c2c9d65d8a1db31e65023175ee81e029ed041.zip
external_mesa3d-cb7c2c9d65d8a1db31e65023175ee81e029ed041.tar.gz
external_mesa3d-cb7c2c9d65d8a1db31e65023175ee81e029ed041.tar.bz2
osmesa: Unbind the current context when given a null context and buffer.
This is needed to be consistent with other drivers. Signed-off-by: Emilio Cobos Álvarez <me@emiliocobos.me> Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'src/mesa/drivers/osmesa/osmesa.c')
-rw-r--r--src/mesa/drivers/osmesa/osmesa.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c
index 8462ab6..356ba71 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) {