[Mesa-dev] [PATCH] osmesa: Unbind the current context when given a null context and buffer.
Brian Paul
brianp at vmware.com
Fri Sep 23 16:09:13 UTC 2016
On 09/22/2016 06:24 PM, Emilio Cobos Álvarez wrote:
> This is needed to be consistent with other drivers.
>
> I used both the context and the buffer as a condition in order to ensure it's an
> intentional unbind, and not a programming error, but let me know if you think I
> should change it to check only the context.
>
> Also, this is my very first mesa patch, so if this patch gets accepted I think
> someone should land it for me, since I have no access to the repo. Thanks!
>
> Signed-off-by: Emilio Cobos Álvarez <me at emiliocobos.me>
> ---
> 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 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) {
>
Looks OK to me. Reviewed-by: Brian Paul <brianp at vmware.com>
I'll push this shortly.
-Brian
More information about the mesa-dev
mailing list