glx: Fix and simplify the share context compatibility check
We only end up with one DRI provider per screen, so the only way the context vtable can differ is if they're not the same directness. Rewrite the test in those terms to help us unify some of this code away in the future. Also apply the same logic to the indirect context creation path. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12456>
This commit is contained in:
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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) {
|
||||
|
Reference in New Issue
Block a user