aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-09-01 02:05:50 +0200
committerSven Gothel <[email protected]>2015-09-01 02:05:50 +0200
commitaacc8afdca0b1376f91dcc68aa3ae3b39c7aba51 (patch)
treebbe7308bcebecaaeab5fcecd236b96bb6f04dfb3 /src
parentee2fea13b20644e45c77f12a8b6d6f55941c27c8 (diff)
Bug 1202: Fix vsync regression on OSX when using CALayer
On OSX using CALayer for onscreen rendering, the drawable is utilizing an offscreen FBO. Hence we need to move the vsync-skip-operation criteria, i.e. skip if offscreen, down to the implementation.
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLContext.java3
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java3
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java3
5 files changed, 20 insertions, 3 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index 6e904d0ed..3d2c9a3e1 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -2636,8 +2636,8 @@ public abstract class GLContextImpl extends GLContext {
return setSwapIntervalNC(interval);
}
protected final boolean setSwapIntervalNC(final int interval) throws GLException {
- if( drawable.getChosenGLCapabilities().isOnscreen() &&
- ( !drawableRetargeted || !hasRendererQuirk(GLRendererQuirks.NoSetSwapIntervalPostRetarget) )
+ if( !drawableRetargeted ||
+ !hasRendererQuirk(GLRendererQuirks.NoSetSwapIntervalPostRetarget)
)
{
final Integer usedInterval = setSwapIntervalImpl2(interval);
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
index a9d025e01..28448d537 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
@@ -433,7 +433,8 @@ public class EGLContext extends GLContextImpl {
@Override
protected final Integer setSwapIntervalImpl2(final int interval) {
- if( hasRendererQuirk(GLRendererQuirks.NoSetSwapInterval) ) {
+ if( !drawable.getChosenGLCapabilities().isOnscreen() ||
+ hasRendererQuirk(GLRendererQuirks.NoSetSwapInterval) ) {
return null;
}
final int useInterval;
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
index 3c76dc212..5097b21aa 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
@@ -86,6 +86,8 @@ public class MacOSXCGLContext extends GLContextImpl
// NSOpenGL-based or CGL-based)
protected interface GLBackendImpl {
boolean isNSContext();
+ /** Indicating CALayer, i.e. onscreen rendering using offscreen layer. */
+ boolean isUsingCALayer();
long create(long share, int ctp, int major, int minor);
boolean destroy(long ctx);
void associateDrawable(boolean bound);
@@ -428,6 +430,9 @@ public class MacOSXCGLContext extends GLContextImpl
@Override
protected final Integer setSwapIntervalImpl2(final int interval) {
+ if( !impl.isUsingCALayer() && !drawable.getChosenGLCapabilities().isOnscreen() ) {
+ return null;
+ }
final int useInterval;
if( 0 > interval ) {
useInterval = Math.abs(interval);
@@ -543,6 +548,8 @@ public class MacOSXCGLContext extends GLContextImpl
@Override
public boolean isNSContext() { return true; }
+ @Override
+ public boolean isUsingCALayer() { return null != backingLayerHost; }
/** Only returns a valid NSView. If !NSView, return null and mark either isPBuffer, isFBO or isSurfaceless. */
private long getNSViewHandle(final boolean[] isPBuffer, final boolean[] isFBO, final boolean[] isSurfaceless) {
@@ -1150,6 +1157,9 @@ public class MacOSXCGLContext extends GLContextImpl
public boolean isNSContext() { return false; }
@Override
+ public boolean isUsingCALayer() { return false; }
+
+ @Override
public long create(final long share, final int ctp, final int major, final int minor) {
long ctx = 0;
final MacOSXCGLGraphicsConfiguration config = (MacOSXCGLGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration();
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
index 4c9469f17..fd0db7c04 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
@@ -524,6 +524,9 @@ public class WindowsWGLContext extends GLContextImpl {
@Override
protected final Integer setSwapIntervalImpl2(final int interval) {
+ if( !drawable.getChosenGLCapabilities().isOnscreen() ) {
+ return null;
+ }
if( 0 == hasSwapInterval ) {
try {
if ( isExtensionAvailable(GLXExtensions.WGL_EXT_swap_control) ) {
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
index 9af534f35..24f2ab8dd 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
@@ -581,6 +581,9 @@ public class X11GLXContext extends GLContextImpl {
@Override
protected final Integer setSwapIntervalImpl2(final int interval) {
+ if( !drawable.getChosenGLCapabilities().isOnscreen() ) {
+ return null;
+ }
final long displayHandle = drawable.getNativeSurface().getDisplayHandle();
if( 0 == hasSwapInterval ) {
try {