aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
diff options
context:
space:
mode:
authorHarvey Harrison <[email protected]>2013-10-17 22:27:27 -0700
committerHarvey Harrison <[email protected]>2013-10-17 22:27:27 -0700
commit5e9c02bce7b241a0bf95c8abca9a91cd25e51ed3 (patch)
tree78e913afc74a64e519d69dfb9aa886dd41ec16ed /src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
parent2ebf1bf35928e35ded6e38df64dee7aa578ae3c7 (diff)
jogl: remove all trailing whitespace
Signed-off-by: Harvey Harrison <[email protected]>
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java')
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java136
1 files changed, 68 insertions, 68 deletions
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
*/