diff options
author | Sven Gothel <[email protected]> | 2014-10-02 00:59:51 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-10-02 00:59:51 +0200 |
commit | 1b5c2dbc9204a85eb63cea952b289f5012690f35 (patch) | |
tree | dc910094e94eabe539dd9b9665765ce6641d7bf6 /src | |
parent | 5d3caefa4ded044b2965d7e046e9c9fa35d58810 (diff) |
Bug 1078: Fix commit 99f91f8b28d42cdf341533736e878056bcae4708 (GLRendererQuirks.NoPBufferWithAccum): Accum buffer allowed if !usePBuffer; Avoid NPE.
99f91f8b28d42cdf341533736e878056bcae4708
Diffstat (limited to 'src')
3 files changed, 39 insertions, 26 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index 02557b7e1..efd8b2860 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -1740,8 +1740,19 @@ public abstract class GLContextImpl extends GLContext { final boolean isX11 = NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(true); final boolean isWindows = Platform.getOSType() == Platform.OSType.WINDOWS; final boolean isDriverMesa = glRenderer.contains(MesaSP) || glRenderer.contains("Gallium "); - final boolean isDriverATICatalyst = !isDriverMesa && ( glVendor.contains("ATI Technologies") || glRenderer.startsWith("ATI ") ); - final boolean isDriverNVIDIAGeForce = !isDriverMesa && ( glVendor.contains("NVIDIA Corporation") || glRenderer.contains("NVIDIA ") ); + + final boolean isDriverATICatalyst; + final boolean isDriverNVIDIAGeForce; + final boolean isDriverIntel; + if( !isDriverMesa ) { + isDriverATICatalyst = glVendor.contains("ATI Technologies") || glRenderer.startsWith("ATI "); + isDriverNVIDIAGeForce = glVendor.contains("NVIDIA Corporation") || glRenderer.contains("NVIDIA "); + isDriverIntel = glVendor.startsWith("Intel"); + } else { + isDriverATICatalyst = false; + isDriverNVIDIAGeForce = false; + isDriverIntel = false; + } final GLRendererQuirks quirks = new GLRendererQuirks(); @@ -1840,8 +1851,7 @@ public abstract class GLContextImpl extends GLContext { } quirks.addQuirk( quirk ); } - } - if (glVendor.equals("Intel") && glRenderer.equals("Intel Bear Lake B")) { + } else if( isDriverIntel && glRenderer.equals("Intel Bear Lake B") ) { final int quirk = GLRendererQuirks.NoPBufferWithAccum; if(DEBUG) { System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: OS "+Platform.getOSType()+", [Vendor "+glVendor+" and Renderer "+glRenderer+"]"); diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java index 597f51178..5d925fe03 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java @@ -142,8 +142,8 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { System.out.println(getThreadName()+": Pbuffer chosenCaps: " + chosenCaps); } - if(!WindowsWGLGraphicsConfiguration.GLCapabilities2AttribList(chosenCaps, - iattributes, sharedResource, -1, floatModeTmp)){ + if( !WindowsWGLGraphicsConfiguration.GLCapabilities2AttribList( sharedResource, chosenCaps, + iattributes, -1, floatModeTmp) ) { throw new GLException("Pbuffer-related extensions not supported"); } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java index ee868b1c0..24d44b5dd 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java @@ -327,9 +327,8 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio final long hdc, final IntBuffer iattributes, final int accelerationMode, final FloatBuffer fattributes) { - if ( !WindowsWGLGraphicsConfiguration.GLCapabilities2AttribList(capabilities, - iattributes, sharedResource, accelerationMode, null)) - { + if ( !WindowsWGLGraphicsConfiguration.GLCapabilities2AttribList( sharedResource, capabilities, + iattributes, accelerationMode, null) ) { if (DEBUG) { System.err.println("wglChoosePixelFormatARB: GLCapabilities2AttribList failed: " + GDI.GetLastError()); Thread.dumpStack(); @@ -412,9 +411,9 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio return bucket; } - static boolean GLCapabilities2AttribList(final GLCapabilitiesImmutable caps, + static boolean GLCapabilities2AttribList(final WindowsWGLDrawableFactory.SharedResource sharedResource, + final GLCapabilitiesImmutable caps, final IntBuffer iattributes, - final WindowsWGLDrawableFactory.SharedResource sharedResource, final int accelerationValue, final int[] floatMode) throws GLException { if (!sharedResource.hasARBPixelFormat()) { @@ -477,23 +476,27 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio } iattributes.put(niattribs++, WGLExt.WGL_DEPTH_BITS_ARB); iattributes.put(niattribs++, caps.getDepthBits()); - if (!sharedResource.getRendererQuirks().exist(GLRendererQuirks.NoPBufferWithAccum) && (caps.getAccumRedBits() > 0 || + + if( caps.getAccumRedBits() > 0 || caps.getAccumGreenBits() > 0 || caps.getAccumBlueBits() > 0 || - caps.getAccumAlphaBits() > 0)) { - iattributes.put(niattribs++, WGLExt.WGL_ACCUM_BITS_ARB); - iattributes.put(niattribs++, ( caps.getAccumRedBits() + - caps.getAccumGreenBits() + - caps.getAccumBlueBits() + - caps.getAccumAlphaBits() ) ); - iattributes.put(niattribs++, WGLExt.WGL_ACCUM_RED_BITS_ARB); - iattributes.put(niattribs++, caps.getAccumRedBits()); - iattributes.put(niattribs++, WGLExt.WGL_ACCUM_GREEN_BITS_ARB); - iattributes.put(niattribs++, caps.getAccumGreenBits()); - iattributes.put(niattribs++, WGLExt.WGL_ACCUM_BLUE_BITS_ARB); - iattributes.put(niattribs++, caps.getAccumBlueBits()); - iattributes.put(niattribs++, WGLExt.WGL_ACCUM_ALPHA_BITS_ARB); - iattributes.put(niattribs++, caps.getAccumAlphaBits()); + caps.getAccumAlphaBits() > 0 ) { + final GLRendererQuirks sharedQuirks = sharedResource.getRendererQuirks(); + if ( !usePBuffer || null==sharedQuirks || !sharedQuirks.exist(GLRendererQuirks.NoPBufferWithAccum) ) { + iattributes.put(niattribs++, WGLExt.WGL_ACCUM_BITS_ARB); + iattributes.put(niattribs++, ( caps.getAccumRedBits() + + caps.getAccumGreenBits() + + caps.getAccumBlueBits() + + caps.getAccumAlphaBits() ) ); + iattributes.put(niattribs++, WGLExt.WGL_ACCUM_RED_BITS_ARB); + iattributes.put(niattribs++, caps.getAccumRedBits()); + iattributes.put(niattribs++, WGLExt.WGL_ACCUM_GREEN_BITS_ARB); + iattributes.put(niattribs++, caps.getAccumGreenBits()); + iattributes.put(niattribs++, WGLExt.WGL_ACCUM_BLUE_BITS_ARB); + iattributes.put(niattribs++, caps.getAccumBlueBits()); + iattributes.put(niattribs++, WGLExt.WGL_ACCUM_ALPHA_BITS_ARB); + iattributes.put(niattribs++, caps.getAccumAlphaBits()); + } } if (caps.getSampleBuffers() && sharedResource.hasARBMultisample()) { |