diff options
author | Sven Gothel <[email protected]> | 2019-09-05 05:38:25 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2019-09-05 05:38:25 +0200 |
commit | 90760ac8eebe7431ac7392e4ebf3f9009e63cd72 (patch) | |
tree | 6e903a56a3fc168e9c682e787fbd3cc239c990e1 | |
parent | b90fcb88cf208dad27402256e4f08659b17ba567 (diff) |
Bug 1390: Fix GLPixelBuffer.GLPixelAttributes::convert(GL, int, boolean) failure on unsupported GL data format/type
GLPixelBuffer.GLPixelAttributes::convert(GL, int, boolean) failed on unsupported GL data format/type
On Mesa/AMD for GLPBuffer chosen GLCaps used rgba 10/10/10/2
and the GLContext set default values:
GL_IMPLEMENTATION_COLOR_READ_FORMAT: 0x1908 GL_RGBA
GL_IMPLEMENTATION_COLOR_READ_TYPE: 0x8368 GL_UNSIGNED_INT_2_10_10_10_REV
GLPixelBuffer.GLPixelAttributes::getPixelFormat(int format, int type)
currently does not handle the type GL_UNSIGNED_INT_2_10_10_10_REV
and hence returned a null PixelFormat.
Therefor the ctor GLPixelAttributes failed and threw the exception:
"Caught GLException: Could not find PixelFormat for format and/or type:
PixelAttributes[fmt 0x1908, type 0x8368, null]"
This fix has the GLContext default values pre-validated in the convert(..) method
and to use default GL_RGBA and GL_UNSIGNED_BYTE fallback values if not supported.
This is most important to be future proof.
Later we may shall add these 32bit coding 2+10+10+10 and its reverse.
-rwxr-xr-x | make/scripts/make.jogl.all.linux-x86_64.sh | 1 | ||||
-rwxr-xr-x | make/scripts/make.jogl.all.macosx.sh | 1 | ||||
-rw-r--r-- | make/scripts/tests.sh | 17 | ||||
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java | 24 |
4 files changed, 31 insertions, 12 deletions
diff --git a/make/scripts/make.jogl.all.linux-x86_64.sh b/make/scripts/make.jogl.all.linux-x86_64.sh index dd01bfed7..1b8af2bbc 100755 --- a/make/scripts/make.jogl.all.linux-x86_64.sh +++ b/make/scripts/make.jogl.all.linux-x86_64.sh @@ -53,5 +53,6 @@ export JOGAMP_JAR_CODEBASE="Codebase: *.goethel.localnet" ant \ $CUSTOMLIBDIR \ -Drootrel.build=build-x86_64 \ + -Djunit.run.arg0="--illegal-access=warn" \ $* 2>&1 | tee -a $LOGF diff --git a/make/scripts/make.jogl.all.macosx.sh b/make/scripts/make.jogl.all.macosx.sh index 1f9cd4941..468238a4a 100755 --- a/make/scripts/make.jogl.all.macosx.sh +++ b/make/scripts/make.jogl.all.macosx.sh @@ -29,4 +29,5 @@ export JOGAMP_JAR_CODEBASE="Codebase: *.goethel.localnet" # BUILD_ARCHIVE=true \ ant \ -Drootrel.build=build-macosx \ + -Djunit.run.arg0="--illegal-access=warn" \ $* 2>&1 | tee make.jogl.all.macosx.log diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 7432728a7..c1b2459d2 100644 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -99,13 +99,13 @@ function jrun() { swton=$1 shift - D_ARGS="-Djogl.quirks.force=GL3CompatNonCompliant,NoSurfacelessCtx -Djogl.debug.GLProfile -Djogl.debug.GLContext -Djogl.disable.opengles" - #D_ARGS="-Djogl.debug.GLProfile -Djogl.debug.GLContext -Djogl.disable.opengles" + #D_ARGS="-Djogl.debug.GLProfile -Djogl.debug.GLContext" #D_ARGS="-Djogl.debug.GLProfile" #D_ARGS="-Djogl.debug.DebugGL" #D_ARGS="-Djogl.debug.TraceGL" #D_ARGS="-Djogl.debug.DebugGL -Djogl.debug.TraceGL" #D_ARGS="-Djogl.debug.DebugGL -Djogl.debug.TraceGL -Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all" + #D_ARGS="-Djogl.debug.GLProfile -Djogl.debug.GLContext -Djogl.quirks.force=GL3CompatNonCompliant,NoSurfacelessCtx -Djogl.disable.opengles" #D_ARGS="-Djogamp.debug=all" #D_ARGS="-Dnativewindow.debug=all" @@ -116,6 +116,8 @@ function jrun() { #D_ARGS="-Djogl.debug=all -Dnativewindow.debug=all" #D_ARGS="-Djogamp.debug=all -Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all" + D_ARGS="-Dnativewindow.debug.JAWT -Djogamp.debug.UnsafeUtil" + X_ARGS="--illegal-access=warn" #D_ARGS="-Djogamp.debug.NativeLibrary=true -Djogamp.debug.JNILibLoader=true" #D_ARGS="-Djogl.debug.GLContext -Djogamp.debug.NativeLibrary -Djogamp.debug.JNILibLoader -Djogl.debug.DebugGL -Djogl.debug.GLDebugMessageHandler" #D_ARGS="-Djogamp.debug.ProcAddressHelper -Djogamp.debug.NativeLibrary -Djogamp.debug.NativeLibrary.Lookup -Djogamp.debug.JNILibLoader -Djogl.debug.GLContext" @@ -438,7 +440,7 @@ function testawtswt() { #testnoawt com.jogamp.newt.opengl.GLWindow $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLVersionParsing00NEWT $* -testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLWindowNEWT $* +#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLWindowNEWT $* #testawt com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLCanvasAWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile00NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile01NEWT $* @@ -939,10 +941,15 @@ testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLWindowNEWT $* #testnoawt com.jogamp.opengl.test.junit.newt.mm.TestScreenMode02aNEWT # -# regressions +# 2.4.0 Regressions # +# OSX +#testawt com.jogamp.opengl.test.junit.jogl.demos.gl2.awt.TestGearsAWT $* +#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting01dAWT $* -#linux: +#linux Mesa/AMD: +#testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestGLReadBufferUtilTextureIOWrite01NEWT $* +testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestBug817GLReadBufferUtilGLCTXDefFormatTypeES2NEWT $* # ATI/Linux: XCB Unknown request in queue while dequeuing # Most likely this is a multi-threaded client and XInitThreads has not been called diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java b/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java index 0e3497bd4..845c23080 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java @@ -321,14 +321,24 @@ public class GLPixelBuffer { } else if( 4 == componentCount || glesReadMode ) { final GLContext ctx = gl.getContext(); final int _dFormat = ctx.getDefaultPixelDataFormat(); - final int dComps = GLBuffers.componentCount(_dFormat); - if( dComps == componentCount || 4 == dComps ) { // accept if desired component count or 4 components - dFormat = _dFormat; - dType = ctx.getDefaultPixelDataType(); - } else { - dFormat = GL.GL_RGBA; - dType = GL.GL_UNSIGNED_BYTE; + final int _dComps = GLBuffers.componentCount(_dFormat); + if( _dComps == componentCount || 4 == _dComps ) { // accept if desired component count or 4 components + // pre-check whether default is supported by implementation + final int _dType = ctx.getDefaultPixelDataType(); + final PixelFormat _pixFmt = getPixelFormat(_dFormat, _dType); + if( null != _pixFmt) { + return new GLPixelAttributes(null, _pixFmt, _dFormat, _dType, pack, true); + } + if( GLContext.DEBUG ) { + System.err.println("GLPixelAttributes.convert("+gl.getGLProfile()+", comps "+componentCount+", pack "+pack+ + "): GL-impl default unsupported: "+ + "[fmt 0x"+Integer.toHexString(_dFormat)+", type 0x"+Integer.toHexString(_dType)+"]: Using std RGBA+UBYTE"); + Thread.dumpStack(); + } + // fall-through intended to set dFormat/dType to std values } + dFormat = GL.GL_RGBA; + dType = GL.GL_UNSIGNED_BYTE; } else { return null; } |