From cfa9d3d5185c1fa96d0c259d40e46813407d7b01 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 26 Feb 2012 02:54:50 +0100 Subject: GLContext.isCurrentContextHardwareRasterizer(): Recognize 'softpipe' (Gallium) as software rasterizer. Check for NULL and issue warnings (TRIAGE THIS). --- src/jogl/classes/jogamp/opengl/GLContextImpl.java | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index b87437088..3d3c387e1 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -1087,10 +1087,25 @@ public abstract class GLContextImpl extends GLContext { isHardwareRasterizer = false; } else { // On some platforms (eg. X11), a software GL impl. does not properly declare itself properly. + // FIXME: We have to evaluate whether this heuristic approach is acceptable. final GLDynamicLookupHelper glDynLookupHelper = getDrawableImpl().getGLDynamicLookupHelper(); - final long _glGetString = glDynLookupHelper.dynamicLookupFunction("glGetString"); - final String glRenderer = glGetStringInt(GL.GL_RENDERER, _glGetString).toLowerCase(); - isHardwareRasterizer = !glRenderer.contains("software"); + final long _glGetString = glDynLookupHelper.dynamicLookupFunction("glGetString"); + if(0 == _glGetString) { + // FIXME + System.err.println("Warning: Entry point to 'glGetString' is NULL."); + Thread.dumpStack(); + } else { + String glRenderer = glGetStringInt(GL.GL_RENDERER, _glGetString); + if(null == glRenderer) { + // FIXME + System.err.println("Warning: GL_RENDERER is NULL."); + Thread.dumpStack(); + } else { + glRenderer = glRenderer.toLowerCase(); + isHardwareRasterizer = ! ( glRenderer.contains("software") /* Mesa3D */ || + glRenderer.contains("softpipe") /* Gallium */ ); + } + } } return isHardwareRasterizer; } -- cgit v1.2.3