aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/macosx
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-04-26 05:38:24 +0200
committerSven Gothel <[email protected]>2013-04-26 05:38:24 +0200
commit36dc4f5ab6957a4078842c488afb51df2fdc0630 (patch)
tree5e5629f085f7d244faf1c1e5e15cfe935e87e1b4 /src/jogl/classes/jogamp/opengl/macosx
parent75b3d37a3b15c071b49609921244bcb62d329fa9 (diff)
Simplify GLDrawableFactory's SharedResource Query Methods; Move WindowsWGLDrawableFactory Quirks to GLRendererQuirks (NeedCurrCtx4ARBPixFmtQueries, NeedCurrCtx4ARBCreateContext); Bug 706: Confine NeedCurrCtx4ARBCreateContext to [Windows, ATI, driver < 12.102.3); Avoid possible NPE @ GLContext.getGLVendorVersionNumber()
- Simplify GLDrawableFactory's SharedResource Query Methods - Moving common methods to GLDrawableFactory/GLDrawableFactoryImpl while reusing common methods to SharedResourceRunner.Resource. - All factories SharedResources impl. SharedResourceRunner.Resource. - Move WindowsWGLDrawableFactory Quirks to GLRendererQuirks (NeedCurrCtx4ARBPixFmtQueries, NeedCurrCtx4ARBCreateContext) - For better maintenance, move the mentioned quirks from the windows factory to our common place, being detected within GLContextImpl after each context creation. - Bug 706: Confine NeedCurrCtx4ARBCreateContext to [Windows, ATI, driver < 12.102.3) - Before we added this quirk if [Windows, ATI], however, we have hopes that the new drivers will suffice for all as tested successful on my test machine (AMD Radeon HD 6300M Series, amd_catalyst_13.5_mobility_beta2). - Avoid possible NPE @ GLContext.getGLVendorVersionNumber() - GLContext.getGLVendorVersionNumber() never returns 'null' but a zero version instance instead! - Add API doc. - Use mixed case names in GLContextImpl.setRendererQuirks(..).
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/macosx')
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java87
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java2
3 files changed, 36 insertions, 55 deletions
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
index 39178290a..c9402b33d 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
@@ -64,10 +64,12 @@ import javax.media.opengl.GLProfile;
import jogamp.nativewindow.WrappedSurface;
import jogamp.nativewindow.macosx.OSXDummyUpstreamSurfaceHook;
import jogamp.opengl.DesktopGLDynamicLookupHelper;
+import jogamp.opengl.GLContextImpl;
import jogamp.opengl.GLDrawableFactoryImpl;
import jogamp.opengl.GLDrawableImpl;
import jogamp.opengl.GLDynamicLookupHelper;
import jogamp.opengl.GLGraphicsConfigurationUtil;
+import jogamp.opengl.SharedResourceRunner;
import com.jogamp.common.nio.Buffers;
import com.jogamp.common.util.ReflectionUtil;
@@ -146,35 +148,54 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
private HashMap<String, SharedResource> sharedMap = new HashMap<String, SharedResource>();
private MacOSXGraphicsDevice defaultDevice;
- static class SharedResource {
+ static class SharedResource implements SharedResourceRunner.Resource {
// private MacOSXCGLDrawable drawable;
// private MacOSXCGLContext context;
private GLRendererQuirks glRendererQuirks;
MacOSXGraphicsDevice device;
- boolean wasContextCreated;
+ boolean valid;
boolean hasNPOTTextures;
boolean hasRECTTextures;
boolean hasAppleFloatPixels;
- SharedResource(MacOSXGraphicsDevice device, boolean wasContextCreated,
+ SharedResource(MacOSXGraphicsDevice device, boolean valid,
boolean hasNPOTTextures, boolean hasRECTTextures, boolean hasAppletFloatPixels
/* MacOSXCGLDrawable draw, MacOSXCGLContext ctx */, GLRendererQuirks glRendererQuirks) {
// drawable = draw;
// this.context = ctx;
this.glRendererQuirks = glRendererQuirks;
this.device = device;
- this.wasContextCreated = wasContextCreated;
+ this.valid = valid;
this.hasNPOTTextures = hasNPOTTextures;
this.hasRECTTextures = hasRECTTextures;
this.hasAppleFloatPixels = hasAppletFloatPixels;
}
- final MacOSXGraphicsDevice getDevice() { return device; }
+ @Override
+ public final boolean isValid() {
+ return valid;
+ }
+ @Override
+ public final MacOSXGraphicsDevice getDevice() { return device; }
// final MacOSXCGLContext getContext() { return context; }
- final GLRendererQuirks getGLRendererQuirks() { return glRendererQuirks; }
- final boolean wasContextAvailable() { return wasContextCreated; }
final boolean isNPOTTextureAvailable() { return hasNPOTTextures; }
final boolean isRECTTextureAvailable() { return hasRECTTextures; }
final boolean isAppleFloatPixelsAvailable() { return hasAppleFloatPixels; }
+ @Override
+ public final AbstractGraphicsScreen getScreen() {
+ return null;
+ }
+ @Override
+ public final GLDrawableImpl getDrawable() {
+ return null;
+ }
+ @Override
+ public GLContextImpl getContext() {
+ return null;
+ }
+ @Override
+ public GLRendererQuirks getRendererQuirks() {
+ return glRendererQuirks;
+ }
}
@Override
@@ -208,7 +229,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
}
}
- /* package */ SharedResource getOrCreateOSXSharedResource(AbstractGraphicsDevice adevice) {
+ protected final SharedResource getOrCreateSharedResourceImpl(AbstractGraphicsDevice adevice) {
final String connection = adevice.getConnection();
SharedResource sr;
synchronized(sharedMap) {
@@ -218,7 +239,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
addDeviceTried(connection);
final MacOSXGraphicsDevice sharedDevice = new MacOSXGraphicsDevice(adevice.getUnitID());
GLRendererQuirks glRendererQuirks = null;
- boolean madeCurrent = false;
+ boolean isValid = false;
boolean hasNPOTTextures = false;
boolean hasRECTTextures = false;
boolean hasAppleFloatPixels = false;
@@ -238,8 +259,8 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
try {
sharedContext.makeCurrent(); // could cause exception
- madeCurrent = sharedContext.isCurrent();
- if(madeCurrent) {
+ isValid = sharedContext.isCurrent();
+ if(isValid) {
GL gl = sharedContext.getGL();
hasNPOTTextures = gl.isNPOTTextureAvailable();
hasRECTTextures = gl.isExtensionAvailable(GLExtensions.EXT_texture_rectangle);
@@ -263,14 +284,14 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
}
sharedDrawable.setRealized(false);
}
- sr = new SharedResource(sharedDevice, madeCurrent, hasNPOTTextures, hasRECTTextures, hasAppleFloatPixels, glRendererQuirks);
+ sr = new SharedResource(sharedDevice, isValid, hasNPOTTextures, hasRECTTextures, hasAppleFloatPixels, glRendererQuirks);
synchronized(sharedMap) {
sharedMap.put(connection, sr);
}
removeDeviceTried(connection);
if (DEBUG) {
System.err.println("MacOSXCGLDrawableFactory.createShared: device: " + sharedDevice);
- System.err.println("MacOSXCGLDrawableFactory.createShared: context: madeCurrent " + madeCurrent + ", NPOT "+hasNPOTTextures+
+ System.err.println("MacOSXCGLDrawableFactory.createShared: context: madeCurrent " + isValid + ", NPOT "+hasNPOTTextures+
", RECT "+hasRECTTextures+", FloatPixels "+hasAppleFloatPixels+", "+glRendererQuirks);
}
}
@@ -283,46 +304,6 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
}
@Override
- protected final boolean createSharedResource(AbstractGraphicsDevice device) {
- try {
- SharedResource sr = getOrCreateOSXSharedResource(device);
- if(null!=sr) {
- return sr.wasContextAvailable();
- }
- } catch (GLException gle) {
- if(DEBUG) {
- System.err.println("Catched Exception on thread "+getThreadName());
- gle.printStackTrace();
- }
- }
- return false;
- }
-
- @Override
- protected final GLContext getOrCreateSharedContextImpl(AbstractGraphicsDevice device) {
- // FIXME: no more available
- return null;
- }
-
- @Override
- public GLRendererQuirks getRendererQuirks(AbstractGraphicsDevice device) {
- SharedResource sr = getOrCreateOSXSharedResource(device);
- if(null!=sr) {
- return sr.getGLRendererQuirks();
- }
- return null;
- }
-
- @Override
- protected AbstractGraphicsDevice getOrCreateSharedDeviceImpl(AbstractGraphicsDevice device) {
- SharedResource sr = getOrCreateOSXSharedResource(device);
- if(null!=sr) {
- return sr.getDevice();
- }
- return null;
- }
-
- @Override
protected List<GLCapabilitiesImmutable> getAvailableCapabilitiesImpl(AbstractGraphicsDevice device) {
return MacOSXCGLGraphicsConfiguration.getAvailableCapabilities(this, device);
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java
index 86e1ef481..5eb11c6a4 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java
@@ -64,7 +64,7 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration
}
protected static List<GLCapabilitiesImmutable> getAvailableCapabilities(MacOSXCGLDrawableFactory factory, AbstractGraphicsDevice device) {
- MacOSXCGLDrawableFactory.SharedResource sharedResource = factory.getOrCreateOSXSharedResource(device);
+ MacOSXCGLDrawableFactory.SharedResource sharedResource = factory.getOrCreateSharedResourceImpl(device);
if(null == sharedResource) {
throw new GLException("Shared resource for device n/a: "+device);
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java
index 982bb57e1..4e791cb5f 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java
@@ -121,7 +121,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
final DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) ms.getGraphicsConfiguration();
final GLCapabilitiesImmutable capabilities = (GLCapabilitiesImmutable)config.getChosenCapabilities();
final GLProfile glProfile = capabilities.getGLProfile();
- MacOSXCGLDrawableFactory.SharedResource sr = ((MacOSXCGLDrawableFactory)factory).getOrCreateOSXSharedResource(config.getScreen().getDevice());
+ MacOSXCGLDrawableFactory.SharedResource sr = ((MacOSXCGLDrawableFactory)factory).getOrCreateSharedResourceImpl(config.getScreen().getDevice());
if (DEBUG) {
System.out.println(getThreadName()+": Pbuffer config: " + config);