summaryrefslogtreecommitdiff
path: root/src/glx/glxcurrent.c
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@apple.com>2010-04-01 17:00:22 -0700
committerJeremy Huddleston <jeremyhu@apple.com>2010-04-01 17:01:51 -0700
commit115203281cf791221f586f03c14cfe4e0a44dd7a (patch)
tree767951e542d416243041b964dd252e030cfadf5e /src/glx/glxcurrent.c
parent9aadc793f3db64cefa0b08f18abad424a659dacc (diff)
Revert accidental commits from the xquartz tree
This reverts commit 9aadc793f3db64cefa0b08f18abad424a659dacc. This reverts commit 69ea4e7718efb60b6b0d795a355cebd6712ceac1. This reverts commit dbe8b013936d977ec63d6607bfd2fc6772d29787. This reverts commit 23215ef4d60a86d9f3b3fdc08e3fdadc59e98890. This reverts commit 9495e3703062d1ddaf3161f4efc23f0b51284d9b. This reverts commit 0594cf70883b64692ba617d85f4f9b4e636e5c2b. This reverts commit 86a7978d37393ee34f876569ac06ffdb8d7289ae. This reverts commit 437902ce978cde9a0e1aa260f12dc232a8501c42.
Diffstat (limited to 'src/glx/glxcurrent.c')
-rw-r--r--src/glx/glxcurrent.c69
1 files changed, 13 insertions, 56 deletions
diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c
index 691e8dfadf..c28360bdde 100644
--- a/src/glx/glxcurrent.c
+++ b/src/glx/glxcurrent.c
@@ -33,20 +33,9 @@
* Client-side GLX interface for current context management.
*/
-#ifdef PTHREADS
-#include <pthread.h>
-#endif
-
#include "glxclient.h"
-#ifdef GLX_USE_APPLEGL
-#include <stdlib.h>
-
-#include "apple_glx.h"
-#include "apple_glx_context.h"
-#else
#include "glapi.h"
#include "indirect_init.h"
-#endif
/*
** We setup some dummy structures here so that the API can be used
@@ -70,12 +59,11 @@ static __GLXcontext dummyContext = {
};
-#ifndef GLX_USE_APPLEGL
/*
** All indirect rendering contexts will share the same indirect dispatch table.
*/
static __GLapi *IndirectAPI = NULL;
-#endif
+
/*
* Current context management and locking
@@ -168,12 +156,10 @@ _X_HIDDEN void
__glXSetCurrentContextNull(void)
{
__glXSetCurrentContext(&dummyContext);
-#ifndef GLX_USE_APPLEGL
-#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
+#ifdef GLX_DIRECT_RENDERING
_glapi_set_dispatch(NULL); /* no-op functions */
_glapi_set_context(NULL);
#endif
-#endif
}
@@ -200,7 +186,6 @@ glXGetCurrentDrawable(void)
}
-#ifndef GLX_USE_APPLEGL
/************************************************************************/
/**
@@ -284,7 +269,7 @@ SendMakeCurrentRequest(Display * dpy, CARD8 opcode,
}
-#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
+#ifdef GLX_DIRECT_RENDERING
static __GLXDRIdrawable *
FetchDRIDrawable(Display * dpy, GLXDrawable glxDrawable, GLXContext gc)
{
@@ -328,8 +313,6 @@ __glXGenerateError(Display * dpy, GLXContext gc, XID resource,
_XError(dpy, &error);
}
-#endif /* GLX_USE_APPLEGL */
-
/**
* Make a particular context current.
*
@@ -339,17 +322,8 @@ static Bool
MakeContextCurrent(Display * dpy, GLXDrawable draw,
GLXDrawable read, GLXContext gc)
{
- const GLXContext oldGC = __glXGetCurrentContext();
-#ifdef GLX_USE_APPLEGL
- bool error = apple_glx_make_current_context(dpy,
- (oldGC && oldGC != &dummyContext) ? oldGC->driContext : NULL,
- gc ? gc->driContext : NULL, draw);
-
- apple_glx_diagnostic("%s: error %s\n", __func__, error ? "YES" : "NO");
- if(error)
- return GL_FALSE;
-#else
xGLXMakeCurrentReply reply;
+ const GLXContext oldGC = __glXGetCurrentContext();
const CARD8 opcode = __glXSetupForCommand(dpy);
const CARD8 oldOpcode = ((gc == oldGC) || (oldGC == &dummyContext))
? opcode : __glXSetupForCommand(oldGC->currentDpy);
@@ -386,7 +360,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
return False;
}
-#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
+#ifdef GLX_DIRECT_RENDERING
/* Bind the direct rendering context to the drawable */
if (gc && gc->driContext) {
__GLXDRIdrawable *pdraw = FetchDRIDrawable(dpy, draw, gc);
@@ -421,7 +395,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
return False;
}
-#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
+#ifdef GLX_DIRECT_RENDERING
if ((dpy != oldGC->currentDpy || (gc && gc->driContext)) &&
!oldGC->isDirect && oldGC != &dummyContext) {
#else
@@ -439,13 +413,12 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
oldGC->currentContextTag, None, None,
&dummy_reply);
}
-#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
+#ifdef GLX_DIRECT_RENDERING
else if (oldGC->driContext && oldGC != gc) {
oldGC->driContext->unbindContext(oldGC->driContext);
}
#endif
-#endif /* GLX_USE_APPLEGL */
/* Update our notion of what is current */
__glXLock();
@@ -455,10 +428,8 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
* cannot be NULL, therefore if they are the same, gc is not
* NULL and not the dummy.
*/
- if(gc) {
- gc->currentDrawable = draw;
- gc->currentReadable = read;
- }
+ gc->currentDrawable = draw;
+ gc->currentReadable = read;
}
else {
if (oldGC != &dummyContext) {
@@ -468,24 +439,13 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
oldGC->currentReadable = None;
oldGC->currentContextTag = 0;
oldGC->thread_id = 0;
-#ifdef GLX_USE_APPLEGL
-
- /*
- * At this point we should check if the context has been
- * through glXDestroyContext, and redestroy it if so.
- */
- if(oldGC->do_destroy) {
- __glXUnlock();
- /* glXDestroyContext uses the same global lock. */
- glXDestroyContext(dpy, oldGC);
- __glXLock();
-#else
+
if (oldGC->xid == None) {
/* We are switching away from a context that was
* previously destroyed, so we need to free the memory
* for the old handle.
*/
-#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
+#ifdef GLX_DIRECT_RENDERING
/* Destroy the old direct rendering context */
if (oldGC->driContext) {
oldGC->driContext->destroyContext(oldGC->driContext,
@@ -495,7 +455,6 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
}
#endif
__glXFreeContext(oldGC);
-#endif /* GLX_USE_APPLEGL */
}
}
if (gc) {
@@ -504,10 +463,9 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
gc->currentDpy = dpy;
gc->currentDrawable = draw;
gc->currentReadable = read;
-#ifndef GLX_USE_APPLEGL
gc->thread_id = _glthread_GetID();
-#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
+#ifdef GLX_DIRECT_RENDERING
if (!gc->driContext) {
#endif
if (!IndirectAPI)
@@ -522,13 +480,12 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
(void) glGetString(GL_VERSION);
__glXInitVertexArrayState(gc);
}
-#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
+#ifdef GLX_DIRECT_RENDERING
}
else {
gc->currentContextTag = -1;
}
#endif
-#endif /* GLX_USE_APPLEGL */
}
else {
__glXSetCurrentContextNull();