GLX_ARB_create_context spec says: If either <draw> or <read> are not a valid GLX drawable, a GLXBadDrawable error is generated, unless <draw> and <read> are both None and the OpenGL version supported by <ctx> is 3.0 or greater.
So when both <draw> and <read> are None, it could pass NULL drawable into driver instead of returing GLXBadDrawable. https://bugs.freedesktop.org/show_bug.cgi?id=79629 Signed-off-by: Xiong Zhang <xiong.y.zh...@intel.com> --- src/glx/dri3_glx.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c index 1ddc723..9cd0aab 100644 --- a/src/glx/dri3_glx.c +++ b/src/glx/dri3_glx.c @@ -133,17 +133,24 @@ dri3_bind_context(struct glx_context *context, struct glx_context *old, struct dri3_context *pcp = (struct dri3_context *) context; struct dri3_screen *psc = (struct dri3_screen *) pcp->base.psc; struct dri3_drawable *pdraw, *pread; + __DRIdrawable *dri_draw = NULL, *dri_read = NULL; pdraw = (struct dri3_drawable *) driFetchDrawable(context, draw); pread = (struct dri3_drawable *) driFetchDrawable(context, read); driReleaseDrawables(&pcp->base); - if (pdraw == NULL || pread == NULL) + if ((pdraw == NULL && draw != None) || + (pread == NULL && read != None)) return GLXBadDrawable; - if (!(*psc->core->bindContext) (pcp->driContext, - pdraw->driDrawable, pread->driDrawable)) + if (pdraw) + dri_draw = pdraw->driDrawable; + + if (pread) + dri_read = pread->driDrawable; + + if (!(*psc->core->bindContext) (pcp->driContext, dri_draw, dri_read)) return GLXBadContext; return Success; -- 2.1.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev