summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-10-02 07:32:24 +0200
committerSven Gothel <[email protected]>2012-10-02 07:32:24 +0200
commit98d5ae6b31802235426f0f540f7d0df74884a3d3 (patch)
treeda6bd9cc445edcf72f895edf7ec632027efe701d /src/jogl/classes
parent21b85e647f1e661c8e5e49caa91c564a3d041df2 (diff)
FBObject/GLFBODrawable: Debug / glError detection
- Enh. Debug output a bit - FBObject: Detect glError @ syncFramebuffer MSAA blit, throw GLException if glError to fail-fast - TODO: May add Mesa NoFBOMSAA Quirk to disable even trying it ..
Diffstat (limited to 'src/jogl/classes')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/FBObject.java19
-rw-r--r--src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java14
2 files changed, 21 insertions, 12 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/FBObject.java b/src/jogl/classes/com/jogamp/opengl/FBObject.java
index b32c8cdcc..4745b5e01 100644
--- a/src/jogl/classes/com/jogamp/opengl/FBObject.java
+++ b/src/jogl/classes/com/jogamp/opengl/FBObject.java
@@ -376,7 +376,7 @@ public class FBObject {
public boolean initialize(GL gl) throws GLException {
final boolean init = 0 == getName();
if( init ) {
- int glerr = checkPreGLError(gl);
+ checkPreGLError(gl);
final int[] name = new int[] { -1 };
gl.glGenRenderbuffers(1, name, 0);
@@ -388,7 +388,7 @@ public class FBObject {
} else {
gl.glRenderbufferStorage(GL.GL_RENDERBUFFER, format, getWidth(), getHeight());
}
- glerr = gl.glGetError();
+ int glerr = gl.glGetError();
if(GL.GL_NO_ERROR != glerr) {
gl.glDeleteRenderbuffers(1, name, 0);
setName(0);
@@ -474,7 +474,7 @@ public class FBObject {
public boolean initialize(GL gl) throws GLException {
final boolean init = 0 == getName();
if( init ) {
- int glerr = checkPreGLError(gl);
+ checkPreGLError(gl);
final int[] name = new int[] { -1 };
gl.glGenTextures(1, name, 0);
@@ -497,7 +497,7 @@ public class FBObject {
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, wrapT);
}
boolean preTexImage2D = true;
- glerr = gl.glGetError();
+ int glerr = gl.glGetError();
if(GL.GL_NO_ERROR == glerr) {
preTexImage2D = false;
gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, format, getWidth(), getHeight(), 0, dataFormat, dataType, null);
@@ -841,6 +841,7 @@ public class FBObject {
if(DEBUG) {
System.err.println("FBObject "+width+"x"+height+", "+samples+" -> "+this.samples+" samples");
System.err.println("fullFBOSupport: "+fullFBOSupport);
+ System.err.println("isSamplesSink: "+(null == samplesSink));
System.err.println("maxColorAttachments: "+maxColorAttachments+"/"+realMaxColorAttachments+" [capped/real]");
System.err.println("maxSamples: "+maxSamples);
System.err.println("maxTextureSize: "+maxTextureSize);
@@ -1102,7 +1103,7 @@ public class FBObject {
destroy(gl);
}
if(null != exceptionMessage) {
- throw new GLException(exceptionMessage+" GL Error "+toHexString(err));
+ throw new GLException(exceptionMessage+" GL Error "+toHexString(err)+" of "+this.toString());
}
return false;
}
@@ -1960,7 +1961,7 @@ public class FBObject {
boolean sampleSinkDepthStencilMismatch = sampleSinkDepthStencilMismatch();
/** if(DEBUG) {
- System.err.println("FBObject.resetMSAATexture2DSink.0: \n\tTHIS "+this+",\n\tSINK "+samplesSink+
+ System.err.println("FBObject.resetSamplingSink.0: \n\tTHIS "+this+",\n\tSINK "+samplesSink+
"\n\t size "+sampleSinkSizeMismatch +", tex "+sampleSinkTexMismatch +", depthStencil "+sampleSinkDepthStencilMismatch);
} */
@@ -1972,7 +1973,7 @@ public class FBObject {
unbind(gl);
if(DEBUG) {
- System.err.println("FBObject.resetMSAATexture2DSink: BEGIN\n\tTHIS "+this+",\n\tSINK "+samplesSink+
+ System.err.println("FBObject.resetSamplingSink: BEGIN\n\tTHIS "+this+",\n\tSINK "+samplesSink+
"\n\t size "+sampleSinkSizeMismatch +", tex "+sampleSinkTexMismatch +", depthStencil "+sampleSinkDepthStencilMismatch);
}
@@ -2007,7 +2008,7 @@ public class FBObject {
}
if(DEBUG) {
- System.err.println("FBObject.resetMSAATexture2DSink: END\n\tTHIS "+this+",\n\tSINK "+samplesSink+
+ System.err.println("FBObject.resetSamplingSink: END\n\tTHIS "+this+",\n\tSINK "+samplesSink+
"\n\t size "+sampleSinkSizeMismatch +", tex "+sampleSinkTexMismatch +", depthStencil "+sampleSinkDepthStencilMismatch);
}
}
@@ -2120,10 +2121,12 @@ public class FBObject {
if(samples>0 && samplesSinkDirty) {
samplesSinkDirty = false;
resetSamplingSink(gl);
+ checkPreGLError(gl);
gl.glBindFramebuffer(GL2GL3.GL_READ_FRAMEBUFFER, fbName);
gl.glBindFramebuffer(GL2GL3.GL_DRAW_FRAMEBUFFER, samplesSink.getWriteFramebuffer());
((GL2GL3)gl).glBlitFramebuffer(0, 0, width, height, 0, 0, width, height, // since MSAA is supported, casting to GL2GL3 is OK
GL.GL_COLOR_BUFFER_BIT, GL.GL_NEAREST);
+ checkNoError(null, gl.glGetError(), "FBObject syncSampleSink"); // throws GLException if error
}
if(fullFBOSupport) {
// default read/draw buffers, may utilize GLContext/GLDrawable override of
diff --git a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
index 503b70af7..2620fb1c7 100644
--- a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
@@ -84,7 +84,13 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
private final void initialize(boolean realize, GL gl) {
if(realize) {
final int maxSamples = gl.getMaxRenderbufferSamples();
- samples = samples <= maxSamples ? samples : maxSamples;
+ {
+ final int newSamples = samples <= maxSamples ? samples : maxSamples;
+ if(DEBUG) {
+ System.err.println("GLFBODrawableImpl.initialize(): samples "+samples+" -> "+newSamples+"/"+maxSamples);
+ }
+ samples = newSamples;
+ }
final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) surface.getGraphicsConfiguration().getChosenCapabilities();
final int fbosN;
@@ -189,21 +195,21 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
Throwable tGL = null;
ourContext.makeCurrent();
fboBound = false; // clear bound-flag immediatly, caused by contextMadeCurrent(..) - otherwise we would swap @ release
- try {
+ try {
final int maxSamples = gl.getMaxRenderbufferSamples();
newSamples = newSamples <= maxSamples ? newSamples : maxSamples;
if(0==samples && 0<newSamples || 0<samples && 0==newSamples) {
// MSAA on/off switch
if(DEBUG) {
- System.err.println("GLFBODrawableImpl.reset(): samples [on/off] reconfig: "+samples+" -> "+newSamples);
+ System.err.println("GLFBODrawableImpl.reset(): samples [on/off] reconfig: "+samples+" -> "+newSamples+"/"+maxSamples);
}
initialize(false, gl);
samples = newSamples;
initialize(true, gl);
} else {
if(DEBUG) {
- System.err.println("GLFBODrawableImpl.reset(): simple reconfig: "+samples+" -> "+newSamples);
+ System.err.println("GLFBODrawableImpl.reset(): simple reconfig: "+samples+" -> "+newSamples+"/"+maxSamples);
}
final int nWidth = getWidth();
final int nHeight = getHeight();