diff options
-rwxr-xr-x | make/scripts/tests.sh | 10 | ||||
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/FBObject.java | 84 |
2 files changed, 51 insertions, 43 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index ed2e238fb..8b554b923 100755 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -66,7 +66,7 @@ function jrun() { #D_ARGS="-Djogl.debug.FBObject -Djogl.debug.TraceGL -Djogl.debug.GLBufferStateTracker" #D_ARGS="-Djogl.debug.FBObject" #D_ARGS="-Djogl.debug.TraceGL -Djogl.debug.DebugGL -Djogl.debug.GLSLCode" - #D_ARGS="-Djogl.debug.FBObject -Djogl.debug.GLContext -Djogl.debug.GLDrawable -Djogl.debug.GLCanvas -Dnewt.debug.Window" + #D_ARGS="-Djogl.debug.DebugGL -Djogl.debug.FBObject -Djogl.debug.GLContext -Djogl.debug.GLDrawable -Djogl.debug.GLCanvas -Dnewt.debug.Window" #D_ARGS="-Dnativewindow.debug.GraphicsConfiguration -Djogl.debug.GLDrawable -Djogl.debug.GLContext -Djogl.debug.FBObject" #D_ARGS="-Djogl.debug.GLContext.NoProfileAliasing" #D_ARGS="-Djogamp.debug=all -Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all" @@ -104,7 +104,7 @@ function jrun() { #D_ARGS="-Djogl.debug.GLContext -Djogl.debug.GLProfile" #D_ARGS="-Djogl.debug.GLProfile" #D_ARGS="-Dnativewindow.debug.NativeWindow" - D_ARGS="-Dnewt.debug.Window -Dnewt.debug.Display -Dnewt.debug.EDT" + #D_ARGS="-Dnewt.debug.Window -Dnewt.debug.Display -Dnewt.debug.EDT" #D_ARGS="-Dnewt.debug.EDT -Dnewt.debug.Window -Djogl.debug.GLContext" #D_ARGS="-Dnativewindow.debug.X11Util.XErrorStackDump -Dnativewindow.debug.X11Util.TraceDisplayLifecycle -Dnativewindow.debug.X11Util" #D_ARGS="-Dnativewindow.debug.X11Util -Djogl.debug.GLContext -Djogl.debug.GLDrawable -Dnewt.debug=all" @@ -137,7 +137,7 @@ function jrun() { #D_ARGS="-Xprof" #D_ARGS="-Djogl.debug.Animator" #D_ARGS="-Dnativewindow.debug=all" - D_ARGS="-Djogl.debug.GLCanvas" + #D_ARGS="-Djogl.debug.GLCanvas" #D_ARGS="-Djogl.debug.GLContext -Dnativewindow.debug.X11Util.XSync" #D_ARGS="-Dnativewindow.debug.X11Util.XSync -Dnativewindow.debug.ToolkitLock.TraceLock" #D_ARGS="-Dnativewindow.debug.NativeWindow" @@ -263,7 +263,7 @@ function testawtswt() { #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT $* #testawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT $* #testawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT $* -#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableFactoryOffscrnCapsNEWT $* +testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableFactoryOffscrnCapsNEWT $* #testawt com.jogamp.opengl.test.junit.jogl.acore.TestOffscreenLayer01GLCanvasAWT $* #testawt com.jogamp.opengl.test.junit.jogl.acore.TestOffscreenLayer02NewtCanvasAWT $* @@ -317,7 +317,7 @@ function testawtswt() { #testawt javax.media.opengl.awt.GLCanvas $* #testawt com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLCanvasAWT $* #testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug551AWT $* -testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug572AWT $* +#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug572AWT $* #testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug611AWT $* #testawt com.jogamp.opengl.test.junit.jogl.awt.TestAWT01GLn $* #testawt com.jogamp.opengl.test.junit.jogl.acore.TestAWTCloseX11DisplayBug565 $* diff --git a/src/jogl/classes/com/jogamp/opengl/FBObject.java b/src/jogl/classes/com/jogamp/opengl/FBObject.java index 4745b5e01..922225207 100644 --- a/src/jogl/classes/com/jogamp/opengl/FBObject.java +++ b/src/jogl/classes/com/jogamp/opengl/FBObject.java @@ -317,7 +317,7 @@ public class FBObject { private int samples; /** - * @param type allowed types are {@link Type#DEPTH}, {@link Type#STENCIL} or {@link Type#COLOR} + * @param type allowed types are {@link Type#DEPTH_STENCIL} {@link Type#DEPTH}, {@link Type#STENCIL} or {@link Type#COLOR} * @param iFormat * @param samples * @param width @@ -335,6 +335,7 @@ public class FBObject { private static Type validateType(Type type) { switch(type) { + case DEPTH_STENCIL: case DEPTH: case STENCIL: case COLOR: @@ -395,7 +396,7 @@ public class FBObject { throw new GLException("GL Error "+toHexString(glerr)+" while creating "+this); } if(DEBUG) { - System.err.println("Attachment.init: "+this); + System.err.println("Attachment.init.X: "+this); } } return init; @@ -405,10 +406,10 @@ public class FBObject { public void free(GL gl) { final int[] name = new int[] { getName() }; if( 0 != name[0] ) { - gl.glDeleteRenderbuffers(1, name, 0); if(DEBUG) { - System.err.println("Attachment.free: "+this); + System.err.println("Attachment.free.0: "+this); } + gl.glDeleteRenderbuffers(1, name, 0); setName(0); } } @@ -509,7 +510,7 @@ public class FBObject { throw new GLException("GL Error "+toHexString(glerr)+" while creating (pre TexImage2D "+preTexImage2D+") "+this); } if(DEBUG) { - System.err.println("Attachment.init: "+this); + System.err.println("Attachment.init.X: "+this); } } return init; @@ -519,10 +520,10 @@ public class FBObject { public void free(GL gl) { final int[] name = new int[] { getName() }; if( 0 != name[0] ) { - gl.glDeleteTextures(1, name, 0); if(DEBUG) { - System.err.println("Attachment.free: "+this); + System.err.println("Attachment.free.0: "+this); } + gl.glDeleteTextures(1, name, 0); setName(0); } } @@ -1082,7 +1083,7 @@ public class FBObject { case 0: default: - System.out.println("Framebuffer " + fbName + " is incomplete: status = " + toHexString(vStatus) + + System.err.println("Framebuffer " + fbName + " is incomplete, status = " + toHexString(vStatus) + " : " + getStatusString(vStatus)); return false; } @@ -1307,7 +1308,7 @@ public class FBObject { } } if(DEBUG) { - System.err.println("FBObject.attachColorbuffer: [attachmentPoint "+attachmentPoint+", colbuf "+colbuf+"]: "+this); + System.err.println("FBObject.attachColorbuffer.X: [attachmentPoint "+attachmentPoint+", colbuf "+colbuf+"]: "+this); } return colbuf; } @@ -1462,20 +1463,17 @@ public class FBObject { stencil.initialize(gl); } else if( Attachment.Type.DEPTH_STENCIL == atype ) { if(null == depth) { - depth = new RenderAttachment(Type.DEPTH, internalFormat, samples, width, height, 0); + if(null != stencil) { + throw new InternalError("XXX: DEPTH_STENCIL, depth was null, stencil not: "+this.toString()); + } + depth = new RenderAttachment(Type.DEPTH_STENCIL, internalFormat, samples, width, height, 0); } else { depth.setSize(width, height); depth.setSamples(samples); } depth.initialize(gl); - if(null == stencil) { - stencil = new RenderAttachment(Type.STENCIL, internalFormat, samples, width, height, depth.getName()); - } else { - stencil.setName(depth.getName()); - stencil.setSize(width, height); - stencil.setSamples(samples); - } - stencil.initialize(gl); + // DEPTH_STENCIL shares buffer w/ depth and stencil + stencil = depth; } // Attach the buffer @@ -1492,12 +1490,12 @@ public class FBObject { updateStatus(gl); if( !isStatusValid() ) { detachRenderbuffer(gl, atype, true); - throw new GLException("renderbuffer attachment failed: "+this.getStatusString()); + throw new GLException("renderbuffer [attachmentType "+atype+", iformat "+toHexString(internalFormat)+"] failed: "+this.getStatusString()+": "+this.toString()); } } if(DEBUG) { - System.err.println("FBObject.attachRenderbuffer: [attachmentType "+atype+"]: "+this); + System.err.println("FBObject.attachRenderbuffer.X: [attachmentType "+atype+", iformat "+toHexString(internalFormat)+"]: "+this); } } @@ -1519,7 +1517,7 @@ public class FBObject { throw new IllegalArgumentException("ColorAttachment at "+attachmentPoint+", not attached, "+this); } if(DEBUG) { - System.err.println("FBObject.detachColorbuffer: [attachmentPoint "+attachmentPoint+", dispose "+dispose+"]: "+res+", "+this); + System.err.println("FBObject.detachColorbuffer.X: [attachmentPoint "+attachmentPoint+", dispose "+dispose+"]: "+res+", "+this); } return res; } @@ -1633,15 +1631,20 @@ public class FBObject { bind(gl); detachRenderbufferImpl(gl, atype, dispose ? DetachAction.DISPOSE : DetachAction.NONE); if(DEBUG) { - System.err.println("FBObject.detachRenderbuffer: [attachmentType "+atype+", dispose "+dispose+"]: "+this); + System.err.println("FBObject.detachRenderbuffer.X: [attachmentType "+atype+", dispose "+dispose+"]: "+this); } } public final boolean isDepthStencilPackedFormat() { final boolean res = null != depth && null != stencil && depth.format == stencil.format ; - if(res && depth.getName() != stencil.getName() ) { - throw new InternalError("depth/stencil packed format not sharing: depth "+depth+", stencil "+stencil); + if(res) { + if(depth.getName() != stencil.getName() ) { + throw new InternalError("depth/stencil packed format not sharing: depth "+depth+", stencil "+stencil); + } + if(depth != stencil) { + throw new InternalError("depth/stencil packed format not a shared reference: depth "+depth+", stencil "+stencil); + } } return res; } @@ -1660,7 +1663,7 @@ public class FBObject { } final boolean packed = isDepthStencilPackedFormat(); if( packed ) { - // packed + // Note: DEPTH_STENCIL shares buffer w/ depth and stencil atype = Attachment.Type.DEPTH_STENCIL; } switch ( atype ) { @@ -1709,6 +1712,9 @@ public class FBObject { final int format = depth.format; if(0 != depth.getName()) { gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT, GL.GL_RENDERBUFFER, 0); + if(packed) { + gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_STENCIL_ATTACHMENT, GL.GL_RENDERBUFFER, 0); + } switch(detachAction) { case DISPOSE: case RECREATE: @@ -1718,12 +1724,15 @@ public class FBObject { } } if(DetachAction.RECREATE == detachAction) { - attachRenderbufferImpl2(gl, Attachment.Type.DEPTH, format); - } else if(!packed) { + attachRenderbufferImpl2(gl, packed ? Attachment.Type.DEPTH_STENCIL : Attachment.Type.DEPTH, format); + } else { depth = null; + if(packed) { + stencil = null; + } } } - if( null != stencil ) { + if( !packed && null != stencil ) { final int format = stencil.format; if(0 != stencil.getName()) { gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_STENCIL_ATTACHMENT, GL.GL_RENDERBUFFER, 0); @@ -1736,13 +1745,7 @@ public class FBObject { } } if(DetachAction.RECREATE == detachAction) { - if(packed) { - // packed - attachRenderbufferImpl2(gl, Attachment.Type.DEPTH_STENCIL, format); - } else { - // single - attachRenderbufferImpl2(gl, Attachment.Type.STENCIL, format); - } + attachRenderbufferImpl2(gl, Attachment.Type.STENCIL, format); } else { stencil = null; } @@ -1753,13 +1756,18 @@ public class FBObject { } private final void freeAllRenderbufferImpl(GL gl) throws IllegalArgumentException { + // Note: DEPTH_STENCIL shares buffer w/ depth and stencil + final boolean packed = isDepthStencilPackedFormat(); if( null != depth ) { if(0 != depth.getName()) { gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT, GL.GL_RENDERBUFFER, 0); + if(packed) { + gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_STENCIL_ATTACHMENT, GL.GL_RENDERBUFFER, 0); + } depth.free(gl); } } - if( null != stencil ) { + if( !packed && null != stencil ) { if(0 != stencil.getName()) { gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_STENCIL_ATTACHMENT, GL.GL_RENDERBUFFER, 0); stencil.free(gl); @@ -1821,7 +1829,7 @@ public class FBObject { } } if(DEBUG) { - System.err.println("FBObject.detachAllTexturebuffer: "+this); + System.err.println("FBObject.detachAllTexturebuffer.X: "+this); } } @@ -1870,7 +1878,7 @@ public class FBObject { ignoreStatus = false; } if(DEBUG) { - System.err.println("FBObject.detachAll: [resetNonColorbuffer "+detachNonColorbuffer+", recreate "+recreate+"]: "+this); + System.err.println("FBObject.detachAll.X: [resetNonColorbuffer "+detachNonColorbuffer+", recreate "+recreate+"]: "+this); } } |