diff options
author | Fredrik Höglund <[email protected]> | 2017-01-01 15:34:17 +0100 |
---|---|---|
committer | Fredrik Höglund <[email protected]> | 2017-01-05 20:52:01 +0100 |
commit | b6670157d742548e7f2430614786c733eb4c20e9 (patch) | |
tree | 17d343dad71a46720548872efa329af4cbcd9abf /src/glx | |
parent | e16245b3393911d703b688adb3ebf161e0b9ba8a (diff) |
dri3: Fix MakeCurrent without a default framebuffer
In OpenGL 3.0 and later it is legal to make a context current without
a default framebuffer.
This has been broken since DRI3 support was introduced.
Cc: "13.0 12.0" <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/glx')
-rw-r--r-- | src/glx/dri3_glx.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c index 358bd5f9feb..4472a0bed26 100644 --- a/src/glx/dri3_glx.c +++ b/src/glx/dri3_glx.c @@ -209,18 +209,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) + dri_draw = pdraw->loader_drawable.dri_drawable; + else if (draw != None) return GLXBadDrawable; - if (!(*psc->core->bindContext) (pcp->driContext, - pdraw->loader_drawable.dri_drawable, - pread->loader_drawable.dri_drawable)) + if (pread) + dri_read = pread->loader_drawable.dri_drawable; + else if (read != None) + return GLXBadDrawable; + + if (!(*psc->core->bindContext) (pcp->driContext, dri_draw, dri_read)) return GLXBadContext; return Success; |