From 61bb64aea9d8967f5360ba42fc9ec7a24b79683b Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 13 Oct 2012 07:10:52 +0200 Subject: Fix Windows ANGLE Workaround Regression of commit 923d9dd7f1d40db72d35ca76a761ca14babf147f We are aware that Google's ANGLE (Windows EGL/ES2 impl. based on D3D) crashes using eglInitialize(..) w/ EGL_DEFAULT_DISPLAY. Commit 923d9dd7f1d40db72d35ca76a761ca14babf147f moved the EGL device initialization into the EGLDrawableFactory ctor and hence slipped out ANGLE workaround to disable it per default. - Moving property static flags from GLProfile -> GLDrawableFactory - Moving ANGLE workaround right into EGLDrawableFactory (where it belongs) - Moving optional EGL/ES disable code to GLDrawableFactory (where it belongs) Tested on Windows w/ Java-32bit and latest Chrome ANGLE DLLs --- .../jogamp/opengl/egl/EGLDrawableFactory.java | 31 +++++++++++++++------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'src/jogl/classes/jogamp/opengl/egl') diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java index da3907193..e985e63b2 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java @@ -81,13 +81,12 @@ import com.jogamp.nativewindow.egl.EGLGraphicsDevice; import com.jogamp.opengl.GLRendererQuirks; public class EGLDrawableFactory extends GLDrawableFactoryImpl { - protected static final boolean DEBUG = GLDrawableFactoryImpl.DEBUG; + protected static final boolean DEBUG = GLDrawableFactoryImpl.DEBUG; // allow package access /* package */ static final boolean QUERY_EGL_ES_NATIVE_TK = Debug.isPropertyDefined("jogl.debug.EGLDrawableFactory.QueryNativeTK", true); private static GLDynamicLookupHelper eglES1DynamicLookupHelper = null; private static GLDynamicLookupHelper eglES2DynamicLookupHelper = null; - private static boolean isANGLE = false; private static final boolean isANGLE(GLDynamicLookupHelper dl) { if(Platform.OSType.WINDOWS == Platform.OS_TYPE) { @@ -135,10 +134,10 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { EGL.resetProcAddressTable(eglES1DynamicLookupHelper); final boolean isANGLEES1 = isANGLE(eglES1DynamicLookupHelper); isANGLE |= isANGLEES1; - if (GLProfile.DEBUG) { + if (DEBUG || GLProfile.DEBUG) { System.err.println("Info: EGLDrawableFactory: EGL ES1 - OK, isANGLE: "+isANGLEES1); } - } else if (GLProfile.DEBUG) { + } else if (DEBUG || GLProfile.DEBUG) { System.err.println("Info: EGLDrawableFactory: EGL ES1 - NOPE"); } } @@ -156,17 +155,28 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { EGL.resetProcAddressTable(eglES2DynamicLookupHelper); final boolean isANGLEES2 = isANGLE(eglES2DynamicLookupHelper); isANGLE |= isANGLEES2; - if (GLProfile.DEBUG) { + if (DEBUG || GLProfile.DEBUG) { System.err.println("Info: EGLDrawableFactory: EGL ES2 - OK, isANGLE: "+isANGLEES2); } - } else if (GLProfile.DEBUG) { + } else if (DEBUG || GLProfile.DEBUG) { System.err.println("Info: EGLDrawableFactory: EGL ES2 - NOPE"); } } - if(null != eglES2DynamicLookupHelper || null != eglES1DynamicLookupHelper) { - sharedMap = new HashMap(); - sharedMapCreateAttempt = new HashSet(); - defaultDevice = EGLDisplayUtil.eglCreateEGLGraphicsDevice(EGL.EGL_DEFAULT_DISPLAY, AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT); + if( null != eglES2DynamicLookupHelper || null != eglES1DynamicLookupHelper ) { + if(isANGLE && !enableANGLE) { + if(DEBUG || GLProfile.DEBUG) { + System.err.println("Info: EGLDrawableFactory.init - EGL/ES2 ANGLE disabled"); + } + } else { + if( isANGLE && ( DEBUG || GLProfile.DEBUG ) ) { + System.err.println("Info: EGLDrawableFactory.init - EGL/ES2 ANGLE enabled"); + } + sharedMap = new HashMap(); + sharedMapCreateAttempt = new HashSet(); + + // FIXME: Following triggers eglInitialize(..) which crashed on Windows w/ Chrome/Angle, FF/Angle! + defaultDevice = EGLDisplayUtil.eglCreateEGLGraphicsDevice(EGL.EGL_DEFAULT_DISPLAY, AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT); + } } } } @@ -239,6 +249,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { private HashSet sharedMapCreateAttempt = null; private EGLGraphicsDevice defaultDevice = null; private SharedResource defaultSharedResource = null; + private boolean isANGLE = false; static class SharedResource { private final EGLGraphicsDevice device; -- cgit v1.2.3