aboutsummaryrefslogtreecommitdiffstats
path: root/src/glx
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2010-02-04 16:43:46 -0800
committerIan Romanick <[email protected]>2010-02-11 15:40:29 -0800
commit2243029eeec9e31b92079ff0e8fafdc0315053d6 (patch)
treebcbfd5a9b156334c22e740798c6c6435cf57e69d /src/glx
parent7bcfb66000557a0ef32bdc6b31949a92f95a9ff6 (diff)
glx: Handle imported contexts outside of CreateContext
A long time ago I was a bit over-agressive in refactoring context creation into a single function. The creation code for glXImportContextEXT does not belong in CreateContext because it does not use any GLX protocol. The big if-statement for the import case routed around almost the entire function anyway.
Diffstat (limited to 'src/glx')
-rw-r--r--src/glx/glxcmds.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index 2eee005db64..48f7049fb49 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -365,7 +365,7 @@ static GLXContext
CreateContext(Display * dpy, XVisualInfo * vis,
const __GLcontextModes * const fbconfig,
GLXContext shareList,
- Bool allowDirect, GLXContextID contextID,
+ Bool allowDirect,
unsigned code, int renderType, int screen)
{
GLXContext gc;
@@ -382,7 +382,6 @@ CreateContext(Display * dpy, XVisualInfo * vis,
if (!gc)
return NULL;
- if (None == contextID) {
if ((vis == NULL) && (fbconfig == NULL))
return NULL;
@@ -489,11 +488,6 @@ CreateContext(Display * dpy, XVisualInfo * vis,
UnlockDisplay(dpy);
SyncHandle();
gc->imported = GL_FALSE;
- }
- else {
- gc->xid = contextID;
- gc->imported = GL_TRUE;
- }
gc->renderType = renderType;
@@ -504,7 +498,7 @@ PUBLIC GLXContext
glXCreateContext(Display * dpy, XVisualInfo * vis,
GLXContext shareList, Bool allowDirect)
{
- return CreateContext(dpy, vis, NULL, shareList, allowDirect, None,
+ return CreateContext(dpy, vis, NULL, shareList, allowDirect,
X_GLXCreateContext, 0, vis->screen);
}
@@ -1754,14 +1748,14 @@ glXImportContextEXT(Display * dpy, GLXContextID contextID)
return NULL;
}
- /* FIXME: Why does this call CreateContext? There is no protocol sent for
- * FIXME: this function.
- */
- ctx = CreateContext(dpy, NULL, NULL, NULL, False, contextID,
- X_GLXCreateContext, 0, 0);
+ ctx = AllocateGLXContext(dpy);
if (NULL != ctx) {
+ ctx->xid = contextID;
+ ctx->imported = GL_TRUE;
+
if (Success != __glXQueryContextInfo(dpy, ctx)) {
- return NULL;
+ __glXFreeContext(ctx);
+ ctx = NULL;
}
}
return ctx;
@@ -1811,7 +1805,7 @@ glXCreateNewContext(Display * dpy, GLXFBConfig config,
(const __GLcontextModes *const) config;
return CreateContext(dpy, NULL, fbconfig, shareList,
- allowDirect, None, X_GLXCreateNewContext, renderType,
+ allowDirect, X_GLXCreateNewContext, renderType,
fbconfig->screen);
}
@@ -2300,7 +2294,7 @@ glXCreateContextWithConfigSGIX(Display * dpy,
if ((psc != NULL)
&& __glXExtensionBitIsEnabled(psc, SGIX_fbconfig_bit)) {
gc = CreateContext(dpy, NULL, (__GLcontextModes *) config, shareList,
- allowDirect, None,
+ allowDirect,
X_GLXvop_CreateContextWithConfigSGIX, renderType,
fbconfig->screen);
}