diff options
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/impl/egl')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/impl/egl/EGLContext.java | 16 | ||||
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java | 39 |
2 files changed, 43 insertions, 12 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLContext.java index d8b5b78f2..d95a9e3ff 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLContext.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLContext.java @@ -192,22 +192,21 @@ public abstract class EGLContext extends GLContextImpl { return true; } - protected void updateGLProcAddressTable(int major, int minor, int ctp) { + protected final void updateGLXProcAddressTable(int major, int minor, int ctp) { if (DEBUG) { System.err.println(getThreadName() + ": !!! Initializing EGL extension address table"); } eglQueryStringInitialized = false; eglQueryStringAvailable = false; - int key = compose8bit(major, minor, ctp, 0); EGLExtProcAddressTable table = null; - synchronized(mappedProcAddressLock) { - table = (EGLExtProcAddressTable) mappedGLXProcAddress.get( key ); + synchronized(mappedContextTypeObjectLock) { + table = (EGLExtProcAddressTable) mappedGLXProcAddress.get( contextFQN ); } if(null != table) { eglExtProcAddressTable = table; if(DEBUG) { - System.err.println(getThreadName() + ": !!! GLContext EGL ProcAddressTable reusing key("+major+","+minor+","+ctp+") -> "+table.hashCode()); + System.err.println(getThreadName() + ": !!! GLContext EGL ProcAddressTable reusing key("+contextFQN+") -> "+table.hashCode()); } } else { if (eglExtProcAddressTable == null) { @@ -216,14 +215,13 @@ public abstract class EGLContext extends GLContextImpl { eglExtProcAddressTable = new EGLExtProcAddressTable(new GLProcAddressResolver()); } resetProcAddressTable(getEGLExtProcAddressTable()); - synchronized(mappedProcAddressLock) { - mappedGLXProcAddress.put(key, getEGLExtProcAddressTable()); + synchronized(mappedContextTypeObjectLock) { + mappedGLXProcAddress.put(contextFQN, getEGLExtProcAddressTable()); if(DEBUG) { - System.err.println(getThreadName() + ": !!! GLContext EGL ProcAddressTable mapping key("+major+","+minor+","+ctp+") -> "+getEGLExtProcAddressTable().hashCode()); + System.err.println(getThreadName() + ": !!! GLContext EGL ProcAddressTable mapping key("+contextFQN+") -> "+getEGLExtProcAddressTable().hashCode()); } } } - super.updateGLProcAddressTable(major, minor, ctp); } public synchronized String getPlatformExtensionsString() { diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java index deb659ddf..6ebd3938a 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java @@ -42,6 +42,8 @@ import com.jogamp.common.JogampRuntimeException; import com.jogamp.common.util.*; import com.jogamp.opengl.impl.*; import com.jogamp.nativewindow.impl.ProxySurface; +import java.util.HashMap; +import javax.media.nativewindow.egl.EGLGraphicsDevice; public class EGLDrawableFactory extends GLDrawableFactoryImpl { @@ -93,6 +95,39 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { public EGLDrawableFactory() { super(); + /** FIXME: + * find out the Windows semantics of a device connection {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection()} + * to actually use multiple devices. + */ + defaultDevice = new EGLGraphicsDevice(AbstractGraphicsDevice.DEFAULT_CONNECTION); + } + + static class SharedResource { + private EGLDrawable drawable; + private EGLContext context; + + SharedResource(EGLDrawable draw, EGLContext ctx) { + drawable = draw; + context = ctx; + } + } + HashMap/*<connection, SharedResource>*/ sharedMap = new HashMap(); + EGLGraphicsDevice defaultDevice; + + public final AbstractGraphicsDevice getDefaultDevice() { + return defaultDevice; + } + + public final boolean getIsDeviceCompatible(AbstractGraphicsDevice device) { + if(device instanceof EGLGraphicsDevice) { + return true; + } + return false; + } + + protected final GLContext getOrCreateSharedContextImpl(AbstractGraphicsDevice device) { + // FIXME: not implemented .. needs a dummy EGL surface + return null; } public GLDynamicLookupHelper getGLDynamicLookupHelper(int esProfile) { @@ -112,8 +147,6 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } protected void shutdownInstance() {} - protected final GLDrawableImpl getSharedDrawable() { return null; } - protected final GLContextImpl getSharedContext() { return null; } protected GLDrawableImpl createOnscreenDrawableImpl(NativeSurface target) { if (target == null) { @@ -141,7 +174,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } protected GLContext createExternalGLContextImpl() { - AbstractGraphicsScreen absScreen = DefaultGraphicsScreen.createScreenDevice(0); + AbstractGraphicsScreen absScreen = DefaultGraphicsScreen.createScreenDevice(AbstractGraphicsDevice.EXTERNAL_CONNECTION, 0); return new EGLExternalContext(absScreen); } |