diff options
author | Sven Gothel <[email protected]> | 2014-10-02 00:59:51 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-10-08 22:11:35 +0200 |
commit | 993a453fb9159c6c681882b07e318b690123988a (patch) | |
tree | 962be927cb95340d6234226b6a5ab8fe56719a63 /src/jogl/classes/jogamp | |
parent | 2b27ba90274f31335ccdb96fcdfef7d0110dcc96 (diff) |
Bug 1078: Fix commit 99f91f8b28d42cdf341533736e878056bcae4708 (GLRendererQuirks.NoPBufferWithAccum): Accum buffer allowed if !usePBuffer; Avoid NPE.
99f91f8b28d42cdf341533736e878056bcae4708
Diffstat (limited to 'src/jogl/classes/jogamp')
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()) { |