* Source/x11/XGGLContext.m,

* Source/x11/XGGLFormat.m: Better error reporting by converting
  glGetError() to a string.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@37047 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2013-09-08 18:19:12 +00:00
parent 3ec966768f
commit a5b102b243
3 changed files with 85 additions and 78 deletions

View file

@ -1,3 +1,9 @@
2013-09-08 Fred Kiefer <FredKiefer@gmx.de>
* Source/x11/XGGLContext.m,
* Source/x11/XGGLFormat.m: Better error reporting by converting
glGetError() to a string.
2013-08-21 Eric Wasylishen <ewasylishen@gmail.com>
* Source/x11/XIMInputServer.m: Add the setlocale(LC_CTYPE, "") call
@ -12,7 +18,7 @@
* Source/opal/OpalContext.m:
Implementation of -graphicsPort that returns a CGContext
* Source/opal/OpalGState.m:
-Stubs for -DPSsetlinejoin:, -DPSsetlinecap:, -DPSsetmiterlimit:
-Implementation of -DPSimage::::::::::: for 32-bit RGB colorspaces

View file

@ -250,20 +250,20 @@ static XGGLContext *currentGLContext;
if ([XGGLPixelFormat glxMinorVersion] >= 3)
{
if ( !glXMakeContextCurrent(dpy, None, None, NULL) )
if (!glXMakeContextCurrent(dpy, None, None, NULL))
{
NSDebugMLLog( @"GLX",
@"Can not clear current GL context - Errror %u",
glGetError() );
NSDebugMLLog(@"GLX",
@"Cannot clear current GL context - Error %s",
glGetString(glGetError()));
}
}
else
{
if ( !glXMakeCurrent(dpy, None, NULL) )
if (!glXMakeCurrent(dpy, None, NULL))
{
NSDebugMLLog( @"GLX",
@"Can not clear current GL context - Errror %u",
glGetError() );
NSDebugMLLog(@"GLX",
@"Can not clear current GL context - Error %s",
glGetString(glGetError()));
}
}
@ -279,8 +279,6 @@ static XGGLContext *currentGLContext;
{
if (xSubWindow)
{
MAKE_DISPLAY(dpy);
if (currentGLContext == self)
{
[XGGLContext clearCurrentContext];
@ -288,6 +286,8 @@ static XGGLContext *currentGLContext;
if ( glx_drawable != xSubWindow->xwindowid )
{
MAKE_DISPLAY(dpy);
glXDestroyWindow(dpy, glx_drawable);
glx_drawable = None;
}
@ -316,7 +316,7 @@ static XGGLContext *currentGLContext;
- (void)copyAttributesFromContext:(NSOpenGLContext *)context
withMask:(unsigned long)mask
{
GLint error;
GLenum error;
MAKE_DISPLAY(dpy);
if (context == nil || ![context isKindOfClass: [XGGLContext class]])
@ -329,12 +329,11 @@ static XGGLContext *currentGLContext;
glx_context, mask);
error = glGetError();
if ( error != GL_NO_ERROR )
if (error != GL_NO_ERROR)
{
NSDebugMLLog( @"GLX",
@"Can not copy GL context %@ from context %@ - Error %u",
self, context, error );
NSDebugMLLog(@"GLX",
@"Cannot copy GL context %@ from context %@ - Error %s",
self, context, glGetString(error));
}
}
@ -382,7 +381,7 @@ static XGGLContext *currentGLContext;
}
- (id)initWithFormat: (NSOpenGLPixelFormat *)_format
shareContext: (NSOpenGLContext *)share
shareContext: (NSOpenGLContext *)share
{
self = [super init];
@ -440,18 +439,18 @@ static XGGLContext *currentGLContext;
if ([XGGLPixelFormat glxMinorVersion] >= 3)
{
if ( !glXMakeContextCurrent(dpy, glx_drawable, glx_drawable, glx_context) )
if (!glXMakeContextCurrent(dpy, glx_drawable, glx_drawable, glx_context) )
{
NSDebugMLLog( @"GLX", @"Cannot make GL context %@ current - Error %u",
self, glGetError() );
NSDebugMLLog(@"GLX", @"Cannot make GL context %@ current - Error %s",
self, glGetString(glGetError()));
}
}
else
{
if ( !glXMakeCurrent(dpy, glx_drawable, glx_context) )
if (!glXMakeCurrent(dpy, glx_drawable, glx_context) )
{
NSDebugMLLog( @"GLX", @"Cannot make GL context %@ current - Error %u",
self, glGetError() );
NSDebugMLLog(@"GLX", @"Cannot make GL context %@ current - Error %s",
self, glGetString(glGetError()));
}
}

View file

@ -47,33 +47,37 @@
+ (int) glxMinorVersion
{
Display * display = [(XGServer *)GSCurrentServer() xDisplay];
NSDictionary * attributes = [GSCurrentServer() attributes];
NSString * sn = [attributes objectForKey: GSScreenNumber];
static int cachedVersion = -1;
// This is due to some OpenGL drivers reporting a lower overall GLX version than they actually implement.
NSString * glxServerVersion = [NSString stringWithFormat:@"%s", glXQueryServerString(display, [sn intValue], GLX_VERSION)];
NSString * glxClientVersion = [NSString stringWithFormat:@"%s", glXGetClientString(display, GLX_VERSION)];
float serverversion = [glxServerVersion floatValue];
float clientversion = [glxClientVersion floatValue];
float serverIntegerPart;
float clientIntegerPart;
float fracServer = modff(serverversion, &serverIntegerPart);
float fracClient = modff(clientversion, &clientIntegerPart);
if ( serverIntegerPart == 1.0f && clientIntegerPart == 1.0f )
if (cachedVersion == -1)
{
fracServer = rintf(fracServer * 10.0f);
fracClient = rintf(fracClient * 10.0f);
NSDebugMLLog(@"GLX", @"server %f client %f", fracServer, fracClient );
return (int)MIN(fracServer, fracClient);
Display * display = [(XGServer *)GSCurrentServer() xDisplay];
NSDictionary * attributes = [GSCurrentServer() attributes];
NSString * sn = [attributes objectForKey: GSScreenNumber];
// This is due to some OpenGL drivers reporting a lower overall GLX version than they actually implement.
NSString *glxServerVersion =
[NSString stringWithFormat:@"%s", glXQueryServerString(display, [sn intValue], GLX_VERSION)];
NSString *glxClientVersion =
[NSString stringWithFormat:@"%s", glXGetClientString(display, GLX_VERSION)];
float serverversion = [glxServerVersion floatValue];
float clientversion = [glxClientVersion floatValue];
float serverIntegerPart;
float clientIntegerPart;
float fracServer = modff(serverversion, &serverIntegerPart);
float fracClient = modff(clientversion, &clientIntegerPart);
if ( serverIntegerPart == 1.0f && clientIntegerPart == 1.0f )
{
fracServer = rintf(fracServer * 10.0f);
fracClient = rintf(fracClient * 10.0f);
NSDebugMLLog(@"GLX", @"server %f client %f", fracServer, fracClient);
cachedVersion = (int)MIN(fracServer, fracClient);
}
}
return -1;
return cachedVersion;
}
// Works for some attributes only
@ -86,7 +90,6 @@
NSAssert((fbconfig != NULL || visualinfo != NULL) && configurationCount > 0,
NSInternalInconsistencyException);
if (glxminorversion >= 3)
{
error = glXGetFBConfigAttrib(display, fbconfig[pickedFBConfig], attrib, vals);
@ -234,31 +237,31 @@ do \
}
case NSOpenGLPFAWindow:
{
{
drawable_type |= GLX_WINDOW_BIT;
break;
}
}
case NSOpenGLPFAPixelBuffer:
{
{
drawable_type |= GLX_PBUFFER_BIT;
break;
}
}
case NSOpenGLPFAOffScreen:
{
{
drawable_type |= GLX_PIXMAP_BIT;
break;
}
}
//can not be handled by X11
case NSOpenGLPFAMinimumPolicy:
{
{
break;
}
}
// can not be handled by X11
case NSOpenGLPFAMaximumPolicy:
{
{
break;
}
}
// Not supported, would be a lot of work to implement.
case NSOpenGLPFAFullScreen:
{
@ -272,11 +275,9 @@ do \
{
ptr++;
append(GLX_SAMPLE_BUFFERS, *ptr);
break;
}
#else
break;
#endif
break;
}
case NSOpenGLPFASamples:
{
@ -285,11 +286,9 @@ do \
{
ptr++;
append(GLX_SAMPLES, *ptr);
break;
}
#else
break;
#endif
break;
}
case NSOpenGLPFAAuxDepthStencil:
@ -310,7 +309,7 @@ do \
case NSOpenGLPFASampleAlpha:
break;
}
ptr ++;
ptr++;
}
if ( drawable_type )
@ -332,6 +331,10 @@ do \
NSDictionary * dsattributes;
self = [super init];
if (self == nil)
{
return nil;
}
fbconfig = NULL;
visualinfo = NULL;
@ -361,8 +364,7 @@ do \
if ((NULL != pictFormat
&& (pictFormat->type == PictTypeDirect)
&& (pictFormat->direct.alphaMask))
||
!shouldRequestARGBVisual)
|| !shouldRequestARGBVisual)
{
pickedFBConfig = i;
visualinfo = vinfo;
@ -371,11 +373,11 @@ do \
}
#endif
if(!visualinfo && configurationCount > 0)
{
visualinfo = glXGetVisualFromFBConfig(display,fbconfig[0]);
pickedFBConfig = 0;
}
if (!visualinfo && configurationCount > 0)
{
visualinfo = glXGetVisualFromFBConfig(display,fbconfig[0]);
pickedFBConfig = 0;
}
}
else
{
@ -401,7 +403,7 @@ do \
- (Display *) display
{
return display;
return display;
}
- (XVisualInfo *) visualinfo
@ -427,8 +429,8 @@ do \
if ( context == NULL )
{
NSDebugMLLog(@"GLX",
@"Can not create GL context for pixel format %@ - Error %u",
self, glGetError());
@"Cannot create GL context for pixel format %@ - Error %s",
self, glGetString(glGetError()));
}
return context;
@ -437,7 +439,7 @@ do \
- (GLXWindow) drawableForWindow: (Window)xwindowid
{
GLXWindow win;
GLint error;
GLenum error;
if (glxminorversion >= 3)
{
@ -452,8 +454,8 @@ do \
if ( error != GL_NO_ERROR )
{
NSDebugMLLog(@"GLX",
@"Can not create GL window for pixel format %@ - Error %u",
self, error );
@"Cannot create GL window for pixel format %@ - Error %s",
self, glGetString(error));
}
return win;