summaryrefslogtreecommitdiff
path: root/xc/lib/GL/glx/glxext.c
diff options
context:
space:
mode:
Diffstat (limited to 'xc/lib/GL/glx/glxext.c')
-rw-r--r--xc/lib/GL/glx/glxext.c44
1 files changed, 41 insertions, 3 deletions
diff --git a/xc/lib/GL/glx/glxext.c b/xc/lib/GL/glx/glxext.c
index d1389b52e..ecb4688fa 100644
--- a/xc/lib/GL/glx/glxext.c
+++ b/xc/lib/GL/glx/glxext.c
@@ -1,4 +1,5 @@
/* $XFree86: xc/lib/GL/glx/glxext.c,v 1.3 1999/12/14 01:32:24 robin Exp $ */
+
/*
** The contents of this file are subject to the GLX Public License Version 1.0
** (the "License"). You may not use this file except in compliance with the
@@ -17,7 +18,6 @@
** Those portions of the Subject Software created by Silicon Graphics, Inc.
** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
**
-** $SGI$
*/
/*
@@ -26,13 +26,17 @@
* Authors:
* Kevin E. Martin <kevin@precisioninsight.com>
*
- * $PI: xc/lib/GL/glx/glxext.c,v 1.6 1999/05/10 07:37:17 martin Exp $
*/
#include "packrender.h"
#include <stdio.h>
#include <Xext.h>
#include <extutil.h>
+#ifdef GLX_DIRECT_RENDERING
+#include "indirect_init.h"
+#include "glapi.h"
+#include <assert.h>
+#endif
#ifdef DEBUG
void __glXDumpDrawBuffer(__GLXcontext *ctx);
@@ -59,8 +63,18 @@ static __GLXcontext dummyContext = {
sizeof(dummyBuffer),
};
+
+#ifdef GLX_DIRECT_RENDERING
+/*
+** All indirect rendering contexts will share the same indirect dispatch table.
+*/
+static __GLapi *IndirectAPI = NULL;
+#endif
+
+
__GLXcontext *__glXcurrentContext = &dummyContext;
+
/*
** You can set this cell to 1 to force the gl drawing stuff to be
** one command per packet
@@ -98,6 +112,9 @@ int __glXCloseDisplay(Display *dpy, XExtCodes *codes)
gc = __glXGetCurrentContext();
if (dpy == gc->currentDpy) {
__glXSetCurrentContext(&dummyContext);
+#ifdef GLX_DIRECT_RENDERING
+ _glapi_set_dispatch(NULL); /* no-op functions */
+#endif
__glXFreeContext(gc);
}
@@ -188,6 +205,10 @@ static int __glXFreeDisplayPrivate(XExtData *extension)
priv->driDisplay.private = NULL;
#endif
+#ifdef GLX_DIRECT_RENDERING
+ XFree(priv->driDisplay.createScreen);
+#endif
+
Xfree((char*) priv);
return 0;
}
@@ -390,6 +411,14 @@ __GLXdisplayPrivate *__glXInitialize(Display* dpy)
XEDataObject dataObj;
int major, minor;
+#ifdef GLX_DIRECT_RENDERING
+ /*
+ **Initialize the indirect GLX dispatch table. It'll never change and
+ ** can be used by all indirect contexts.
+ */
+ IndirectAPI = __glXNewIndirectAPI();
+#endif
+
/* The one and only long long lock */
__glXLock();
@@ -459,7 +488,7 @@ __GLXdisplayPrivate *__glXInitialize(Display* dpy)
Xfree((char*) private);
return 0;
}
-
+
/*
** Fill in the private structure. This is the actual structure that
** hangs off of the Display structure. Our private structure is
@@ -865,6 +894,12 @@ Bool glXMakeCurrent(Display *dpy, GLXDrawable draw, GLXContext gc)
}
if (gc) {
__glXSetCurrentContext(gc);
+#ifdef GLX_DIRECT_RENDERING
+ if (!gc->isDirect) {
+ assert(IndirectAPI);
+ _glapi_set_dispatch(IndirectAPI);
+ }
+#endif
gc->currentDpy = dpy;
gc->currentDrawable = draw;
#ifdef GLX_DIRECT_RENDERING
@@ -873,6 +908,9 @@ Bool glXMakeCurrent(Display *dpy, GLXDrawable draw, GLXContext gc)
gc->currentContextTag = reply.contextTag;
} else {
__glXSetCurrentContext(&dummyContext);
+#ifdef GLX_DIRECT_RENDERING
+ _glapi_set_dispatch(NULL); /* no-op functions */
+#endif
}
}
__glXUnlock();