diff options
author | Keith Packard <keithp@keithp.com> | 2008-05-04 22:24:56 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2008-05-04 22:24:56 -0700 |
commit | 33e5a176e62a0114cb8cca9447798c6d6b6665ed (patch) | |
tree | 8efa34606aae171fe1bad7aff993a2a94910d76e /GL | |
parent | e48f6bcd94b310e5c79939bdb1703f9555a3cdd1 (diff) | |
parent | efa65a0317e12c9ad34fa00fe90bf5eae9fa2670 (diff) |
Merge commit 'origin/master' into transform-proposal-oldtransform-proposal
Conflicts:
configure.ac
exa/exa.c
Diffstat (limited to 'GL')
-rw-r--r-- | GL/Makefile.am | 7 | ||||
-rw-r--r-- | GL/apple/Makefile.am | 24 | ||||
-rw-r--r-- | GL/apple/aglGlx.c | 1354 | ||||
-rw-r--r-- | GL/apple/indirect.c | 1938 | ||||
-rw-r--r-- | GL/glx/Makefile.am | 5 | ||||
-rw-r--r-- | GL/glx/glxglcore.c | 87 | ||||
-rw-r--r-- | GL/glx/glxscreens.c | 15 | ||||
-rw-r--r-- | GL/glx/glxutil.c | 58 | ||||
-rw-r--r-- | GL/mesa/.gitignore | 32 | ||||
-rw-r--r-- | GL/mesa/Makefile.am | 18 | ||||
-rw-r--r-- | GL/mesa/X/Makefile.am | 27 | ||||
-rw-r--r-- | GL/mesa/dummy.c | 0 | ||||
-rw-r--r-- | GL/mesa/glapi/Makefile.am | 20 | ||||
-rw-r--r-- | GL/mesa/main/Makefile.am | 86 | ||||
-rw-r--r-- | GL/mesa/math/Makefile.am | 27 | ||||
-rw-r--r-- | GL/mesa/shader/Makefile.am | 39 | ||||
-rw-r--r-- | GL/mesa/shader/grammar/Makefile.am | 20 | ||||
-rw-r--r-- | GL/mesa/shader/slang/Makefile.am | 41 | ||||
-rw-r--r-- | GL/mesa/swrast/Makefile.am | 50 | ||||
-rw-r--r-- | GL/mesa/swrast_setup/Makefile.am | 20 | ||||
-rw-r--r-- | GL/mesa/tnl/Makefile.am | 37 | ||||
-rw-r--r-- | GL/mesa/vbo/Makefile.am | 35 | ||||
-rwxr-xr-x | GL/symlink-mesa.sh | 166 |
23 files changed, 132 insertions, 3974 deletions
diff --git a/GL/Makefile.am b/GL/Makefile.am index 29d03f2d6..c3ac15564 100644 --- a/GL/Makefile.am +++ b/GL/Makefile.am @@ -1,9 +1,4 @@ -if XQUARTZ -XQUARTZ_SUBDIRS = apple -endif - -SUBDIRS = glx mesa $(XQUARTZ_SUBDIRS) -DIST_SUBDIRS = glx mesa apple +SUBDIRS = glx WINDOWS_EXTRAS = \ windows/ChangeLog \ diff --git a/GL/apple/Makefile.am b/GL/apple/Makefile.am deleted file mode 100644 index c064c03f8..000000000 --- a/GL/apple/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -AM_CFLAGS = $(DIX_CFLAGS) -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/GL/glx \ - -I$(top_srcdir)/GL/include \ - -I$(top_srcdir)/GL/mesa/glapi \ - -I$(top_srcdir)/hw/xquartz \ - -I$(top_srcdir)/hw/xquartz/xpr \ - -I$(top_srcdir)/miext/damage - -if HAVE_AGL_FRAMEWORK -noinst_LIBRARIES = libAGLcore.a -libAGLcore_a_SOURCES = aglGlx.c \ - $(top_srcdir)/hw/xquartz/xpr/x-list.c \ - $(top_srcdir)/hw/xquartz/xpr/x-list.h \ - $(top_srcdir)/hw/xquartz/xpr/x-hash.c \ - $(top_srcdir)/hw/xquartz/xpr/x-hash.h \ - $(top_srcdir)/hw/dmx/glxProxy/compsize.c -endif - -#noinst_LIBRARIES = libCGLcore.a -#libCGLcore_a_SOURCES = \ -# indirect.c \ -# $(top_srcdir)/hw/dmx/glxProxy/compsize.c diff --git a/GL/apple/aglGlx.c b/GL/apple/aglGlx.c deleted file mode 100644 index 900a9a96e..000000000 --- a/GL/apple/aglGlx.c +++ /dev/null @@ -1,1354 +0,0 @@ -/* - * GLX implementation that uses Apple's AGL.framework for OpenGL - * - * FIXME: This file and indirect.c are very similar. The two should be - * merged by introducing suitable abstractions. - */ -/* - * Copyright (c) 2002 Greg Parker. All Rights Reserved. - * Copyright (c) 2004 Torrey T. Lyons. All Rights Reserved. - * - * Large portions of this file are copied from Mesa's xf86glx.c, - * which contains the following copyright: - * - * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "quartzCommon.h" -#include <AGL/agl.h> -#include "cr.h" - -// X11 and X11's glx -#undef BOOL -#define BOOL xBOOL -#include "quartz.h" -#include <miscstruct.h> -#include <windowstr.h> -#include <resource.h> -#include <GL/glxint.h> -#include <GL/glxtokens.h> -#include <scrnintstr.h> -#include <glxserver.h> -#include <glxscreens.h> -#include <glxdrawable.h> -#include <glxcontext.h> -#include <glxext.h> -#include <glxutil.h> -#include <glxscreens.h> -#include <GL/internal/glcore.h> -#undef BOOL - -#include "glcontextmodes.h" - -// ggs: needed to call back to glx with visual configs -extern void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, void **configprivs); - -// Write debugging output, or not -#ifdef GLAQUA_DEBUG -#define GLAQUA_DEBUG_MSG ErrorF -#else -#define GLAQUA_DEBUG_MSG(a, ...) -#endif - - -// The following GL functions don't have an EXT suffix in OpenGL.framework. -GLboolean glAreTexturesResidentEXT (GLsizei a, const GLuint *b, GLboolean *c) { - return glAreTexturesResident(a, b, c); -} -void glDeleteTexturesEXT (GLsizei d, const GLuint *e) { - glDeleteTextures(d, e); -} -void glGenTexturesEXT (GLsizei f, GLuint *g) { - glGenTextures(f, g); -} -GLboolean glIsTextureEXT (GLuint h) { - return glIsTexture(h); -} - - -// some prototypes -static Bool glAquaScreenProbe(int screen); -static Bool glAquaInitVisuals(VisualPtr *visualp, DepthPtr *depthp, - int *nvisualp, int *ndepthp, - int *rootDepthp, VisualID *defaultVisp, - unsigned long sizes, int bitsPerRGB); -static void glAquaSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, - void **privates); -static __GLinterface *glAquaCreateContext(__GLimports *imports, - __GLcontextModes *mode, - __GLinterface *shareGC); -static void glAquaCreateBuffer(__GLXdrawablePrivate *glxPriv); -static void glAquaResetExtension(void); - - -/* - * This structure is statically allocated in the __glXScreens[] - * structure. This struct is not used anywhere other than in - * __glXScreenInit to initialize each of the active screens - * (__glXActiveScreens[]). Several of the fields must be initialized by - * the screenProbe routine before they are copied to the active screens - * struct. In particular, the contextCreate, modes, numVisuals, - * and numUsableVisuals fields must be initialized. - */ -static __GLXscreenInfo __glDDXScreenInfo = { - glAquaScreenProbe, /* Must be generic and handle all screens */ - glAquaCreateContext, /* Substitute screen's createContext routine */ - glAquaCreateBuffer, /* Substitute screen's createBuffer routine */ - NULL, /* Set up modes in probe */ - NULL, /* Set up pVisualPriv in probe */ - 0, /* Set up numVisuals in probe */ - 0, /* Set up numUsableVisuals in probe */ - "Vendor String", /* GLXvendor is overwritten by __glXScreenInit */ - "Version String", /* GLXversion is overwritten by __glXScreenInit */ - "Extensions String", /* GLXextensions is overwritten by __glXScreenInit */ - NULL /* WrappedPositionWindow is overwritten */ -}; - -void *__glXglDDXScreenInfo(void) { - return &__glDDXScreenInfo; -} - -static __GLXextensionInfo __glDDXExtensionInfo = { - GL_CORE_APPLE, - glAquaResetExtension, - glAquaInitVisuals, - glAquaSetVisualConfigs -}; - -void *__glXglDDXExtensionInfo(void) { - return &__glDDXExtensionInfo; -} - -// prototypes - -static GLboolean glAquaDestroyContext(__GLcontext *gc); -static GLboolean glAquaLoseCurrent(__GLcontext *gc); -static GLboolean glAquaMakeCurrent(__GLcontext *gc); -static GLboolean glAquaShareContext(__GLcontext *gc, __GLcontext *gcShare); -static GLboolean glAquaCopyContext(__GLcontext *dst, const __GLcontext *src, - GLuint mask); -static GLboolean glAquaForceCurrent(__GLcontext *gc); - -/* Drawing surface notification callbacks */ -static GLboolean glAquaNotifyResize(__GLcontext *gc); -static void glAquaNotifyDestroy(__GLcontext *gc); -static void glAquaNotifySwapBuffers(__GLcontext *gc); - -/* Dispatch table override control for external agents like libGLS */ -static struct __GLdispatchStateRec* glAquaDispatchExec(__GLcontext *gc); -static void glAquaBeginDispatchOverride(__GLcontext *gc); -static void glAquaEndDispatchOverride(__GLcontext *gc); - - -static __GLexports glAquaExports = { - glAquaDestroyContext, - glAquaLoseCurrent, - glAquaMakeCurrent, - glAquaShareContext, - glAquaCopyContext, - glAquaForceCurrent, - - glAquaNotifyResize, - glAquaNotifyDestroy, - glAquaNotifySwapBuffers, - - glAquaDispatchExec, - glAquaBeginDispatchOverride, - glAquaEndDispatchOverride -}; - - -typedef struct { - int num_vis; - __GLcontextModes *modes; - void **priv; - - // wrapped screen functions - RealizeWindowProcPtr RealizeWindow; - UnrealizeWindowProcPtr UnrealizeWindow; -} glAquaScreenRec; - -static glAquaScreenRec glAquaScreens[MAXSCREENS]; - - -// __GLdrawablePrivate->private -typedef struct { - GLboolean (*resize)(__GLdrawableBuffer *buf, GLint x, GLint y, - GLuint width, GLuint height, - __GLdrawablePrivate *glPriv, - GLuint bufferMask); -} GLAquaDrawableRec; - -struct __GLcontextRec { - struct __GLinterfaceRec interface; // required to be first - - AGLContext ctx; - AGLPixelFormat pixelFormat; - - Bool isAttached; // TRUE if ctx is really attached to a window -}; - - -// Context manipulation; return GL_FALSE on failure -static GLboolean glAquaDestroyContext(__GLcontext *gc) -{ - GLAQUA_DEBUG_MSG("glAquaDestroyContext (ctx 0x%x)\n", gc->ctx); - - if (gc) { - if (gc->ctx) aglDestroyContext(gc->ctx); - if (gc->pixelFormat) aglDestroyPixelFormat(gc->pixelFormat); - free(gc); - } - - return GL_TRUE; -} - - -static GLboolean glAquaLoseCurrent(__GLcontext *gc) -{ - GLAQUA_DEBUG_MSG("glAquaLoseCurrent (ctx 0x%x)\n", gc->ctx); - - aglSetCurrentContext(NULL); - __glXLastContext = NULL; // Mesa does this; why? - gc->isAttached = FALSE; - - return GL_TRUE; -} - - -/* - * Attach a GL context to a GL drawable - * If glPriv is NULL, the context is detached. - */ -static void attach(__GLcontext *gc, __GLdrawablePrivate *glPriv) -{ - __GLXdrawablePrivate *glxPriv; - - if (glPriv == NULL) { - // attaching to nothing - GLAQUA_DEBUG_MSG("unattaching\n"); - aglSetDrawable(gc->ctx, NULL); - gc->isAttached = FALSE; - return; - } - - // Note that when resizing, the X11 WindowPtr already has its - // new size and position, but the Aqua window does not. - - glxPriv = (__GLXdrawablePrivate *)glPriv->other; - - if (glxPriv->type == DRAWABLE_WINDOW) { - WindowPtr pWin = (WindowPtr) glxPriv->pDraw; - WindowPtr topWin = quartzProcs->TopLevelParent(pWin); - CRWindowPtr crWinPtr; - AGLDrawable newPort; - - if (glPriv->width <= 0 || glPriv->height <= 0) { - // attach to zero size drawable - will really attach later - GLAQUA_DEBUG_MSG("couldn't attach to zero size drawable\n"); - aglSetDrawable(gc->ctx, NULL); - gc->isAttached = FALSE; - return; - } - - crWinPtr = (CRWindowPtr) quartzProcs->FrameForWindow(pWin, FALSE); - - if (crWinPtr) { - newPort = (AGLDrawable) crWinPtr->port; - } else { - newPort = NULL; - } - - if (newPort) { - // FIXME: won't be a CGrafPtr if currently offscreen or fullscreen - AGLDrawable oldPort = aglGetDrawable(gc->ctx); - // AGLDrawable newPort = GetWindowPort(window); - - // Frame is GLdrawable in X11 global coordinates - // FIXME: Does this work for multiple screens? - GLint frame[4] = {glPriv->xOrigin, glPriv->yOrigin, glPriv->width, glPriv->height}; - GLAQUA_DEBUG_MSG("global size %d %d %d %d\n", - frame[0], frame[1], frame[2], frame[3]); - - // Convert to window-local coordinates - frame[0] -= topWin->drawable.x - topWin->borderWidth; - frame[1] -= topWin->drawable.y - topWin->borderWidth; - - // AGL uses flipped coordinates - frame[1] = topWin->drawable.height + 2*topWin->borderWidth - - frame[1] - frame[3]; - - GLAQUA_DEBUG_MSG("local size %d %d %d %d\n", - frame[0], frame[1], frame[2], frame[3]); - - if (oldPort != newPort) { - // FIXME: retain/release windows - if (!aglSetDrawable(gc->ctx, newPort)) return; - } - if (!aglSetInteger(gc->ctx, AGL_BUFFER_RECT, frame)) return; - if (!aglEnable(gc->ctx, AGL_BUFFER_RECT)) return; - if (!aglSetInteger(gc->ctx, AGL_SWAP_RECT, frame)) return; - if (!aglEnable(gc->ctx, AGL_SWAP_RECT)) return; - if (!aglUpdateContext(gc->ctx)) return; - - gc->isAttached = TRUE; - GLAQUA_DEBUG_MSG("attached context 0x%x to window 0x%x\n", gc->ctx, - pWin->drawable.id); - } else { - // attach to not-yet-realized window - will really attach later - GLAQUA_DEBUG_MSG("couldn't attach to unrealized window\n"); - aglSetDrawable(gc->ctx, NULL); - gc->isAttached = FALSE; - } - } else { - GLAQUA_DEBUG_MSG("attach: attach to non-window unimplemented\n"); - aglSetDrawable(gc->ctx, NULL); - gc->isAttached = FALSE; - } -} - -static GLboolean glAquaMakeCurrent(__GLcontext *gc) -{ - __GLdrawablePrivate *glPriv = gc->interface.imports.getDrawablePrivate(gc); - - GLAQUA_DEBUG_MSG("glAquaMakeCurrent (ctx 0x%x)\n", gc->ctx); - - if (!gc->isAttached) { - attach(gc, glPriv); - } - - return aglSetCurrentContext(gc->ctx); -} - -static GLboolean glAquaShareContext(__GLcontext *gc, __GLcontext *gcShare) -{ - GLAQUA_DEBUG_MSG("glAquaShareContext unimplemented\n"); - - return GL_TRUE; -} - - -static GLboolean glAquaCopyContext(__GLcontext *dst, const __GLcontext *src, - GLuint mask) -{ - GLAQUA_DEBUG_MSG("glAquaCopyContext\n"); - - return aglCopyContext(src->ctx, dst->ctx, mask); -} - -static GLboolean glAquaForceCurrent(__GLcontext *gc) -{ - // GLAQUA_DEBUG_MSG("glAquaForceCurrent (ctx 0x%x)\n", gc->ctx); - return aglSetCurrentContext(gc->ctx); -} - -/* Drawing surface notification callbacks */ - -static GLboolean glAquaNotifyResize(__GLcontext *gc) -{ - GLAQUA_DEBUG_MSG("unimplemented glAquaNotifyResize"); - return GL_TRUE; -} - -static void glAquaNotifyDestroy(__GLcontext *gc) -{ - GLAQUA_DEBUG_MSG("unimplemented glAquaNotifyDestroy"); -} - -static void glAquaNotifySwapBuffers(__GLcontext *gc) -{ - GLAQUA_DEBUG_MSG("unimplemented glAquaNotifySwapBuffers"); -} - -/* Dispatch table override control for external agents like libGLS */ -static struct __GLdispatchStateRec* glAquaDispatchExec(__GLcontext *gc) -{ - GLAQUA_DEBUG_MSG("unimplemented glAquaDispatchExec"); - return NULL; -} - -static void glAquaBeginDispatchOverride(__GLcontext *gc) -{ - GLAQUA_DEBUG_MSG("unimplemented glAquaBeginDispatchOverride"); -} - -static void glAquaEndDispatchOverride(__GLcontext *gc) -{ - GLAQUA_DEBUG_MSG("unimplemented glAquaEndDispatchOverride"); -} - - -static AGLPixelFormat makeFormat(__GLcontextModes *mode) -{ - int i; - GLint attr[64]; // currently uses max of 30 - AGLPixelFormat result; - - GLAQUA_DEBUG_MSG("makeFormat\n"); - - i = 0; - - // attr [i++] = AGL_ACCELERATED; // require hwaccel - BAD for multiscreen - // attr [i++] = AGL_NO_RECOVERY; // disable fallback renderers - BAD - - if (mode->stereoMode) { - attr[i++] = AGL_STEREO; - } - if (mode->doubleBufferMode) { - attr[i++] = AGL_DOUBLEBUFFER; - } - - if (mode->colorIndexMode) { - attr[i++] = AGL_BUFFER_SIZE; - attr[i++] = mode->indexBits; - } - - if (mode->rgbMode) { - attr[i++] = AGL_RGBA; - attr[i++] = AGL_RED_SIZE; - attr[i++] = mode->redBits; - attr[i++] = AGL_GREEN_SIZE; - attr[i++] = mode->greenBits; - attr[i++] = AGL_BLUE_SIZE; - attr[i++] = mode->blueBits; - attr[i++] = AGL_ALPHA_SIZE; - attr[i++] = mode->alphaBits; - } - - if (mode->haveAccumBuffer) { - attr[i++] = AGL_ACCUM_RED_SIZE; - attr[i++] = mode->accumRedBits; - attr[i++] = AGL_ACCUM_GREEN_SIZE; - attr[i++] = mode->accumGreenBits; - attr[i++] = AGL_ACCUM_BLUE_SIZE; - attr[i++] = mode->accumBlueBits; - attr[i++] = AGL_ACCUM_ALPHA_SIZE; - attr[i++] = mode->accumAlphaBits; - } - if (mode->haveDepthBuffer) { - attr[i++] = AGL_DEPTH_SIZE; - attr[i++] = mode->depthBits; - } - if (mode->haveStencilBuffer) { - attr[i++] = AGL_STENCIL_SIZE; - attr[i++] = mode->stencilBits; - } - - attr[i++] = AGL_AUX_BUFFERS; - attr[i++] = mode->numAuxBuffers; - - attr[i++] = AGL_LEVEL; - attr[i++] = mode->level; - - // mode->pixmapMode ? - - attr[i++] = AGL_NONE; // end of option list - - GLAQUA_DEBUG_MSG("makeFormat almost done\n"); - result = aglChoosePixelFormat(NULL, 0, attr); - GLAQUA_DEBUG_MSG("makeFormat done (0x%x)\n", result); - return result; -} - -static __GLinterface *glAquaCreateContext(__GLimports *imports, - __GLcontextModes *mode, - __GLinterface *shareGC) -{ - __GLcontext *result; - __GLcontext *sharectx = (__GLcontext *)shareGC; - - GLAQUA_DEBUG_MSG("glAquaCreateContext\n"); - - result = (__GLcontext *)calloc(1, sizeof(__GLcontext)); - if (!result) return NULL; - - result->interface.imports = *imports; - result->interface.exports = glAquaExports; - - result->pixelFormat = makeFormat(mode); - if (!result->pixelFormat) { - free(result); - return NULL; - } - - result->ctx = aglCreateContext(result->pixelFormat, - (sharectx && sharectx->ctx) ? sharectx->ctx : NULL); - - if (!result->ctx) { - aglDestroyPixelFormat(result->pixelFormat); - free(result); - return NULL; - } - - result->isAttached = FALSE; - - GLAQUA_DEBUG_MSG("glAquaCreateContext done\n"); - return (__GLinterface *)result; -} - - -Bool -glAquaRealizeWindow(WindowPtr pWin) -{ - // If this window has GL contexts, tell them to reattach - Bool result; - ScreenPtr pScreen = pWin->drawable.pScreen; - glAquaScreenRec *screenPriv = &glAquaScreens[pScreen->myNum]; - __GLXdrawablePrivate *glxPriv; - - GLAQUA_DEBUG_MSG("glAquaRealizeWindow\n"); - - // Allow the window to be created (RootlessRealizeWindow is inside our wrap) - pScreen->RealizeWindow = screenPriv->RealizeWindow; - result = pScreen->RealizeWindow(pWin); - pScreen->RealizeWindow = glAquaRealizeWindow; - - // The Aqua window will already have been created (windows are - // realized from top down) - - // Re-attach this window's GL contexts, if any. - glxPriv = __glXFindDrawablePrivate(pWin->drawable.id); - if (glxPriv) { - __GLXcontext *gx; - __GLcontext *gc; - __GLdrawablePrivate *glPriv = &glxPriv->glPriv; - GLAQUA_DEBUG_MSG("glAquaRealizeWindow is GL drawable!\n"); - - // GL contexts bound to this window for drawing - for (gx = glxPriv->drawGlxc; gx != NULL; gx = gx->nextDrawPriv) { - gc = (__GLcontext *)gx->gc; - attach(gc, glPriv); - } - - // GL contexts bound to this window for reading - for (gx = glxPriv->readGlxc; gx != NULL; gx = gx->nextReadPriv) { - gc = (__GLcontext *)gx->gc; - attach(gc, glPriv); - } - } - - return result; -} - -Bool -glAquaUnrealizeWindow(WindowPtr pWin) -{ - // If this window has GL contexts, tell them to unattach - Bool result; - ScreenPtr pScreen = pWin->drawable.pScreen; - glAquaScreenRec *screenPriv = &glAquaScreens[pScreen->myNum]; - __GLXdrawablePrivate *glxPriv; - - GLAQUA_DEBUG_MSG("glAquaUnrealizeWindow\n"); - - // The Aqua window may have already been destroyed (windows - // are unrealized from top down) - - // Unattach this window's GL contexts, if any. - glxPriv = __glXFindDrawablePrivate(pWin->drawable.id); - if (glxPriv) { - __GLXcontext *gx; - __GLcontext *gc; - GLAQUA_DEBUG_MSG("glAquaUnealizeWindow is GL drawable!\n"); - - // GL contexts bound to this window for drawing - for (gx = glxPriv->drawGlxc; gx != NULL; gx = gx->nextDrawPriv) { - gc = (__GLcontext *)gx->gc; - attach(gc, NULL); - } - - // GL contexts bound to this window for reading - for (gx = glxPriv->readGlxc; gx != NULL; gx = gx->nextReadPriv) { - gc = (__GLcontext *)gx->gc; - attach(gc, NULL); - } - } - - pScreen->UnrealizeWindow = screenPriv->UnrealizeWindow; - result = pScreen->UnrealizeWindow(pWin); - pScreen->UnrealizeWindow = glAquaUnrealizeWindow; - - return result; -} - - -// Originally copied from Mesa - -static int numConfigs = 0; -static __GLXvisualConfig *visualConfigs = NULL; -static void **visualPrivates = NULL; - -/* - * In the case the driver defines no GLX visuals we'll use these. - * Note that for TrueColor and DirectColor visuals, bufferSize is the - * sum of redSize, greenSize, blueSize and alphaSize, which may be larger - * than the nplanes/rootDepth of the server's X11 visuals - */ -#define NUM_FALLBACK_CONFIGS 5 -static __GLXvisualConfig FallbackConfigs[NUM_FALLBACK_CONFIGS] = { - /* [0] = RGB, double buffered, Z */ - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 0, /* rgba sizes */ - -1, -1, -1, 0, /* rgba masks */ - 0, 0, 0, 0, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 0, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, - /* [1] = RGB, double buffered, Z, stencil, accum */ - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 0, /* rgba sizes */ - -1, -1, -1, 0, /* rgba masks */ - 16, 16, 16, 0, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 8, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, - /* [2] = RGB+Alpha, double buffered, Z, stencil, accum */ - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 8, /* rgba sizes */ - -1, -1, -1, -1, /* rgba masks */ - 16, 16, 16, 16, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 8, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, - /* [3] = RGB+Alpha, single buffered, Z, stencil, accum */ - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 8, /* rgba sizes */ - -1, -1, -1, -1, /* rgba masks */ - 16, 16, 16, 16, /* rgba accum sizes */ - False, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 8, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, - /* [4] = CI, double buffered, Z */ - { - -1, /* vid */ - -1, /* class */ - False, /* rgba? (false = color index) */ - -1, -1, -1, 0, /* rgba sizes */ - -1, -1, -1, 0, /* rgba masks */ - 0, 0, 0, 0, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 0, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, -}; - -static __GLXvisualConfig NullConfig = { - -1, /* vid */ - -1, /* class */ - False, /* rgba */ - -1, -1, -1, 0, /* rgba sizes */ - -1, -1, -1, 0, /* rgba masks */ - 0, 0, 0, 0, /* rgba accum sizes */ - False, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 0, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE_EXT, /* visualRating */ - 0, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ -}; - - -static int count_bits(unsigned int n) -{ - int bits = 0; - - while (n > 0) { - if (n & 1) bits++; - n >>= 1; - } - return bits; -} - - -static Bool init_visuals(int *nvisualp, VisualPtr *visualp, - VisualID *defaultVisp, - int ndepth, DepthPtr pdepth, - int rootDepth) -{ - int numRGBconfigs; - int numCIconfigs; - int numVisuals = *nvisualp; - int numNewVisuals; - int numNewConfigs; - VisualPtr pVisual = *visualp; - VisualPtr pVisualNew = NULL; - VisualID *orig_vid = NULL; - __GLcontextModes *modes; - __GLXvisualConfig *pNewVisualConfigs = NULL; - void **glXVisualPriv; - void **pNewVisualPriv; - int found_default; - int i, j, k; - - GLAQUA_DEBUG_MSG("init_visuals\n"); - - if (numConfigs > 0) - numNewConfigs = numConfigs; - else - numNewConfigs = NUM_FALLBACK_CONFIGS; - - /* Alloc space for the list of new GLX visuals */ - pNewVisualConfigs = (__GLXvisualConfig *) - __glXMalloc(numNewConfigs * sizeof(__GLXvisualConfig)); - if (!pNewVisualConfigs) { - return FALSE; - } - - /* Alloc space for the list of new GLX visual privates */ - pNewVisualPriv = (void **) __glXMalloc(numNewConfigs * sizeof(void *)); - if (!pNewVisualPriv) { - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* - ** If SetVisualConfigs was not called, then use default GLX - ** visual configs. - */ - if (numConfigs == 0) { - memcpy(pNewVisualConfigs, FallbackConfigs, - NUM_FALLBACK_CONFIGS * sizeof(__GLXvisualConfig)); - memset(pNewVisualPriv, 0, NUM_FALLBACK_CONFIGS * sizeof(void *)); - } - else { - /* copy driver's visual config info */ - for (i = 0; i < numConfigs; i++) { - pNewVisualConfigs[i] = visualConfigs[i]; - pNewVisualPriv[i] = visualPrivates[i]; - } - } - - /* Count the number of RGB and CI visual configs */ - numRGBconfigs = 0; - numCIconfigs = 0; - for (i = 0; i < numNewConfigs; i++) { - if (pNewVisualConfigs[i].rgba) - numRGBconfigs++; - else - numCIconfigs++; - } - - /* Count the total number of visuals to compute */ - numNewVisuals = 0; - for (i = 0; i < numVisuals; i++) { - int count; - - count = ((pVisual[i].class == TrueColor || - pVisual[i].class == DirectColor) - ? numRGBconfigs : numCIconfigs); - if (count == 0) - count = 1; /* preserve the existing visual */ - - numNewVisuals += count; - } - - /* Reset variables for use with the next screen/driver's visual configs */ - visualConfigs = NULL; - numConfigs = 0; - - /* Alloc temp space for the list of orig VisualIDs for each new visual */ - orig_vid = (VisualID *)__glXMalloc(numNewVisuals * sizeof(VisualID)); - if (!orig_vid) { - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* Alloc space for the list of glXVisuals */ - modes = _gl_context_modes_create(numNewVisuals, sizeof(__GLcontextModes)); - if (modes == NULL) { - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* Alloc space for the list of glXVisualPrivates */ - glXVisualPriv = (void **)__glXMalloc(numNewVisuals * sizeof(void *)); - if (!glXVisualPriv) { - _gl_context_modes_destroy( modes ); - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* Alloc space for the new list of the X server's visuals */ - pVisualNew = (VisualPtr)__glXMalloc(numNewVisuals * sizeof(VisualRec)); - if (!pVisualNew) { - __glXFree(glXVisualPriv); - _gl_context_modes_destroy( modes ); - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* Initialize the new visuals */ - found_default = FALSE; - glAquaScreens[screenInfo.numScreens-1].modes = modes; - for (i = j = 0; i < numVisuals; i++) { - int is_rgb = (pVisual[i].class == TrueColor || - pVisual[i].class == DirectColor); - - if (!is_rgb) - { - /* We don't support non-rgb visuals for GL. But we don't - want to remove them either, so just pass them through - with null glX configs */ - - pVisualNew[j] = pVisual[i]; - pVisualNew[j].vid = FakeClientID(0); - - /* Check for the default visual */ - if (!found_default && pVisual[i].vid == *defaultVisp) { - *defaultVisp = pVisualNew[j].vid; - found_default = TRUE; - } - - /* Save the old VisualID */ - orig_vid[j] = pVisual[i].vid; - - /* Initialize the glXVisual */ - _gl_copy_visual_to_context_mode( modes, & NullConfig ); - modes->visualID = pVisualNew[j].vid; - - j++; - - continue; - } - - for (k = 0; k < numNewConfigs; k++) { - if (pNewVisualConfigs[k].rgba != is_rgb) - continue; - - assert( modes != NULL ); - - /* Initialize the new visual */ - pVisualNew[j] = pVisual[i]; - pVisualNew[j].vid = FakeClientID(0); - - /* Check for the default visual */ - if (!found_default && pVisual[i].vid == *defaultVisp) { - *defaultVisp = pVisualNew[j].vid; - found_default = TRUE; - } - - /* Save the old VisualID */ - orig_vid[j] = pVisual[i].vid; - - /* Initialize the glXVisual */ - _gl_copy_visual_to_context_mode( modes, & pNewVisualConfigs[k] ); - modes->visualID = pVisualNew[j].vid; - - /* - * If the class is -1, then assume the X visual information - * is identical to what GLX needs, and take them from the X - * visual. NOTE: if class != -1, then all other fields MUST - * be initialized. - */ - if (modes->visualType == GLX_NONE) { - modes->visualType = _gl_convert_from_x_visual_type( pVisual[i].class ); - modes->redBits = count_bits(pVisual[i].redMask); - modes->greenBits = count_bits(pVisual[i].greenMask); - modes->blueBits = count_bits(pVisual[i].blueMask); - modes->alphaBits = modes->alphaBits; - modes->redMask = pVisual[i].redMask; - modes->greenMask = pVisual[i].greenMask; - modes->blueMask = pVisual[i].blueMask; - modes->alphaMask = modes->alphaMask; - modes->rgbBits = (is_rgb) - ? (modes->redBits + modes->greenBits + - modes->blueBits + modes->alphaBits) - : rootDepth; - } - - /* Save the device-dependent private for this visual */ - glXVisualPriv[j] = pNewVisualPriv[k]; - - j++; - modes = modes->next; - } - } - - assert(j <= numNewVisuals); - - /* Save the GLX visuals in the screen structure */ - glAquaScreens[screenInfo.numScreens-1].num_vis = numNewVisuals; - glAquaScreens[screenInfo.numScreens-1].priv = glXVisualPriv; - - /* Set up depth's VisualIDs */ - for (i = 0; i < ndepth; i++) { - int numVids = 0; - VisualID *pVids = NULL; - int k, n = 0; - - /* Count the new number of VisualIDs at this depth */ - for (j = 0; j < pdepth[i].numVids; j++) - for (k = 0; k < numNewVisuals; k++) - if (pdepth[i].vids[j] == orig_vid[k]) - numVids++; - - /* Allocate a new list of VisualIDs for this depth */ - pVids = (VisualID *)__glXMalloc(numVids * sizeof(VisualID)); - - /* Initialize the new list of VisualIDs for this depth */ - for (j = 0; j < pdepth[i].numVids; j++) - for (k = 0; k < numNewVisuals; k++) - if (pdepth[i].vids[j] == orig_vid[k]) - pVids[n++] = pVisualNew[k].vid; - - /* Update this depth's list of VisualIDs */ - __glXFree(pdepth[i].vids); - pdepth[i].vids = pVids; - pdepth[i].numVids = numVids; - } - - /* Update the X server's visuals */ - *nvisualp = numNewVisuals; - *visualp = pVisualNew; - - /* Free the old list of the X server's visuals */ - __glXFree(pVisual); - - /* Clean up temporary allocations */ - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - - /* Free the private list created by DDX HW driver */ - if (visualPrivates) - xfree(visualPrivates); - visualPrivates = NULL; - - return TRUE; -} - -/* based on code in i830_dri.c - This ends calling glAquaSetVisualConfigs to set the static - numconfigs, etc. */ -static void -glAquaInitVisualConfigs(void) -{ - int lclNumConfigs = 0; - __GLXvisualConfig *lclVisualConfigs = NULL; - void **lclVisualPrivates = NULL; - - int depth, aux, buffers, stencil, accum; - int i = 0; - - GLAQUA_DEBUG_MSG("glAquaInitVisualConfigs "); - - /* count num configs: - 2 Z buffer (0, 24 bit) - 2 AUX buffer (0, 2) - 2 buffers (single, double) - 2 stencil (0, 8 bit) - 2 accum (0, 64 bit) - = 32 configs */ - - lclNumConfigs = 2 * 2 * 2 * 2 * 2; /* 32 */ - - /* alloc */ - lclVisualConfigs = xcalloc(sizeof(__GLXvisualConfig), lclNumConfigs); - lclVisualPrivates = xcalloc(sizeof(void *), lclNumConfigs); - - /* fill in configs */ - if (NULL != lclVisualConfigs) { - i = 0; /* current buffer */ - for (depth = 0; depth < 2; depth++) { - for (aux = 0; aux < 2; aux++) { - for (buffers = 0; buffers < 2; buffers++) { - for (stencil = 0; stencil < 2; stencil++) { - for (accum = 0; accum < 2; accum++) { - lclVisualConfigs[i].vid = -1; - lclVisualConfigs[i].class = -1; - lclVisualConfigs[i].rgba = TRUE; - lclVisualConfigs[i].redSize = -1; - lclVisualConfigs[i].greenSize = -1; - lclVisualConfigs[i].blueSize = -1; - lclVisualConfigs[i].redMask = -1; - lclVisualConfigs[i].greenMask = -1; - lclVisualConfigs[i].blueMask = -1; - lclVisualConfigs[i].alphaMask = 0; - if (accum) { - lclVisualConfigs[i].accumRedSize = 16; - lclVisualConfigs[i].accumGreenSize = 16; - lclVisualConfigs[i].accumBlueSize = 16; - lclVisualConfigs[i].accumAlphaSize = 16; - } - else { - lclVisualConfigs[i].accumRedSize = 0; - lclVisualConfigs[i].accumGreenSize = 0; - lclVisualConfigs[i].accumBlueSize = 0; - lclVisualConfigs[i].accumAlphaSize = 0; - } - lclVisualConfigs[i].doubleBuffer = buffers ? TRUE : FALSE; - lclVisualConfigs[i].stereo = FALSE; - lclVisualConfigs[i].bufferSize = -1; - - lclVisualConfigs[i].depthSize = depth? 24 : 0; - lclVisualConfigs[i].stencilSize = stencil ? 8 : 0; - lclVisualConfigs[i].auxBuffers = aux ? 2 : 0; - lclVisualConfigs[i].level = 0; - lclVisualConfigs[i].visualRating = GLX_NONE_EXT; - lclVisualConfigs[i].transparentPixel = 0; - lclVisualConfigs[i].transparentRed = 0; - lclVisualConfigs[i].transparentGreen = 0; - lclVisualConfigs[i].transparentBlue = 0; - lclVisualConfigs[i].transparentAlpha = 0; - lclVisualConfigs[i].transparentIndex = 0; - i++; - } - } - } - } - } - } - if (i != lclNumConfigs) - GLAQUA_DEBUG_MSG("glAquaInitVisualConfigs failed to alloc visual configs"); - - GlxSetVisualConfigs(lclNumConfigs, lclVisualConfigs, lclVisualPrivates); -} - - -static void glAquaSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, - void **privates) -{ - GLAQUA_DEBUG_MSG("glAquaSetVisualConfigs\n"); - - numConfigs = nconfigs; - visualConfigs = configs; - visualPrivates = privates; -} - -static Bool glAquaInitVisuals(VisualPtr *visualp, DepthPtr *depthp, - int *nvisualp, int *ndepthp, - int *rootDepthp, VisualID *defaultVisp, - unsigned long sizes, int bitsPerRGB) -{ - GLAQUA_DEBUG_MSG("glAquaInitVisuals\n"); - - if (numConfigs == 0) /* if no configs */ - glAquaInitVisualConfigs(); /* ensure the visual configs are setup */ - - /* - * Setup the visuals supported by this particular screen. - */ - return init_visuals(nvisualp, visualp, defaultVisp, - *ndepthp, *depthp, *rootDepthp); -} - - -static void fixup_visuals(int screen) -{ - ScreenPtr pScreen = screenInfo.screens[screen]; - glAquaScreenRec *pScr = &glAquaScreens[screen]; - int j; - __GLcontextModes *modes; - - GLAQUA_DEBUG_MSG("fixup_visuals\n"); - - for ( modes = pScr->modes ; modes != NULL ; modes = modes->next ) { - const int vis_class = _gl_convert_to_x_visual_type( modes->visualType ); - const int nplanes = (modes->rgbBits - modes->alphaBits); - const VisualPtr pVis = pScreen->visuals; - - /* Find a visual that matches the GLX visual's class and size */ - for (j = 0; j < pScreen->numVisuals; j++) { - if (pVis[j].class == vis_class && - pVis[j].nplanes == nplanes) { - - /* Fixup the masks */ - modes->redMask = pVis[j].redMask; - modes->greenMask = pVis[j].greenMask; - modes->blueMask = pVis[j].blueMask; - - /* Recalc the sizes */ - modes->redBits = count_bits(modes->redMask); - modes->greenBits = count_bits(modes->greenMask); - modes->blueBits = count_bits(modes->blueMask); - } - } - } -} - -static void init_screen_visuals(int screen) -{ - ScreenPtr pScreen = screenInfo.screens[screen]; - __GLcontextModes *modes; - int *used; - int i, j; - - GLAQUA_DEBUG_MSG("init_screen_visuals\n"); - - /* FIXME: Change 'used' to be a array of bits (rather than of ints), - * FIXME: create a stack array of 8 or 16 bytes. If 'numVisuals' is less - * FIXME: than 64 or 128 the stack array can be used instead of calling - * FIXME: __glXMalloc / __glXFree. If nothing else, convert 'used' to - * FIXME: array of bytes instead of ints! - */ - used = (int *)__glXMalloc(pScreen->numVisuals * sizeof(int)); - __glXMemset(used, 0, pScreen->numVisuals * sizeof(int)); - - i = 0; - for ( modes = glAquaScreens[screen].modes - ; modes != NULL - ; modes = modes->next ) { - const int vis_class = _gl_convert_to_x_visual_type( modes->visualType ); - const int nplanes = (modes->rgbBits - modes->alphaBits); - const VisualPtr pVis = pScreen->visuals; - - for (j = 0; j < pScreen->numVisuals; j++) { - if (pVis[j].class == vis_class && - pVis[j].nplanes == nplanes && - pVis[j].redMask == modes->redMask && - pVis[j].greenMask == modes->greenMask && - pVis[j].blueMask == modes->blueMask && - !used[j]) { - - /* Set the VisualID */ - modes->visualID = pVis[j].vid; - - /* Mark this visual used */ - used[j] = 1; - break; - } - } - if ( j == pScreen->numVisuals ) { - ErrorF("No matching visual for __GLcontextMode with " - "visual class = %d (%d), nplanes = %u\n", - vis_class, - (int)modes->visualType, - (unsigned int)(modes->rgbBits - modes->alphaBits) ); - } - else if ( modes->visualID == -1 ) { - FatalError( "Matching visual found, but visualID still -1!\n" ); - } - - i++; - } - - __glXFree(used); -} - -static Bool glAquaScreenProbe(int screen) -{ - ScreenPtr pScreen; - glAquaScreenRec *screenPriv; - - GLAQUA_DEBUG_MSG("glAquaScreenProbe\n"); - - /* - * Set up the current screen's visuals. - */ - __glDDXScreenInfo.modes = glAquaScreens[screen].modes; - __glDDXScreenInfo.pVisualPriv = glAquaScreens[screen].priv; - __glDDXScreenInfo.numVisuals = - __glDDXScreenInfo.numUsableVisuals = glAquaScreens[screen].num_vis; - - /* - * Set the current screen's createContext routine. This could be - * wrapped by a DDX GLX context creation routine. - */ - __glDDXScreenInfo.createContext = glAquaCreateContext; - - /* - * The ordering of the rgb compenents might have been changed by the - * driver after mi initialized them. - */ - fixup_visuals(screen); - - /* - * Find the GLX visuals that are supported by this screen and create - * XMesa's visuals. - */ - init_screen_visuals(screen); - - /* - * Wrap RealizeWindow and UnrealizeWindow on this screen - */ - pScreen = screenInfo.screens[screen]; - screenPriv = &glAquaScreens[screen]; - screenPriv->RealizeWindow = pScreen->RealizeWindow; - pScreen->RealizeWindow = glAquaRealizeWindow; - screenPriv->UnrealizeWindow = pScreen->UnrealizeWindow; - pScreen->UnrealizeWindow = glAquaUnrealizeWindow; - - return TRUE; -} - - -static GLboolean glAquaResizeBuffers(__GLdrawableBuffer *buffer, - GLint x, GLint y, - GLuint width, GLuint height, - __GLdrawablePrivate *glPriv, - GLuint bufferMask) -{ - GLAquaDrawableRec *aquaPriv = (GLAquaDrawableRec *)glPriv->private; - __GLXdrawablePrivate *glxPriv = (__GLXdrawablePrivate *)glPriv->other; - __GLXcontext *gx; - __GLcontext *gc; - - GLAQUA_DEBUG_MSG("glAquaResizeBuffers to (%d %d %d %d)\n", x, y, width, height); - - // update all contexts that point at this drawable for drawing (hack?) - for (gx = glxPriv->drawGlxc; gx != NULL; gx = gx->nextDrawPriv) { - gc = (__GLcontext *)gx->gc; - attach(gc, glPriv); - } - - // update all contexts that point at this drawable for reading (hack?) - for (gx = glxPriv->readGlxc; gx != NULL; gx = gx->nextReadPriv) { - gc = (__GLcontext *)gx->gc; - attach(gc, glPriv); - } - - return aquaPriv->resize(buffer, x, y, width, height, glPriv, bufferMask); -} - - -static GLboolean glAquaSwapBuffers(__GLXdrawablePrivate *glxPriv) -{ - // fixme AGL software renderer will use properties of current QD port (bad) - - // swap buffers on only *one* of the contexts - // (e.g. the last one for drawing) - __GLcontext *gc = (__GLcontext *)glxPriv->drawGlxc->gc; - if (gc && gc->ctx) aglSwapBuffers(gc->ctx); - - return GL_TRUE; -} - -static void glAquaDestroyDrawablePrivate(__GLdrawablePrivate *glPriv) -{ - GLAQUA_DEBUG_MSG("glAquaDestroyDrawablePrivate\n"); - - free(glPriv->private); - glPriv->private = NULL; -} - -static void glAquaCreateBuffer(__GLXdrawablePrivate *glxPriv) -{ - GLAquaDrawableRec *aquaPriv = malloc(sizeof(GLAquaDrawableRec)); - __GLdrawablePrivate *glPriv = &glxPriv->glPriv; - - GLAQUA_DEBUG_MSG("glAquaCreateBuffer\n"); - - // replace swapBuffers (original is never called) - glxPriv->swapBuffers = glAquaSwapBuffers; - - // wrap front buffer resize - aquaPriv->resize = glPriv->frontBuffer.resize; - glPriv->frontBuffer.resize = glAquaResizeBuffers; - - // stash private data - glPriv->private = aquaPriv; - glPriv->freePrivate = glAquaDestroyDrawablePrivate; -} - - -static void glAquaResetExtension(void) -{ - GLAQUA_DEBUG_MSG("glAquaResetExtension\n"); - aglResetLibrary(); -} - - - -// Extra goodies for glx - -GLuint __glFloorLog2(GLuint val) -{ - int c = 0; - - while (val > 1) { - c++; - val >>= 1; - } - return c; -} diff --git a/GL/apple/indirect.c b/GL/apple/indirect.c deleted file mode 100644 index 2729ab0ba..000000000 --- a/GL/apple/indirect.c +++ /dev/null @@ -1,1938 +0,0 @@ -/* - * GLX implementation that uses Apple's OpenGL.framework - * (Indirect rendering path) - * - * Copyright (c) 2007 Apple Inc. - * Copyright (c) 2004 Torrey T. Lyons. All Rights Reserved. - * Copyright (c) 2002 Greg Parker. All Rights Reserved. - * - * Portions of this file are copied from Mesa's xf86glx.c, - * which contains the following copyright: - * - * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "dri.h" - -#define GL_EXT_histogram 1 -#define GL_EXT_polygon_offset 1 -#define GL_SGIS_pixel_texture 1 -#define GL_SGIX_pixel_texture 1 -#define GL_EXT_multisample 1 -#define GL_SGIS_multisample 1 -#define GL_EXT_vertex_array 1 -#define GL_ARB_point_parameters 1 -#define GL_NV_vertex_array_range 1 -#define GL_MESA_resize_buffers 1 -#define GL_ARB_window_pos 1 -#define GL_EXT_cull_vertex 1 -#define GL_NV_vertex_program 1 -#define GL_APPLE_fence 1 -#define GL_IBM_multimode_draw_arrays 1 -#define GL_EXT_fragment_shader 1 - -#include <OpenGL/OpenGL.h> -#include <OpenGL/CGLContext.h> - -// X11 and X11's glx -#include <GL/gl.h> -#include <GL/glxproto.h> -#include <windowstr.h> -#include <resource.h> -#include <GL/glxint.h> -#include <GL/glxtokens.h> -#include <scrnintstr.h> -#include <glxserver.h> -#include <glxscreens.h> -#include <glxdrawable.h> -#include <glxcontext.h> -#include <glxext.h> -#include <glxutil.h> -#include <glxscreens.h> -#include <GL/internal/glcore.h> -#include "x-hash.h" -#include "x-list.h" - -#include <dispatch.h> -#define GLAPIENTRYP * -typedef unsigned long long GLuint64EXT; -typedef long long GLint64EXT; -#include <Xplugin.h> -#include "glcontextmodes.h" -#include <glapi.h> -#include <glapitable.h> - -// ggs: needed to call back to glx with visual configs -extern void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, void **configprivs); -__GLXprovider * GlxGetMesaProvider (void); - -// Write debugging output, or not -#ifdef GLAQUA_DEBUG -#define GLAQUA_DEBUG_MSG ErrorF -#else -#define GLAQUA_DEBUG_MSG(a, ...) -#endif - -static void setup_dispatch_table(void); -GLuint __glFloorLog2(GLuint val); -void warn_func(void * p1, char *format, ...); - -// some prototypes -static __GLXscreen * __glXAquaScreenProbe(ScreenPtr pScreen); -static __GLXdrawable * __glXAquaScreenCreateDrawable(__GLXscreen *screen, DrawablePtr pDraw, XID drawId, __GLcontextModes *modes); - -static Bool glAquaInitVisuals(VisualPtr *visualp, DepthPtr *depthp, - int *nvisualp, int *ndepthp, - int *rootDepthp, VisualID *defaultVisp, - unsigned long sizes, int bitsPerRGB); -static void glAquaSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, - void **privates); - -static void glAquaResetExtension(void); -static void __glXAquaContextDestroy(__GLXcontext *baseContext); -static int __glXAquaContextMakeCurrent(__GLXcontext *baseContext); -static int __glXAquaContextLoseCurrent(__GLXcontext *baseContext); -static int __glXAquaContextForceCurrent(__GLXcontext *baseContext); -static int __glXAquaContextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc, unsigned long mask); - -static CGLPixelFormatObj makeFormat(__GLcontextModes *mode); - -__GLXprovider __glXMesaProvider = { - __glXAquaScreenProbe, - "Core OpenGL", - NULL -}; - -__GLXprovider * -GlxGetMesaProvider (void) -{ - GLAQUA_DEBUG_MSG("GlxGetMesaProvider\n"); - return &__glXMesaProvider; -} - -typedef struct __GLXAquaScreen __GLXAquaScreen; -typedef struct __GLXAquaContext __GLXAquaContext; -typedef struct __GLXAquaDrawable __GLXAquaDrawable; - -struct __GLXAquaScreen { - __GLXscreen base; - int index; - int num_vis; - __GLcontextModes *modes; -}; - -static __GLXAquaScreen glAquaScreens[MAXSCREENS]; - -struct __GLXAquaContext { - __GLXcontext base; - CGLContextObj ctx; - CGLPixelFormatObj pixelFormat; - xp_surface_id sid; - unsigned isAttached :1; -}; - -struct __GLXAquaDrawable { - __GLXdrawable base; - DrawablePtr pDraw; - xp_surface_id sid; -}; - -static __GLXcontext * -__glXAquaScreenCreateContext(__GLXscreen *screen, - __GLcontextModes *modes, - __GLXcontext *baseShareContext) -{ - __GLXAquaContext *context; - __GLXAquaContext *shareContext = (__GLXAquaContext *) baseShareContext; - CGLError gl_err; - - GLAQUA_DEBUG_MSG("glXAquaScreenCreateContext\n"); - - context = malloc (sizeof (__GLXAquaContext)); - if (context == NULL) return NULL; - - memset(context, 0, sizeof *context); - - context->base.pGlxScreen = screen; - context->base.modes = modes; - - context->base.destroy = __glXAquaContextDestroy; - context->base.makeCurrent = __glXAquaContextMakeCurrent; - context->base.loseCurrent = __glXAquaContextLoseCurrent; - context->base.copy = __glXAquaContextCopy; - context->base.forceCurrent = __glXAquaContextForceCurrent; - // context->base.createDrawable = __glXAquaContextCreateDrawable; - - context->pixelFormat = makeFormat(modes); - if (!context->pixelFormat) { - free(context); - return NULL; - } - - context->ctx = NULL; - gl_err = CGLCreateContext(context->pixelFormat, - shareContext ? shareContext->ctx : NULL, - &context->ctx); - - if (gl_err != 0) { - ErrorF("CGLCreateContext error: %s\n", CGLErrorString(gl_err)); - CGLDestroyPixelFormat(context->pixelFormat); - free(context); - return NULL; - } - setup_dispatch_table(); - GLAQUA_DEBUG_MSG("glAquaCreateContext done\n"); - return &context->base; -} - -static __GLXextensionInfo __glDDXExtensionInfo = { - GL_CORE_APPLE, - glAquaResetExtension, - glAquaInitVisuals, - glAquaSetVisualConfigs -}; - -void *__glXglDDXExtensionInfo(void) { - GLAQUA_DEBUG_MSG("glXAglDDXExtensionInfo\n"); - return &__glDDXExtensionInfo; -} - -/* maps from surface id -> list of __GLcontext */ -static x_hash_table *surface_hash; - -static void __glXAquaContextDestroy(__GLXcontext *baseContext) { - x_list *lst; - - __GLXAquaContext *context = (__GLXAquaContext *) baseContext; - - GLAQUA_DEBUG_MSG("glAquaContextDestroy (ctx 0x%x)\n", - (unsigned int) baseContext); - if (context != NULL) { - if (context->sid != 0 && surface_hash != NULL) { - lst = x_hash_table_lookup(surface_hash, (void *) context->sid, NULL); - lst = x_list_remove(lst, context); - x_hash_table_insert(surface_hash, (void *) context->sid, lst); - } - - if (context->ctx != NULL) CGLDestroyContext(context->ctx); - - if (context->pixelFormat != NULL) CGLDestroyPixelFormat(context->pixelFormat); - - free(context); - } -} - -static int __glXAquaContextLoseCurrent(__GLXcontext *baseContext) { - CGLError gl_err; - - GLAQUA_DEBUG_MSG("glAquaLoseCurrent (ctx 0x%p)\n", baseContext); - - gl_err = CGLSetCurrentContext(NULL); - if (gl_err != 0) - ErrorF("CGLSetCurrentContext error: %s\n", CGLErrorString(gl_err)); - - __glXLastContext = NULL; // Mesa does this; why? - - return GL_TRUE; -} - -/* Called when a surface is destroyed as a side effect of destroying - the window it's attached to. */ -static void surface_notify(void *_arg, void *data) { - DRISurfaceNotifyArg *arg = (DRISurfaceNotifyArg *)_arg; - __GLXAquaDrawable *draw = (__GLXAquaDrawable *)data; - __GLXAquaContext *context; - x_list *lst; - if(_arg == NULL || data == NULL) { - ErrorF("surface_notify called with bad params"); - return; - } - - GLAQUA_DEBUG_MSG("surface_notify(%p, %p)\n", _arg, data); - switch (arg->kind) { - case AppleDRISurfaceNotifyDestroyed: - if (surface_hash != NULL) - x_hash_table_remove(surface_hash, (void *) arg->id); - draw->base.pDraw = NULL; - draw->sid = 0; - break; - - case AppleDRISurfaceNotifyChanged: - if (surface_hash != NULL) { - lst = x_hash_table_lookup(surface_hash, (void *) arg->id, NULL); - for (; lst != NULL; lst = lst->next) - { - context = lst->data; - xp_update_gl_context(context->ctx); - } - } - break; - default: - ErrorF("surface_notify: unknown kind %d\n", arg->kind); - break; - } -} - -static void attach(__GLXAquaContext *context, __GLXAquaDrawable *draw) { - DrawablePtr pDraw; - GLAQUA_DEBUG_MSG("attach(%p, %p)\n", context, draw); - pDraw = draw->base.pDraw; - - if (draw->sid == 0) { -// if (!quartzProcs->CreateSurface(pDraw->pScreen, pDraw->id, pDraw, - if (!DRICreateSurface(pDraw->pScreen, pDraw->id, pDraw, - 0, &draw->sid, NULL, - surface_notify, draw)) - return; - draw->pDraw = pDraw; - } - - if (!context->isAttached || context->sid != draw->sid) { - x_list *lst; - - if (xp_attach_gl_context(context->ctx, draw->sid) != Success) { -// quartzProcs->DestroySurface(pDraw->pScreen, pDraw->id, pDraw, - DRIDestroySurface(pDraw->pScreen, pDraw->id, pDraw, - surface_notify, draw); - if (surface_hash != NULL) - x_hash_table_remove(surface_hash, (void *) draw->sid); - - draw->sid = 0; - return; - } - - context->isAttached = TRUE; - context->sid = draw->sid; - - if (surface_hash == NULL) - surface_hash = x_hash_table_new(NULL, NULL, NULL, NULL); - - lst = x_hash_table_lookup(surface_hash, (void *) context->sid, NULL); - if (x_list_find(lst, context) == NULL) { - lst = x_list_prepend(lst, context); - x_hash_table_insert(surface_hash, (void *) context->sid, lst); - } - - GLAQUA_DEBUG_MSG("attached 0x%x to 0x%x\n", (unsigned int) pDraw->id, - (unsigned int) draw->sid); - } -} - -#if 0 // unused -static void unattach(__GLXAquaContext *context) { - x_list *lst; - GLAQUA_DEBUG_MSG("unattach\n"); - if (context == NULL) { - ErrorF("Tried to unattach a null context\n"); - return; - } - if (context->isAttached) { - GLAQUA_DEBUG_MSG("unattaching\n"); - - if (surface_hash != NULL) { - lst = x_hash_table_lookup(surface_hash, (void *) context->sid, NULL); - lst = x_list_remove(lst, context); - x_hash_table_insert(surface_hash, (void *) context->sid, lst); - } - - CGLClearDrawable(context->ctx); - context->isAttached = FALSE; - context->sid = 0; - } -} -#endif - -static int __glXAquaContextMakeCurrent(__GLXcontext *baseContext) { - CGLError gl_err; - __GLXAquaContext *context = (__GLXAquaContext *) baseContext; - __GLXAquaDrawable *drawPriv = (__GLXAquaDrawable *) context->base.drawPriv; - - GLAQUA_DEBUG_MSG("glAquaMakeCurrent (ctx 0x%p)\n", baseContext); - - attach(context, drawPriv); - - gl_err = CGLSetCurrentContext(context->ctx); - if (gl_err != 0) - ErrorF("CGLSetCurrentContext error: %s\n", CGLErrorString(gl_err)); - - return gl_err == 0; -} - -static int __glXAquaContextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc, unsigned long mask) -{ - CGLError gl_err; - - __GLXAquaContext *dst = (__GLXAquaContext *) baseDst; - __GLXAquaContext *src = (__GLXAquaContext *) baseSrc; - - GLAQUA_DEBUG_MSG("GLXAquaContextCopy\n"); - - gl_err = CGLCopyContext(src->ctx, dst->ctx, mask); - if (gl_err != 0) - ErrorF("CGLCopyContext error: %s\n", CGLErrorString(gl_err)); - - return gl_err == 0; -} - -static int __glXAquaContextForceCurrent(__GLXcontext *baseContext) -{ - CGLError gl_err; - __GLXAquaContext *context = (__GLXAquaContext *) baseContext; - GLAQUA_DEBUG_MSG("glAquaForceCurrent (ctx %p)\n", context->ctx); - - gl_err = CGLSetCurrentContext(context->ctx); - if (gl_err != 0) - ErrorF("CGLSetCurrentContext error: %s\n", CGLErrorString(gl_err)); - - return gl_err == 0; -} - -/* Drawing surface notification callbacks */ - -static GLboolean __glXAquaDrawableResize(__GLXdrawable *base) { - GLAQUA_DEBUG_MSG("unimplemented glAquaDrawableResize\n"); - return GL_TRUE; -} - -static GLboolean __glXAquaDrawableSwapBuffers(__GLXdrawable *base) { - CGLError gl_err; - __GLXAquaContext * drawableCtx; -// GLAQUA_DEBUG_MSG("glAquaDrawableSwapBuffers(%p)\n",base); - - if(!base) { - ErrorF("glXAquaDrawbleSwapBuffers passed NULL\n"); - return GL_FALSE; - } - - drawableCtx = (__GLXAquaContext *)base->drawGlxc; - - if (drawableCtx != NULL && drawableCtx->ctx != NULL) { - gl_err = CGLFlushDrawable(drawableCtx->ctx); - if (gl_err != 0) - ErrorF("CGLFlushDrawable error: %s\n", CGLErrorString(gl_err)); - } - return GL_TRUE; -} - -static CGLPixelFormatObj makeFormat(__GLcontextModes *mode) { - int i; - CGLPixelFormatAttribute attr[64]; // currently uses max of 30 - CGLPixelFormatObj result; - GLint n_formats; - CGLError gl_err; - - GLAQUA_DEBUG_MSG("makeFormat\n"); - - if (!mode->rgbMode) - return NULL; - - i = 0; - - // attr [i++] = kCGLPFAAcelerated; // require hwaccel - BAD for multiscreen - // attr [i++] = kCGLPFANoRecovery; // disable fallback renderers - BAD - - if (mode->stereoMode) { - attr[i++] = kCGLPFAStereo; - } - if (mode->doubleBufferMode) { - attr[i++] = kCGLPFADoubleBuffer; - } - - if (mode->colorIndexMode) { - /* ignored */ - } - - if (mode->rgbMode) { - attr[i++] = kCGLPFAColorSize; - attr[i++] = mode->redBits + mode->greenBits + mode->blueBits; - attr[i++] = kCGLPFAAlphaSize; - attr[i++] = 1; /* FIXME: ignoring mode->alphaBits which is always 0 */ - } - - if (mode->haveAccumBuffer) { - attr[i++] = kCGLPFAAccumSize; - attr[i++] = mode->accumRedBits + mode->accumGreenBits - + mode->accumBlueBits + mode->accumAlphaBits; - } - - if (mode->haveDepthBuffer) { - attr[i++] = kCGLPFADepthSize; - attr[i++] = mode->depthBits; - } - - if (mode->haveStencilBuffer) { - attr[i++] = kCGLPFAStencilSize; - attr[i++] = mode->stencilBits; - } - - attr[i++] = kCGLPFAAuxBuffers; - attr[i++] = mode->numAuxBuffers; - - /* mode->level ignored */ - - /* mode->pixmapMode ? */ - - attr[i++] = 0; - - GLAQUA_DEBUG_MSG("makeFormat almost done\n"); - - result = NULL; - gl_err = CGLChoosePixelFormat(attr, &result, &n_formats); - if (gl_err != 0) - ErrorF("CGLChoosePixelFormat error: %s\n", CGLErrorString(gl_err)); - - GLAQUA_DEBUG_MSG("makeFormat done (0x%x)\n", (unsigned int) result); - - return result; -} - -// Originally copied from Mesa - -static int numConfigs = 0; -static __GLXvisualConfig *visualConfigs = NULL; -static void **visualPrivates = NULL; - -/* - * In the case the driver defines no GLX visuals we'll use these. - * Note that for TrueColor and DirectColor visuals, bufferSize is the - * sum of redSize, greenSize, blueSize and alphaSize, which may be larger - * than the nplanes/rootDepth of the server's X11 visuals - */ -#define NUM_FALLBACK_CONFIGS 5 -static __GLXvisualConfig FallbackConfigs[NUM_FALLBACK_CONFIGS] = { - /* [0] = RGB, double buffered, Z */ - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 0, /* rgba sizes */ - -1, -1, -1, 0, /* rgba masks */ - 0, 0, 0, 0, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 0, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, - /* [1] = RGB, double buffered, Z, stencil, accum */ - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 0, /* rgba sizes */ - -1, -1, -1, 0, /* rgba masks */ - 16, 16, 16, 0, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 8, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, - /* [2] = RGB+Alpha, double buffered, Z, stencil, accum */ - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 8, /* rgba sizes */ - -1, -1, -1, -1, /* rgba masks */ - 16, 16, 16, 16, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 8, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, - /* [3] = RGB+Alpha, single buffered, Z, stencil, accum */ - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 8, /* rgba sizes */ - -1, -1, -1, -1, /* rgba masks */ - 16, 16, 16, 16, /* rgba accum sizes */ - False, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 8, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, - /* [4] = CI, double buffered, Z */ - { - -1, /* vid */ - -1, /* class */ - False, /* rgba? (false = color index) */ - -1, -1, -1, 0, /* rgba sizes */ - -1, -1, -1, 0, /* rgba masks */ - 0, 0, 0, 0, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 0, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, -}; - -static __GLXvisualConfig NullConfig = { - -1, /* vid */ - -1, /* class */ - False, /* rgba */ - -1, -1, -1, 0, /* rgba sizes */ - -1, -1, -1, 0, /* rgba masks */ - 0, 0, 0, 0, /* rgba accum sizes */ - False, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 0, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE_EXT, /* visualRating */ - 0, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ -}; - - -static inline int count_bits(uint32_t x) -{ - x = x - ((x >> 1) & 0x55555555); - x = (x & 0x33333333) + ((x >> 2) & 0x33333333); - x = (x + (x >> 4)) & 0x0f0f0f0f; - x = x + (x >> 8); - x = x + (x >> 16); - return x & 63; -} - - -static Bool init_visuals(int *nvisualp, VisualPtr *visualp, - VisualID *defaultVisp, - int ndepth, DepthPtr pdepth, - int rootDepth) -{ - int numRGBconfigs; - int numCIconfigs; - int numVisuals = *nvisualp; - int numNewVisuals; - int numNewConfigs; - VisualPtr pVisual = *visualp; - VisualPtr pVisualNew = NULL; - VisualID *orig_vid = NULL; - __GLcontextModes *modes; - __GLXvisualConfig *pNewVisualConfigs = NULL; - void **glXVisualPriv; - void **pNewVisualPriv; - int found_default; - int i, j, k; - - GLAQUA_DEBUG_MSG("init_visuals\n"); - - if (numConfigs > 0) - numNewConfigs = numConfigs; - else - numNewConfigs = NUM_FALLBACK_CONFIGS; - - /* Alloc space for the list of new GLX visuals */ - pNewVisualConfigs = (__GLXvisualConfig *) - malloc(numNewConfigs * sizeof(__GLXvisualConfig)); - if (!pNewVisualConfigs) { - return FALSE; - } - - /* Alloc space for the list of new GLX visual privates */ - pNewVisualPriv = (void **) malloc(numNewConfigs * sizeof(void *)); - if (!pNewVisualPriv) { - free(pNewVisualConfigs); - return FALSE; - } - - /* - ** If SetVisualConfigs was not called, then use default GLX - ** visual configs. - */ - if (numConfigs == 0) { - memcpy(pNewVisualConfigs, FallbackConfigs, - NUM_FALLBACK_CONFIGS * sizeof(__GLXvisualConfig)); - memset(pNewVisualPriv, 0, NUM_FALLBACK_CONFIGS * sizeof(void *)); - } - else { - /* copy driver's visual config info */ - for (i = 0; i < numConfigs; i++) { - pNewVisualConfigs[i] = visualConfigs[i]; - pNewVisualPriv[i] = visualPrivates[i]; - } - } - - /* Count the number of RGB and CI visual configs */ - numRGBconfigs = 0; - numCIconfigs = 0; - for (i = 0; i < numNewConfigs; i++) { - if (pNewVisualConfigs[i].rgba) - numRGBconfigs++; - else - numCIconfigs++; - } - - /* Count the total number of visuals to compute */ - numNewVisuals = 0; - for (i = 0; i < numVisuals; i++) { - int count; - - count = ((pVisual[i].class == TrueColor || - pVisual[i].class == DirectColor) - ? numRGBconfigs : numCIconfigs); - if (count == 0) - count = 1; /* preserve the existing visual */ - - numNewVisuals += count; - } - - /* Reset variables for use with the next screen/driver's visual configs */ - visualConfigs = NULL; - numConfigs = 0; - - /* Alloc temp space for the list of orig VisualIDs for each new visual */ - orig_vid = (VisualID *)malloc(numNewVisuals * sizeof(VisualID)); - if (!orig_vid) { - free(pNewVisualPriv); - free(pNewVisualConfigs); - return FALSE; - } - - /* Alloc space for the list of glXVisuals */ - modes = _gl_context_modes_create(numNewVisuals, sizeof(__GLcontextModes)); - if (modes == NULL) { - free(orig_vid); - free(pNewVisualPriv); - free(pNewVisualConfigs); - return FALSE; - } - - /* Alloc space for the list of glXVisualPrivates */ - glXVisualPriv = (void **)malloc(numNewVisuals * sizeof(void *)); - if (!glXVisualPriv) { - _gl_context_modes_destroy( modes ); - free(orig_vid); - free(pNewVisualPriv); - free(pNewVisualConfigs); - return FALSE; - } - - /* Alloc space for the new list of the X server's visuals */ - pVisualNew = (VisualPtr)malloc(numNewVisuals * sizeof(VisualRec)); - if (!pVisualNew) { - free(glXVisualPriv); - _gl_context_modes_destroy( modes ); - free(orig_vid); - free(pNewVisualPriv); - free(pNewVisualConfigs); - return FALSE; - } - - /* Initialize the new visuals */ - found_default = FALSE; - glAquaScreens[screenInfo.numScreens-1].modes = modes; - for (i = j = 0; i < numVisuals; i++) { - int is_rgb = (pVisual[i].class == TrueColor || - pVisual[i].class == DirectColor); - - if (!is_rgb) - { - /* We don't support non-rgb visuals for GL. But we don't - want to remove them either, so just pass them through - with null glX configs */ - - pVisualNew[j] = pVisual[i]; - pVisualNew[j].vid = FakeClientID(0); - - /* Check for the default visual */ - if (!found_default && pVisual[i].vid == *defaultVisp) { - *defaultVisp = pVisualNew[j].vid; - found_default = TRUE; - } - - /* Save the old VisualID */ - orig_vid[j] = pVisual[i].vid; - - /* Initialize the glXVisual */ - _gl_copy_visual_to_context_mode( modes, & NullConfig ); - modes->visualID = pVisualNew[j].vid; - - j++; - - continue; - } - - for (k = 0; k < numNewConfigs; k++) { - if (pNewVisualConfigs[k].rgba != is_rgb) - continue; - - assert( modes != NULL ); - - /* Initialize the new visual */ - pVisualNew[j] = pVisual[i]; - pVisualNew[j].vid = FakeClientID(0); - - /* Check for the default visual */ - if (!found_default && pVisual[i].vid == *defaultVisp) { - *defaultVisp = pVisualNew[j].vid; - found_default = TRUE; - } - - /* Save the old VisualID */ - orig_vid[j] = pVisual[i].vid; - - /* Initialize the glXVisual */ - _gl_copy_visual_to_context_mode( modes, & pNewVisualConfigs[k] ); - modes->visualID = pVisualNew[j].vid; - - /* - * If the class is -1, then assume the X visual information - * is identical to what GLX needs, and take them from the X - * visual. NOTE: if class != -1, then all other fields MUST - * be initialized. - */ - if (modes->visualType == GLX_NONE) { - modes->visualType = _gl_convert_from_x_visual_type( pVisual[i].class ); - modes->redBits = count_bits(pVisual[i].redMask); - modes->greenBits = count_bits(pVisual[i].greenMask); - modes->blueBits = count_bits(pVisual[i].blueMask); - modes->alphaBits = modes->alphaBits; - modes->redMask = pVisual[i].redMask; - modes->greenMask = pVisual[i].greenMask; - modes->blueMask = pVisual[i].blueMask; - modes->alphaMask = modes->alphaMask; - modes->rgbBits = (is_rgb) - ? (modes->redBits + modes->greenBits + - modes->blueBits + modes->alphaBits) - : rootDepth; - } - - /* Save the device-dependent private for this visual */ - glXVisualPriv[j] = pNewVisualPriv[k]; - - j++; - modes = modes->next; - } - } - - assert(j <= numNewVisuals); - - /* Save the GLX visuals in the screen structure */ - glAquaScreens[screenInfo.numScreens-1].num_vis = numNewVisuals; - // glAquaScreens[screenInfo.numScreens-1].priv = glXVisualPriv; - - /* set up depth's VisualIDs */ - for (i = 0; i < ndepth; i++) { - int numVids = 0; - VisualID *pVids = NULL; - int k, n = 0; - - /* Count the new number of VisualIDs at this depth */ - for (j = 0; j < pdepth[i].numVids; j++) - for (k = 0; k < numNewVisuals; k++) - if (pdepth[i].vids[j] == orig_vid[k]) - numVids++; - - /* Allocate a new list of VisualIDs for this depth */ - pVids = (VisualID *)malloc(numVids * sizeof(VisualID)); - - /* Initialize the new list of VisualIDs for this depth */ - for (j = 0; j < pdepth[i].numVids; j++) - for (k = 0; k < numNewVisuals; k++) - if (pdepth[i].vids[j] == orig_vid[k]) - pVids[n++] = pVisualNew[k].vid; - - /* Update this depth's list of VisualIDs */ - free(pdepth[i].vids); - pdepth[i].vids = pVids; - pdepth[i].numVids = numVids; - } - - /* Update the X server's visuals */ - *nvisualp = numNewVisuals; - *visualp = pVisualNew; - - /* Free the old list of the X server's visuals */ - free(pVisual); - - /* Clean up temporary allocations */ - free(orig_vid); - free(pNewVisualPriv); - free(pNewVisualConfigs); - - /* Free the private list created by DDX HW driver */ - if (visualPrivates) - free(visualPrivates); - visualPrivates = NULL; - - return TRUE; -} - -Bool enable_stereo = FALSE; -/* based on code in i830_dri.c - This ends calling glAquaSetVisualConfigs to set the static - numconfigs, etc. */ -static void -glAquaInitVisualConfigs(void) -{ - int lclNumConfigs = 0; - __GLXvisualConfig *lclVisualConfigs = NULL; - void **lclVisualPrivates = NULL; - - int stereo, depth, aux, buffers, stencil, accum; - int i = 0; - - GLAQUA_DEBUG_MSG("glAquaInitVisualConfigs "); - - /* count num configs: - 2 stereo (on, off) (optional) - 2 Z buffer (0, 24 bit) - 2 AUX buffer (0, 2) - 2 buffers (single, double) - 2 stencil (0, 8 bit) - 2 accum (0, 64 bit) - = 64 configs with stereo, or 32 without */ - - if (enable_stereo) lclNumConfigs = 2 * 2 * 2 * 2 * 2 * 2; /* 64 */ - else lclNumConfigs = 2 * 2 * 2 * 2 * 2; /* 32 */ - - /* alloc */ - lclVisualConfigs = xcalloc(sizeof(__GLXvisualConfig), lclNumConfigs); - lclVisualPrivates = xcalloc(sizeof(void *), lclNumConfigs); - - /* fill in configs */ - if (NULL != lclVisualConfigs) { - i = 0; /* current buffer */ - for (stereo = 0; stereo < (enable_stereo ? 2 : 1); stereo++) { - for (depth = 0; depth < 2; depth++) { - for (aux = 0; aux < 2; aux++) { - for (buffers = 0; buffers < 2; buffers++) { - for (stencil = 0; stencil < 2; stencil++) { - for (accum = 0; accum < 2; accum++) { - lclVisualConfigs[i].vid = -1; - lclVisualConfigs[i].class = -1; - lclVisualConfigs[i].rgba = TRUE; - lclVisualConfigs[i].redSize = -1; - lclVisualConfigs[i].greenSize = -1; - lclVisualConfigs[i].blueSize = -1; - lclVisualConfigs[i].redMask = -1; - lclVisualConfigs[i].greenMask = -1; - lclVisualConfigs[i].blueMask = -1; - lclVisualConfigs[i].alphaMask = 0; - if (accum) { - lclVisualConfigs[i].accumRedSize = 16; - lclVisualConfigs[i].accumGreenSize = 16; - lclVisualConfigs[i].accumBlueSize = 16; - lclVisualConfigs[i].accumAlphaSize = 16; - } else { - lclVisualConfigs[i].accumRedSize = 0; - lclVisualConfigs[i].accumGreenSize = 0; - lclVisualConfigs[i].accumBlueSize = 0; - lclVisualConfigs[i].accumAlphaSize = 0; - } - lclVisualConfigs[i].doubleBuffer = buffers ? TRUE : FALSE; - lclVisualConfigs[i].stereo = stereo ? TRUE : FALSE; - lclVisualConfigs[i].bufferSize = -1; - - lclVisualConfigs[i].depthSize = depth? 24 : 0; - lclVisualConfigs[i].stencilSize = stencil ? 8 : 0; - lclVisualConfigs[i].auxBuffers = aux ? 2 : 0; - lclVisualConfigs[i].level = 0; - lclVisualConfigs[i].visualRating = GLX_NONE_EXT; - lclVisualConfigs[i].transparentPixel = 0; - lclVisualConfigs[i].transparentRed = 0; - lclVisualConfigs[i].transparentGreen = 0; - lclVisualConfigs[i].transparentBlue = 0; - lclVisualConfigs[i].transparentAlpha = 0; - lclVisualConfigs[i].transparentIndex = 0; - i++; - } - } - } - } - } - } - } - if (i != lclNumConfigs) - GLAQUA_DEBUG_MSG("glAquaInitVisualConfigs failed to alloc visual configs"); - - GlxSetVisualConfigs(lclNumConfigs, lclVisualConfigs, lclVisualPrivates); -} - - -static void glAquaSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, - void **privates) -{ - GLAQUA_DEBUG_MSG("glAquaSetVisualConfigs\n"); - - numConfigs = nconfigs; - visualConfigs = configs; - visualPrivates = privates; -} - -static Bool glAquaInitVisuals(VisualPtr *visualp, DepthPtr *depthp, - int *nvisualp, int *ndepthp, - int *rootDepthp, VisualID *defaultVisp, - unsigned long sizes, int bitsPerRGB) -{ - GLAQUA_DEBUG_MSG("glAquaInitVisuals\n"); - - if (numConfigs == 0) /* if no configs */ - glAquaInitVisualConfigs(); /* ensure the visual configs are setup */ - - /* - * setup the visuals supported by this particular screen. - */ - return init_visuals(nvisualp, visualp, defaultVisp, - *ndepthp, *depthp, *rootDepthp); -} - -#if 0 -static void fixup_visuals(int screen) -{ - ScreenPtr pScreen = screenInfo.screens[screen]; - glAquaScreenRec *pScr = &glAquaScreens[screen]; - int j; - __GLcontextModes *modes; - - GLAQUA_DEBUG_MSG("fixup_visuals\n"); - - for ( modes = pScr->modes ; modes != NULL ; modes = modes->next ) { - const int vis_class = _gl_convert_to_x_visual_type( modes->visualType ); - const int nplanes = (modes->rgbBits - modes->alphaBits); - const VisualPtr pVis = pScreen->visuals; - - /* Find a visual that matches the GLX visual's class and size */ - for (j = 0; j < pScreen->numVisuals; j++) { - if (pVis[j].class == vis_class && - pVis[j].nplanes == nplanes) { - - /* Fixup the masks */ - modes->redMask = pVis[j].redMask; - modes->greenMask = pVis[j].greenMask; - modes->blueMask = pVis[j].blueMask; - - /* Recalc the sizes */ - modes->redBits = count_bits(modes->redMask); - modes->greenBits = count_bits(modes->greenMask); - modes->blueBits = count_bits(modes->blueMask); - } - } - } -} -#endif -static void __glXAquaScreenDestroy(__GLXscreen *screen) { - - GLAQUA_DEBUG_MSG("glXAquaScreenDestroy(%p)\n", screen); - __glXScreenDestroy(screen); - - free(screen); -} - -static void init_screen_visuals(__GLXAquaScreen *screen) { - ScreenPtr pScreen = screen->base.pScreen; - - __GLcontextModes *modes; - int *used; - int i, j; - - GLAQUA_DEBUG_MSG("init_screen_visuals\n"); - - /* FIXME: Change 'used' to be a array of bits (rather than of ints), - * FIXME: create a stack array of 8 or 16 bytes. If 'numVisuals' is less - * FIXME: than 64 or 128 the stack array can be used instead of calling - * FIXME: malloc / free. If nothing else, convert 'used' to - * FIXME: array of bytes instead of ints! - */ - used = (int *)malloc(pScreen->numVisuals * sizeof(int)); - memset(used, 0, pScreen->numVisuals * sizeof(int)); - - i = 0; - for ( modes = screen -> base.modes - ; modes != NULL - ; modes = modes->next ) { - const int vis_class = _gl_convert_to_x_visual_type( modes->visualType ); - const int nplanes = (modes->rgbBits - modes->alphaBits); - const VisualPtr pVis = pScreen->visuals; - - for (j = 0; j < pScreen->numVisuals; j++) { - if (pVis[j].class == vis_class && - pVis[j].nplanes == nplanes && - pVis[j].redMask == modes->redMask && - pVis[j].greenMask == modes->greenMask && - pVis[j].blueMask == modes->blueMask && - !used[j]) { - - /* set the VisualID */ - modes->visualID = pVis[j].vid; - - /* Mark this visual used */ - used[j] = 1; - break; - } - } - if ( j == pScreen->numVisuals ) { - ErrorF("No matching visual for __GLcontextMode with " - "visual class = %d (%d), nplanes = %u\n", - vis_class, - (int)modes->visualType, - (unsigned int)(modes->rgbBits - modes->alphaBits) ); - } - else if ( modes->visualID == -1 ) { - FatalError( "Matching visual found, but visualID still -1!\n" ); - } - - i++; - } - - free(used); -} - -static __GLXscreen * __glXAquaScreenProbe(ScreenPtr pScreen) { - __GLXAquaScreen *screen; - GLAQUA_DEBUG_MSG("glXAquaScreenProbe\n"); - if (screen == NULL) return NULL; - - screen = malloc(sizeof *screen); - - __glXScreenInit(&screen->base, pScreen); - - screen->base.destroy = __glXAquaScreenDestroy; - screen->base.createContext = __glXAquaScreenCreateContext; - screen->base.createDrawable = __glXAquaScreenCreateDrawable; - screen->base.pScreen = pScreen; - - init_screen_visuals(screen); - - return &screen->base; -} - -static void __glXAquaDrawableDestroy(__GLXdrawable *base) { - GLAQUA_DEBUG_MSG("glAquaDestroyDrawablePrivate\n"); - - /* It doesn't work to call DRIDestroySurface here, the drawable's - already gone.. But dri.c notices the window destruction and - frees the surface itself. */ - - free(base); -} - -static __GLXdrawable * -__glXAquaScreenCreateDrawable(__GLXscreen *screen, - DrawablePtr pDraw, - XID drawId, - __GLcontextModes *modes) { - __GLXAquaDrawable *glxPriv; - - GLAQUA_DEBUG_MSG("glAquaScreenCreateDrawable(%p,%p,%d,%p)\n", context, pDraw, drawId, modes); - - glxPriv = xalloc(sizeof *glxPriv); - if (glxPriv == NULL) return NULL; - - memset(glxPriv, 0, sizeof *glxPriv); - - if (!__glXDrawableInit(&glxPriv->base, screen, pDraw, drawId, modes)) { - xfree(glxPriv); - return NULL; - } - - glxPriv->base.destroy = __glXAquaDrawableDestroy; - glxPriv->base.resize = __glXAquaDrawableResize; - glxPriv->base.swapBuffers = __glXAquaDrawableSwapBuffers; - // glxPriv->base.copySubBuffer = __glXAquaDrawableCopySubBuffer; - - return &glxPriv->base; -} - -static void glAquaResetExtension(void) -{ - GLAQUA_DEBUG_MSG("glAquaResetExtension\n"); - CGLSetOption(kCGLGOResetLibrary, GL_TRUE); -} - -// Extra goodies for glx - -GLuint __glFloorLog2(GLuint val) -{ - int c = 0; - - while (val > 1) { - c++; - val >>= 1; - } - return c; -} - -void warn_func(void * p1, char *format, ...) { - va_list v; - va_start(v, format); - vfprintf(stderr, format, v); - va_end(v); -} - -static void setup_dispatch_table(void) { - struct _glapi_table *disp=_glapi_get_dispatch(); - _glapi_set_warning_func((_glapi_warning_func)warn_func); - _glapi_noop_enable_warnings(TRUE); - - SET_Accum(disp, glAccum); - SET_ActiveStencilFaceEXT(disp, glActiveStencilFaceEXT); - SET_ActiveTextureARB(disp, glActiveTextureARB); -//SET_AlphaFragmentOp1ATI(disp, glAlphaFragmentOp1EXT); // <-- EXT -> ATI -//SET_AlphaFragmentOp2ATI(disp, glAlphaFragmentOp2EXT); -//SET_AlphaFragmentOp3ATI(disp, glAlphaFragmentOp3EXT); - SET_AlphaFunc(disp, glAlphaFunc); -//SET_AreProgramsResidentNV(disp, glAreProgramsResidentNV); - SET_AreTexturesResident(disp, glAreTexturesResident); - SET_ArrayElement(disp, glArrayElement); - SET_AttachObjectARB(disp, glAttachObjectARB); - SET_Begin(disp, glBegin); -//SET_BeginFragmentShaderATI(disp, glBeginFragmentShaderEXT); // <-- EXT -> ATI - SET_BeginQueryARB(disp, glBeginQueryARB); - SET_BindAttribLocationARB(disp, glBindAttribLocationARB); - SET_BindBufferARB(disp, glBindBufferARB); -//SET_BindFragmentShaderATI(disp, glBindFragmentShaderEXT); // <-- EXT -> ATI - SET_BindFramebufferEXT(disp, glBindFramebufferEXT); -//SET_BindProgramNV(disp, glBindProgramNV); - SET_BindRenderbufferEXT(disp, glBindRenderbufferEXT); - SET_BindTexture(disp, glBindTexture); - SET_Bitmap(disp, glBitmap); - SET_BlendColor(disp, glBlendColor); - SET_BlendEquation(disp, glBlendEquation); - SET_BlendEquationSeparateEXT(disp, glBlendEquationSeparateEXT); - SET_BlendFunc(disp, glBlendFunc); - SET_BlendFuncSeparateEXT(disp, glBlendFuncSeparateEXT); - SET_BlitFramebufferEXT(disp, glBlitFramebufferEXT); - SET_BufferDataARB(disp, glBufferDataARB); - SET_BufferSubDataARB(disp, glBufferSubDataARB); - SET_CallList(disp, glCallList); - SET_CallLists(disp, glCallLists); - SET_CheckFramebufferStatusEXT(disp, glCheckFramebufferStatusEXT); - SET_Clear(disp, glClear); - SET_ClearAccum(disp, glClearAccum); - SET_ClearColor(disp, glClearColor); - SET_ClearDepth(disp, glClearDepth); - SET_ClearIndex(disp, glClearIndex); - SET_ClearStencil(disp, glClearStencil); - SET_ClientActiveTextureARB(disp, glClientActiveTextureARB); - SET_ClipPlane(disp, glClipPlane); - SET_Color3b(disp, glColor3b); - SET_Color3bv(disp, glColor3bv); - SET_Color3d(disp, glColor3d); - SET_Color3dv(disp, glColor3dv); - SET_Color3f(disp, glColor3f); - SET_Color3fv(disp, glColor3fv); - SET_Color3i(disp, glColor3i); - SET_Color3iv(disp, glColor3iv); - SET_Color3s(disp, glColor3s); - SET_Color3sv(disp, glColor3sv); - SET_Color3ub(disp, glColor3ub); - SET_Color3ubv(disp, glColor3ubv); - SET_Color3ui(disp, glColor3ui); - SET_Color3uiv(disp, glColor3uiv); - SET_Color3us(disp, glColor3us); - SET_Color3usv(disp, glColor3usv); - SET_Color4b(disp, glColor4b); - SET_Color4bv(disp, glColor4bv); - SET_Color4d(disp, glColor4d); - SET_Color4dv(disp, glColor4dv); - SET_Color4f(disp, glColor4f); - SET_Color4fv(disp, glColor4fv); - SET_Color4i(disp, glColor4i); - SET_Color4iv(disp, glColor4iv); - SET_Color4s(disp, glColor4s); - SET_Color4sv(disp, glColor4sv); - SET_Color4ub(disp, glColor4ub); - SET_Color4ubv(disp, glColor4ubv); - SET_Color4ui(disp, glColor4ui); - SET_Color4uiv(disp, glColor4uiv); - SET_Color4us(disp, glColor4us); - SET_Color4usv(disp, glColor4usv); -//SET_ColorFragmentOp1ATI(disp, glColorFragmentOp1EXT); // <-- EXT -> ATI -//SET_ColorFragmentOp2ATI(disp, glColorFragmentOp2EXT); -//SET_ColorFragmentOp3ATI(disp, glColorFragmentOp3EXT); - SET_ColorMask(disp, glColorMask); - SET_ColorMaterial(disp, glColorMaterial); - SET_ColorPointer(disp, glColorPointer); -//SET_ColorPointerEXT(disp, glColorPointerEXT); - SET_ColorSubTable(disp, glColorSubTable); - SET_ColorTable(disp, glColorTable); - SET_ColorTableParameterfv(disp, glColorTableParameterfv); - SET_ColorTableParameteriv(disp, glColorTableParameteriv); - SET_CombinerInputNV(disp, glCombinerInputNV); - SET_CombinerOutputNV(disp, glCombinerOutputNV); - SET_CombinerParameterfNV(disp, glCombinerParameterfNV); - SET_CombinerParameterfvNV(disp, glCombinerParameterfvNV); - SET_CombinerParameteriNV(disp, glCombinerParameteriNV); - SET_CombinerParameterivNV(disp, glCombinerParameterivNV); - SET_CompileShaderARB(disp, glCompileShaderARB); - SET_CompressedTexImage1DARB(disp, glCompressedTexImage1DARB); - SET_CompressedTexImage2DARB(disp, glCompressedTexImage2DARB); - SET_CompressedTexImage3DARB(disp, glCompressedTexImage3DARB); - SET_CompressedTexSubImage1DARB(disp, glCompressedTexSubImage1DARB); - SET_CompressedTexSubImage2DARB(disp, glCompressedTexSubImage2DARB); - SET_CompressedTexSubImage3DARB(disp, glCompressedTexSubImage3DARB); - SET_ConvolutionFilter1D(disp, glConvolutionFilter1D); - SET_ConvolutionFilter2D(disp, glConvolutionFilter2D); - SET_ConvolutionParameterf(disp, glConvolutionParameterf); - SET_ConvolutionParameterfv(disp, glConvolutionParameterfv); - SET_ConvolutionParameteri(disp, glConvolutionParameteri); - SET_ConvolutionParameteriv(disp, glConvolutionParameteriv); - SET_CopyColorSubTable(disp, glCopyColorSubTable); - SET_CopyColorTable(disp, glCopyColorTable); - SET_CopyConvolutionFilter1D(disp, glCopyConvolutionFilter1D); - SET_CopyConvolutionFilter2D(disp, glCopyConvolutionFilter2D); - SET_CopyPixels(disp, glCopyPixels); - SET_CopyTexImage1D(disp, glCopyTexImage1D); - SET_CopyTexImage2D(disp, glCopyTexImage2D); - SET_CopyTexSubImage1D(disp, glCopyTexSubImage1D); - SET_CopyTexSubImage2D(disp, glCopyTexSubImage2D); - SET_CopyTexSubImage3D(disp, glCopyTexSubImage3D); - SET_CreateProgramObjectARB(disp, glCreateProgramObjectARB); - SET_CreateShaderObjectARB(disp, glCreateShaderObjectARB); - SET_CullFace(disp, glCullFace); -//SET_CullParameterdvEXT(disp, glCullParameterdvEXT); -//SET_CullParameterfvEXT(disp, glCullParameterfvEXT); - SET_DeleteBuffersARB(disp, glDeleteBuffersARB); - SET_DeleteFencesNV(disp, glDeleteFencesAPPLE); -//SET_DeleteFragmentShaderATI(disp, glDeleteFragmentShaderEXT); // <-- EXT -> ATI - SET_DeleteFramebuffersEXT(disp, glDeleteFramebuffersEXT); - SET_DeleteLists(disp, glDeleteLists); - SET_DeleteObjectARB(disp, glDeleteObjectARB); -//SET_DeleteProgramsNV(disp, glDeleteProgramsNV); - SET_DeleteQueriesARB(disp, glDeleteQueriesARB); - SET_DeleteRenderbuffersEXT(disp, glDeleteRenderbuffersEXT); - SET_DeleteTextures(disp, glDeleteTextures); - SET_DepthBoundsEXT(disp, glDepthBoundsEXT); - SET_DepthFunc(disp, glDepthFunc); - SET_DepthMask(disp, glDepthMask); - SET_DepthRange(disp, glDepthRange); - SET_DetachObjectARB(disp, glDetachObjectARB); - SET_Disable(disp, glDisable); - SET_DisableClientState(disp, glDisableClientState); - SET_DisableVertexAttribArrayARB(disp, glDisableVertexAttribArrayARB); - SET_DrawArrays(disp, glDrawArrays); - SET_DrawBuffer(disp, glDrawBuffer); - SET_DrawBuffersARB(disp, glDrawBuffersARB); - SET_DrawElements(disp, glDrawElements); - SET_DrawPixels(disp, glDrawPixels); - SET_DrawRangeElements(disp, glDrawRangeElements); - SET_EdgeFlag(disp, glEdgeFlag); - SET_EdgeFlagPointer(disp, glEdgeFlagPointer); -//SET_EdgeFlagPointerEXT(disp, glEdgeFlagPointerEXT); - SET_EdgeFlagv(disp, glEdgeFlagv); - SET_Enable(disp, glEnable); - SET_EnableClientState(disp, glEnableClientState); - SET_EnableVertexAttribArrayARB(disp, glEnableVertexAttribArrayARB); - SET_End(disp, glEnd); -//SET_EndFragmentShaderATI(disp, glEndFragmentShaderEXT); // <-- EXT -> ATI - SET_EndList(disp, glEndList); - SET_EndQueryARB(disp, glEndQueryARB); - SET_EvalCoord1d(disp, glEvalCoord1d); - SET_EvalCoord1dv(disp, glEvalCoord1dv); - SET_EvalCoord1f(disp, glEvalCoord1f); - SET_EvalCoord1fv(disp, glEvalCoord1fv); - SET_EvalCoord2d(disp, glEvalCoord2d); - SET_EvalCoord2dv(disp, glEvalCoord2dv); - SET_EvalCoord2f(disp, glEvalCoord2f); - SET_EvalCoord2fv(disp, glEvalCoord2fv); - SET_EvalMesh1(disp, glEvalMesh1); - SET_EvalMesh2(disp, glEvalMesh2); - SET_EvalPoint1(disp, glEvalPoint1); - SET_EvalPoint2(disp, glEvalPoint2); -//SET_ExecuteProgramNV(disp, glExecuteProgramNV); - SET_FeedbackBuffer(disp, glFeedbackBuffer); - SET_FinalCombinerInputNV(disp, glFinalCombinerInputNV); - SET_Finish(disp, glFinish); - SET_FinishFenceNV(disp, glFinishFenceAPPLE); // <-- APPLE -> NV - SET_Flush(disp, glFlush); -//SET_FlushVertexArrayRangeNV(disp, glFlushVertexArrayRangeNV); - SET_FogCoordPointerEXT(disp, glFogCoordPointerEXT); - SET_FogCoorddEXT(disp, glFogCoorddEXT); - SET_FogCoorddvEXT(disp, glFogCoorddvEXT); - SET_FogCoordfEXT(disp, glFogCoordfEXT); - SET_FogCoordfvEXT(disp, glFogCoordfvEXT); - SET_Fogf(disp, glFogf); - SET_Fogfv(disp, glFogfv); - SET_Fogi(disp, glFogi); - SET_Fogiv(disp, glFogiv); - SET_FramebufferRenderbufferEXT(disp, glFramebufferRenderbufferEXT); - SET_FramebufferTexture1DEXT(disp, glFramebufferTexture1DEXT); - SET_FramebufferTexture2DEXT(disp, glFramebufferTexture2DEXT); - SET_FramebufferTexture3DEXT(disp, glFramebufferTexture3DEXT); - SET_FrontFace(disp, glFrontFace); - SET_Frustum(disp, glFrustum); - SET_GenBuffersARB(disp, glGenBuffersARB); - SET_GenFencesNV(disp, glGenFencesAPPLE); // <-- APPLE -> NV -//SET_GenFragmentShadersATI(disp, glGenFragmentShadersEXT); // <-- EXT -> ATI - SET_GenFramebuffersEXT(disp, glGenFramebuffersEXT); - SET_GenLists(disp, glGenLists); -//SET_GenProgramsNV(disp, glGenProgramsNV); - SET_GenQueriesARB(disp, glGenQueriesARB); - SET_GenRenderbuffersEXT(disp, glGenRenderbuffersEXT); - SET_GenTextures(disp, glGenTextures); - SET_GenerateMipmapEXT(disp, glGenerateMipmapEXT); - SET_GetActiveAttribARB(disp, glGetActiveAttribARB); - SET_GetActiveUniformARB(disp, glGetActiveUniformARB); - SET_GetAttachedObjectsARB(disp, glGetAttachedObjectsARB); - SET_GetAttribLocationARB(disp, glGetAttribLocationARB); - SET_GetBooleanv(disp, glGetBooleanv); - SET_GetBufferParameterivARB(disp, glGetBufferParameterivARB); - SET_GetBufferPointervARB(disp, glGetBufferPointervARB); - SET_GetBufferSubDataARB(disp, glGetBufferSubDataARB); - SET_GetClipPlane(disp, glGetClipPlane); - SET_GetColorTable(disp, glGetColorTable); - SET_GetColorTableParameterfv(disp, glGetColorTableParameterfv); - SET_GetColorTableParameteriv(disp, glGetColorTableParameteriv); - SET_GetCombinerInputParameterfvNV(disp, glGetCombinerInputParameterfvNV); - SET_GetCombinerInputParameterivNV(disp, glGetCombinerInputParameterivNV); - SET_GetCombinerOutputParameterfvNV(disp, glGetCombinerOutputParameterfvNV); - SET_GetCombinerOutputParameterivNV(disp, glGetCombinerOutputParameterivNV); - SET_GetCompressedTexImageARB(disp, glGetCompressedTexImageARB); - SET_GetConvolutionFilter(disp, glGetConvolutionFilter); - SET_GetConvolutionParameterfv(disp, glGetConvolutionParameterfv); - SET_GetConvolutionParameteriv(disp, glGetConvolutionParameteriv); - SET_GetDoublev(disp, glGetDoublev); - SET_GetError(disp, glGetError); -//SET_GetFenceivNV(disp, glGetFenceivNV); - SET_GetFinalCombinerInputParameterfvNV(disp, glGetFinalCombinerInputParameterfvNV); - SET_GetFinalCombinerInputParameterivNV(disp, glGetFinalCombinerInputParameterivNV); - SET_GetFloatv(disp, glGetFloatv); - SET_GetFramebufferAttachmentParameterivEXT(disp, glGetFramebufferAttachmentParameterivEXT); - SET_GetHandleARB(disp, glGetHandleARB); - SET_GetHistogram(disp, glGetHistogram); - SET_GetHistogramParameterfv(disp, glGetHistogramParameterfv); - SET_GetHistogramParameteriv(disp, glGetHistogramParameteriv); - SET_GetInfoLogARB(disp, glGetInfoLogARB); - SET_GetIntegerv(disp, glGetIntegerv); - SET_GetLightfv(disp, glGetLightfv); - SET_GetLightiv(disp, glGetLightiv); - SET_GetMapdv(disp, glGetMapdv); - SET_GetMapfv(disp, glGetMapfv); - SET_GetMapiv(disp, glGetMapiv); - SET_GetMaterialfv(disp, glGetMaterialfv); - SET_GetMaterialiv(disp, glGetMaterialiv); - SET_GetMinmax(disp, glGetMinmax); - SET_GetMinmaxParameterfv(disp, glGetMinmaxParameterfv); - SET_GetMinmaxParameteriv(disp, glGetMinmaxParameteriv); - SET_GetObjectParameterfvARB(disp, glGetObjectParameterfvARB); - SET_GetObjectParameterivARB(disp, glGetObjectParameterivARB); - SET_GetPixelMapfv(disp, glGetPixelMapfv); - SET_GetPixelMapuiv(disp, glGetPixelMapuiv); - SET_GetPixelMapusv(disp, glGetPixelMapusv); -//SET_GetPixelTexGenParameterfvSGIS(disp, glGetPixelTexGenParameterfvSGIS); -//SET_GetPixelTexGenParameterivSGIS(disp, glGetPixelTexGenParameterivSGIS); - SET_GetPointerv(disp, glGetPointerv); - SET_GetPolygonStipple(disp, glGetPolygonStipple); - SET_GetProgramEnvParameterdvARB(disp, glGetProgramEnvParameterdvARB); - SET_GetProgramEnvParameterfvARB(disp, glGetProgramEnvParameterfvARB); - SET_GetProgramLocalParameterdvARB(disp, glGetProgramLocalParameterdvARB); - SET_GetProgramLocalParameterfvARB(disp, glGetProgramLocalParameterfvARB); -//SET_GetProgramNamedParameterdvNV(disp, glGetProgramNamedParameterdvNV); -//SET_GetProgramNamedParameterfvNV(disp, glGetProgramNamedParameterfvNV); -//SET_GetProgramParameterdvNV(disp, glGetProgramParameterdvNV); -//SET_GetProgramParameterfvNV(disp, glGetProgramParameterfvNV); - SET_GetProgramStringARB(disp, glGetProgramStringARB); -//SET_GetProgramStringNV(disp, glGetProgramStringNV); - SET_GetProgramivARB(disp, glGetProgramivARB); -//SET_GetProgramivNV(disp, glGetProgramivNV); -//SET_GetQueryObjecti64vEXT(disp, glGetQueryObjecti64vEXT); - SET_GetQueryObjectivARB(disp, glGetQueryObjectivARB); -//SET_GetQueryObjectui64vEXT(disp, glGetQueryObjectui64vEXT); - SET_GetQueryObjectuivARB(disp, glGetQueryObjectuivARB); - SET_GetQueryivARB(disp, glGetQueryivARB); - SET_GetRenderbufferParameterivEXT(disp, glGetRenderbufferParameterivEXT); - SET_GetSeparableFilter(disp, glGetSeparableFilter); - SET_GetShaderSourceARB(disp, glGetShaderSourceARB); - SET_GetString(disp, glGetString); - SET_GetTexEnvfv(disp, glGetTexEnvfv); - SET_GetTexEnviv(disp, glGetTexEnviv); - SET_GetTexGendv(disp, glGetTexGendv); - SET_GetTexGenfv(disp, glGetTexGenfv); - SET_GetTexGeniv(disp, glGetTexGeniv); - SET_GetTexImage(disp, glGetTexImage); - SET_GetTexLevelParameterfv(disp, glGetTexLevelParameterfv); - SET_GetTexLevelParameteriv(disp, glGetTexLevelParameteriv); - SET_GetTexParameterfv(disp, glGetTexParameterfv); - SET_GetTexParameteriv(disp, glGetTexParameteriv); -//SET_GetTrackMatrixivNV(disp, glGetTrackMatrixivNV); - SET_GetUniformLocationARB(disp, glGetUniformLocationARB); - SET_GetUniformfvARB(disp, glGetUniformfvARB); - SET_GetUniformivARB(disp, glGetUniformivARB); -//SET_GetVertexAttribPointervNV(disp, glGetVertexAttribPointervNV); - SET_GetVertexAttribdvARB(disp, glGetVertexAttribdvARB); -//SET_GetVertexAttribdvNV(disp, glGetVertexAttribdvNV); - SET_GetVertexAttribfvARB(disp, glGetVertexAttribfvARB); -//SET_GetVertexAttribfvNV(disp, glGetVertexAttribfvNV); - SET_GetVertexAttribivARB(disp, glGetVertexAttribivARB); -//SET_GetVertexAttribivNV(disp, glGetVertexAttribivNV); - SET_Hint(disp, glHint); - SET_Histogram(disp, glHistogram); - SET_IndexMask(disp, glIndexMask); - SET_IndexPointer(disp, glIndexPointer); -//SET_IndexPointerEXT(disp, glIndexPointerEXT); - SET_Indexd(disp, glIndexd); - SET_Indexdv(disp, glIndexdv); - SET_Indexf(disp, glIndexf); - SET_Indexfv(disp, glIndexfv); - SET_Indexi(disp, glIndexi); - SET_Indexiv(disp, glIndexiv); - SET_Indexs(disp, glIndexs); - SET_Indexsv(disp, glIndexsv); - SET_Indexub(disp, glIndexub); - SET_Indexubv(disp, glIndexubv); - SET_InitNames(disp, glInitNames); - SET_InterleavedArrays(disp, glInterleavedArrays); - SET_IsBufferARB(disp, glIsBufferARB); - SET_IsEnabled(disp, glIsEnabled); - SET_IsFenceNV(disp, glIsFenceAPPLE); // <-- APPLE -> NV - SET_IsFramebufferEXT(disp, glIsFramebufferEXT); - SET_IsList(disp, glIsList); -//SET_IsProgramNV(disp, glIsProgramNV); - SET_IsQueryARB(disp, glIsQueryARB); - SET_IsRenderbufferEXT(disp, glIsRenderbufferEXT); - SET_IsTexture(disp, glIsTexture); - SET_LightModelf(disp, glLightModelf); - SET_LightModelfv(disp, glLightModelfv); - SET_LightModeli(disp, glLightModeli); - SET_LightModeliv(disp, glLightModeliv); - SET_Lightf(disp, glLightf); - SET_Lightfv(disp, glLightfv); - SET_Lighti(disp, glLighti); - SET_Lightiv(disp, glLightiv); - SET_LineStipple(disp, glLineStipple); - SET_LineWidth(disp, glLineWidth); - SET_LinkProgramARB(disp, glLinkProgramARB); - SET_ListBase(disp, glListBase); - SET_LoadIdentity(disp, glLoadIdentity); - SET_LoadMatrixd(disp, glLoadMatrixd); - SET_LoadMatrixf(disp, glLoadMatrixf); - SET_LoadName(disp, glLoadName); -//SET_LoadProgramNV(disp, glLoadProgramNV); - SET_LoadTransposeMatrixdARB(disp, glLoadTransposeMatrixdARB); - SET_LoadTransposeMatrixfARB(disp, glLoadTransposeMatrixfARB); - SET_LockArraysEXT(disp, glLockArraysEXT); - SET_LogicOp(disp, glLogicOp); - SET_Map1d(disp, glMap1d); - SET_Map1f(disp, glMap1f); - SET_Map2d(disp, glMap2d); - SET_Map2f(disp, glMap2f); - SET_MapBufferARB(disp, glMapBufferARB); - SET_MapGrid1d(disp, glMapGrid1d); - SET_MapGrid1f(disp, glMapGrid1f); - SET_MapGrid2d(disp, glMapGrid2d); - SET_MapGrid2f(disp, glMapGrid2f); - SET_Materialf(disp, glMaterialf); - SET_Materialfv(disp, glMaterialfv); - SET_Materiali(disp, glMateriali); - SET_Materialiv(disp, glMaterialiv); - SET_MatrixMode(disp, glMatrixMode); - SET_Minmax(disp, glMinmax); - SET_MultMatrixd(disp, glMultMatrixd); - SET_MultMatrixf(disp, glMultMatrixf); - SET_MultTransposeMatrixdARB(disp, glMultTransposeMatrixdARB); - SET_MultTransposeMatrixfARB(disp, glMultTransposeMatrixfARB); - SET_MultiDrawArraysEXT(disp, glMultiDrawArraysEXT); - SET_MultiDrawElementsEXT(disp, glMultiDrawElementsEXT); -//SET_MultiModeDrawArraysIBM(disp, glMultiModeDrawArraysIBM); -//SET_MultiModeDrawElementsIBM(disp, glMultiModeDrawElementsIBM); - SET_MultiTexCoord1dARB(disp, glMultiTexCoord1dARB); - SET_MultiTexCoord1dvARB(disp, glMultiTexCoord1dvARB); - SET_MultiTexCoord1fARB(disp, glMultiTexCoord1fARB); - SET_MultiTexCoord1fvARB(disp, glMultiTexCoord1fvARB); - SET_MultiTexCoord1iARB(disp, glMultiTexCoord1iARB); - SET_MultiTexCoord1ivARB(disp, glMultiTexCoord1ivARB); - SET_MultiTexCoord1sARB(disp, glMultiTexCoord1sARB); - SET_MultiTexCoord1svARB(disp, glMultiTexCoord1svARB); - SET_MultiTexCoord2dARB(disp, glMultiTexCoord2dARB); - SET_MultiTexCoord2dvARB(disp, glMultiTexCoord2dvARB); - SET_MultiTexCoord2fARB(disp, glMultiTexCoord2fARB); - SET_MultiTexCoord2fvARB(disp, glMultiTexCoord2fvARB); - SET_MultiTexCoord2iARB(disp, glMultiTexCoord2iARB); - SET_MultiTexCoord2ivARB(disp, glMultiTexCoord2ivARB); - SET_MultiTexCoord2sARB(disp, glMultiTexCoord2sARB); - SET_MultiTexCoord2svARB(disp, glMultiTexCoord2svARB); - SET_MultiTexCoord3dARB(disp, glMultiTexCoord3dARB); - SET_MultiTexCoord3dvARB(disp, glMultiTexCoord3dvARB); - SET_MultiTexCoord3fARB(disp, glMultiTexCoord3fARB); - SET_MultiTexCoord3fvARB(disp, glMultiTexCoord3fvARB); - SET_MultiTexCoord3iARB(disp, glMultiTexCoord3iARB); - SET_MultiTexCoord3ivARB(disp, glMultiTexCoord3ivARB); - SET_MultiTexCoord3sARB(disp, glMultiTexCoord3sARB); - SET_MultiTexCoord3svARB(disp, glMultiTexCoord3svARB); - SET_MultiTexCoord4dARB(disp, glMultiTexCoord4dARB); - SET_MultiTexCoord4dvARB(disp, glMultiTexCoord4dvARB); - SET_MultiTexCoord4fARB(disp, glMultiTexCoord4fARB); - SET_MultiTexCoord4fvARB(disp, glMultiTexCoord4fvARB); - SET_MultiTexCoord4iARB(disp, glMultiTexCoord4iARB); - SET_MultiTexCoord4ivARB(disp, glMultiTexCoord4ivARB); - SET_MultiTexCoord4sARB(disp, glMultiTexCoord4sARB); - SET_MultiTexCoord4svARB(disp, glMultiTexCoord4svARB); - SET_NewList(disp, glNewList); - SET_Normal3b(disp, glNormal3b); - SET_Normal3bv(disp, glNormal3bv); - SET_Normal3d(disp, glNormal3d); - SET_Normal3dv(disp, glNormal3dv); - SET_Normal3f(disp, glNormal3f); - SET_Normal3fv(disp, glNormal3fv); - SET_Normal3i(disp, glNormal3i); - SET_Normal3iv(disp, glNormal3iv); - SET_Normal3s(disp, glNormal3s); - SET_Normal3sv(disp, glNormal3sv); - SET_NormalPointer(disp, glNormalPointer); -//SET_NormalPointerEXT(disp, glNormalPointerEXT); - SET_Ortho(disp, glOrtho); -//SET_PassTexCoordATI(disp, glPassTexCoordEXT); // <-- EXT -> ATI - SET_PassThrough(disp, glPassThrough); - SET_PixelMapfv(disp, glPixelMapfv); - SET_PixelMapuiv(disp, glPixelMapuiv); - SET_PixelMapusv(disp, glPixelMapusv); - SET_PixelStoref(disp, glPixelStoref); - SET_PixelStorei(disp, glPixelStorei); -//SET_PixelTexGenParameterfSGIS(disp, glPixelTexGenParameterfSGIS); -//SET_PixelTexGenParameterfvSGIS(disp, glPixelTexGenParameterfvSGIS); -//SET_PixelTexGenParameteriSGIS(disp, glPixelTexGenParameteriSGIS); -//SET_PixelTexGenParameterivSGIS(disp, glPixelTexGenParameterivSGIS); -// SET_PixelTexGenSGIX(disp, glPixelTexGenSGIX); - SET_PixelTransferf(disp, glPixelTransferf); - SET_PixelTransferi(disp, glPixelTransferi); - SET_PixelZoom(disp, glPixelZoom); - SET_PointParameterfEXT(disp, glPointParameterfARB); // <-- ARB -> EXT - SET_PointParameterfvEXT(disp, glPointParameterfvARB); // <-- ARB -> EXT - SET_PointParameteriNV(disp, glPointParameteriNV); - SET_PointParameterivNV(disp, glPointParameterivNV); - SET_PointSize(disp, glPointSize); - SET_PolygonMode(disp, glPolygonMode); - SET_PolygonOffset(disp, glPolygonOffset); -//SET_PolygonOffsetEXT(disp, glPolygonOffsetEXT); - SET_PolygonStipple(disp, glPolygonStipple); - SET_PopAttrib(disp, glPopAttrib); - SET_PopClientAttrib(disp, glPopClientAttrib); - SET_PopMatrix(disp, glPopMatrix); - SET_PopName(disp, glPopName); - SET_PrioritizeTextures(disp, glPrioritizeTextures); - SET_ProgramEnvParameter4dARB(disp, glProgramEnvParameter4dARB); - SET_ProgramEnvParameter4dvARB(disp, glProgramEnvParameter4dvARB); - SET_ProgramEnvParameter4fARB(disp, glProgramEnvParameter4fARB); - SET_ProgramEnvParameter4fvARB(disp, glProgramEnvParameter4fvARB); - SET_ProgramLocalParameter4dARB(disp, glProgramLocalParameter4dARB); - SET_ProgramLocalParameter4dvARB(disp, glProgramLocalParameter4dvARB); - SET_ProgramLocalParameter4fARB(disp, glProgramLocalParameter4fARB); - SET_ProgramLocalParameter4fvARB(disp, glProgramLocalParameter4fvARB); -//SET_ProgramNamedParameter4dNV(disp, glProgramNamedParameter4dNV); -//SET_ProgramNamedParameter4dvNV(disp, glProgramNamedParameter4dvNV); -//SET_ProgramNamedParameter4fNV(disp, glProgramNamedParameter4fNV); -//SET_ProgramNamedParameter4fvNV(disp, glProgramNamedParameter4fvNV); -//SET_ProgramParameter4dNV(disp, glProgramParameter4dNV); -//SET_ProgramParameter4dvNV(disp, glProgramParameter4dvNV); -//SET_ProgramParameter4fNV(disp, glProgramParameter4fNV); -//SET_ProgramParameter4fvNV(disp, glProgramParameter4fvNV); -//SET_ProgramParameters4dvNV(disp, glProgramParameters4dvNV); -//SET_ProgramParameters4fvNV(disp, glProgramParameters4fvNV); - SET_ProgramStringARB(disp, glProgramStringARB); - SET_PushAttrib(disp, glPushAttrib); - SET_PushClientAttrib(disp, glPushClientAttrib); - SET_PushMatrix(disp, glPushMatrix); - SET_PushName(disp, glPushName); - SET_RasterPos2d(disp, glRasterPos2d); - SET_RasterPos2dv(disp, glRasterPos2dv); - SET_RasterPos2f(disp, glRasterPos2f); - SET_RasterPos2fv(disp, glRasterPos2fv); - SET_RasterPos2i(disp, glRasterPos2i); - SET_RasterPos2iv(disp, glRasterPos2iv); - SET_RasterPos2s(disp, glRasterPos2s); - SET_RasterPos2sv(disp, glRasterPos2sv); - SET_RasterPos3d(disp, glRasterPos3d); - SET_RasterPos3dv(disp, glRasterPos3dv); - SET_RasterPos3f(disp, glRasterPos3f); - SET_RasterPos3fv(disp, glRasterPos3fv); - SET_RasterPos3i(disp, glRasterPos3i); - SET_RasterPos3iv(disp, glRasterPos3iv); - SET_RasterPos3s(disp, glRasterPos3s); - SET_RasterPos3sv(disp, glRasterPos3sv); - SET_RasterPos4d(disp, glRasterPos4d); - SET_RasterPos4dv(disp, glRasterPos4dv); - SET_RasterPos4f(disp, glRasterPos4f); - SET_RasterPos4fv(disp, glRasterPos4fv); - SET_RasterPos4i(disp, glRasterPos4i); - SET_RasterPos4iv(disp, glRasterPos4iv); - SET_RasterPos4s(disp, glRasterPos4s); - SET_RasterPos4sv(disp, glRasterPos4sv); - SET_ReadBuffer(disp, glReadBuffer); - SET_ReadPixels(disp, glReadPixels); - SET_Rectd(disp, glRectd); - SET_Rectdv(disp, glRectdv); - SET_Rectf(disp, glRectf); - SET_Rectfv(disp, glRectfv); - SET_Recti(disp, glRecti); - SET_Rectiv(disp, glRectiv); - SET_Rects(disp, glRects); - SET_Rectsv(disp, glRectsv); - SET_RenderMode(disp, glRenderMode); - SET_RenderbufferStorageEXT(disp, glRenderbufferStorageEXT); -//SET_RequestResidentProgramsNV(disp, glRequestResidentProgramsNV); - SET_ResetHistogram(disp, glResetHistogram); - SET_ResetMinmax(disp, glResetMinmax); -//SET_ResizeBuffersMESA(disp, glResizeBuffersMESA); - SET_Rotated(disp, glRotated); - SET_Rotatef(disp, glRotatef); - SET_SampleCoverageARB(disp, glSampleCoverageARB); -//SET_SampleMapATI(disp, glSampleMapEXT); // <-- EXT -> ATI -//SET_SampleMaskSGIS(disp, glSampleMaskSGIS); -//SET_SamplePatternSGIS(disp, glSamplePatternSGIS); - SET_Scaled(disp, glScaled); - SET_Scalef(disp, glScalef); - SET_Scissor(disp, glScissor); - SET_SecondaryColor3bEXT(disp, glSecondaryColor3bEXT); - SET_SecondaryColor3bvEXT(disp, glSecondaryColor3bvEXT); - SET_SecondaryColor3dEXT(disp, glSecondaryColor3dEXT); - SET_SecondaryColor3dvEXT(disp, glSecondaryColor3dvEXT); - SET_SecondaryColor3fEXT(disp, glSecondaryColor3fEXT); - SET_SecondaryColor3fvEXT(disp, glSecondaryColor3fvEXT); - SET_SecondaryColor3iEXT(disp, glSecondaryColor3iEXT); - SET_SecondaryColor3ivEXT(disp, glSecondaryColor3ivEXT); - SET_SecondaryColor3sEXT(disp, glSecondaryColor3sEXT); - SET_SecondaryColor3svEXT(disp, glSecondaryColor3svEXT); - SET_SecondaryColor3ubEXT(disp, glSecondaryColor3ubEXT); - SET_SecondaryColor3ubvEXT(disp, glSecondaryColor3ubvEXT); - SET_SecondaryColor3uiEXT(disp, glSecondaryColor3uiEXT); - SET_SecondaryColor3uivEXT(disp, glSecondaryColor3uivEXT); - SET_SecondaryColor3usEXT(disp, glSecondaryColor3usEXT); - SET_SecondaryColor3usvEXT(disp, glSecondaryColor3usvEXT); - SET_SecondaryColorPointerEXT(disp, glSecondaryColorPointerEXT); - SET_SelectBuffer(disp, glSelectBuffer); - SET_SeparableFilter2D(disp, glSeparableFilter2D); - SET_SetFenceNV(disp, glSetFenceAPPLE); // <-- APPLE -> NV -//SET_SetFragmentShaderConstantATI(disp, glSetFragmentShaderConstantEXT); // <-- EXT -> ATI - SET_ShadeModel(disp, glShadeModel); - SET_ShaderSourceARB(disp, glShaderSourceARB); - SET_StencilFunc(disp, glStencilFunc); - SET_StencilFuncSeparate(disp, glStencilFuncSeparate); - SET_StencilMask(disp, glStencilMask); - SET_StencilMaskSeparate(disp, glStencilMaskSeparate); - SET_StencilOp(disp, glStencilOp); - SET_StencilOpSeparate(disp, glStencilOpSeparate); - SET_TestFenceNV(disp, glTestFenceAPPLE); // <-- APPLE -> NV - SET_TexCoord1d(disp, glTexCoord1d); - SET_TexCoord1dv(disp, glTexCoord1dv); - SET_TexCoord1f(disp, glTexCoord1f); - SET_TexCoord1fv(disp, glTexCoord1fv); - SET_TexCoord1i(disp, glTexCoord1i); - SET_TexCoord1iv(disp, glTexCoord1iv); - SET_TexCoord1s(disp, glTexCoord1s); - SET_TexCoord1sv(disp, glTexCoord1sv); - SET_TexCoord2d(disp, glTexCoord2d); - SET_TexCoord2dv(disp, glTexCoord2dv); - SET_TexCoord2f(disp, glTexCoord2f); - SET_TexCoord2fv(disp, glTexCoord2fv); - SET_TexCoord2i(disp, glTexCoord2i); - SET_TexCoord2iv(disp, glTexCoord2iv); - SET_TexCoord2s(disp, glTexCoord2s); - SET_TexCoord2sv(disp, glTexCoord2sv); - SET_TexCoord3d(disp, glTexCoord3d); - SET_TexCoord3dv(disp, glTexCoord3dv); - SET_TexCoord3f(disp, glTexCoord3f); - SET_TexCoord3fv(disp, glTexCoord3fv); - SET_TexCoord3i(disp, glTexCoord3i); - SET_TexCoord3iv(disp, glTexCoord3iv); - SET_TexCoord3s(disp, glTexCoord3s); - SET_TexCoord3sv(disp, glTexCoord3sv); - SET_TexCoord4d(disp, glTexCoord4d); - SET_TexCoord4dv(disp, glTexCoord4dv); - SET_TexCoord4f(disp, glTexCoord4f); - SET_TexCoord4fv(disp, glTexCoord4fv); - SET_TexCoord4i(disp, glTexCoord4i); - SET_TexCoord4iv(disp, glTexCoord4iv); - SET_TexCoord4s(disp, glTexCoord4s); - SET_TexCoord4sv(disp, glTexCoord4sv); - SET_TexCoordPointer(disp, glTexCoordPointer); -//SET_TexCoordPointerEXT(disp, glTexCoordPointerEXT); - SET_TexEnvf(disp, glTexEnvf); - SET_TexEnvfv(disp, glTexEnvfv); - SET_TexEnvi(disp, glTexEnvi); - SET_TexEnviv(disp, glTexEnviv); - SET_TexGend(disp, glTexGend); - SET_TexGendv(disp, glTexGendv); - SET_TexGenf(disp, glTexGenf); - SET_TexGenfv(disp, glTexGenfv); - SET_TexGeni(disp, glTexGeni); - SET_TexGeniv(disp, glTexGeniv); - SET_TexImage1D(disp, glTexImage1D); - SET_TexImage2D(disp, glTexImage2D); - SET_TexImage3D(disp, glTexImage3D); - SET_TexParameterf(disp, glTexParameterf); - SET_TexParameterfv(disp, glTexParameterfv); - SET_TexParameteri(disp, glTexParameteri); - SET_TexParameteriv(disp, glTexParameteriv); - SET_TexSubImage1D(disp, glTexSubImage1D); - SET_TexSubImage2D(disp, glTexSubImage2D); - SET_TexSubImage3D(disp, glTexSubImage3D); -//SET_TrackMatrixNV(disp, glTrackMatrixNV); - SET_Translated(disp, glTranslated); - SET_Translatef(disp, glTranslatef); - SET_Uniform1fARB(disp, glUniform1fARB); - SET_Uniform1fvARB(disp, glUniform1fvARB); - SET_Uniform1iARB(disp, glUniform1iARB); - SET_Uniform1ivARB(disp, glUniform1ivARB); - SET_Uniform2fARB(disp, glUniform2fARB); - SET_Uniform2fvARB(disp, glUniform2fvARB); - SET_Uniform2iARB(disp, glUniform2iARB); - SET_Uniform2ivARB(disp, glUniform2ivARB); - SET_Uniform3fARB(disp, glUniform3fARB); - SET_Uniform3fvARB(disp, glUniform3fvARB); - SET_Uniform3iARB(disp, glUniform3iARB); - SET_Uniform3ivARB(disp, glUniform3ivARB); - SET_Uniform4fARB(disp, glUniform4fARB); - SET_Uniform4fvARB(disp, glUniform4fvARB); - SET_Uniform4iARB(disp, glUniform4iARB); - SET_Uniform4ivARB(disp, glUniform4ivARB); - SET_UniformMatrix2fvARB(disp, glUniformMatrix2fvARB); - SET_UniformMatrix3fvARB(disp, glUniformMatrix3fvARB); - SET_UniformMatrix4fvARB(disp, glUniformMatrix4fvARB); - SET_UnlockArraysEXT(disp, glUnlockArraysEXT); - SET_UnmapBufferARB(disp, glUnmapBufferARB); - SET_UseProgramObjectARB(disp, glUseProgramObjectARB); - SET_ValidateProgramARB(disp, glValidateProgramARB); - SET_Vertex2d(disp, glVertex2d); - SET_Vertex2dv(disp, glVertex2dv); - SET_Vertex2f(disp, glVertex2f); - SET_Vertex2fv(disp, glVertex2fv); - SET_Vertex2i(disp, glVertex2i); - SET_Vertex2iv(disp, glVertex2iv); - SET_Vertex2s(disp, glVertex2s); - SET_Vertex2sv(disp, glVertex2sv); - SET_Vertex3d(disp, glVertex3d); - SET_Vertex3dv(disp, glVertex3dv); - SET_Vertex3f(disp, glVertex3f); - SET_Vertex3fv(disp, glVertex3fv); - SET_Vertex3i(disp, glVertex3i); - SET_Vertex3iv(disp, glVertex3iv); - SET_Vertex3s(disp, glVertex3s); - SET_Vertex3sv(disp, glVertex3sv); - SET_Vertex4d(disp, glVertex4d); - SET_Vertex4dv(disp, glVertex4dv); - SET_Vertex4f(disp, glVertex4f); - SET_Vertex4fv(disp, glVertex4fv); - SET_Vertex4i(disp, glVertex4i); - SET_Vertex4iv(disp, glVertex4iv); - SET_Vertex4s(disp, glVertex4s); - SET_Vertex4sv(disp, glVertex4sv); -//SET_VertexArrayRangeNV(disp, glVertexArrayRangeNV); - SET_VertexAttrib1dARB(disp, glVertexAttrib1dARB); - SET_VertexAttrib1dvARB(disp, glVertexAttrib1dvARB); - SET_VertexAttrib1fARB(disp, glVertexAttrib1fARB); - SET_VertexAttrib1fvARB(disp, glVertexAttrib1fvARB); - SET_VertexAttrib1sARB(disp, glVertexAttrib1sARB); - SET_VertexAttrib1svARB(disp, glVertexAttrib1svARB); - SET_VertexAttrib2dARB(disp, glVertexAttrib2dARB); - SET_VertexAttrib2dvARB(disp, glVertexAttrib2dvARB); - SET_VertexAttrib2fARB(disp, glVertexAttrib2fARB); - SET_VertexAttrib2fvARB(disp, glVertexAttrib2fvARB); - SET_VertexAttrib2sARB(disp, glVertexAttrib2sARB); - SET_VertexAttrib2svARB(disp, glVertexAttrib2svARB); - SET_VertexAttrib3dARB(disp, glVertexAttrib3dARB); - SET_VertexAttrib3dvARB(disp, glVertexAttrib3dvARB); - SET_VertexAttrib3fARB(disp, glVertexAttrib3fARB); - SET_VertexAttrib3fvARB(disp, glVertexAttrib3fvARB); - SET_VertexAttrib3sARB(disp, glVertexAttrib3sARB); - SET_VertexAttrib3svARB(disp, glVertexAttrib3svARB); - SET_VertexAttrib4NbvARB(disp, glVertexAttrib4NbvARB); - SET_VertexAttrib4NivARB(disp, glVertexAttrib4NivARB); - SET_VertexAttrib4NsvARB(disp, glVertexAttrib4NsvARB); - SET_VertexAttrib4NubARB(disp, glVertexAttrib4NubARB); - SET_VertexAttrib4NubvARB(disp, glVertexAttrib4NubvARB); - SET_VertexAttrib4NuivARB(disp, glVertexAttrib4NuivARB); - SET_VertexAttrib4NusvARB(disp, glVertexAttrib4NusvARB); - SET_VertexAttrib4bvARB(disp, glVertexAttrib4bvARB); - SET_VertexAttrib4dARB(disp, glVertexAttrib4dARB); - SET_VertexAttrib4dvARB(disp, glVertexAttrib4dvARB); - SET_VertexAttrib4fARB(disp, glVertexAttrib4fARB); - SET_VertexAttrib4fvARB(disp, glVertexAttrib4fvARB); - SET_VertexAttrib4ivARB(disp, glVertexAttrib4ivARB); - SET_VertexAttrib4sARB(disp, glVertexAttrib4sARB); - SET_VertexAttrib4svARB(disp, glVertexAttrib4svARB); - SET_VertexAttrib4ubvARB(disp, glVertexAttrib4ubvARB); - SET_VertexAttrib4uivARB(disp, glVertexAttrib4uivARB); - SET_VertexAttrib4usvARB(disp, glVertexAttrib4usvARB); - SET_VertexAttribPointerARB(disp, glVertexAttribPointerARB); - SET_VertexPointer(disp, glVertexPointer); -// SET_VertexPointerEXT(disp, glVertexPointerEXT); - SET_Viewport(disp, glViewport); - SET_WindowPos2dMESA(disp, glWindowPos2dARB); - SET_WindowPos2dvMESA(disp, glWindowPos2dvARB); - SET_WindowPos2fMESA(disp, glWindowPos2fARB); - SET_WindowPos2fvMESA(disp, glWindowPos2fvARB); - SET_WindowPos2iMESA(disp, glWindowPos2iARB); - SET_WindowPos2ivMESA(disp, glWindowPos2ivARB); - SET_WindowPos2sMESA(disp, glWindowPos2sARB); - SET_WindowPos2svMESA(disp, glWindowPos2svARB); - SET_WindowPos3dMESA(disp, glWindowPos3dARB); - SET_WindowPos3dvMESA(disp, glWindowPos3dvARB); - SET_WindowPos3fMESA(disp, glWindowPos3fARB); - SET_WindowPos3fvMESA(disp, glWindowPos3fvARB); - SET_WindowPos3iMESA(disp, glWindowPos3iARB); - SET_WindowPos3ivMESA(disp, glWindowPos3ivARB); - SET_WindowPos3sMESA(disp, glWindowPos3sARB); - SET_WindowPos3svMESA(disp, glWindowPos3svARB); -//SET_WindowPos4dMESA(disp, glWindowPos4dMESA); -//SET_WindowPos4dvMESA(disp, glWindowPos4dvMESA); -//SET_WindowPos4fMESA(disp, glWindowPos4fMESA); -//SET_WindowPos4fvMESA(disp, glWindowPos4fvMESA); -//SET_WindowPos4iMESA(disp, glWindowPos4iMESA); -//SET_WindowPos4ivMESA(disp, glWindowPos4ivMESA); -//SET_WindowPos4sMESA(disp, glWindowPos4sMESA); -//SET_WindowPos4svMESA(disp, glWindowPos4svMESA); -} diff --git a/GL/glx/Makefile.am b/GL/glx/Makefile.am index 1d4719c88..9bf296c71 100644 --- a/GL/glx/Makefile.am +++ b/GL/glx/Makefile.am @@ -47,7 +47,12 @@ libglxdri_la_SOURCES = \ extension_string.c \ extension_string.h +#if XQUARTZ +XQUARTZ_libglx_la_SOURCES = glcontextmodes.c +#endif + libglx_la_SOURCES = \ + $(XQUARTZ_libglx_la_SOURCES) \ g_disptab.h \ glxbyteorder.h \ glxcmds.c \ diff --git a/GL/glx/glxglcore.c b/GL/glx/glxglcore.c index 972ab88e6..dafa9bca7 100644 --- a/GL/glx/glxglcore.c +++ b/GL/glx/glxglcore.c @@ -37,7 +37,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #endif #include <string.h> +#include <dlfcn.h> +#define _NEED_GL_CORE_IF #include <GL/xmesa.h> #include <GL/internal/glcore.h> #include <glxserver.h> @@ -48,6 +50,22 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "os.h" +#define XMesaCreateVisual (*glcore->XMesaCreateVisual) +#define XMesaDestroyVisual (*glcore->XMesaDestroyVisual) + +#define XMesaCreateWindowBuffer (*glcore->XMesaCreateWindowBuffer) +#define XMesaCreatePixmapBuffer (*glcore->XMesaCreatePixmapBuffer) +#define XMesaDestroyBuffer (*glcore->XMesaDestroyBuffer) +#define XMesaSwapBuffers (*glcore->XMesaSwapBuffers) +#define XMesaResizeBuffers (*glcore->XMesaResizeBuffers) + +#define XMesaCreateContext (*glcore->XMesaCreateContext) +#define XMesaDestroyContext (*glcore->XMesaDestroyContext) +#define XMesaCopyContext (*glcore->XMesaCopyContext) +#define XMesaMakeCurrent2 (*glcore->XMesaMakeCurrent2) +#define XMesaForceCurrent (*glcore->XMesaForceCurrent) +#define XMesaLoseCurrent (*glcore->XMesaLoseCurrent) + typedef struct __GLXMESAscreen __GLXMESAscreen; typedef struct __GLXMESAcontext __GLXMESAcontext; typedef struct __GLXMESAdrawable __GLXMESAdrawable; @@ -55,8 +73,11 @@ typedef struct __GLXMESAdrawable __GLXMESAdrawable; struct __GLXMESAscreen { __GLXscreen base; int index; - int num_vis; + int num_vis; XMesaVisual *xm_vis; + void *driver; + + const __GLcoreModule *glcore; }; struct __GLXMESAcontext { @@ -65,8 +86,9 @@ struct __GLXMESAcontext { }; struct __GLXMESAdrawable { - __GLXdrawable base; - XMesaBuffer xm_buf; + __GLXdrawable base; + XMesaBuffer xm_buf; + __GLXMESAscreen *screen; }; static XMesaVisual find_mesa_visual(__GLXscreen *screen, XID fbconfigID); @@ -76,6 +98,7 @@ static void __glXMesaDrawableDestroy(__GLXdrawable *base) { __GLXMESAdrawable *glxPriv = (__GLXMESAdrawable *) base; + const __GLcoreModule *glcore = glxPriv->screen->glcore; if (glxPriv->xm_buf != NULL) XMesaDestroyBuffer(glxPriv->xm_buf); @@ -86,6 +109,7 @@ static GLboolean __glXMesaDrawableResize(__GLXdrawable *base) { __GLXMESAdrawable *glxPriv = (__GLXMESAdrawable *) base; + const __GLcoreModule *glcore = glxPriv->screen->glcore; XMesaResizeBuffers(glxPriv->xm_buf); @@ -96,6 +120,7 @@ static GLboolean __glXMesaDrawableSwapBuffers(__GLXdrawable *base) { __GLXMESAdrawable *glxPriv = (__GLXMESAdrawable *) base; + const __GLcoreModule *glcore = glxPriv->screen->glcore; /* This is terrifying: XMesaSwapBuffers() ends up calling CopyArea * to do the buffer swap, but this assumes that the server holds @@ -121,6 +146,8 @@ __glXMesaScreenCreateDrawable(__GLXscreen *screen, XID drawId, __GLXconfig *modes) { + __GLXMESAscreen *mesaScreen = (__GLXMESAscreen *) screen; + const __GLcoreModule *glcore = mesaScreen->glcore; __GLXMESAdrawable *glxPriv; XMesaVisual xm_vis; @@ -130,6 +157,7 @@ __glXMesaScreenCreateDrawable(__GLXscreen *screen, memset(glxPriv, 0, sizeof *glxPriv); + glxPriv->screen = mesaScreen; if (!__glXDrawableInit(&glxPriv->base, screen, pDraw, type, drawId, modes)) { xfree(glxPriv); @@ -166,6 +194,8 @@ static void __glXMesaContextDestroy(__GLXcontext *baseContext) { __GLXMESAcontext *context = (__GLXMESAcontext *) baseContext; + __GLXMESAscreen *screen = (__GLXMESAscreen *) context->base.pGlxScreen; + const __GLcoreModule *glcore = screen->glcore; XMesaDestroyContext(context->xmesa); __glXContextDestroy(&context->base); @@ -179,6 +209,8 @@ __glXMesaContextMakeCurrent(__GLXcontext *baseContext) __GLXMESAcontext *context = (__GLXMESAcontext *) baseContext; __GLXMESAdrawable *drawPriv = (__GLXMESAdrawable *) context->base.drawPriv; __GLXMESAdrawable *readPriv = (__GLXMESAdrawable *) context->base.readPriv; + __GLXMESAscreen *screen = (__GLXMESAscreen *) context->base.pGlxScreen; + const __GLcoreModule *glcore = screen->glcore; return XMesaMakeCurrent2(context->xmesa, drawPriv->xm_buf, @@ -189,6 +221,8 @@ static int __glXMesaContextLoseCurrent(__GLXcontext *baseContext) { __GLXMESAcontext *context = (__GLXMESAcontext *) baseContext; + __GLXMESAscreen *screen = (__GLXMESAscreen *) context->base.pGlxScreen; + const __GLcoreModule *glcore = screen->glcore; return XMesaLoseCurrent(context->xmesa); } @@ -200,6 +234,8 @@ __glXMesaContextCopy(__GLXcontext *baseDst, { __GLXMESAcontext *dst = (__GLXMESAcontext *) baseDst; __GLXMESAcontext *src = (__GLXMESAcontext *) baseSrc; + __GLXMESAscreen *screen = (__GLXMESAscreen *) dst->base.pGlxScreen; + const __GLcoreModule *glcore = screen->glcore; return XMesaCopyContext(src->xmesa, dst->xmesa, mask); } @@ -208,6 +244,8 @@ static int __glXMesaContextForceCurrent(__GLXcontext *baseContext) { __GLXMESAcontext *context = (__GLXMESAcontext *) baseContext; + __GLXMESAscreen *screen = (__GLXMESAscreen *) context->base.pGlxScreen; + const __GLcoreModule *glcore = screen->glcore; /* GlxSetRenderTables() call for XGL moved in XMesaForceCurrent() */ @@ -219,6 +257,8 @@ __glXMesaScreenCreateContext(__GLXscreen *screen, __GLXconfig *config, __GLXcontext *baseShareContext) { + __GLXMESAscreen *mesaScreen = (__GLXMESAscreen *) screen; + const __GLcoreModule *glcore = mesaScreen->glcore; __GLXMESAcontext *context; __GLXMESAcontext *shareContext = (__GLXMESAcontext *) baseShareContext; XMesaVisual xm_vis; @@ -261,6 +301,7 @@ static void __glXMesaScreenDestroy(__GLXscreen *screen) { __GLXMESAscreen *mesaScreen = (__GLXMESAscreen *) screen; + const __GLcoreModule *glcore = mesaScreen->glcore; int i; if (mesaScreen->xm_vis) { @@ -272,6 +313,8 @@ __glXMesaScreenDestroy(__GLXscreen *screen) xfree(mesaScreen->xm_vis); } + dlclose(mesaScreen->driver); + __glXScreenDestroy(screen); xfree(screen); @@ -317,9 +360,10 @@ createFBConfigsForVisual(__GLXscreen *screen, ScreenPtr pScreen, for (back = numBack - 1; back >= 0; back--) for (depth = 0; depth < numDepth; depth++) for (stencil = 0; stencil < numStencil; stencil++) { - config->next = xalloc(sizeof *config); + config->next = xcalloc(sizeof(*config), 1); config = config->next; + config->visualRating = GLX_NONE; config->visualType = glx_visual_types[visual->class]; config->xRenderable = GL_TRUE; config->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT; @@ -372,6 +416,7 @@ createFBConfigs(__GLXscreen *pGlxScreen, ScreenPtr pScreen) static void createMesaVisuals(__GLXMESAscreen *pMesaScreen) { + const __GLcoreModule *glcore = pMesaScreen->glcore; __GLXconfig *config; ScreenPtr pScreen; VisualPtr visual = NULL; @@ -408,15 +453,35 @@ createMesaVisuals(__GLXMESAscreen *pMesaScreen) } } +static const char dri_driver_path[] = DRI_DRIVER_PATH; + static __GLXscreen * __glXMesaScreenProbe(ScreenPtr pScreen) { __GLXMESAscreen *screen; + char filename[128]; screen = xalloc(sizeof *screen); if (screen == NULL) return NULL; + snprintf(filename, sizeof filename, "%s/%s.so", + dri_driver_path, "libGLcore"); + + screen->driver = dlopen(filename, RTLD_LAZY | RTLD_LOCAL); + if (screen->driver == NULL) { + LogMessage(X_ERROR, "GLX error: dlopen of %s failed (%s)\n", + filename, dlerror()); + goto handle_error; + } + + screen->glcore = dlsym(screen->driver, __GL_CORE); + if (screen->glcore == NULL) { + LogMessage(X_ERROR, "GLX error: dlsym for %s failed (%s)\n", + __GL_CORE, dlerror()); + goto handle_error; + } + /* * Find the GLX visuals that are supported by this screen and create * XMesa's visuals. @@ -431,9 +496,23 @@ __glXMesaScreenProbe(ScreenPtr pScreen) screen->base.destroy = __glXMesaScreenDestroy; screen->base.createContext = __glXMesaScreenCreateContext; screen->base.createDrawable = __glXMesaScreenCreateDrawable; + screen->base.swapInterval = NULL; screen->base.pScreen = pScreen; + LogMessage(X_INFO, "GLX: Loaded and initialized %s\n", filename); + return &screen->base; + +handle_error: + + if (screen->driver) + dlclose(screen->driver); + + xfree(screen); + + FatalError("GLX: could not load software renderer\n"); + + return NULL; } __GLXprovider __glXMesaProvider = { diff --git a/GL/glx/glxscreens.c b/GL/glx/glxscreens.c index b49a775b5..5859de0b1 100644 --- a/GL/glx/glxscreens.c +++ b/GL/glx/glxscreens.c @@ -437,6 +437,7 @@ initGlxVisual(VisualPtr visual, __GLXconfig *config) typedef struct { GLboolean doubleBuffer; GLboolean depthBuffer; + GLboolean stencilBuffer; } FBConfigTemplateRec, *FBConfigTemplatePtr; static __GLXconfig * @@ -453,6 +454,8 @@ pickFBConfig(__GLXscreen *pGlxScreen, FBConfigTemplatePtr template, int class) continue; if ((config->depthBits > 0) != template->depthBuffer) continue; + if ((config->stencilBits > 0) != template->stencilBuffer) + continue; return config; } @@ -466,8 +469,9 @@ addMinimalSet(__GLXscreen *pGlxScreen) __GLXconfig *config; VisualPtr visuals; int i, j; - FBConfigTemplateRec best = { GL_TRUE, GL_TRUE }; - FBConfigTemplateRec minimal = { GL_FALSE, GL_FALSE }; + FBConfigTemplateRec best = { GL_TRUE, GL_TRUE, GL_TRUE }; + FBConfigTemplateRec good = { GL_TRUE, GL_TRUE, GL_FALSE }; + FBConfigTemplateRec minimal = { GL_FALSE, GL_FALSE, GL_FALSE }; pGlxScreen->visuals = xcalloc(pGlxScreen->pScreen->numVisuals, sizeof (__GLXconfig *)); @@ -480,15 +484,18 @@ addMinimalSet(__GLXscreen *pGlxScreen) for (i = 0, j = 0; i < pGlxScreen->pScreen->numVisuals; i++) { if (visuals[i].nplanes == 32) config = pickFBConfig(pGlxScreen, &minimal, visuals[i].class); - else + else { config = pickFBConfig(pGlxScreen, &best, visuals[i].class); + if (config == NULL) + config = pickFBConfig(pGlxScreen, &good, visuals[i].class); + } if (config == NULL) config = pGlxScreen->fbconfigs; if (config == NULL) continue; pGlxScreen->visuals[j] = config; - config->visualID = visuals[j].vid; + config->visualID = visuals[i].vid; j++; } diff --git a/GL/glx/glxutil.c b/GL/glx/glxutil.c index 11e9f898b..aa23a95fd 100644 --- a/GL/glx/glxutil.c +++ b/GL/glx/glxutil.c @@ -81,38 +81,40 @@ __glXDeassociateContext(__GLXcontext *glxc) __GLXcontext *curr, *prev; prev = NULL; - for ( curr = glxc->drawPriv->drawGlxc - ; curr != NULL - ; prev = curr, curr = curr->nextDrawPriv ) { - if (curr == glxc) { - /* found context. Deassociate. */ - if (prev == NULL) { - glxc->drawPriv->drawGlxc = curr->nextDrawPriv; - } else { - prev->nextDrawPriv = curr->nextDrawPriv; + if (glxc->drawPriv) { + for ( curr = glxc->drawPriv->drawGlxc; curr != NULL + ; prev = curr, curr = curr->nextDrawPriv ) { + if (curr == glxc) { + /* found context. Deassociate. */ + if (prev == NULL) { + glxc->drawPriv->drawGlxc = curr->nextDrawPriv; + } else { + prev->nextDrawPriv = curr->nextDrawPriv; + } + curr->nextDrawPriv = NULL; + __glXUnrefDrawable(glxc->drawPriv); + break; } - curr->nextDrawPriv = NULL; - __glXUnrefDrawable(glxc->drawPriv); - break; - } + } } - prev = NULL; - for ( curr = glxc->readPriv->readGlxc - ; curr != NULL - ; prev = curr, curr = curr->nextReadPriv ) { - if (curr == glxc) { - /* found context. Deassociate. */ - if (prev == NULL) { - glxc->readPriv->readGlxc = curr->nextReadPriv; - } else { - prev->nextReadPriv = curr->nextReadPriv; - } - curr->nextReadPriv = NULL; - __glXUnrefDrawable(glxc->readPriv); - break; - } + if (glxc->readPriv) { + for ( curr = glxc->readPriv->readGlxc + ; curr != NULL + ; prev = curr, curr = curr->nextReadPriv ) { + if (curr == glxc) { + /* found context. Deassociate. */ + if (prev == NULL) { + glxc->readPriv->readGlxc = curr->nextReadPriv; + } else { + prev->nextReadPriv = curr->nextReadPriv; + } + curr->nextReadPriv = NULL; + __glXUnrefDrawable(glxc->readPriv); + break; + } + } } } diff --git a/GL/mesa/.gitignore b/GL/mesa/.gitignore deleted file mode 100644 index 6b92b24bd..000000000 --- a/GL/mesa/.gitignore +++ /dev/null @@ -1,32 +0,0 @@ -X/drivers -X/glxheader.h -X/xm*.h -X/xm*.c -mesa/drivers -mesa/glxheader.h -mesa/xm*.c -glapi/*.c -glapi/*.h -main/*.c -main/*.h -math/*.c -math/*.h -ppc -shader/*.c -shader/*.h -shader/slang/*.c -shader/slang/*.h -shader/slang/library -shader/grammar/*.c -shader/grammar/*.h -sparc -swrast/*.c -swrast/*.h -swrast_setup/*.c -swrast_setup/*.h -tnl/*.c -tnl/*.h -x86 -x86-64 -vbo/*.c -vbo/*.h diff --git a/GL/mesa/Makefile.am b/GL/mesa/Makefile.am deleted file mode 100644 index 7f27c58ba..000000000 --- a/GL/mesa/Makefile.am +++ /dev/null @@ -1,18 +0,0 @@ -SUBDIRS = X -SUBDIRS += main math swrast swrast_setup tnl shader glapi vbo - -noinst_LTLIBRARIES = libGLcore.la - -libGLcore_la_SOURCES = dummy.c -MESA_LIBS = main/libmain.la \ - math/libmath.la \ - swrast/libswrast.la \ - swrast_setup/libss.la \ - tnl/libtnl.la \ - shader/libshader.la \ - shader/grammar/libgrammar.la \ - shader/slang/libslang.la \ - vbo/libvbo.la - -libGLcore_la_LIBADD = $(MESA_LIBS) \ - X/libX.la diff --git a/GL/mesa/X/Makefile.am b/GL/mesa/X/Makefile.am deleted file mode 100644 index d8abbc6bd..000000000 --- a/GL/mesa/X/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -noinst_LTLIBRARIES = libX.la - -INCLUDES = -I@MESA_SOURCE@/include \ - -I. \ - -I@MESA_SOURCE@/src/mesa/glapi \ - -I@MESA_SOURCE@/src/mesa/main \ - -I@MESA_SOURCE@/src/mesa - -# -DXFree86Server is required because the X11 driver in Mesa thinks that -# symbol means "being built in the server" -AM_CFLAGS = \ - $(DIX_CFLAGS) \ - -DXFree86Server \ - @GLX_DEFINES@ - -XM_SOURCES = \ - xm_api.c \ - xm_buffer.c \ - xm_dd.c \ - xm_image.c \ - xm_line.c \ - xm_span.c \ - xm_tri.c - -XM_SOURCES += drivers/common/driverfuncs.c - -nodist_libX_la_SOURCES = $(XM_SOURCES) diff --git a/GL/mesa/dummy.c b/GL/mesa/dummy.c deleted file mode 100644 index e69de29bb..000000000 --- a/GL/mesa/dummy.c +++ /dev/null diff --git a/GL/mesa/glapi/Makefile.am b/GL/mesa/glapi/Makefile.am deleted file mode 100644 index db791143e..000000000 --- a/GL/mesa/glapi/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -noinst_LTLIBRARIES = libglapi.la - -AM_CFLAGS = \ - $(DIX_CFLAGS) \ - -DXFree86Server \ - @GLX_DEFINES@ - -INCLUDES = -I@MESA_SOURCE@/include \ - -I../X \ - -I../glapi \ - -I../main \ - -I../math \ - -I../shader \ - -I../swrast \ - -I../swrast_setup \ - -I../tnl \ - -I.. \ - -I$(top_srcdir)/hw/xfree86/os-support - -nodist_libglapi_la_SOURCES = glapi.c glthread.c diff --git a/GL/mesa/main/Makefile.am b/GL/mesa/main/Makefile.am deleted file mode 100644 index f8ce13775..000000000 --- a/GL/mesa/main/Makefile.am +++ /dev/null @@ -1,86 +0,0 @@ -noinst_LTLIBRARIES = libmain.la - -AM_CFLAGS = \ - $(DIX_CFLAGS) \ - -DXFree86Server \ - @GLX_DEFINES@ - -INCLUDES = -I@MESA_SOURCE@/include \ - -I../X \ - -I../glapi \ - -I../main \ - -I../math \ - -I../shader \ - -I../swrast \ - -I../swrast_setup \ - -I../tnl \ - -I.. \ - -I$(top_srcdir)/hw/xfree86/os-support - -if NEED_VSNPRINTF -VSNPRINTF_SOURCES = vsnprintf.c -endif - -nodist_libmain_la_SOURCES = accum.c \ - api_arrayelt.c \ - api_loopback.c \ - api_noop.c \ - api_validate.c \ - arrayobj.c \ - attrib.c \ - blend.c \ - bufferobj.c \ - buffers.c \ - clip.c \ - colortab.c \ - context.c \ - convolve.c \ - debug.c \ - depth.c \ - depthstencil.c \ - dlist.c \ - drawpix.c \ - enable.c \ - enums.c \ - eval.c \ - execmem.c \ - extensions.c \ - fbobject.c \ - feedback.c \ - fog.c \ - framebuffer.c \ - get.c \ - getstring.c \ - hash.c \ - hint.c \ - histogram.c \ - image.c \ - imports.c \ - light.c \ - lines.c \ - matrix.c \ - mipmap.c \ - mm.c \ - pixel.c \ - points.c \ - polygon.c \ - queryobj.c \ - rastpos.c \ - rbadaptors.c \ - renderbuffer.c \ - shaders.c \ - state.c \ - stencil.c \ - texcompress.c \ - texcompress_fxt1.c \ - texcompress_s3tc.c \ - texenvprogram.c \ - texformat.c \ - teximage.c \ - texobj.c \ - texrender.c \ - texstate.c \ - texstore.c \ - varray.c \ - $(VSNPRINTF_SOURCES) \ - vtxfmt.c diff --git a/GL/mesa/math/Makefile.am b/GL/mesa/math/Makefile.am deleted file mode 100644 index c7c564272..000000000 --- a/GL/mesa/math/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -noinst_LTLIBRARIES = libmath.la - -AM_CFLAGS = \ - $(DIX_CFLAGS) \ - -DXFree86Server \ - @GLX_DEFINES@ - -INCLUDES = -I@MESA_SOURCE@/include \ - -I../X \ - -I../glapi \ - -I../main \ - -I../math \ - -I../shader \ - -I../swrast \ - -I../swrast_setup \ - -I../tnl \ - -I.. \ - -I$(top_srcdir)/hw/xfree86/os-support - -nodist_libmath_la_SOURCES = m_debug_clip.c \ - m_debug_norm.c \ - m_debug_xform.c \ - m_eval.c \ - m_matrix.c \ - m_translate.c \ - m_vector.c \ - m_xform.c diff --git a/GL/mesa/shader/Makefile.am b/GL/mesa/shader/Makefile.am deleted file mode 100644 index abde27513..000000000 --- a/GL/mesa/shader/Makefile.am +++ /dev/null @@ -1,39 +0,0 @@ -SUBDIRS = grammar slang - -noinst_LTLIBRARIES = libshader.la - -AM_CFLAGS = \ - $(DIX_CFLAGS) \ - -DXFree86Server \ - @GLX_DEFINES@ - -INCLUDES = -I@MESA_SOURCE@/include \ - -I../X \ - -I../glapi \ - -I../main \ - -I../math \ - -I../shader \ - -I../shader/grammar \ - -I../shader/slang \ - -I../swrast \ - -I../swrast_setup \ - -I../tnl \ - -I.. \ - -I$(top_srcdir)/hw/xfree86/os-support - -nodist_libshader_la_SOURCES = \ - arbprogparse.c \ - arbprogram.c \ - atifragshader.c \ - nvfragparse.c \ - nvprogram.c \ - nvvertparse.c \ - prog_debug.c \ - prog_execute.c \ - prog_instruction.c \ - prog_parameter.c \ - prog_print.c \ - program.c \ - programopt.c \ - prog_statevars.c \ - shader_api.c diff --git a/GL/mesa/shader/grammar/Makefile.am b/GL/mesa/shader/grammar/Makefile.am deleted file mode 100644 index 332c8e952..000000000 --- a/GL/mesa/shader/grammar/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -noinst_LTLIBRARIES = libgrammar.la - -AM_CFLAGS = \ - $(DIX_CFLAGS) \ - -DXFree86Server \ - @GLX_DEFINES@ - -INCLUDES = -I@MESA_SOURCE@/include \ - -I../../X \ - -I../../glapi \ - -I../../main \ - -I../../math \ - -I../../shader \ - -I../../swrast \ - -I../../swrast_setup \ - -I../../tnl \ - -I../.. \ - -I$(top_srcdir)/hw/xfree86/os-support - -nodist_libgrammar_la_SOURCES = grammar_mesa.c diff --git a/GL/mesa/shader/slang/Makefile.am b/GL/mesa/shader/slang/Makefile.am deleted file mode 100644 index 71498eeac..000000000 --- a/GL/mesa/shader/slang/Makefile.am +++ /dev/null @@ -1,41 +0,0 @@ -noinst_LTLIBRARIES = libslang.la - -AM_CFLAGS = \ - $(DIX_CFLAGS) \ - -DXFree86Server \ - @GLX_DEFINES@ - -INCLUDES = -I@MESA_SOURCE@/include \ - -I../grammar \ - -I../../X \ - -I../../glapi \ - -I../../main \ - -I../../math \ - -I../../shader \ - -I../../swrast \ - -I../../swrast_setup \ - -I../../tnl \ - -I../.. \ - -I$(top_srcdir)/hw/xfree86/os-support - -nodist_libslang_la_SOURCES = slang_builtin.c \ - slang_codegen.c \ - slang_compile.c \ - slang_compile_function.c \ - slang_compile_operation.c \ - slang_compile_struct.c \ - slang_compile_variable.c \ - slang_emit.c \ - slang_ir.c \ - slang_label.c \ - slang_library_noise.c \ - slang_link.c \ - slang_log.c \ - slang_mem.c \ - slang_preprocess.c \ - slang_print.c \ - slang_simplify.c \ - slang_storage.c \ - slang_typeinfo.c \ - slang_utility.c \ - slang_vartable.c diff --git a/GL/mesa/swrast/Makefile.am b/GL/mesa/swrast/Makefile.am deleted file mode 100644 index bffb1e7c1..000000000 --- a/GL/mesa/swrast/Makefile.am +++ /dev/null @@ -1,50 +0,0 @@ -noinst_LTLIBRARIES = libswrast.la - -AM_CFLAGS = \ - $(DIX_CFLAGS) \ - -DXFree86Server \ - @GLX_DEFINES@ - -INCLUDES = -I@MESA_SOURCE@/include \ - -I../X \ - -I../glapi \ - -I../main \ - -I../math \ - -I../shader \ - -I../shader/slang \ - -I../shader/slang \ - -I../swrast \ - -I../swrast_setup \ - -I../tnl \ - -I.. \ - -I$(top_srcdir)/hw/xfree86/os-support - -nodist_libswrast_la_SOURCES = s_aaline.c \ - s_aatriangle.c \ - s_accum.c \ - s_alpha.c \ - s_atifragshader.c \ - s_bitmap.c \ - s_blend.c \ - s_blit.c \ - s_buffers.c \ - s_context.c \ - s_copypix.c \ - s_depth.c \ - s_drawpix.c \ - s_feedback.c \ - s_fog.c \ - s_fragprog.c \ - s_imaging.c \ - s_lines.c \ - s_logic.c \ - s_masking.c \ - s_points.c \ - s_readpix.c \ - s_span.c \ - s_stencil.c \ - s_texcombine.c \ - s_texfilter.c \ - s_texstore.c \ - s_triangle.c \ - s_zoom.c diff --git a/GL/mesa/swrast_setup/Makefile.am b/GL/mesa/swrast_setup/Makefile.am deleted file mode 100644 index 1f3c031aa..000000000 --- a/GL/mesa/swrast_setup/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -noinst_LTLIBRARIES = libss.la - -AM_CFLAGS = \ - $(DIX_CFLAGS) \ - -DXFree86Server \ - @GLX_DEFINES@ - -INCLUDES = -I@MESA_SOURCE@/include \ - -I../X \ - -I../glapi \ - -I../main \ - -I../math \ - -I../shader \ - -I../swrast \ - -I../swrast_setup \ - -I../tnl \ - -I.. \ - -I$(top_srcdir)/hw/xfree86/os-support - -nodist_libss_la_SOURCES = ss_context.c ss_triangle.c diff --git a/GL/mesa/tnl/Makefile.am b/GL/mesa/tnl/Makefile.am deleted file mode 100644 index b3c82066f..000000000 --- a/GL/mesa/tnl/Makefile.am +++ /dev/null @@ -1,37 +0,0 @@ -noinst_LTLIBRARIES = libtnl.la - -AM_CFLAGS = \ - $(DIX_CFLAGS) \ - -DXFree86Server \ - @GLX_DEFINES@ - -INCLUDES = -I@MESA_SOURCE@/include \ - -I../X \ - -I../glapi \ - -I../main \ - -I../math \ - -I../shader \ - -I../shader/slang \ - -I../swrast \ - -I../swrast_setup \ - -I../tnl \ - -I.. \ - -I$(top_srcdir)/hw/xfree86/os-support - -nodist_libtnl_la_SOURCES = t_context.c \ - t_draw.c \ - t_pipeline.c \ - t_vb_cull.c \ - t_vb_fog.c \ - t_vb_light.c \ - t_vb_normals.c \ - t_vb_points.c \ - t_vb_program.c \ - t_vb_render.c \ - t_vb_texgen.c \ - t_vb_texmat.c \ - t_vb_vertex.c \ - t_vertex.c \ - t_vertex_generic.c \ - t_vertex_sse.c \ - t_vp_build.c diff --git a/GL/mesa/vbo/Makefile.am b/GL/mesa/vbo/Makefile.am deleted file mode 100644 index 9943f2a5a..000000000 --- a/GL/mesa/vbo/Makefile.am +++ /dev/null @@ -1,35 +0,0 @@ -noinst_LTLIBRARIES = libvbo.la - -AM_CFLAGS = \ - $(DIX_CFLAGS) \ - -DXFree86Server \ - @GLX_DEFINES@ - -INCLUDES = -I@MESA_SOURCE@/include \ - -I../X \ - -I../glapi \ - -I../main \ - -I../math \ - -I../shader \ - -I../shader/slang \ - -I../shader/slang \ - -I../swrast \ - -I../swrast_setup \ - -I../tnl \ - -I.. \ - -I$(top_srcdir)/hw/xfree86/os-support - -nodist_libvbo_la_SOURCES = vbo_context.c \ - vbo_exec_api.c \ - vbo_exec_array.c \ - vbo_exec.c \ - vbo_exec_draw.c \ - vbo_exec_eval.c \ - vbo_rebase.c \ - vbo_save_api.c \ - vbo_save.c \ - vbo_save_draw.c \ - vbo_save_loopback.c \ - vbo_split.c \ - vbo_split_copy.c \ - vbo_split_inplace.c diff --git a/GL/symlink-mesa.sh b/GL/symlink-mesa.sh index 47afdcd37..def4f63f7 100755 --- a/GL/symlink-mesa.sh +++ b/GL/symlink-mesa.sh @@ -58,175 +58,14 @@ main() { ## actual symlinking -symlink_mesa_glapi() { - src_dir src/mesa/glapi - dst_dir mesa/glapi - - for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do - action `basename $src` - done -} - -symlink_mesa_main() { - src_dir src/mesa/main - dst_dir mesa/main - - for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do - action `basename $src` - done -} - -symlink_mesa_math() { - src_dir src/mesa/math - dst_dir mesa/math - - for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do - action `basename $src` - done -} - -symlink_mesa_swrast() { - src_dir src/mesa/swrast - dst_dir mesa/swrast - - for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do - action `basename $src` - done -} - -symlink_mesa_ss() { - src_dir src/mesa/swrast_setup - dst_dir mesa/swrast_setup - - for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do - action `basename $src` - done -} - -symlink_mesa_tnl() { - src_dir src/mesa/tnl - dst_dir mesa/tnl - - for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do - action `basename $src` - done -} - -symlink_mesa_shader() { - src_dir src/mesa/shader - dst_dir mesa/shader - - for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do - action `basename $src` - done -} - -symlink_mesa_shader_grammar() { - src_dir src/mesa/shader/grammar - dst_dir mesa/shader/grammar - - for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do - action `basename $src` - done -} - -symlink_mesa_shader_slang() { - src_dir src/mesa/shader/slang - dst_dir mesa/shader/slang - - for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do - action `basename $src` - done -} - -symlink_mesa_shader_slang_library() { - src_dir src/mesa/shader/slang/library - dst_dir mesa/shader/slang/library - - for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do - action `basename $src` - done -} - -symlink_mesa_vbo() { - src_dir src/mesa/vbo - dst_dir mesa/vbo - - for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do - action `basename $src` - done -} - -symlink_mesa_x() { - src_dir src/mesa/drivers/x11 - dst_dir mesa/X - - # action glxapi.h - action glxheader.h - # action realglx.h - # action xfonts.h - action xm_api.c - action xm_buffer.c - action xm_dd.c - action xm_image.c - action xm_image.h - action xm_line.c - action xm_span.c - action xm_tri.c - action xmesaP.h - - # another hack - src_dir src/mesa/drivers/common - dst_dir mesa/X/drivers/common - action driverfuncs.c - action driverfuncs.h -} - -symlink_mesa_ppc() { - src_dir src/mesa/ppc - dst_dir mesa/ppc -} - -symlink_mesa_sparc() { - src_dir src/mesa/sparc - dst_dir mesa/sparc -} - -symlink_mesa_x86() { - src_dir src/mesa/x86 - dst_dir mesa/x86 -} - -symlink_mesa_x8664() { - src_dir src/mesa/x86-64 - dst_dir mesa/x86-64 -} - -symlink_mesa() { - symlink_mesa_main - symlink_mesa_math - symlink_mesa_swrast - symlink_mesa_ss - symlink_mesa_tnl - symlink_mesa_shader - symlink_mesa_shader_grammar - symlink_mesa_shader_slang - symlink_mesa_shader_slang_library - symlink_mesa_x - symlink_mesa_glapi - symlink_mesa_ppc - symlink_mesa_sparc - symlink_mesa_vbo - symlink_mesa_x86 - symlink_mesa_x8664 -} - symlink_glx() { # this is... unpleasant src_dir src/glx/x11 dst_dir glx action indirect_size.h + action glcontextmodes.c + action glcontextmodes.h action indirect_dispatch.c action indirect_dispatch.h action indirect_dispatch_swap.c @@ -267,7 +106,6 @@ run() { # $1 what to do # $2 explanation - ACTION=$1 EXPLANATION=$2 run_module mesa ACTION=$1 EXPLANATION=$2 run_module glx } |