Revision: 231 http://trac.macosforge.org/projects/xquartz/changeset/231 Author: gstaplin@apple.com Date: 2009-02-21 23:25:36 -0800 (Sat, 21 Feb 2009) Log Message: ----------- Complete the transition to __glXSendError in glxcmds.c. Modified Paths: -------------- AppleSGLX/trunk/apple_glx_context.c AppleSGLX/trunk/apple_glx_context.h AppleSGLX/trunk/glxcmds.c Modified: AppleSGLX/trunk/apple_glx_context.c =================================================================== --- AppleSGLX/trunk/apple_glx_context.c 2009-02-22 07:08:21 UTC (rev 230) +++ AppleSGLX/trunk/apple_glx_context.c 2009-02-22 07:25:36 UTC (rev 231) @@ -112,7 +112,7 @@ */ bool apple_glx_create_context(void **ptr, Display *dpy, int screen, const void *mode, void *sharedContext, - int *errorptr) { + int *errorptr, bool *x11errorptr) { struct apple_glx_context *ac; struct apple_glx_context *sharedac = sharedContext; CGLError error; @@ -123,11 +123,13 @@ if(NULL == ac) { *errorptr = BadAlloc; + *x11errorptr = true; return true; } if(sharedac && !is_context_valid(sharedac)) { *errorptr = GLXBadContext; + *x11errorptr = false; return true; } @@ -155,8 +157,10 @@ if(kCGLBadMatch == error) { *errorptr = BadMatch; + *x11errorptr = true; } else { *errorptr = GLXBadContext; + *x11errorptr = false; } if(getenv("LIBGL_DIAGNOSTIC")) @@ -299,8 +303,6 @@ } /* Return true if an error occured. */ -/* TODO handle the readable GLXDrawable...? STUDY */ - bool apple_glx_make_current_context(Display *dpy, void *oldptr, void *ptr, GLXDrawable drawable) { struct apple_glx_context *oldac = oldptr; @@ -498,7 +500,8 @@ } bool apple_glx_copy_context(void *currentptr, void *srcptr, void *destptr, - unsigned long mask, int *errorptr) { + unsigned long mask, int *errorptr, + bool *x11errorptr) { struct apple_glx_context *src, *dest; CGLError err; @@ -507,11 +510,13 @@ if(src->screen != dest->screen) { *errorptr = BadMatch; + *x11errorptr = true; return true; } if(dest == currentptr || dest->is_current) { *errorptr = BadAccess; + *x11errorptr = true; return true; } @@ -526,6 +531,7 @@ if(kCGLNoError != err) { *errorptr = GLXBadContext; + *x11errorptr = false; return true; } Modified: AppleSGLX/trunk/apple_glx_context.h =================================================================== --- AppleSGLX/trunk/apple_glx_context.h 2009-02-22 07:08:21 UTC (rev 230) +++ AppleSGLX/trunk/apple_glx_context.h 2009-02-22 07:25:36 UTC (rev 231) @@ -1,5 +1,5 @@ /* - Copyright (c) 2008 Apple Inc. + Copyright (c) 2008, 2009 Apple Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files @@ -55,7 +55,7 @@ bool apple_glx_create_context(void **ptr, Display *dpy, int screen, const void *mode, void *sharedContext, - int *errorptr); + int *errorptr, bool *x11errorptr); void apple_glx_destroy_context(void **ptr, Display *dpy); bool apple_glx_make_current_context(Display *dpy, void *oldptr, void *ptr, GLXDrawable drawable); @@ -65,6 +65,7 @@ CGLContextObj *contextobj); bool apple_glx_copy_context(void *currentptr, void *srcptr, void *destptr, - unsigned long mask, int *errorptr); + unsigned long mask, int *errorptr, + bool *x11errorptr); #endif /*APPLE_GLX_CONTEXT_H*/ Modified: AppleSGLX/trunk/glxcmds.c =================================================================== --- AppleSGLX/trunk/glxcmds.c 2009-02-22 07:08:21 UTC (rev 230) +++ AppleSGLX/trunk/glxcmds.c 2009-02-22 07:25:36 UTC (rev 231) @@ -40,6 +40,7 @@ #include "apple_glx_context.h" #include "apple_glx.h" +#include "glx_error.h" static const char __glXGLXClientVendorName[] = "SGI"; static const char __glXGLXClientVersion[] = "1.4"; @@ -358,6 +359,7 @@ __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen); const __GLcontextModes *mode; int errorcode; + bool x11error; if ( dpy == NULL ) return NULL; @@ -379,20 +381,8 @@ mode = _gl_context_modes_find_visual(psc->visuals, vis->visualid); if(NULL == mode) { - xError error; - - LockDisplay(dpy); - - error.errorCode = BadValue; - error.resourceID = vis->visualid; - error.sequenceNumber = dpy->request; - error.type = X_Error; - error.majorCode = gc->majorOpcode; - error.minorCode = X_GLXCreateContext; - _XError(dpy, &error); - - UnlockDisplay(dpy); - + __glXSendError(dpy, BadValue, vis->visualid, X_GLXCreateContext, + true); __glXFreeContext(gc); return NULL; @@ -401,18 +391,8 @@ if(apple_glx_create_context(&gc->apple, dpy, screen, mode, shareList ? shareList->apple : NULL, - &errorcode)) { - xError error; - error.errorCode = errorcode; - error.resourceID = 0; - error.sequenceNumber = dpy->request; - error.type = X_Error; - error.majorCode = gc->majorOpcode; - error.minorCode = X_GLXCreateContext; - _XError(dpy, &error); - - UnlockDisplay(dpy); - + &errorcode, &x11error)) { + __glXSendError(dpy, errorcode, 0, X_GLXCreateContext, x11error); __glXFreeContext(gc); return NULL; @@ -573,24 +553,11 @@ { GLXContext gc = __glXGetCurrentContext(); int errorcode; + bool x11error; if(apple_glx_copy_context(gc->apple, source->apple, dest->apple, - mask, &errorcode)) { - xError error; - - LockDisplay(dpy); - - error.errorCode = errorcode; - error.resourceID = 0; - error.sequenceNumber = dpy->request; - error.type = X_Error; - error.majorCode = gc->majorOpcode; - error.minorCode = X_GLXCopyContext; - _XError(dpy, &error); - - UnlockDisplay(dpy); - - return; + mask, &errorcode, &x11error)) { + __glXSendError(dpy, errorcode, 0, X_GLXCopyContext, x11error); } } @@ -602,25 +569,12 @@ */ PUBLIC Bool glXIsDirect(Display *dpy, GLXContext gc) { - xError error; - + /* + * This isn't an ideal test. + * glXIsDirect should probably search a list of contexts. + */ if(NULL == gc) { - /* - * This isn't an ideal test. - * glXIsDirect should probably search a list of contexts. - */ - LockDisplay(dpy); - - error.errorCode = GLXBadContext; - error.resourceID = 0; - error.sequenceNumber = dpy->request; - error.type = X_Error; - error.majorCode = 0; //gc->majorOpcode; - error.minorCode = X_GLXIsDirect; - _XError(dpy, &error); - - UnlockDisplay(dpy); - + __glXSendError(dpy, GLXBadContext, 0, X_GLXIsDirect, false); return False; } @@ -647,7 +601,10 @@ */ PUBLIC void glXDestroyGLXPixmap(Display *dpy, GLXPixmap glxpixmap) { - apple_glx_pixmap_destroy(dpy, glxpixmap); + if(apple_glx_pixmap_destroy(dpy, glxpixmap)) + return; /*Success*/ + + __glXSendError(dpy, GLXBadPixmap, glxpixmap, X_GLXDestroyPixmap, false); } PUBLIC void glXSwapBuffers(Display *dpy, GLXDrawable drawable) { @@ -661,18 +618,7 @@ if(apple_glx_is_current_drawable(gc->apple, drawable)) { apple_glx_swap_buffers(gc->apple); } else { - LockDisplay(dpy); - - xError error; - error.errorCode = GLXBadCurrentWindow; - error.resourceID = 0; - error.sequenceNumber = dpy->request; - error.type = X_Error; - error.majorCode = gc->majorOpcode; - error.minorCode = X_GLXSwapBuffers; - _XError(dpy, &error); - - UnlockDisplay(dpy); + __glXSendError(dpy, GLXBadCurrentWindow, 0, X_GLXSwapBuffers, false); } }
participants (1)
-
source_changes@macosforge.org