diff options
author | Kristian Høgsberg <krh@redhat.com> | 2006-06-29 00:05:01 -0400 |
---|---|---|
committer | Kristian Høgsberg <krh@redhat.com> | 2006-07-06 00:28:53 -0400 |
commit | 8b5bc6a9ab487fdea754266b120c686d75d9e100 (patch) | |
tree | b743bf88c8dace06a475a20153a1988db26b42a1 /GL/glx | |
parent | 7cf3ec7b59223f15314a0629f122ecb796678421 (diff) |
Drop global GLX error integer variables and use __glXError() instead.
Also drop glxerror.h (__glXError is now declared in glxserver.h)
and global.c (last remaining globals are in glxext.c now).
With this change we now support all GLX 1.3 error codes.
Diffstat (limited to 'GL/glx')
-rw-r--r-- | GL/glx/Makefile.am | 2 | ||||
-rw-r--r-- | GL/glx/global.c | 77 | ||||
-rw-r--r-- | GL/glx/glxcmds.c | 86 | ||||
-rw-r--r-- | GL/glx/glxcmdsswap.c | 24 | ||||
-rw-r--r-- | GL/glx/glxerror.h | 58 | ||||
-rw-r--r-- | GL/glx/glxext.c | 58 | ||||
-rw-r--r-- | GL/glx/glxserver.h | 3 | ||||
-rw-r--r-- | GL/glx/xfont.c | 2 |
8 files changed, 99 insertions, 211 deletions
diff --git a/GL/glx/Makefile.am b/GL/glx/Makefile.am index fd8a59bd0..646f7d102 100644 --- a/GL/glx/Makefile.am +++ b/GL/glx/Makefile.am @@ -43,13 +43,11 @@ libglx_la_SOURCES = \ glapi.c \ glcontextmodes.c \ glcontextmodes.h \ - global.c \ glthread.c \ glxcmds.c \ glxcmdsswap.c \ glxcontext.h \ glxdrawable.h \ - glxerror.h \ glxext.c \ glxext.h \ glxvisuals.c \ diff --git a/GL/glx/global.c b/GL/glx/global.c deleted file mode 100644 index 28030ec03..000000000 --- a/GL/glx/global.c +++ /dev/null @@ -1,77 +0,0 @@ -/* $XFree86$ */ -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -** -*/ - -#define NEED_REPLIES -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "glxserver.h" - -/* -** The last context used by the server. It is the context that is current -** from the server's perspective. -*/ -__GLXcontext *__glXLastContext; - -/* -** X resources. -*/ -RESTYPE __glXContextRes; -RESTYPE __glXClientRes; -RESTYPE __glXPixmapRes; -RESTYPE __glXDrawableRes; -RESTYPE __glXSwapBarrierRes; - -/* -** Error codes with the extension error base already added in. -*/ -int __glXBadContext, __glXBadContextState, __glXBadDrawable, __glXBadPixmap; -int __glXBadContextTag, __glXBadCurrentWindow; -int __glXBadRenderRequest, __glXBadLargeRequest; -int __glXUnsupportedPrivateRequest; - -/* -** Reply for most singles. -*/ -xGLXSingleReply __glXReply; - -/* -** A set of state for each client. The 0th one is unused because client -** indices start at 1, not 0. -*/ -__GLXclientState *__glXClients[MAXCLIENTS+1]; - diff --git a/GL/glx/glxcmds.c b/GL/glx/glxcmds.c index e2e157db8..665159ced 100644 --- a/GL/glx/glxcmds.c +++ b/GL/glx/glxcmds.c @@ -188,7 +188,7 @@ int DoCreateContext(__GLXclientState *cl, GLXContextID gcId, shareglxc = (__GLXcontext *) LookupIDByType(shareList, __glXContextRes); if (!shareglxc) { client->errorValue = shareList; - return __glXBadContext; + return __glXError(GLXBadContext); } if (shareglxc->isDirect) { /* @@ -301,7 +301,7 @@ int __glXDestroyContext(__GLXclientState *cl, GLbyte *pc) return Success; } else { client->errorValue = gcId; - return __glXBadContext; + return __glXError(GLXBadContext); } } @@ -474,7 +474,7 @@ static int GetDrawableOrPixmap( __GLXcontext *glxc, GLXDrawable drawId, ** is, but it must first be created with glxCreateGLXPixmap). */ client->errorValue = drawId; - return __glXBadDrawable; + return __glXError(GLXBadDrawable); } } else { drawPixmap = (__GLXpixmap *) LookupIDByType(drawId, __glXPixmapRes); @@ -494,7 +494,7 @@ static int GetDrawableOrPixmap( __GLXcontext *glxc, GLXDrawable drawId, ** Drawable is neither a Window nor a GLXPixmap. */ client->errorValue = drawId; - return __glXBadDrawable; + return __glXError(GLXBadDrawable); } } @@ -542,12 +542,12 @@ int DoMakeCurrent( __GLXclientState *cl, /* ** Tag for previous context is invalid. */ - return __glXBadContextTag; + return __glXError(GLXBadContextTag); } if (prevglxc->renderMode != GL_RENDER) { /* Oops. Not in render mode render. */ client->errorValue = prevglxc->id; - return __glXBadContextState; + return __glXError(GLXBadContextState); } } else { prevglxc = 0; @@ -562,7 +562,7 @@ int DoMakeCurrent( __GLXclientState *cl, glxc = (__GLXcontext *) LookupIDByType(contextId, __glXContextRes); if (!glxc) { client->errorValue = contextId; - return __glXBadContext; + return __glXError(GLXBadContext); } if ((glxc != prevglxc) && glxc->isCurrent) { /* Context is current to somebody else */ @@ -593,14 +593,14 @@ int DoMakeCurrent( __GLXclientState *cl, if (pDraw) { drawPriv = __glXGetDrawable(glxc, pDraw, drawId); if (drawPriv == NULL) { - return __glXBadDrawable; + return __glXError(GLXBadDrawable); } } if (pRead != pDraw) { readPriv = __glXGetDrawable(glxc, pRead, readId); if (readPriv == NULL) { - return __glXBadDrawable; + return __glXError(GLXBadDrawable); } } else { readPriv = drawPriv; @@ -631,7 +631,7 @@ int DoMakeCurrent( __GLXclientState *cl, ** Make the previous context not current. */ if (!(*prevglxc->loseCurrent)(prevglxc)) { - return __glXBadContext; + return __glXError(GLXBadContext); } __glXFlushContextCache(); __glXDeassociateContext(prevglxc); @@ -647,7 +647,7 @@ int DoMakeCurrent( __GLXclientState *cl, if (!(*glxc->makeCurrent)(glxc)) { glxc->drawPriv = NULL; glxc->readPriv = NULL; - return __glXBadContext; + return __glXError(GLXBadContext); } /* resize the buffers */ @@ -656,7 +656,7 @@ int DoMakeCurrent( __GLXclientState *cl, (*glxc->loseCurrent)(glxc); glxc->drawPriv = NULL; glxc->readPriv = NULL; - return __glXBadContext; + return __glXError(GLXBadContext); } glxc->isCurrent = GL_TRUE; @@ -750,7 +750,7 @@ int __glXIsDirect(__GLXclientState *cl, GLbyte *pc) glxc = (__GLXcontext *) LookupIDByType(req->context, __glXContextRes); if (!glxc) { client->errorValue = req->context; - return __glXBadContext; + return __glXError(GLXBadContext); } reply.isDirect = glxc->isDirect; @@ -844,12 +844,12 @@ int __glXCopyContext(__GLXclientState *cl, GLbyte *pc) src = (__GLXcontext *) LookupIDByType(source, __glXContextRes); if (!src) { client->errorValue = source; - return __glXBadContext; + return __glXError(GLXBadContext); } dst = (__GLXcontext *) LookupIDByType(dest, __glXContextRes); if (!dst) { client->errorValue = dest; - return __glXBadContext; + return __glXError(GLXBadContext); } /* @@ -874,7 +874,7 @@ int __glXCopyContext(__GLXclientState *cl, GLbyte *pc) __GLXcontext *tagcx = __glXLookupContextByTag(cl, tag); if (!tagcx) { - return __glXBadContextTag; + return __glXError(GLXBadContextTag); } if (tagcx != src) { /* @@ -1308,7 +1308,7 @@ int DoDestroyPixmap(__GLXclientState *cl, XID glxpixmap) */ if (!LookupIDByType(glxpixmap, __glXPixmapRes)) { client->errorValue = glxpixmap; - return __glXBadPixmap; + return __glXError(GLXBadPixmap); } FreeResource(glxpixmap, FALSE); @@ -1408,7 +1408,7 @@ int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc) ** Drawable is an X pixmap, which is not allowed. */ client->errorValue = drawId; - return __glXBadDrawable; + return __glXError(GLXBadDrawable); } } else { pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId, @@ -1422,14 +1422,14 @@ int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc) ** Drawable is neither a X window nor a GLX pixmap. */ client->errorValue = drawId; - return __glXBadDrawable; + return __glXError(GLXBadDrawable); } } if (tag) { glxc = __glXLookupContextByTag(cl, tag); if (!glxc) { - return __glXBadContextTag; + return __glXError(GLXBadContextTag); } /* ** The calling thread is swapping its current drawable. In this case, @@ -1454,7 +1454,7 @@ int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc) if (glxc) { glxPriv = __glXGetDrawable(glxc, pDraw, drawId); if (glxPriv == NULL) { - return __glXBadDrawable; + return __glXError(GLXBadDrawable); } } else { @@ -1466,7 +1466,7 @@ int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc) } if ((*glxPriv->swapBuffers)(glxPriv) == GL_FALSE) { - return __glXBadDrawable; + return __glXError(GLXBadDrawable); } } @@ -1486,7 +1486,7 @@ int DoQueryContext(__GLXclientState *cl, GLXContextID gcId) ctx = (__GLXcontext *) LookupIDByType(gcId, __glXContextRes); if (!ctx) { client->errorValue = gcId; - return __glXBadContext; + return __glXError(GLXBadContext); } nProps = 3; @@ -1498,7 +1498,7 @@ int DoQueryContext(__GLXclientState *cl, GLXContextID gcId) nReplyBytes = reply.length << 2; sendBuf = (int *)xalloc((size_t)nReplyBytes); if (sendBuf == NULL) { - return __glXBadContext; /* XXX: Is this correct? */ + return __glXError(GLXBadContext); /* XXX: Is this correct? */ } pSendBuf = sendBuf; *pSendBuf++ = GLX_SHARE_CONTEXT_EXT; @@ -1549,7 +1549,7 @@ int __glXBindTexImageEXT(__GLXclientState *cl, GLbyte *pc) buffer = *((INT32 *) (pc + 4)); if (buffer != GLX_FRONT_LEFT_EXT) - return __glXBadPixmap; + return __glXError(GLXBadPixmap); context = __glXForceCurrent (cl, req->contextTag, &error); if (!context) @@ -1558,11 +1558,11 @@ int __glXBindTexImageEXT(__GLXclientState *cl, GLbyte *pc) pGlxPixmap = (__GLXpixmap *)LookupIDByType(drawId, __glXPixmapRes); if (!pGlxPixmap) { client->errorValue = drawId; - return __glXBadPixmap; + return __glXError(GLXBadPixmap); } if (!context->textureFromPixmap) - return __glXUnsupportedPrivateRequest; + return __glXError(GLXUnsupportedPrivateRequest); return context->textureFromPixmap->bindTexImage(context, buffer, @@ -1591,11 +1591,11 @@ int __glXReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc) pGlxPixmap = (__GLXpixmap *)LookupIDByType(drawId, __glXPixmapRes); if (!pGlxPixmap) { client->errorValue = drawId; - return __glXBadDrawable; + return __glXError(GLXBadDrawable); } if (!context->textureFromPixmap) - return __glXUnsupportedPrivateRequest; + return __glXError(GLXUnsupportedPrivateRequest); return context->textureFromPixmap->releaseTexImage(context, buffer, @@ -1617,7 +1617,7 @@ DoGetDrawableAttributes(__GLXclientState *cl, XID drawId) glxPixmap = (__GLXpixmap *)LookupIDByType(drawId, __glXPixmapRes); if (!glxPixmap) { client->errorValue = drawId; - return __glXBadPixmap; + return __glXError(GLXBadPixmap); } numAttribs = 2; @@ -1728,13 +1728,13 @@ int __glXRender(__GLXclientState *cl, GLbyte *pc) #endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */ } else { client->errorValue = commandsDone; - return __glXBadRenderRequest; + return __glXError(GLXBadRenderRequest); } if (!entry->bytes) { /* unused opcode */ client->errorValue = commandsDone; - return __glXBadRenderRequest; + return __glXError(GLXBadRenderRequest); } if (entry->varsize) { /* variable size command */ @@ -1820,7 +1820,7 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc) */ if (req->requestNumber != 1) { client->errorValue = req->requestNumber; - return __glXBadLargeRequest; + return __glXError(GLXBadLargeRequest); } hdr = (__GLXrenderLargeHeader *) pc; @@ -1841,13 +1841,13 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc) #endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */ } else { client->errorValue = opcode; - return __glXBadLargeRequest; + return __glXError(GLXBadLargeRequest); } if (!entry->bytes) { /* unused opcode */ client->errorValue = opcode; - return __glXBadLargeRequest; + return __glXError(GLXBadLargeRequest); } if (entry->varsize) { /* @@ -1904,12 +1904,12 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc) if (req->requestNumber != cl->largeCmdRequestsSoFar + 1) { client->errorValue = req->requestNumber; __glXResetLargeCommandStatus(cl); - return __glXBadLargeRequest; + return __glXError(GLXBadLargeRequest); } if (req->requestTotal != cl->largeCmdRequestsTotal) { client->errorValue = req->requestTotal; __glXResetLargeCommandStatus(cl); - return __glXBadLargeRequest; + return __glXError(GLXBadLargeRequest); } /* @@ -1918,7 +1918,7 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc) if ((cl->largeCmdBytesSoFar + dataBytes) > cl->largeCmdBytesTotal) { client->errorValue = dataBytes; __glXResetLargeCommandStatus(cl); - return __glXBadLargeRequest; + return __glXError(GLXBadLargeRequest); } memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes); cl->largeCmdBytesSoFar += dataBytes; @@ -1942,7 +1942,7 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc) __GLX_PAD(cl->largeCmdBytesTotal)) { client->errorValue = dataBytes; __glXResetLargeCommandStatus(cl); - return __glXBadLargeRequest; + return __glXError(GLXBadLargeRequest); } hdr = (__GLXrenderLargeHeader *) cl->largeCmdBuf; opcode = hdr->opcode; @@ -1961,7 +1961,7 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc) #endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */ } else { client->errorValue = opcode; - return __glXBadLargeRequest; + return __glXError(GLXBadLargeRequest); } /* @@ -2011,7 +2011,7 @@ static int __glXBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc) } } client->errorValue = drawable; - return __glXBadDrawable; + return __glXError(GLXBadDrawable); } @@ -2252,7 +2252,7 @@ int __glXVendorPrivate(__GLXclientState *cl, GLbyte *pc) ** This sample implemention does not support any private requests. */ cl->client->errorValue = req->vendorCode; - return __glXUnsupportedPrivateRequest; + return __glXError(GLXUnsupportedPrivateRequest); } int __glXVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc) @@ -2312,7 +2312,7 @@ int __glXVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc) } cl->client->errorValue = vendorcode; - return __glXUnsupportedPrivateRequest; + return __glXError(GLXUnsupportedPrivateRequest); } int __glXQueryExtensionsString(__GLXclientState *cl, GLbyte *pc) diff --git a/GL/glx/glxcmdsswap.c b/GL/glx/glxcmdsswap.c index 3464e135a..b8f958bb3 100644 --- a/GL/glx/glxcmdsswap.c +++ b/GL/glx/glxcmdsswap.c @@ -674,12 +674,12 @@ int __glXSwapRender(__GLXclientState *cl, GLbyte *pc) #endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */ } else { client->errorValue = commandsDone; - return __glXBadRenderRequest; + return __glXError(GLXBadRenderRequest); } if (!entry->bytes) { /* unused opcode */ client->errorValue = commandsDone; - return __glXBadRenderRequest; + return __glXError(GLXBadRenderRequest); } if (entry->varsize) { /* variable size command */ @@ -772,7 +772,7 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) */ if (req->requestNumber != 1) { client->errorValue = req->requestNumber; - return __glXBadLargeRequest; + return __glXError(GLXBadLargeRequest); } hdr = (__GLXrenderLargeHeader *) pc; __GLX_SWAP_INT(&hdr->length); @@ -793,13 +793,13 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) #endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */ } else { client->errorValue = opcode; - return __glXBadLargeRequest; + return __glXError(GLXBadLargeRequest); } if (!entry->bytes) { /* unused opcode */ client->errorValue = opcode; - return __glXBadLargeRequest; + return __glXError(GLXBadLargeRequest); } if (entry->varsize) { /* @@ -855,12 +855,12 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) if (req->requestNumber != cl->largeCmdRequestsSoFar + 1) { client->errorValue = req->requestNumber; __glXResetLargeCommandStatus(cl); - return __glXBadLargeRequest; + return __glXError(GLXBadLargeRequest); } if (req->requestTotal != cl->largeCmdRequestsTotal) { client->errorValue = req->requestTotal; __glXResetLargeCommandStatus(cl); - return __glXBadLargeRequest; + return __glXError(GLXBadLargeRequest); } /* @@ -869,7 +869,7 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) if ((cl->largeCmdBytesSoFar + dataBytes) > cl->largeCmdBytesTotal) { client->errorValue = dataBytes; __glXResetLargeCommandStatus(cl); - return __glXBadLargeRequest; + return __glXError(GLXBadLargeRequest); } memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes); cl->largeCmdBytesSoFar += dataBytes; @@ -893,7 +893,7 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) __GLX_PAD(cl->largeCmdBytesTotal)) { client->errorValue = dataBytes; __glXResetLargeCommandStatus(cl); - return __glXBadLargeRequest; + return __glXError(GLXBadLargeRequest); } hdr = (__GLXrenderLargeHeader *) cl->largeCmdBuf; /* @@ -916,7 +916,7 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) #endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */ } else { client->errorValue = opcode; - return __glXBadLargeRequest; + return __glXError(GLXBadLargeRequest); } /* @@ -984,7 +984,7 @@ int __glXSwapVendorPrivate(__GLXclientState *cl, GLbyte *pc) return Success; } cl->client->errorValue = req->vendorCode; - return __glXUnsupportedPrivateRequest; + return __glXError(GLXUnsupportedPrivateRequest); } int __glXSwapVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc) @@ -1037,5 +1037,5 @@ int __glXSwapVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc) return (*__glXSwapVendorPrivTable_EXT[vendorcode-__GLX_MIN_VENDPRIV_OPCODE_EXT])(cl, (GLbyte*)req); } cl->client->errorValue = req->vendorCode; - return __glXUnsupportedPrivateRequest; + return __glXError(GLXUnsupportedPrivateRequest); } diff --git a/GL/glx/glxerror.h b/GL/glx/glxerror.h deleted file mode 100644 index 2c6d6d863..000000000 --- a/GL/glx/glxerror.h +++ /dev/null @@ -1,58 +0,0 @@ -/* $XFree86$ */ -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#ifndef _GLX_error_h_ -#define _GLX_error_h_ - -/* -** License Applicability. Except to the extent portions of this file are -** made subject to an alternative license as permitted in the SGI Free -** Software License B, Version 1.1 (the "License"), the contents of this -** file are subject only to the provisions of the License. You may not use -** this file except in compliance with the License. You may obtain a copy -** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 -** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** -** http://oss.sgi.com/projects/FreeB -** -** Note that, as provided in the License, the Software is distributed on an -** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS -** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND -** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A -** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** -** Original Code. The Original Code is: OpenGL Sample Implementation, -** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, -** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. -** Copyright in any portions created by third parties is as indicated -** elsewhere herein. All Rights Reserved. -** -** Additional Notice Provisions: The application programming interfaces -** established by SGI in conjunction with the Original Code are The -** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released -** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version -** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X -** Window System(R) (Version 1.3), released October 19, 1998. This software -** was created using the OpenGL(R) version 1.2.1 Sample Implementation -** published by SGI, but has not been independently verified as being -** compliant with the OpenGL(R) version 1.2.1 Specification. -** -*/ - -/* -** Error codes. These have the extension error base added to them -** when the extension initializes. -*/ -extern int __glXBadContext; -extern int __glXBadContextState; -extern int __glXBadDrawable; -extern int __glXBadPixmap; -extern int __glXBadCurrentWindow; -extern int __glXBadContextTag; -extern int __glXBadRenderRequest; -extern int __glXBadLargeRequest; -extern int __glXUnsupportedPrivateRequest; - -#endif diff --git a/GL/glx/glxext.c b/GL/glx/glxext.c index cc5dd965a..176883da7 100644 --- a/GL/glx/glxext.c +++ b/GL/glx/glxext.c @@ -33,6 +33,33 @@ #include "glxutil.h" #include "glxext.h" +/* +** The last context used by the server. It is the context that is current +** from the server's perspective. +*/ +__GLXcontext *__glXLastContext; + +/* +** X resources. +*/ +RESTYPE __glXContextRes; +RESTYPE __glXClientRes; +RESTYPE __glXPixmapRes; +RESTYPE __glXDrawableRes; +RESTYPE __glXSwapBarrierRes; + +/* +** Reply for most singles. +*/ +xGLXSingleReply __glXReply; + +/* +** A set of state for each client. The 0th one is unused because client +** indices start at 1, not 0. +*/ +__GLXclientState *__glXClients[MAXCLIENTS+1]; + + static Bool inDispatch; /* @@ -265,6 +292,13 @@ GLboolean __glXErrorOccured(void) return errorOccured; } +static int __glXErrorBase; + +int __glXError(int error) +{ + return __glXErrorBase + error; +} + /************************************************************************/ /* @@ -274,11 +308,12 @@ void GlxExtensionInit(void) { ExtensionEntry *extEntry; int i; - + __glXContextRes = CreateNewResourceType((DeleteType)ContextGone); __glXClientRes = CreateNewResourceType((DeleteType)ClientGone); __glXPixmapRes = CreateNewResourceType((DeleteType)PixmapGone); __glXDrawableRes = CreateNewResourceType((DeleteType)DrawableGone); + __glXSwapBarrierRes = CreateNewResourceType((DeleteType)SwapBarrierGone); /* ** Add extension to server extensions. @@ -296,18 +331,7 @@ void GlxExtensionInit(void) return; } - __glXBadContext = extEntry->errorBase + GLXBadContext; - __glXBadContextState = extEntry->errorBase + GLXBadContextState; - __glXBadDrawable = extEntry->errorBase + GLXBadDrawable; - __glXBadPixmap = extEntry->errorBase + GLXBadPixmap; - __glXBadContextTag = extEntry->errorBase + GLXBadContextTag; - __glXBadCurrentWindow = extEntry->errorBase + GLXBadCurrentWindow; - __glXBadRenderRequest = extEntry->errorBase + GLXBadRenderRequest; - __glXBadLargeRequest = extEntry->errorBase + GLXBadLargeRequest; - __glXUnsupportedPrivateRequest = extEntry->errorBase + - GLXUnsupportedPrivateRequest; - - __glXSwapBarrierRes = CreateNewResourceType((DeleteType)SwapBarrierGone); + __glXErrorBase = extEntry->errorBase; /* ** Initialize table of client state. There is never a client 0. @@ -347,7 +371,7 @@ __GLXcontext *__glXForceCurrent(__GLXclientState *cl, GLXContextTag tag, cx = (__GLXcontext *) __glXLookupContextByTag(cl, tag); if (!cx) { cl->client->errorValue = tag; - *error = __glXBadContextTag; + *error = __glXError(GLXBadContextTag); return 0; } @@ -358,7 +382,7 @@ __GLXcontext *__glXForceCurrent(__GLXclientState *cl, GLXContextTag tag, ** windows can be destroyed from under us; GLX pixmaps are ** refcounted and don't go away until no one is using them. */ - *error = __glXBadCurrentWindow; + *error = __glXError(GLXBadCurrentWindow); return 0; } } @@ -373,7 +397,7 @@ __GLXcontext *__glXForceCurrent(__GLXclientState *cl, GLXContextTag tag, if (!(*cx->forceCurrent)(cx)) { /* Bind failed, and set the error code. Bummer */ cl->client->errorValue = cx->id; - *error = __glXBadContextState; + *error = __glXError(GLXBadContextState); return 0; } } @@ -469,7 +493,7 @@ static int __glXDispatch(ClientPtr client) */ if ((cl->largeCmdRequestsSoFar != 0) && (opcode != X_GLXRenderLarge)) { client->errorValue = stuff->glxCode; - return __glXBadLargeRequest; + return __glXError(GLXBadLargeRequest); } /* diff --git a/GL/glx/glxserver.h b/GL/glx/glxserver.h index a41720f54..ddb3ca9a6 100644 --- a/GL/glx/glxserver.h +++ b/GL/glx/glxserver.h @@ -70,7 +70,6 @@ typedef struct __GLXcontext __GLXcontext; #include "glxscreens.h" #include "glxdrawable.h" #include "glxcontext.h" -#include "glxerror.h" #define GLX_SERVER_MAJOR_VERSION 1 @@ -112,6 +111,8 @@ void __glXScreenInitVisuals(__GLXscreen *screen); extern __GLXcontext *__glXLastContext; extern __GLXcontext *__glXForceCurrent(__GLXclientState*, GLXContextTag, int*); +int __glXError(int error); + /* ** Macros to set, unset, and retrieve the flag that says whether a context ** has unflushed commands. diff --git a/GL/glx/xfont.c b/GL/glx/xfont.c index 795671534..89ff95b7c 100644 --- a/GL/glx/xfont.c +++ b/GL/glx/xfont.c @@ -179,7 +179,7 @@ int __glXUseXFont(__GLXclientState *cl, GLbyte *pc) ** to try to make a font during another lists construction. */ client->errorValue = cx->id; - return __glXBadContextState; + return __glXError(GLXBadContextState); } /* |