summaryrefslogtreecommitdiffstats
path: root/src/glx
diff options
context:
space:
mode:
authorColin McDonald <cjmmail10-bz@yahoo.co.uk>2016-06-22 19:07:49 -0700
committerMatt Turner <mattst88@gmail.com>2016-07-08 14:02:56 -0700
commitd57c85c1bf77f194720ab8d8dfa4b4885e44157d (patch)
tree8504c1ee62dee607a3edb90824653b9ac0cec479 /src/glx
parent64ac4aef2766261fe544fbc7d74dabc5f5ebefae (diff)
downloadexternal_mesa3d-d57c85c1bf77f194720ab8d8dfa4b4885e44157d.zip
external_mesa3d-d57c85c1bf77f194720ab8d8dfa4b4885e44157d.tar.gz
external_mesa3d-d57c85c1bf77f194720ab8d8dfa4b4885e44157d.tar.bz2
glx: Call __glXInitVertexArrayState() with a usable gc.
For each indirect context the indirect vertex array state must be initialised by __glXInitVertexArrayState in indirect_vertex_array.c. As noted in the routine header it requires that the glx context has been setup prior to the call, in order to test the server version and extensions. Currently __glXInitVertexArrayState is called from indirect_bind_context in indirect_glx.c, as follows: state = gc->client_state_private; if (state->array_state == NULL) { glGetString(GL_EXTENSIONS); glGetString(GL_VERSION); __glXInitVertexArrayState(gc); } But, the gc context is not yet usable at this stage, so the server queries fail, and __glXInitVertexArrayState is called without the server version and extension information it needs. This breaks multi-texturing as glXInitVertexArrayState doesn't get GL_MAX_TEXTURE_UNITS. It probably also breaks setup of other arrays: fog, secondary colour, vertex attributes. To fix this I have moved the call to __glXInitVertexArrayState to the end of MakeContextCurrent in glxcurrent.c, where the glx context is usable. Fixes a regression caused by commit 4fbdde889c. Fixes ARB_vertex_program usage in the arbvparray Mesa demo when run with indirect GLX and also the tex-skipped-unit piglit test when run with indirect GLX. Reviewed-by: Matt Turner <mattst88@gmail.com> Acked-by: Ian Romanick <ian.d.romanick@intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=61907
Diffstat (limited to 'src/glx')
-rw-r--r--src/glx/glxcurrent.c12
-rw-r--r--src/glx/indirect_glx.c8
2 files changed, 12 insertions, 8 deletions
diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c
index f2e3865..d119326 100644
--- a/src/glx/glxcurrent.c
+++ b/src/glx/glxcurrent.c
@@ -252,6 +252,18 @@ 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 1991f70..51dd2ca 100644
--- a/src/glx/indirect_glx.c
+++ b/src/glx/indirect_glx.c
@@ -131,7 +131,6 @@ indirect_bind_context(struct glx_context *gc, struct glx_context *old,
GLXDrawable draw, GLXDrawable read)
{
GLXContextTag tag;
- __GLXattribute *state;
Display *dpy = gc->psc->dpy;
int opcode = __glXSetupForCommand(dpy);
Bool sent;
@@ -150,13 +149,6 @@ indirect_bind_context(struct glx_context *gc, struct glx_context *old,
IndirectAPI = __glXNewIndirectAPI();
_glapi_set_dispatch(IndirectAPI);
- state = gc->client_state_private;
- if (state->array_state == NULL) {
- glGetString(GL_EXTENSIONS);
- glGetString(GL_VERSION);
- __glXInitVertexArrayState(gc);
- }
-
return !sent;
}