diff options
author | Adam Jackson <[email protected]> | 2017-11-14 15:13:03 -0500 |
---|---|---|
committer | Adam Jackson <[email protected]> | 2019-09-23 20:21:01 -0400 |
commit | 01e437988d7b34065059cc1715aedd09adaf5cdd (patch) | |
tree | e98fb7c40055c7daa07fbfd058393edb984431b9 /src/glx | |
parent | b9e93db20896a436c716107dd0d12057b3aa9f72 (diff) |
glx: Move vertex array protocol state into the indirect backend
Only relevant for indirect contexts, so let's get that code out of the
common path.
Diffstat (limited to 'src/glx')
-rw-r--r-- | src/glx/glxcurrent.c | 12 | ||||
-rw-r--r-- | src/glx/indirect_glx.c | 26 |
2 files changed, 22 insertions, 16 deletions
diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c index 9c5d2af8956..a388df7a78d 100644 --- a/src/glx/glxcurrent.c +++ b/src/glx/glxcurrent.c @@ -245,18 +245,6 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw, __glXUnlock(); - /* The indirect vertex array state must to be initialised after we - * have setup the context, as it needs to query server attributes. - */ - if (gc && !gc->isDirect) { - __GLXattribute *state = gc->client_state_private; - if (state && state->array_state == NULL) { - glGetString(GL_EXTENSIONS); - glGetString(GL_VERSION); - __glXInitVertexArrayState(gc); - } - } - return GL_TRUE; } diff --git a/src/glx/indirect_glx.c b/src/glx/indirect_glx.c index d4a0b640ada..f370daf8bb6 100644 --- a/src/glx/indirect_glx.c +++ b/src/glx/indirect_glx.c @@ -34,7 +34,7 @@ #include "glapi.h" #include "glxclient.h" - +#include "indirect.h" #include "util/debug.h" #ifndef GLX_USE_APPLEGL @@ -148,9 +148,27 @@ indirect_bind_context(struct glx_context *gc, struct glx_context *old, sent = SendMakeCurrentRequest(dpy, gc->xid, tag, draw, read, &gc->currentContextTag); - if (!IndirectAPI) - IndirectAPI = __glXNewIndirectAPI(); - _glapi_set_dispatch(IndirectAPI); + if (sent) { + if (!IndirectAPI) + IndirectAPI = __glXNewIndirectAPI(); + _glapi_set_dispatch(IndirectAPI); + + /* The indirect vertex array state must to be initialised after we + * have setup the context, as it needs to query server attributes. + * + * At the point this is called gc->currentDpy is not initialized + * nor is the thread's current context actually set. Hence the + * cleverness before the GetString calls. + */ + __GLXattribute *state = gc->client_state_private; + if (state && state->array_state == NULL) { + gc->currentDpy = gc->psc->dpy; + __glXSetCurrentContext(gc); + __indirect_glGetString(GL_EXTENSIONS); + __indirect_glGetString(GL_VERSION); + __glXInitVertexArrayState(gc); + } + } return !sent; } |