Commit fff0d547 authored by Ulrich Sibiller's avatar Ulrich Sibiller Committed by Mike Gabriel

glxext.c/NXglxext.c: merge two functions into one

This has also been done in Xorg 7.1 This also fixes a little flaw for the swapped case: a check for glXRenderLarge was missing.
parent b0b62dde
...@@ -42,7 +42,6 @@ static __GLXextensionInfo *__glXExt /* = &__glDDXExtensionInfo */; ...@@ -42,7 +42,6 @@ static __GLXextensionInfo *__glXExt /* = &__glDDXExtensionInfo */;
/* /*
** Forward declarations. ** Forward declarations.
*/ */
static int __glXSwapDispatch(ClientPtr);
static int __glXDispatch(ClientPtr); static int __glXDispatch(ClientPtr);
/* /*
...@@ -246,7 +245,7 @@ void GlxExtensionInit(void) ...@@ -246,7 +245,7 @@ void GlxExtensionInit(void)
*/ */
extEntry = AddExtension(GLX_EXTENSION_NAME, __GLX_NUMBER_EVENTS, extEntry = AddExtension(GLX_EXTENSION_NAME, __GLX_NUMBER_EVENTS,
__GLX_NUMBER_ERRORS, __glXDispatch, __GLX_NUMBER_ERRORS, __glXDispatch,
__glXSwapDispatch, ResetExtension, __glXDispatch, ResetExtension,
StandardMinorOpcode); StandardMinorOpcode);
if (!extEntry) { if (!extEntry) {
FatalError("__glXExtensionInit: AddExtensions failed\n"); FatalError("__glXExtensionInit: AddExtensions failed\n");
...@@ -445,53 +444,10 @@ static int __glXDispatch(ClientPtr client) ...@@ -445,53 +444,10 @@ static int __glXDispatch(ClientPtr client)
/* /*
** Use the opcode to index into the procedure table. ** Use the opcode to index into the procedure table.
*/ */
proc = __glXSingleTable[opcode]; if (client->swapped)
return (*proc)(cl, (GLbyte *) stuff); proc = __glXSwapSingleTable[opcode];
} else
proc = __glXSingleTable[opcode];
static int __glXSwapDispatch(ClientPtr client)
{
REQUEST(xGLXSingleReq);
CARD8 opcode;
int (*proc)(__GLXclientState *cl, GLbyte *pc);
__GLXclientState *cl;
opcode = stuff->glxCode;
cl = __glXClients[client->index];
if (!cl) {
cl = (__GLXclientState *) malloc(sizeof(__GLXclientState));
__glXClients[client->index] = cl;
if (!cl) {
return BadAlloc;
}
memset(cl, 0, sizeof(__GLXclientState));
}
if (!cl->inUse) {
/*
** This is first request from this client. Associate a resource
** with the client so we will be notified when the client dies.
*/
XID xid = FakeClientID(client->index);
if (!AddResource( xid, __glXClientRes, (void *)(long)client->index)) {
return BadAlloc;
}
ResetClientState(client->index);
cl->inUse = GL_TRUE;
cl->client = client;
}
/*
** Check for valid opcode.
*/
if (opcode >= __GLX_SINGLE_TABLE_SIZE) {
return BadRequest;
}
/*
** Use the opcode to index into the procedure table.
*/
proc = __glXSwapSingleTable[opcode];
return (*proc)(cl, (GLbyte *) stuff); return (*proc)(cl, (GLbyte *) stuff);
} }
......
...@@ -107,77 +107,10 @@ static int __glXDispatch(ClientPtr client) ...@@ -107,77 +107,10 @@ static int __glXDispatch(ClientPtr client)
/* /*
** Use the opcode to index into the procedure table. ** Use the opcode to index into the procedure table.
*/ */
proc = __glXSingleTable[opcode]; if (client->swapped)
proc = __glXSwapSingleTable[opcode];
/* else
* Report upstream that we are proc = __glXSingleTable[opcode];
* dispatching a GLX operation.
*/
nxagentGlxTrap = 1;
#ifdef TEST
fprintf(stderr, "__glXDispatch: Going to dispatch GLX operation [%d] for client [%d].\n",
opcode, client -> index);
#endif
result = (*proc)(cl, (GLbyte *) stuff);
nxagentGlxTrap = 0;
#ifdef TEST
fprintf(stderr, "__glXDispatch: Dispatched GLX operation [%d] for client [%d].\n",
opcode, client -> index);
#endif
return result;
}
static int __glXSwapDispatch(ClientPtr client)
{
int result;
REQUEST(xGLXSingleReq);
CARD8 opcode;
int (*proc)(__GLXclientState *cl, GLbyte *pc);
__GLXclientState *cl;
opcode = stuff->glxCode;
cl = __glXClients[client->index];
if (!cl) {
cl = (__GLXclientState *) malloc(sizeof(__GLXclientState));
__glXClients[client->index] = cl;
if (!cl) {
return BadAlloc;
}
memset(cl, 0, sizeof(__GLXclientState));
}
if (!cl->inUse) {
/*
** This is first request from this client. Associate a resource
** with the client so we will be notified when the client dies.
*/
XID xid = FakeClientID(client->index);
if (!AddResource( xid, __glXClientRes, (void *)(long)client->index)) {
return BadAlloc;
}
ResetClientState(client->index);
cl->inUse = GL_TRUE;
cl->client = client;
}
/*
** Check for valid opcode.
*/
if (opcode >= __GLX_SINGLE_TABLE_SIZE) {
return BadRequest;
}
/*
** Use the opcode to index into the procedure table.
*/
proc = __glXSwapSingleTable[opcode];
/* /*
* Report upstream that we are * Report upstream that we are
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment