diff options
author | Harvey Harrison <[email protected]> | 2013-10-17 22:27:27 -0700 |
---|---|---|
committer | Harvey Harrison <[email protected]> | 2013-10-17 22:27:27 -0700 |
commit | 5e9c02bce7b241a0bf95c8abca9a91cd25e51ed3 (patch) | |
tree | 78e913afc74a64e519d69dfb9aa886dd41ec16ed /src/jogl/classes/jogamp/opengl/egl | |
parent | 2ebf1bf35928e35ded6e38df64dee7aa578ae3c7 (diff) |
jogl: remove all trailing whitespace
Signed-off-by: Harvey Harrison <[email protected]>
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/egl')
14 files changed, 281 insertions, 281 deletions
diff --git a/src/jogl/classes/jogamp/opengl/egl/DesktopES2DynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/DesktopES2DynamicLibraryBundleInfo.java index 3d59d1d53..1179e2b7f 100644 --- a/src/jogl/classes/jogamp/opengl/egl/DesktopES2DynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/egl/DesktopES2DynamicLibraryBundleInfo.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package jogamp.opengl.egl; import java.util.*; @@ -60,12 +60,12 @@ public final class DesktopES2DynamicLibraryBundleInfo extends GLDynamicLibraryBu public final boolean useToolGetProcAdressFirst(String funcName) { return true; } - + public final List<List<String>> getToolLibNames() { final List<List<String>> libsList = new ArrayList<List<String>>(); final List<String> libsGL = new ArrayList<String>(); - - // Be aware that on DRI systems, eg ATI fglrx, etc, + + // Be aware that on DRI systems, eg ATI fglrx, etc, // you have to set LIBGL_DRIVERS_PATH env variable. // Eg on Ubuntu 64bit systems this is: // export LIBGL_DRIVERS_PATH=/usr/lib/fglrx/dri:/usr/lib32/fglrx/dri @@ -82,15 +82,15 @@ public final class DesktopES2DynamicLibraryBundleInfo extends GLDynamicLibraryBu // OSX (guess ES2 on OSX will never happen) libsGL.add("/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib"); - + // last but not least .. the generic one libsGL.add("GL"); - + libsList.add(libsGL); return libsList; - } - + } + public final List<String> getGlueLibNames() { return glueLibNames; - } + } } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java index 179cb7504..3de910369 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java @@ -115,7 +115,7 @@ public class EGLContext extends GLContextImpl { if (EGL.eglGetCurrentContext() != contextHandle) { final long dpy = drawable.getNativeSurface().getDisplayHandle(); if (!EGL.eglMakeCurrent(dpy, drawable.getHandle(), drawableRead.getHandle(), contextHandle)) { - throw new GLException("Error making context " + toHexString(contextHandle) + + throw new GLException("Error making context " + toHexString(contextHandle) + " current on Thread " + getThreadName() + " with display " + toHexString(dpy) + ", drawableWrite " + toHexString(drawable.getHandle()) + @@ -128,7 +128,7 @@ public class EGLContext extends GLContextImpl { @Override protected void releaseImpl() throws GLException { if (!EGL.eglMakeCurrent(drawable.getNativeSurface().getDisplayHandle(), EGL.EGL_NO_SURFACE, EGL.EGL_NO_SURFACE, EGL.EGL_NO_CONTEXT)) { - throw new GLException("Error freeing OpenGL context " + toHexString(contextHandle) + + throw new GLException("Error freeing OpenGL context " + toHexString(contextHandle) + ": error code " + toHexString(EGL.eglGetError())); } } @@ -138,7 +138,7 @@ public class EGLContext extends GLContextImpl { if (!EGL.eglDestroyContext(drawable.getNativeSurface().getDisplayHandle(), contextHandle)) { final int eglError = EGL.eglGetError(); if(EGL.EGL_SUCCESS != eglError) { /* oops, Mesa EGL impl. may return false, but has no EGL error */ - throw new GLException("Error destroying OpenGL context " + toHexString(contextHandle) + + throw new GLException("Error destroying OpenGL context " + toHexString(contextHandle) + ": error code " + toHexString(eglError)); } } @@ -285,11 +285,11 @@ public class EGLContext extends GLContextImpl { // // Accessible .. // - + /* pp */ void mapCurrentAvailableGLVersion(AbstractGraphicsDevice device) { mapStaticGLVersion(device, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions); } - /* pp */ int getContextOptions() { return ctxOptions; } + /* pp */ int getContextOptions() { return ctxOptions; } /* pp */ static void mapStaticGLESVersion(AbstractGraphicsDevice device, GLCapabilitiesImmutable caps) { final GLProfile glp = caps.getGLProfile(); final int[] reqMajorCTP = new int[2]; @@ -305,7 +305,7 @@ public class EGLContext extends GLContextImpl { reqMajorCTP[1] |= GLContext.CTX_IMPL_ACCEL_SOFT; } mapStaticGLVersion(device, reqMajorCTP[0], 0, reqMajorCTP[1]); - } + } /* pp */ static void mapStaticGLESVersion(AbstractGraphicsDevice device, final int major) { int ctp = GLContext.CTX_PROFILE_ES; if( major >= 3 ) { @@ -324,20 +324,20 @@ public class EGLContext extends GLContextImpl { if(! ( device instanceof EGLGraphicsDevice ) ) { final EGLGraphicsDevice eglDevice = new EGLGraphicsDevice(device.getHandle(), EGL.EGL_NO_DISPLAY, device.getConnection(), device.getUnitID(), null); GLContext.mapAvailableGLVersion(eglDevice, reqMajor, reqProfile, major, minor, ctp); - } + } } } protected static String getGLVersion(int major, int minor, int ctp, String gl_version) { return GLContext.getGLVersion(major, minor, ctp, gl_version); } - + protected static boolean getAvailableGLVersionsSet(AbstractGraphicsDevice device) { return GLContext.getAvailableGLVersionsSet(device); } protected static void setAvailableGLVersionsSet(AbstractGraphicsDevice device) { GLContext.setAvailableGLVersionsSet(device); } - + protected static String toHexString(int hex) { return GLContext.toHexString(hex); } @@ -358,7 +358,7 @@ public class EGLContext extends GLContextImpl { public final ByteBuffer glAllocateMemoryNV(int size, float readFrequency, float writeFrequency, float priority) { throw new GLException("Should not call this"); } - + @Override public final void glFreeMemoryNV(ByteBuffer pointer) { throw new GLException("Should not call this"); diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java b/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java index f2efb0479..89f34432d 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -41,8 +41,8 @@ import jogamp.opengl.Debug; import com.jogamp.common.util.LongObjectHashMap; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; -/** - * This implementation provides recursive calls to +/** + * This implementation provides recursive calls to * {@link EGL#eglInitialize(long, IntBuffer, IntBuffer)} and {@link EGL#eglTerminate(long)}, * where <code>eglInitialize(..)</code> is issued only for the 1st call per <code>eglDisplay</code> * and <code>eglTerminate(..)</code> is issued only for the last call. @@ -53,30 +53,30 @@ import com.jogamp.nativewindow.egl.EGLGraphicsDevice; */ public class EGLDisplayUtil { protected static final boolean DEBUG = Debug.debug("EGLDisplayUtil"); - + private static class DpyCounter { final long eglDisplay; final Throwable createdStack; int refCount; - + private DpyCounter(long eglDisplay) { this.eglDisplay = eglDisplay; this.refCount = 0; this.createdStack = DEBUG ? new Throwable() : null; } - + public String toString() { return "EGLDisplay[0x"+Long.toHexString(eglDisplay)+": refCnt "+refCount+"]"; } } static final LongObjectHashMap eglDisplayCounter; - + static { eglDisplayCounter = new LongObjectHashMap(); eglDisplayCounter.setKeyNotFoundValue(null); } - /** + /** * @return number of unclosed EGL Displays.<br> */ public static int shutdown(boolean verbose) { @@ -91,7 +91,7 @@ public class EGLDisplayUtil { } return eglDisplayCounter.size(); } - + public static void dumpOpenDisplayConnections() { System.err.println("EGLDisplayUtil: Open EGL Display Connections: "+eglDisplayCounter.size()); int i=0; @@ -104,7 +104,7 @@ public class EGLDisplayUtil { } } } - + public static long eglGetDisplay(long nativeDisplay_id) { final long eglDisplay = EGL.eglGetDisplay(nativeDisplay_id); if(DEBUG) { @@ -114,16 +114,16 @@ public class EGLDisplayUtil { } return eglDisplay; } - + /** * @param eglDisplay * @param major * @param minor * @return true if the eglDisplay is valid and it's reference counter becomes one and {@link EGL#eglInitialize(long, IntBuffer, IntBuffer)} was successful, otherwise false - * + * * @see EGL#eglInitialize(long, IntBuffer, IntBuffer) */ - public static synchronized boolean eglInitialize(long eglDisplay, IntBuffer major, IntBuffer minor) { + public static synchronized boolean eglInitialize(long eglDisplay, IntBuffer major, IntBuffer minor) { if( EGL.EGL_NO_DISPLAY == eglDisplay) { return false; } @@ -157,16 +157,16 @@ public class EGLDisplayUtil { } return res; } - + /** * @param nativeDisplayID * @param eglDisplay array of size 1 holding return value if successful, otherwise {@link EGL#EGL_NO_DISPLAY}. - * @param eglErr array of size 1 holding the EGL error value as retrieved by {@link EGL#eglGetError()} if not successful. + * @param eglErr array of size 1 holding the EGL error value as retrieved by {@link EGL#eglGetError()} if not successful. * @param major * @param minor - * @return {@link EGL#EGL_SUCCESS} if successful, otherwise {@link EGL#EGL_BAD_DISPLAY} if {@link #eglGetDisplay(long)} failed + * @return {@link EGL#EGL_SUCCESS} if successful, otherwise {@link EGL#EGL_BAD_DISPLAY} if {@link #eglGetDisplay(long)} failed * or {@link EGL#EGL_NOT_INITIALIZED} if {@link #eglInitialize(long, IntBuffer, IntBuffer)} failed. - * + * * @see #eglGetDisplay(long) * @see #eglInitialize(long, IntBuffer, IntBuffer) */ @@ -184,7 +184,7 @@ public class EGLDisplayUtil { eglDisplay[0] = _eglDisplay; return EGL.EGL_SUCCESS; } - + /** * @param nativeDisplayID in/out array of size 1, passing the requested nativeVisualID, may return a different revised nativeVisualID handle * @return the initialized EGL display ID @@ -209,7 +209,7 @@ public class EGLDisplayUtil { } throw new GLException("Failed to created/initialize EGL display incl. fallback default: native "+EGLContext.toHexString(nativeDisplayID[0])+", error "+EGLContext.toHexString(eglRes)+"/"+EGLContext.toHexString(eglError[0])); } - + /** * @param eglDisplay the EGL display handle * @return true if the eglDisplay is valid and it's reference counter becomes zero and {@link EGL#eglTerminate(long)} was successful, otherwise false @@ -218,7 +218,7 @@ public class EGLDisplayUtil { if( EGL.EGL_NO_DISPLAY == eglDisplay) { return false; } - final boolean res; + final boolean res; final int refCnt; final DpyCounter d; { @@ -237,7 +237,7 @@ public class EGLDisplayUtil { } else { if(0 < refCnt) { // no negative refCount d.refCount = refCnt; - } + } res = true; } if(DEBUG) { @@ -246,7 +246,7 @@ public class EGLDisplayUtil { } return res; } - + public static final EGLGraphicsDevice.EGLDisplayLifecycleCallback eglLifecycleCallback = new EGLGraphicsDevice.EGLDisplayLifecycleCallback() { public long eglGetAndInitDisplay(long[] nativeDisplayID) { return eglGetDisplayAndInitialize(nativeDisplayID); @@ -255,25 +255,25 @@ public class EGLDisplayUtil { EGLDisplayUtil.eglTerminate(eglDisplayHandle); } }; - + /** * @param nativeDisplayID * @param connection * @param unitID - * @return an initialized EGLGraphicsDevice + * @return an initialized EGLGraphicsDevice * @throws GLException if {@link EGL#eglGetDisplay(long)} or {@link EGL#eglInitialize(long, int[], int, int[], int)} fails - * @see EGLGraphicsDevice#EGLGraphicsDevice(long, long, String, int, com.jogamp.nativewindow.egl.EGLGraphicsDevice.EGLDisplayLifecycleCallback) + * @see EGLGraphicsDevice#EGLGraphicsDevice(long, long, String, int, com.jogamp.nativewindow.egl.EGLGraphicsDevice.EGLDisplayLifecycleCallback) */ public static EGLGraphicsDevice eglCreateEGLGraphicsDevice(long nativeDisplayID, String connection, int unitID) { final EGLGraphicsDevice eglDisplay = new EGLGraphicsDevice(nativeDisplayID, EGL.EGL_NO_DISPLAY, connection, unitID, eglLifecycleCallback); eglDisplay.open(); return eglDisplay; } - + /** * @param surface - * @return an initialized EGLGraphicsDevice - * @throws GLException if {@link EGL#eglGetDisplay(long)} or {@link EGL#eglInitialize(long, int[], int, int[], int)} fails incl fallback + * @return an initialized EGLGraphicsDevice + * @throws GLException if {@link EGL#eglGetDisplay(long)} or {@link EGL#eglInitialize(long, int[], int, int[], int)} fails incl fallback */ public static EGLGraphicsDevice eglCreateEGLGraphicsDevice(NativeSurface surface) { final long nativeDisplayID; diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java index 2edf26145..bf269c548 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java @@ -59,15 +59,15 @@ public abstract class EGLDrawable extends GLDrawableImpl { @Override public abstract GLContext createContext(GLContext shareWith); - protected abstract long createSurface(EGLGraphicsConfiguration config, int width, int height, long nativeSurfaceHandle); + protected abstract long createSurface(EGLGraphicsConfiguration config, int width, int height, long nativeSurfaceHandle); private final long createEGLSurface() { final EGLWrappedSurface eglws = (EGLWrappedSurface) surface; - final EGLGraphicsConfiguration eglConfig = (EGLGraphicsConfiguration) eglws.getGraphicsConfiguration(); + final EGLGraphicsConfiguration eglConfig = (EGLGraphicsConfiguration) eglws.getGraphicsConfiguration(); final NativeSurface upstreamSurface = eglws.getUpstreamSurface(); - + long eglSurface = createSurface(eglConfig, eglws.getWidth(), eglws.getHeight(), upstreamSurface.getSurfaceHandle()); - + int eglError0; if (EGL.EGL_NO_SURFACE == eglSurface) { eglError0 = EGL.eglGetError(); @@ -104,7 +104,7 @@ public abstract class EGLDrawable extends GLDrawableImpl { final EGLWrappedSurface eglws = (EGLWrappedSurface) surface; if(DEBUG) { System.err.println(getThreadName() + ": createHandle of "+eglws); - } + } if( eglws.containsUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ) ) { if( EGL.EGL_NO_SURFACE != eglws.getSurfaceHandle() ) { throw new InternalError("Set surface but claimed to be invalid: "+eglws); @@ -114,12 +114,12 @@ public abstract class EGLDrawable extends GLDrawableImpl { throw new InternalError("Nil surface but claimed to be valid: "+eglws); } } - - protected void destroyHandle() { + + protected void destroyHandle() { final EGLWrappedSurface eglws = (EGLWrappedSurface) surface; if(DEBUG) { System.err.println(getThreadName() + ": destroyHandle of "+eglws); - } + } if( EGL.EGL_NO_SURFACE == eglws.getSurfaceHandle() ) { throw new InternalError("Nil surface but claimed to be valid: "+eglws); } @@ -134,7 +134,7 @@ public abstract class EGLDrawable extends GLDrawableImpl { if( 0 == surfaceHandle ) { return false; } - final IntBuffer val = Buffers.newDirectIntBuffer(1); + final IntBuffer val = Buffers.newDirectIntBuffer(1); final boolean eglSurfaceValid = EGL.eglQuerySurface(eglDisplayHandle, surfaceHandle, EGL.EGL_CONFIG_ID, val); if( !eglSurfaceValid ) { final int eglErr = EGL.eglGetError(); @@ -144,7 +144,7 @@ public abstract class EGLDrawable extends GLDrawableImpl { } return eglSurfaceValid; } - + @Override protected final void setRealizedImpl() { if(DEBUG) { diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java index 5d99e3eba..a0d896e3a 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java @@ -83,14 +83,14 @@ import com.jogamp.opengl.GLRendererQuirks; public class EGLDrawableFactory extends GLDrawableFactoryImpl { protected static final boolean DEBUG = GLDrawableFactoryImpl.DEBUG; // allow package access - + /* package */ static final boolean QUERY_EGL_ES_NATIVE_TK; - + static { Debug.initSingleton(); QUERY_EGL_ES_NATIVE_TK = Debug.isPropertyDefined("jogl.debug.EGLDrawableFactory.QueryNativeTK", true); } - + private static GLDynamicLookupHelper eglES1DynamicLookupHelper = null; private static GLDynamicLookupHelper eglES2DynamicLookupHelper = null; @@ -109,7 +109,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { dl.isFunctionAvailable("glEnableClientState") && dl.isFunctionAvailable("glColorPointer"); } - + public EGLDrawableFactory() { super(); @@ -189,10 +189,10 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } else { if( isANGLE && ( DEBUG || GLProfile.DEBUG ) ) { System.err.println("Info: EGLDrawableFactory.init - EGL/ES2 ANGLE enabled"); - } + } sharedMap = new HashMap<String /*uniqueKey*/, SharedResource>(); sharedMapCreateAttempt = new HashSet<String>(); - + // 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); } @@ -204,8 +204,8 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { protected final boolean isComplete() { return null != sharedMap; // null != eglES2DynamicLookupHelper || null != eglES1DynamicLookupHelper; } - - + + @Override protected final void destroy() { if(null != sharedMap) { @@ -247,7 +247,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { EGLGraphicsConfigurationFactory.unregisterFactory(); EGLDisplayUtil.shutdown(DEBUG); } - + private void dumpMap() { synchronized(sharedMap) { System.err.println("EGLDrawableFactory.map "+sharedMap.size()); @@ -265,7 +265,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } private HashMap<String /*uniqueKey*/, SharedResource> sharedMap = null; - private HashSet<String> sharedMapCreateAttempt = null; + private HashSet<String> sharedMapCreateAttempt = null; private EGLGraphicsDevice defaultDevice = null; private SharedResource defaultSharedResource = null; private boolean isANGLE = false; @@ -286,9 +286,9 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { private final boolean hasPBufferES1; private final boolean hasPBufferES3ES2; - SharedResource(EGLGraphicsDevice dev, - boolean wasContextES1Created, boolean hasPBufferES1, GLRendererQuirks rendererQuirksES1, int ctpES1, - boolean wasContextES2Created, boolean wasContextES3Created, + SharedResource(EGLGraphicsDevice dev, + boolean wasContextES1Created, boolean hasPBufferES1, GLRendererQuirks rendererQuirksES1, int ctpES1, + boolean wasContextES2Created, boolean wasContextES3Created, boolean hasPBufferES3ES2, GLRendererQuirks rendererQuirksES3ES2, int ctpES3ES2) { this.device = dev; // this.contextES1 = ctxES1; @@ -296,7 +296,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { this.hasPBufferES1= hasPBufferES1; this.rendererQuirksES1 = rendererQuirksES1; this.ctpES1 = ctpES1; - + // this.contextES2 = ctxES2; // this.contextES3 = ctxES3; this.wasES2ContextCreated = wasContextES2Created; @@ -314,7 +314,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { // final EGLContext getContextES1() { return contextES1; } // final EGLContext getContextES2() { return contextES2; } // final EGLContext getContextES3() { return contextES3; } - + @Override public AbstractGraphicsScreen getScreen() { return null; @@ -329,7 +329,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override public GLRendererQuirks getRendererQuirks() { - return null != rendererQuirksES3ES2 ? rendererQuirksES3ES2 : rendererQuirksES1 ; + return null != rendererQuirksES3ES2 ? rendererQuirksES3ES2 : rendererQuirksES1 ; } } @@ -359,18 +359,18 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } return new ArrayList<GLCapabilitiesImmutable>(0); } - - private boolean mapAvailableEGLESConfig(AbstractGraphicsDevice adevice, int esProfile, + + private boolean mapAvailableEGLESConfig(AbstractGraphicsDevice adevice, int esProfile, boolean[] hasPBuffer, GLRendererQuirks[] rendererQuirks, int[] ctp) { final String profileString; switch( esProfile ) { case 3: - profileString = GLProfile.GLES3; break; + profileString = GLProfile.GLES3; break; case 2: - profileString = GLProfile.GLES2; break; - case 1: + profileString = GLProfile.GLES2; break; + case 1: profileString = GLProfile.GLES1; break; - default: + default: throw new GLException("Invalid ES profile number "+esProfile); } if ( !GLProfile.isAvailable(adevice, profileString) ) { @@ -394,23 +394,23 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { ProxySurface upstreamSurface = null; // X11, GLX, .. boolean success = false; boolean deviceFromUpstreamSurface = false; - try { + try { final GLCapabilities reqCapsAny = new GLCapabilities(glp); reqCapsAny.setRedBits(5); reqCapsAny.setGreenBits(5); reqCapsAny.setBlueBits(5); reqCapsAny.setAlphaBits(0); reqCapsAny.setDoubleBuffered(false); - + if( mapsADeviceToDefaultDevice ) { // In this branch, any non EGL device is mapped to EGL default shared resources (default behavior). - // Only one default shared resource instance is ever be created. + // Only one default shared resource instance is ever be created. final GLCapabilitiesImmutable reqCapsPBuffer = GLGraphicsConfigurationUtil.fixGLPBufferGLCapabilities(reqCapsAny); final List<GLCapabilitiesImmutable> availablePBufferCapsL = getAvailableEGLConfigs(defaultDevice, reqCapsPBuffer); hasPBuffer[0] = availablePBufferCapsL.size() > 0; - + // 1st case: adevice is not the EGL default device, map default shared resources if( adevice != defaultDevice ) { if(null == defaultSharedResource) { return false; - } + } switch(esProfile) { case 3: if( !defaultSharedResource.wasES3ContextCreated ) { @@ -419,14 +419,14 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { rendererQuirks[0] = defaultSharedResource.rendererQuirksES3ES2; ctp[0] = defaultSharedResource.ctpES3ES2; break; - case 2: + case 2: if( !defaultSharedResource.wasES2ContextCreated ) { return false; } rendererQuirks[0] = defaultSharedResource.rendererQuirksES3ES2; ctp[0] = defaultSharedResource.ctpES3ES2; break; - case 1: + case 1: if( !defaultSharedResource.wasES1ContextCreated ) { return false; } @@ -437,11 +437,11 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { EGLContext.mapStaticGLVersion(adevice, esProfile, 0, ctp[0]); return true; } - + // attempt to created the default shared resources .. - + eglDevice = defaultDevice; // reuse - + if( hasPBuffer[0] ) { // 2nd case create defaultDevice shared resource using pbuffer surface surface = createDummySurfaceImpl(eglDevice, false, reqCapsPBuffer, reqCapsPBuffer, null, 64, 64); // egl pbuffer offscreen @@ -459,15 +459,15 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { if(DEBUG) { System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig() no pbuffer config available, detected !pbuffer config: "+success); EGLGraphicsConfigurationFactory.printCaps("!PBufferCaps", capsAnyL, System.err); - } - } + } + } } else { - // 4th case always creates a true mapping of given device to EGL + // 4th case always creates a true mapping of given device to EGL surface = desktopFactory.createDummySurface(adevice, reqCapsAny, null, 64, 64); // X11, WGL, .. dummy window upstreamSurface = ( surface instanceof ProxySurface ) ? (ProxySurface)surface : null ; if(null != upstreamSurface) { upstreamSurface.createNotify(); - } + } eglDevice = EGLDisplayUtil.eglCreateEGLGraphicsDevice(surface); deviceFromUpstreamSurface = true; hasPBuffer[0] = true; @@ -482,7 +482,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { context.makeCurrent(); // could cause exception if(context.isCurrent()) { final String glVersion = context.getGL().glGetString(GL.GL_VERSION); - if(null != glVersion) { + if(null != glVersion) { context.mapCurrentAvailableGLVersion(eglDevice); if(eglDevice != adevice) { context.mapCurrentAvailableGLVersion(adevice); @@ -493,7 +493,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } else { // Oops .. something is wrong if(DEBUG) { - System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig: "+eglDevice+", "+context.getGLVersion()+" - VERSION is null, dropping availability!"); + System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig: "+eglDevice+", "+context.getGLVersion()+" - VERSION is null, dropping availability!"); } } } @@ -510,7 +510,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } } catch (Throwable t) { if(DEBUG) { - System.err.println("Catched Exception on thread "+getThreadName()); + System.err.println("Catched Exception on thread "+getThreadName()); t.printStackTrace(); } success = false; @@ -518,7 +518,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { if(eglDevice == defaultDevice) { if(null != upstreamSurface) { upstreamSurface.destroyNotify(); - } + } } else if( deviceFromUpstreamSurface ) { if(null != eglDevice) { eglDevice.close(); @@ -529,7 +529,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } else { if(null != upstreamSurface) { upstreamSurface.destroyNotify(); - } + } if(null != eglDevice) { eglDevice.close(); } @@ -553,9 +553,9 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } return false; } - } + } } - + @Override protected final SharedResource getOrCreateSharedResourceImpl(AbstractGraphicsDevice adevice) { if(null == sharedMap) { // null == eglES1DynamicLookupHelper && null == eglES2DynamicLookupHelper @@ -571,27 +571,27 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { dumpMap(); throw new InternalError("defaultSharedResource already exist: "+defaultSharedResource); } - defaultSharedResource = createEGLSharedResourceImpl(defaultDevice); + defaultSharedResource = createEGLSharedResourceImpl(defaultDevice); } - + final String key = adevice.getUniqueID(); if( defaultDevice.getUniqueID().equals(key) ) { return defaultSharedResource; } else { - if( null == defaultSharedResource) { // defaultDevice must be initialized before host-device + if( null == defaultSharedResource) { // defaultDevice must be initialized before host-device dumpMap(); - throw new InternalError("defaultSharedResource does not exist"); + throw new InternalError("defaultSharedResource does not exist"); } final SharedResource[] existing = new SharedResource[] { null }; if ( !needsToCreateSharedResource(key, existing) ) { return existing[0]; - } + } return createEGLSharedResourceImpl(adevice); } } - + private SharedResource createEGLSharedResourceImpl(AbstractGraphicsDevice adevice) { - final boolean madeCurrentES1; + final boolean madeCurrentES1; final boolean madeCurrentES2; final boolean madeCurrentES3; boolean[] hasPBufferES1 = new boolean[] { false }; @@ -602,12 +602,12 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { GLRendererQuirks[] rendererQuirksES3ES2 = new GLRendererQuirks[] { null }; int[] ctpES1 = new int[] { -1 }; int[] ctpES3ES2 = new int[] { -1 }; - - + + if (DEBUG) { System.err.println("EGLDrawableFactory.createShared(): device "+adevice); } - + if( null != eglES1DynamicLookupHelper ) { madeCurrentES1 = mapAvailableEGLESConfig(adevice, 1, hasPBufferES1, rendererQuirksES1, ctpES1); } else { @@ -625,10 +625,10 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { madeCurrentES2 = false; madeCurrentES3 = false; } - + if( !EGLContext.getAvailableGLVersionsSet(adevice) ) { // Even though we override the non EGL native mapping intentionally, - // avoid exception due to double 'set' - carefull exception of the rule. + // avoid exception due to double 'set' - carefull exception of the rule. EGLContext.setAvailableGLVersionsSet(adevice); } if( hasX11 ) { @@ -637,7 +637,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } final SharedResource sr = new SharedResource(defaultDevice, madeCurrentES1, hasPBufferES1[0], rendererQuirksES1[0], ctpES1[0], madeCurrentES2, madeCurrentES3, hasPBufferES3ES2[0], rendererQuirksES3ES2[0], ctpES3ES2[0]); - + synchronized(sharedMap) { sharedMap.put(adevice.getUniqueID(), sr); } @@ -650,7 +650,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } return sr; } - + private void handleDontCloseX11DisplayQuirk(GLRendererQuirks quirks) { if( null != quirks && quirks.exist( GLRendererQuirks.DontCloseX11Display ) ) { jogamp.nativewindow.x11.X11Util.markAllDisplaysUnclosable(); @@ -692,7 +692,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } return new EGLOnscreenDrawable(this, EGLWrappedSurface.get(target)); } - + @Override protected GLDrawableImpl createOffscreenDrawableImpl(NativeSurface target) { if (target == null) { @@ -715,8 +715,8 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, - GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, + protected ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, + GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstreamHook) { final boolean ownDevice; final EGLGraphicsDevice device; @@ -732,21 +732,21 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { final DefaultGraphicsScreen screen = new DefaultGraphicsScreen(device, 0); final EGLGraphicsConfiguration config = EGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsChosen, capsRequested, chooser, screen, VisualIDHolder.VID_UNDEFINED, false); if(null == config) { - throw new GLException("Choosing GraphicsConfiguration failed w/ "+capsChosen+" on "+screen); - } + throw new GLException("Choosing GraphicsConfiguration failed w/ "+capsChosen+" on "+screen); + } return new WrappedSurface(config, 0, upstreamHook, ownDevice); } - + @Override - public final ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, + public final ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, GLCapabilitiesImmutable chosenCaps, GLCapabilitiesImmutable requestedCaps, GLCapabilitiesChooser chooser, int width, int height) { - chosenCaps = GLGraphicsConfigurationUtil.fixOffscreenBitOnly(chosenCaps); // complete validation in EGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(..) above + chosenCaps = GLGraphicsConfigurationUtil.fixOffscreenBitOnly(chosenCaps); // complete validation in EGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(..) above return createMutableSurfaceImpl(deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser, new EGLDummyUpstreamSurfaceHook(width, height)); } - + /** - * @param ms {@link MutableSurface} which dimensions and config are being used to create the pbuffer surface. - * It will also hold the resulting pbuffer surface handle. + * @param ms {@link MutableSurface} which dimensions and config are being used to create the pbuffer surface. + * It will also hold the resulting pbuffer surface handle. * @param useTexture * @return the passed {@link MutableSurface} which now has the EGL pbuffer surface set as it's handle */ diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java b/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java index 162e7166a..eb6578ec5 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java @@ -9,17 +9,17 @@ import com.jogamp.nativewindow.egl.EGLGraphicsDevice; public class EGLDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize { /** - * @param width the initial width as returned by {@link NativeSurface#getWidth()} via {@link UpstreamSurfaceHook#getWidth(ProxySurface)}, - * not the actual dummy surface width. + * @param width the initial width as returned by {@link NativeSurface#getWidth()} via {@link UpstreamSurfaceHook#getWidth(ProxySurface)}, + * not the actual dummy surface width. * The latter is platform specific and small - * @param height the initial height as returned by {@link NativeSurface#getHeight()} via {@link UpstreamSurfaceHook#getHeight(ProxySurface)}, + * @param height the initial height as returned by {@link NativeSurface#getHeight()} via {@link UpstreamSurfaceHook#getHeight(ProxySurface)}, * not the actual dummy surface height, * The latter is platform specific and small */ public EGLDummyUpstreamSurfaceHook(int width, int height) { super(width, height); } - + @Override public final void create(ProxySurface s) { final EGLGraphicsDevice eglDevice = (EGLGraphicsDevice) s.getGraphicsConfiguration().getScreen().getDevice(); @@ -31,14 +31,14 @@ public class EGLDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize } if( EGL.EGL_NO_SURFACE == s.getSurfaceHandle() ) { s.setSurfaceHandle( EGLDrawableFactory.createPBufferSurfaceImpl((EGLGraphicsConfiguration)s.getGraphicsConfiguration(), 64, 64, false) ); - s.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ); + s.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ); } s.addUpstreamOptionBits(ProxySurface.OPT_UPSTREAM_WINDOW_INVISIBLE); } finally { eglDevice.unlock(); } } - + @Override public final void destroy(ProxySurface s) { if( s.containsUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ) ) { diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java index 778f0cb38..ac880ebc0 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package jogamp.opengl.egl; import com.jogamp.common.os.AndroidVersion; @@ -52,7 +52,7 @@ public abstract class EGLDynamicLibraryBundleInfo extends GLDynamicLibraryBundle super(); } - /** + /** * Returns <code>true</code> on <code>Android</code>, * and <code>false</code> otherwise. */ @@ -65,7 +65,7 @@ public abstract class EGLDynamicLibraryBundleInfo extends GLDynamicLibraryBundle // default behavior for other platforms return false; } - + @Override public final List<String> getToolGetProcAddressFuncNameList() { List<String> res = new ArrayList<String>(); @@ -87,26 +87,26 @@ public abstract class EGLDynamicLibraryBundleInfo extends GLDynamicLibraryBundle return true; } } - + protected final List<String> getEGLLibNamesList() { List<String> eglLibNames = new ArrayList<String>(); - - // this is the default EGL lib name, according to the spec + + // this is the default EGL lib name, according to the spec eglLibNames.add("libEGL.so.1"); - + // try these as well, if spec fails eglLibNames.add("libEGL.so"); eglLibNames.add("EGL"); - - // for windows distributions using the 'unlike' lib prefix, + + // for windows distributions using the 'unlike' lib prefix, // where our tool does not add it. eglLibNames.add("libEGL"); - + return eglLibNames; } @Override public final List<String> getGlueLibNames() { return glueLibNames; - } + } } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLES1DynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/EGLES1DynamicLibraryBundleInfo.java index dd3d6faea..9ffcea864 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLES1DynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLES1DynamicLibraryBundleInfo.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package jogamp.opengl.egl; import java.util.*; @@ -39,29 +39,29 @@ public final class EGLES1DynamicLibraryBundleInfo extends EGLDynamicLibraryBundl final List<List<String>> libsList = new ArrayList<List<String>>(); { final List<String> libsGL = new ArrayList<String>(); - - // this is the default lib name, according to the spec + + // this is the default lib name, according to the spec libsGL.add("libGLESv1_CM.so.2"); - + // try these as well, if spec fails libsGL.add("libGLESv1_CM.so"); - libsGL.add("GLESv1_CM"); + libsGL.add("GLESv1_CM"); // alternative names libsGL.add("GLES_CM"); libsGL.add("GLES_CL"); - - // for windows distributions using the 'unlike' lib prefix, + + // for windows distributions using the 'unlike' lib prefix, // where our tool does not add it. libsGL.add("libGLESv1_CM"); libsGL.add("libGLES_CM"); libsGL.add("libGLES_CL"); - + libsList.add(libsGL); } libsList.add(getEGLLibNamesList()); - + return libsList; - } + } } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java index 0d20fd4e8..de1f0a42e 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,17 +20,17 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package jogamp.opengl.egl; import java.util.*; -/** +/** * <p> * Covering ES3 and ES2. * </p> @@ -44,12 +44,12 @@ public final class EGLES2DynamicLibraryBundleInfo extends EGLDynamicLibraryBundl final List<List<String>> libsList = new ArrayList<List<String>>(); { final List<String> libsGL = new ArrayList<String>(); - - // ES3: This is the default lib name, according to the spec + + // ES3: This is the default lib name, according to the spec libsGL.add("libGLESv3.so.3"); - + // ES3: Try these as well, if spec fails - libsGL.add("libGLESv3.so"); + libsGL.add("libGLESv3.so"); libsGL.add("GLESv3"); // ES3: Alternative names @@ -59,12 +59,12 @@ public final class EGLES2DynamicLibraryBundleInfo extends EGLDynamicLibraryBundl // where our tool does not add it. libsGL.add("libGLESv3"); libsGL.add("libGLES30"); - - // ES2: This is the default lib name, according to the spec + + // ES2: This is the default lib name, according to the spec libsGL.add("libGLESv2.so.2"); - + // ES2: Try these as well, if spec fails - libsGL.add("libGLESv2.so"); + libsGL.add("libGLESv2.so"); libsGL.add("GLESv2"); // ES2: Alternative names @@ -75,14 +75,14 @@ public final class EGLES2DynamicLibraryBundleInfo extends EGLDynamicLibraryBundl // where our tool does not add it. libsGL.add("libGLESv2"); libsGL.add("libGLESv2_CM"); - libsGL.add("libGLES20"); - + libsGL.add("libGLES20"); + libsList.add(libsGL); } libsList.add(getEGLLibNamesList()); - + return libsList; - } - + } + } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java index b1ffe608e..f3592c150 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. * Copyright (c) 2010 JogAmp Community. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -29,7 +29,7 @@ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * + * * Sun gratefully acknowledges that this software was originally authored * and developed by Kenneth Bradley Russell and Christopher John Kline. */ @@ -57,7 +57,7 @@ import com.jogamp.nativewindow.MutableGraphicsConfiguration; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration implements Cloneable { - + public final long getNativeConfig() { return ((EGLGLCapabilities)capabilitiesChosen).getEGLConfig(); } @@ -66,7 +66,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple return ((EGLGLCapabilities)capabilitiesChosen).getEGLConfigID(); } - EGLGraphicsConfiguration(AbstractGraphicsScreen absScreen, + EGLGraphicsConfiguration(AbstractGraphicsScreen absScreen, EGLGLCapabilities capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser) { super(absScreen, capsChosen, capsRequested); this.chooser = chooser; @@ -77,7 +77,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple * @param absScreen * @param eglConfigID {@link EGL#EGL_CONFIG_ID} for which the config is being created for. * @return - * @throws GLException if invalid EGL display. + * @throws GLException if invalid EGL display. */ public static EGLGraphicsConfiguration create(GLCapabilitiesImmutable capsRequested, AbstractGraphicsScreen absScreen, int eglConfigID) { final AbstractGraphicsDevice absDevice = absScreen.getDevice(); @@ -101,9 +101,9 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple public Object clone() { return super.clone(); } - + void updateGraphicsConfiguration() { - CapabilitiesImmutable capsChosen = getChosenCapabilities(); + CapabilitiesImmutable capsChosen = getChosenCapabilities(); EGLGraphicsConfiguration newConfig = (EGLGraphicsConfiguration) GraphicsConfigurationFactory.getFactory(getScreen().getDevice(), capsChosen).chooseGraphicsConfiguration( capsChosen, getRequestedCapabilities(), chooser, getScreen(), VisualIDHolder.VID_UNDEFINED); @@ -140,7 +140,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple return false; } final IntBuffer val = Buffers.newDirectIntBuffer(1); - + // get the configID if(!EGL.eglGetConfigAttrib(display, config, EGL.EGL_CONFIG_ID, val)) { final int eglErr = EGL.eglGetError(); @@ -169,7 +169,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple } if ( 0 != ( _stype & EGL.EGL_PBUFFER_BIT ) ) { val |= GLGraphicsConfigurationUtil.PBUFFER_BIT | - GLGraphicsConfigurationUtil.FBO_BIT; + GLGraphicsConfigurationUtil.FBO_BIT; } return val; } @@ -189,7 +189,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple final int cfgID; final int rType; final int visualID; - + // get the configID if(!EGL.eglGetConfigAttrib(display, config, EGL.EGL_CONFIG_ID, val)) { if(DEBUG) { @@ -199,7 +199,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple return null; } cfgID = val.get(0); - + if(!EGL.eglGetConfigAttrib(display, config, EGL.EGL_RENDERABLE_TYPE, val)) { if(DEBUG) { System.err.println("EGL couldn't retrieve EGL_RENDERABLE_TYPE for config "+toHexString(config)+", error "+toHexString(EGL.eglGetError())); @@ -213,8 +213,8 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple } else { visualID = VisualIDHolder.VID_UNDEFINED; } - - EGLGLCapabilities caps = null; + + EGLGLCapabilities caps = null; try { if(null == glp) { glp = EGLGLCapabilities.getCompatible(device, rType); @@ -232,8 +232,8 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple System.err.println("config "+toHexString(config)+": "+gle); } return null; - } - + } + if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_CONFIG_CAVEAT, val)) { if( EGL.EGL_SLOW_CONFIG == val.get(0) ) { caps.setHardwareAccelerated(false); @@ -244,11 +244,11 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple caps.setNumSamples(val.get(0)); } if(!caps.getSampleBuffers()) { - // try NV_coverage_sample extension + // try NV_coverage_sample extension if(EGL.eglGetConfigAttrib(display, config, EGLExt.EGL_COVERAGE_BUFFERS_NV, val)) { if(val.get(0)>0 && EGL.eglGetConfigAttrib(display, config, EGLExt.EGL_COVERAGE_SAMPLES_NV, val)) { - caps.setSampleExtension(GLGraphicsConfigurationUtil.NV_coverage_sample); + caps.setSampleExtension(GLGraphicsConfigurationUtil.NV_coverage_sample); caps.setSampleBuffers(true); caps.setNumSamples(val.get(0)); } @@ -269,7 +269,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_TRANSPARENT_BLUE_VALUE, val)) { caps.setTransparentBlueValue(val.get(0)==EGL.EGL_DONT_CARE?-1:val.get(0)); } - /** Not defined in EGL + /** Not defined in EGL if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_TRANSPARENT_ALPHA_VALUE, val)) { caps.setTransparentAlphaValue(val.get(0)==EGL.EGL_DONT_CARE?-1:val.get(0)); } */ @@ -294,16 +294,16 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple caps.setDepthBits(val.get(0)); } - // Since the passed GLProfile may be null, + // Since the passed GLProfile may be null, // we use EGL_RENDERABLE_TYPE derived profile as created in the EGLGLCapabilities constructor. - final int availableTypeBits = EGLConfigDrawableTypeBits(device, config); + final int availableTypeBits = EGLConfigDrawableTypeBits(device, config); final int drawableTypeBits = winattrmask & availableTypeBits; if( 0 == drawableTypeBits ) { return null; } - - return (EGLGLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, caps); + + return (EGLGLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, caps); } public static IntBuffer GLCapabilities2AttribList(GLCapabilitiesImmutable caps) { @@ -313,7 +313,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple attrs.put(idx++, EGL.EGL_SURFACE_TYPE); final int surfaceType; if( caps.isOnscreen() ) { - surfaceType = EGL.EGL_WINDOW_BIT; + surfaceType = EGL.EGL_WINDOW_BIT; } else if( caps.isFBO() ) { surfaceType = EGL.EGL_PBUFFER_BIT; // native replacement! } else if( caps.isPBuffer() ) { @@ -338,7 +338,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple attrs.put(idx++, EGL.EGL_ALPHA_SIZE); attrs.put(idx++, caps.getAlphaBits()); } - + if(caps.getStencilBits()>0) { attrs.put(idx++, EGL.EGL_STENCIL_SIZE); attrs.put(idx++, caps.getStencilBits()); @@ -382,7 +382,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple attrs.put(idx++, caps.getTransparentAlphaValue()>=0?caps.getTransparentAlphaValue():EGL.EGL_DONT_CARE; */ } - // 28 + // 28 attrs.put(idx++, EGL.EGL_RENDERABLE_TYPE); if(caps.getGLProfile().usesNativeGLES1()) { attrs.put(idx++, EGL.EGL_OPENGL_ES_BIT); diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java index b44e08500..5764a6178 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. * Copyright (c) 2010 JogAmp Community. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -75,10 +75,10 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact static GraphicsConfigurationFactory nativeGraphicsConfigurationFactory = null; static GraphicsConfigurationFactory kdeglGraphicsConfigurationFactory = null; static GraphicsConfigurationFactory fallbackGraphicsConfigurationFactory = null; - + static void registerFactory() { GraphicsConfigurationFactory eglFactory = new EGLGraphicsConfigurationFactory(); - + // become the pre-selector for X11/.. to match the native visual id w/ EGL, if native ES is selected final String nwType = NativeWindowFactory.getNativeWindowType(false); if(NativeWindowFactory.TYPE_X11 == nwType) { @@ -86,32 +86,32 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact if(null != nativeGraphicsConfigurationFactory) { fallbackGraphicsConfigurationFactory = nativeGraphicsConfigurationFactory; } else { - fallbackGraphicsConfigurationFactory = GraphicsConfigurationFactory.getFactory(com.jogamp.nativewindow.x11.X11GraphicsDevice.class, CapabilitiesImmutable.class); + fallbackGraphicsConfigurationFactory = GraphicsConfigurationFactory.getFactory(com.jogamp.nativewindow.x11.X11GraphicsDevice.class, CapabilitiesImmutable.class); } } /* else if(NativeWindowFactory.TYPE_WINDOWS == NativeWindowFactory.getNativeWindowType(false)) { nativeGraphicsConfigurationFactory = GraphicsConfigurationFactory.registerFactory(javax.media.nativewindow.windows.WindowsGraphicsDevice.class, eglFactory); - } else if(NativeWindowFactory.TYPE_MACOSX == NativeWindowFactory.getNativeWindowType(false)) { + } else if(NativeWindowFactory.TYPE_MACOSX == NativeWindowFactory.getNativeWindowType(false)) { } */ - + // become the selector for KD/EGL .. - kdeglGraphicsConfigurationFactory = GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.egl.EGLGraphicsDevice.class, GLCapabilitiesImmutable.class, eglFactory); + kdeglGraphicsConfigurationFactory = GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.egl.EGLGraphicsDevice.class, GLCapabilitiesImmutable.class, eglFactory); } - + static void unregisterFactory() { final String nwType = NativeWindowFactory.getNativeWindowType(false); if(NativeWindowFactory.TYPE_X11 == nwType) { - GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.x11.X11GraphicsDevice.class, GLCapabilitiesImmutable.class, nativeGraphicsConfigurationFactory); + GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.x11.X11GraphicsDevice.class, GLCapabilitiesImmutable.class, nativeGraphicsConfigurationFactory); } /* else if(NativeWindowFactory.TYPE_WINDOWS == NativeWindowFactory.getNativeWindowType(false)) { GraphicsConfigurationFactory.registerFactory(javax.media.nativewindow.windows.WindowsGraphicsDevice.class, nativeGraphicsConfigurationFactory); - } else if(NativeWindowFactory.TYPE_MACOSX == NativeWindowFactory.getNativeWindowType(false)) { + } else if(NativeWindowFactory.TYPE_MACOSX == NativeWindowFactory.getNativeWindowType(false)) { } */ nativeGraphicsConfigurationFactory = null; fallbackGraphicsConfigurationFactory = null; - + GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.egl.EGLGraphicsDevice.class, GLCapabilitiesImmutable.class, kdeglGraphicsConfigurationFactory); kdeglGraphicsConfigurationFactory = null; } - + private EGLGraphicsConfigurationFactory() { } @@ -139,21 +139,21 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact AbstractGraphicsDevice absDevice = absScreen.getDevice(); if(null==absDevice) { throw new GLException("Null AbstractGraphicsDevice"); - } - + } + AbstractGraphicsConfiguration cfg = null; - + if( absDevice instanceof EGLGraphicsDevice ) { cfg = chooseGraphicsConfigurationStatic((GLCapabilitiesImmutable) capsChosen, (GLCapabilitiesImmutable) capsRequested, (GLCapabilitiesChooser) chooser, - absScreen, nativeVisualID, false); + absScreen, nativeVisualID, false); } else { - // handle non native cases (X11, ..) + // handle non native cases (X11, ..) if(null == fallbackGraphicsConfigurationFactory) { throw new InternalError("Native fallback GraphicsConfigurationFactory is null, but call issued for device: "+absDevice+" of type "+absDevice.getClass().getSimpleName()); } - + if(glCapsChosen.getGLProfile().usesNativeGLES()) { if(DEBUG) { System.err.println("EGLGraphicsConfigurationFactory.choose..: Handle native device "+absDevice.getClass().getSimpleName()); @@ -175,7 +175,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact System.err.println("EGLGraphicsConfigurationFactory.choose..: Delegate to "+fallbackGraphicsConfigurationFactory.getClass().getSimpleName()); } cfg = fallbackGraphicsConfigurationFactory.chooseGraphicsConfiguration(capsChosen, capsRequested, chooser, absScreen, nativeVisualID); - } + } } return cfg; } @@ -219,7 +219,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact public static EGLGraphicsConfiguration chooseGraphicsConfigurationStatic(GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsReq, GLCapabilitiesChooser chooser, - AbstractGraphicsScreen absScreen, int nativeVisualID, + AbstractGraphicsScreen absScreen, int nativeVisualID, boolean forceTransparentFlag) { if (capsChosen == null) { capsChosen = new GLCapabilities(null); @@ -232,7 +232,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact if(null==absDevice) { throw new GLException("Null AbstractGraphicsDevice"); } - + final EGLGraphicsDevice eglDevice; final boolean ownEGLDisplay; if( absDevice instanceof EGLGraphicsDevice ) { @@ -253,7 +253,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact if(DEBUG) { System.err.println("eglChooseConfig failed with given capabilities "+capsChosen); } - + // Last try .. add a fixed embedded profile [ATI, Nokia, Intel, ..] // // rgb888 - d16, s4 @@ -268,7 +268,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact fixedCaps.setOnscreen(false); fixedCaps.setPBuffer(capsChosen.isPBuffer()); fixedCaps.setFBO(capsChosen.isFBO()); - } + } if(DEBUG) { System.err.println("trying fixed caps (1): "+fixedCaps); } @@ -286,7 +286,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact fixedCaps.setOnscreen(false); fixedCaps.setPBuffer(capsChosen.isPBuffer()); fixedCaps.setFBO(capsChosen.isFBO()); - } + } if(DEBUG) { System.err.println("trying fixed caps (2): "+fixedCaps); } @@ -306,7 +306,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact fixedCaps.setOnscreen(false); fixedCaps.setPBuffer(capsChosen.isPBuffer()); fixedCaps.setFBO(capsChosen.isFBO()); - } + } if(DEBUG) { System.err.println("trying fixed caps (3): "+fixedCaps); } @@ -322,8 +322,8 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact return res; } - - static EGLGraphicsConfiguration eglChooseConfig(EGLGraphicsDevice device, + + static EGLGraphicsConfiguration eglChooseConfig(EGLGraphicsDevice device, GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, @@ -354,7 +354,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact final IntBuffer attrs = EGLGraphicsConfiguration.GLCapabilities2AttribList(capsChosen); PointerBuffer configs = PointerBuffer.allocateDirect(numConfigs.get(0)); - // 1st choice: get GLCapabilities based on users GLCapabilities + // 1st choice: get GLCapabilities based on users GLCapabilities // setting recommendedIndex as preferred choice // skipped if nativeVisualID is given if( VisualIDHolder.VID_UNDEFINED != nativeVisualID || !EGL.eglChooseConfig(eglDisplay, attrs, configs, configs.capacity(), numConfigs) ) { @@ -387,7 +387,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact throw new GLException("EGLGraphicsConfiguration.eglChooseConfig: #2 Get all configs (eglGetConfigs) call failed, error "+toHexString(EGL.eglGetError())); } if (numConfigs.get(0) > 0) { - availableCaps = eglConfigs2GLCaps(device, glp, configs, numConfigs.get(0), winattrmask, forceTransparentFlag); + availableCaps = eglConfigs2GLCaps(device, glp, configs, numConfigs.get(0), winattrmask, forceTransparentFlag); } } @@ -400,7 +400,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact } return null; } - + if(DEBUG) { System.err.println("EGLGraphicsConfiguration.eglChooseConfig: got configs: "+availableCaps.size()); for(int i=0; i<availableCaps.size(); i++) { diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java index 19084ba19..065f80dcb 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java @@ -54,8 +54,8 @@ public class EGLOnscreenDrawable extends EGLDrawable { } @Override - protected long createSurface(EGLGraphicsConfiguration config, int width, int height, long nativeSurfaceHandle) { + protected long createSurface(EGLGraphicsConfiguration config, int width, int height, long nativeSurfaceHandle) { return EGL.eglCreateWindowSurface(config.getScreen().getDevice().getHandle(), config.getNativeConfig(), nativeSurfaceHandle, null); - } + } } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java b/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java index 8dea10df1..5083c854f 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java @@ -23,8 +23,8 @@ import com.jogamp.nativewindow.egl.EGLGraphicsDevice; public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { protected static final boolean DEBUG = EGLDrawableFactory.DEBUG; private final NativeSurface upstreamSurface; - private final UpstreamSurfaceHook.MutableSize upstreamSurfaceHookMutableSize; - + private final UpstreamSurfaceHook.MutableSize upstreamSurfaceHookMutableSize; + public EGLUpstreamSurfaceHook(NativeSurface upstream) { upstreamSurface = upstream; if(upstreamSurface instanceof ProxySurface) { @@ -39,32 +39,32 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { upstreamSurfaceHookMutableSize = null; } } - + public final NativeSurface getUpstreamSurface() { return upstreamSurface; } - + static String getThreadName() { return Thread.currentThread().getName(); } - + public final void setSize(int width, int height) { if(null != upstreamSurfaceHookMutableSize) { upstreamSurfaceHookMutableSize.setSize(width, height); - } + } } - + @Override public final void create(ProxySurface surface) { final String dbgPrefix; if(DEBUG) { dbgPrefix = getThreadName() + ": EGLUpstreamSurfaceHook.create( up "+upstreamSurface.getClass().getSimpleName()+" -> this "+surface.getClass().getSimpleName()+" ): "; - System.err.println(dbgPrefix+this); + System.err.println(dbgPrefix+this); } else { dbgPrefix = null; } - + if(upstreamSurface instanceof ProxySurface) { - // propagate createNotify(..) so upstreamSurface will be created + // propagate createNotify(..) so upstreamSurface will be created ((ProxySurface)upstreamSurface).createNotify(); } - + // lock upstreamSurface, so it can be used in case EGLDisplay is derived from it! if(NativeSurface.LOCK_SURFACE_NOT_READY >= upstreamSurface.lockSurface()) { throw new GLException("Could not lock: "+upstreamSurface); @@ -73,16 +73,16 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { evalUpstreamSurface(dbgPrefix, surface); } finally { upstreamSurface.unlockSurface(); - } + } } - + private final void evalUpstreamSurface(String dbgPrefix, ProxySurface surface) { // // evaluate nature of upstreamSurface, may create EGL instances if required // - + boolean isEGLSurfaceValid = true; // assume yes - + final EGLGraphicsDevice eglDevice; final AbstractGraphicsConfiguration aConfig; { @@ -92,14 +92,14 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { System.err.println(dbgPrefix+"SurfaceDevice: "+surfaceDevice.getClass().getSimpleName()+", hash 0x"+Integer.toHexString(surfaceDevice.hashCode())+", "+surfaceDevice); System.err.println(dbgPrefix+"SurfaceConfig: "+surfaceConfig.getClass().getSimpleName()+", hash 0x"+Integer.toHexString(surfaceConfig.hashCode())+", "+surfaceConfig); } - - final AbstractGraphicsConfiguration upstreamConfig = upstreamSurface.getGraphicsConfiguration(); + + final AbstractGraphicsConfiguration upstreamConfig = upstreamSurface.getGraphicsConfiguration(); final AbstractGraphicsDevice upstreamDevice = upstreamConfig.getScreen().getDevice(); if(DEBUG) { System.err.println(dbgPrefix+"UpstreamDevice: "+upstreamDevice.getClass().getSimpleName()+", hash 0x"+Integer.toHexString(upstreamDevice.hashCode())+", "+upstreamDevice); System.err.println(dbgPrefix+"UpstreamConfig: "+upstreamConfig.getClass().getSimpleName()+", hash 0x"+Integer.toHexString(upstreamConfig.hashCode())+", "+upstreamConfig); } - + if( surfaceDevice instanceof EGLGraphicsDevice ) { eglDevice = (EGLGraphicsDevice) surfaceDevice; aConfig = surfaceConfig; @@ -129,13 +129,13 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { surface.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_DEVICE ); } } - + final GLCapabilitiesImmutable capsRequested = (GLCapabilitiesImmutable) aConfig.getRequestedCapabilities(); final EGLGraphicsConfiguration eglConfig; if( aConfig instanceof EGLGraphicsConfiguration ) { // Config is already in EGL type - reuse .. final EGLGLCapabilities capsChosen = (EGLGLCapabilities) aConfig.getChosenCapabilities(); - if( !isEGLSurfaceValid || !EGLGraphicsConfiguration.isEGLConfigValid(eglDevice.getHandle(), capsChosen.getEGLConfig()) ) { + if( !isEGLSurfaceValid || !EGLGraphicsConfiguration.isEGLConfigValid(eglDevice.getHandle(), capsChosen.getEGLConfig()) ) { // 'refresh' the native EGLConfig handle capsChosen.setEGLConfig(EGLGraphicsConfiguration.EGLConfigId2EGLConfig(eglDevice.getHandle(), capsChosen.getEGLConfigID())); if( 0 == capsChosen.getEGLConfig() ) { @@ -166,7 +166,7 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { isEGLSurfaceValid = false; } surface.setGraphicsConfiguration(eglConfig); - + if(isEGLSurfaceValid) { isEGLSurfaceValid = EGLDrawable.isValidEGLSurface(eglDevice.getHandle(), upstreamSurface.getSurfaceHandle()); } @@ -182,15 +182,15 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { if(DEBUG) { System.err.println(dbgPrefix+"Fin: EGL surface n/a - TBD: "+upstreamSurface); } - } + } } @Override public final void destroy(ProxySurface surface) { if(EGLDrawableFactory.DEBUG) { - System.err.println("EGLUpstreamSurfaceHook.destroy("+surface.getClass().getSimpleName()+"): "+this); + System.err.println("EGLUpstreamSurfaceHook.destroy("+surface.getClass().getSimpleName()+"): "+this); } - surface.clearUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ); + surface.clearUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ); if(upstreamSurface instanceof ProxySurface) { ((ProxySurface)upstreamSurface).destroyNotify(); } @@ -205,7 +205,7 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { public final int getHeight(ProxySurface s) { return upstreamSurface.getHeight(); } - + @Override public String toString() { final String us_s = null != upstreamSurface ? ( upstreamSurface.getClass().getName() + ": 0x" + Long.toHexString(upstreamSurface.getSurfaceHandle()) ) : "nil"; diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLWrappedSurface.java b/src/jogl/classes/jogamp/opengl/egl/EGLWrappedSurface.java index f816151c7..e6d43d957 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLWrappedSurface.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLWrappedSurface.java @@ -19,16 +19,16 @@ public class EGLWrappedSurface extends WrappedSurface { } return new EGLWrappedSurface(surface); } - + public EGLWrappedSurface(NativeSurface surface) { super(surface.getGraphicsConfiguration(), EGL.EGL_NO_SURFACE, new EGLUpstreamSurfaceHook(surface), false /* tbd in UpstreamSurfaceHook */); if(EGLDrawableFactory.DEBUG) { - System.err.println("EGLWrappedSurface.ctor(): "+this); + System.err.println("EGLWrappedSurface.ctor(): "+this); } } @Override - public final NativeSurface getUpstreamSurface() { - return ((EGLUpstreamSurfaceHook)super.getUpstreamSurfaceHook()).getUpstreamSurface(); - } + public final NativeSurface getUpstreamSurface() { + return ((EGLUpstreamSurfaceHook)super.getUpstreamSurfaceHook()).getUpstreamSurface(); + } } |