summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/macosx
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-09-20 23:12:48 +0200
committerSven Gothel <[email protected]>2012-09-20 23:12:48 +0200
commit923d9dd7f1d40db72d35ca76a761ca14babf147f (patch)
tree754fdccc679898e9699cb76feeb54b97fcb2e605 /src/jogl/classes/jogamp/opengl/macosx
parent0f531ec116245b10fcb41e7b0905f240b91aa93a (diff)
Add GLRendererQuirks; Fix shared EGL/ES resources;
Add GLRendererQuirks: - Contains centralized 'tagged' workarounds for GL renderer bugs (quirks) - Accessible via GLContext and GLDrawableFactory - Initialized in GLContext.setAvailability* - Simplify GLGraphicsConfigurationUtil.fixOffscreenGLCapabilities(..) & use Quirks - use quirks - instead of passing booleans for each config, pass factory & device Fix shared EGL/ES resources: - GLProfile needs to initialize EGLDrawableFactory's shared resources before desktop, so EGLDrawableFactory can use the fallback defaultDisplay & defaultSharedResource for host mapped sharedResources (hack). - If using defaultSharedResources for host mapped ones, do not go through initialization cycles - simply map (sharedResource + context). - EGLDrawableFactory: Use device's unique-key instead of connection only, since the latter causes a collision (EGL-connection == X11-connection).
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/macosx')
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java19
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java6
2 files changed, 12 insertions, 13 deletions
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
index e174d38f4..06f8c0c25 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
@@ -45,7 +45,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
import javax.media.nativewindow.AbstractGraphicsDevice;
import javax.media.nativewindow.AbstractGraphicsScreen;
import javax.media.nativewindow.DefaultGraphicsScreen;
@@ -64,7 +63,6 @@ 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;
@@ -148,7 +146,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
static class SharedResource {
// private MacOSXCGLDrawable drawable;
- // private MacOSXCGLContext context;
+ private MacOSXCGLContext context;
MacOSXGraphicsDevice device;
boolean wasContextCreated;
boolean hasNPOTTextures;
@@ -157,9 +155,9 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
SharedResource(MacOSXGraphicsDevice device, boolean wasContextCreated,
boolean hasNPOTTextures, boolean hasRECTTextures, boolean hasAppletFloatPixels
- /* MacOSXCGLDrawable draw, MacOSXCGLContext ctx */) {
+ /* MacOSXCGLDrawable draw */, MacOSXCGLContext ctx) {
// drawable = draw;
- // context = ctx;
+ this.context = ctx;
this.device = device;
this.wasContextCreated = wasContextCreated;
this.hasNPOTTextures = hasNPOTTextures;
@@ -167,6 +165,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
this.hasAppleFloatPixels = hasAppletFloatPixels;
}
final MacOSXGraphicsDevice getDevice() { return device; }
+ final MacOSXCGLContext getContext() { return context; }
final boolean wasContextAvailable() { return wasContextCreated; }
final boolean isNPOTTextureAvailable() { return hasNPOTTextures; }
final boolean isRECTTextureAvailable() { return hasRECTTextures; }
@@ -213,6 +212,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
if(null==sr && !getDeviceTried(connection)) {
addDeviceTried(connection);
final MacOSXGraphicsDevice sharedDevice = new MacOSXGraphicsDevice(adevice.getUnitID());
+ final MacOSXCGLContext sharedContext;
boolean madeCurrent = false;
boolean hasNPOTTextures = false;
boolean hasRECTTextures = false;
@@ -225,7 +225,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
final GLDrawableImpl sharedDrawable = createOnscreenDrawableImpl(createDummySurfaceImpl(sharedDevice, false, new GLCapabilities(glp), null, 64, 64));
sharedDrawable.setRealized(true);
- final GLContextImpl sharedContext = (GLContextImpl) sharedDrawable.createContext(null);
+ sharedContext = (MacOSXCGLContext) sharedDrawable.createContext(null);
if (null == sharedContext) {
throw new GLException("Couldn't create shared context for drawable: "+sharedDrawable);
}
@@ -256,7 +256,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
}
sharedDrawable.setRealized(false);
}
- sr = new SharedResource(sharedDevice, madeCurrent, hasNPOTTextures, hasRECTTextures, hasAppleFloatPixels);
+ sr = new SharedResource(sharedDevice, madeCurrent, hasNPOTTextures, hasRECTTextures, hasAppleFloatPixels, sharedContext);
synchronized(sharedMap) {
sharedMap.put(connection, sr);
}
@@ -293,7 +293,10 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
@Override
protected final GLContext getOrCreateSharedContextImpl(AbstractGraphicsDevice device) {
- // FIXME: not implemented .. needs a dummy OSX surface
+ SharedResource sr = getOrCreateOSXSharedResource(device);
+ if(null!=sr) {
+ return sr.getContext();
+ }
return null;
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java
index 43a9d0d1a..3bbba2c52 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java
@@ -35,7 +35,6 @@ package jogamp.opengl.macosx.cgl;
import jogamp.opengl.GLGraphicsConfigurationFactory;
import jogamp.opengl.GLGraphicsConfigurationUtil;
-import jogamp.opengl.x11.glx.X11GLXDrawableFactory;
import javax.media.nativewindow.AbstractGraphicsConfiguration;
import javax.media.nativewindow.AbstractGraphicsDevice;
@@ -45,7 +44,6 @@ import javax.media.nativewindow.CapabilitiesImmutable;
import javax.media.nativewindow.GraphicsConfigurationFactory;
import javax.media.opengl.GLCapabilitiesChooser;
import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLContext;
import javax.media.opengl.GLDrawableFactory;
@@ -91,10 +89,8 @@ public class MacOSXCGLGraphicsConfigurationFactory extends GLGraphicsConfigurati
if (absScreen == null) {
throw new IllegalArgumentException("AbstractGraphicsScreen is null");
}
- final MacOSXCGLDrawableFactory factory = (MacOSXCGLDrawableFactory) GLDrawableFactory.getDesktopFactory();
final AbstractGraphicsDevice device = absScreen.getDevice();
-
- capsChosen = GLGraphicsConfigurationUtil.fixGLCapabilities( capsChosen, GLContext.isFBOAvailable(device, capsChosen.getGLProfile()), factory.canCreateGLPbuffer(device) );
+ capsChosen = GLGraphicsConfigurationUtil.fixGLCapabilities( capsChosen, GLDrawableFactory.getDesktopFactory(), device);
return new MacOSXCGLGraphicsConfiguration(absScreen, (GLCapabilitiesImmutable)capsChosen, (GLCapabilitiesImmutable)capsRequested);
}