From ce8c5cebdfe0570e22c116fbb8ebc83b9a4d3c12 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Tue, 28 Mar 2006 16:11:15 +0000 Subject: Worked around spurious SetPixelFormat failures seen on Intel 82855 hardware with help from Matt Abraham by silently squelching a few back-to-back failures of this call and indicating that the surface was not ready yet. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@691 232f8b59-042b-4e1e-8c03-345bb8c30851 --- .../sun/opengl/impl/windows/WindowsOnscreenGLDrawable.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/classes/com/sun/opengl/impl/windows/WindowsOnscreenGLDrawable.java b/src/classes/com/sun/opengl/impl/windows/WindowsOnscreenGLDrawable.java index ee8393296..f30b2c4b8 100644 --- a/src/classes/com/sun/opengl/impl/windows/WindowsOnscreenGLDrawable.java +++ b/src/classes/com/sun/opengl/impl/windows/WindowsOnscreenGLDrawable.java @@ -77,6 +77,10 @@ public class WindowsOnscreenGLDrawable extends WindowsGLDrawable { private int profilingSwapBuffersTicks; private long profilingSwapBuffersTime; + // Workaround for problems on Intel 82855 cards + private int setPixelFormatFailCount; + private static final int MAX_SET_PIXEL_FORMAT_FAIL_COUNT = 5; + public WindowsOnscreenGLDrawable(Component component, GLCapabilities capabilities, GLCapabilitiesChooser chooser) { @@ -196,10 +200,16 @@ public class WindowsOnscreenGLDrawable extends WindowsGLDrawable { if (!pixelFormatChosen) { try { choosePixelFormat(true); + setPixelFormatFailCount = 0; } catch (RuntimeException e) { + // Workaround for problems seen on Intel 82855 cards in particular // Make it look like the lockSurface() call didn't succeed unlockSurface(); - throw e; + if (++setPixelFormatFailCount == MAX_SET_PIXEL_FORMAT_FAIL_COUNT) { + setPixelFormatFailCount = 0; + throw e; + } + return LOCK_SURFACE_NOT_READY; } } if (PROFILING) { -- cgit v1.2.3