diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index e681042bdc5..4247cb7b32c 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -221,12 +221,9 @@ dri2_create_context_attribs(struct glx_screen *base, goto error_exit; if (shareList) { - /* If the shareList context is not a DRI2 context, we cannot possibly - * create a DRI2 context that shares it. - */ - if (shareList->vtable->destroy != dri2_destroy_context) { - return NULL; - } + /* We can't share with an indirect context */ + if (!shareList->isDirect) + return NULL; pcp_shared = (struct dri2_context *) shareList; shared = pcp_shared->driContext; diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c index db1b079663f..e73cba6028c 100644 --- a/src/glx/dri3_glx.c +++ b/src/glx/dri3_glx.c @@ -268,12 +268,9 @@ dri3_create_context_attribs(struct glx_screen *base, goto error_exit; if (shareList) { - /* If the shareList context is not a DRI3 context, we cannot possibly - * create a DRI3 context that shares it. - */ - if (shareList->vtable->destroy != dri3_destroy_context) { - return NULL; - } + /* We can't share with an indirect context */ + if (!shareList->isDirect) + return NULL; pcp_shared = (struct dri3_context *) shareList; shared = pcp_shared->driContext; diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c index 122c35221ab..02fd2d5aad7 100644 --- a/src/glx/drisw_glx.c +++ b/src/glx/drisw_glx.c @@ -548,12 +548,9 @@ drisw_create_context_attribs(struct glx_screen *base, return NULL; if (shareList) { - /* If the shareList context is not a DRISW context, we cannot possibly - * create a DRISW context that shares it. - */ - if (shareList->vtable->destroy != drisw_destroy_context) { - return NULL; - } + /* We can't share with an indirect context */ + if (!shareList->isDirect) + return NULL; pcp_shared = (struct drisw_context *) shareList; shared = pcp_shared->driContext; diff --git a/src/glx/indirect_glx.c b/src/glx/indirect_glx.c index db26605b8b2..4fb4ddecc0d 100644 --- a/src/glx/indirect_glx.c +++ b/src/glx/indirect_glx.c @@ -253,10 +253,6 @@ indirect_create_context(struct glx_screen *psc, * \todo Eliminate \c __glXInitVertexArrayState. Replace it with a new * function called \c __glXAllocateClientState that allocates the memory and * does all the initialization (including the pixel pack / unpack). - * - * \note - * This function is \b not the place to validate the context creation - * parameters. It is just the allocator for the \c glx_context. */ _X_HIDDEN struct glx_context * indirect_create_context_attribs(struct glx_screen *psc, @@ -302,6 +298,10 @@ indirect_create_context_attribs(struct glx_screen *psc, return NULL; } + /* We can't share with a direct context */ + if (shareList && shareList->isDirect) + return NULL; + /* Allocate our context record */ gc = calloc(1, sizeof *gc); if (!gc) {