Bug 630

Summary: packed depth stencil extension not properly detected
Product: [JogAmp] Jogl Reporter: ac <andres.colubri>
Component: macosxAssignee: Sven Gothel <sgothel>
Status: RESOLVED FIXED    
Severity: normal CC: andres.colubri
Priority: ---    
Version: 2   
Hardware: pc_all   
OS: macosx   
Type: --- SCM Refs:
jogl dedf4ea7ddab1279602208fa194231ea65409251
Workaround: ---

Description ac 2012-10-23 21:10:56 CEST
Hello, I'm testing fairly recent (16th Oct) autobuilds jogl jars on OSX 10.6, using a 2007 mac Mini with the Intel GMA 950 chipset, and found that if I set the stencil bits of the requested capabilities to 8, then I get the following error:

Exception in thread "AWT-EventQueue-0" javax.media.opengl.GLException: stencil buffer n/a
	at com.jogamp.opengl.FBObject.attachRenderbuffer(FBObject.java:1389)
	at jogamp.opengl.GLFBODrawableImpl.initialize(GLFBODrawableImpl.java:130)
	at jogamp.opengl.GLFBODrawableImpl.contextRealized(GLFBODrawableImpl.java:321)
...

If I set the requested stencil bits to 0, then there is no error. I was surprised about this at first, because if I query the chosen caps I get:

GLCaps[rgba 0x8/8/8/8, opaque, accum-rgba 0/0/0/0, dp/st/ms: 24/8/2, sample-ext default, dbl, mono  , hw, GLProfile[GL2/GL2.hw], offscr[fbo]]

which indicates that the 24/8 bit configurations for the depth and stencil buffers, respectively is supported. On the other hand, it is very likely that only packed depth+stencil buffers are supported (see this this thread for more info http://lists.apple.com/archives/mac-opengl/2008/Aug/msg00089.html).

I checked the source code of FBObject.java and found that the condition to use packed depth+stencil buffer is evaluated in the following line (804)

packedDepthStencilAvail = fullFBOSupport || gl.isExtensionAvailable(GLExtensions.OES_packed_depth_stencil);

fullFBOSupport is false on the GMA 950 for some reason (pgl.gl.hasFullFBOSupport() returns false), but I know for sure that the chipset supports packed depth and stencil because of tests I run earlier. Indeed, manually inspecting the extensions string returned by gl, I found GL_EXT_packed_depth_stencil. However jogl is checking for GL_OES_packed_depth_stencil instead, so I think this is the source of the problem.
Comment 1 Sven Gothel 2012-10-24 12:49:09 CEST
(In reply to comment #0)
> Hello, I'm testing fairly recent (16th Oct) autobuilds jogl jars on OSX 10.6,
> using a 2007 mac Mini with the Intel GMA 950 chipset, 

Thank you for testing on this config, which I don't have available!

> If I set the requested stencil bits to 0, then there is no error. I was
> surprised about this at first, because if I query the chosen caps I get:
> 
> GLCaps[rgba 0x8/8/8/8, opaque, accum-rgba 0/0/0/0, dp/st/ms: 24/8/2, sample-ext
> default, dbl, mono  , hw, GLProfile[GL2/GL2.hw], offscr[fbo]]

Yes, thats a 'fake', i.e. onscreen dp/st/ms config .. sorry.

> 
> which indicates that the 24/8 bit configurations for the depth and stencil
> buffers, respectively is supported. On the other hand, it is very likely that
> only packed depth+stencil buffers are supported (see this this thread for more
> info http://lists.apple.com/archives/mac-opengl/2008/Aug/msg00089.html).
> 
> I checked the source code of FBObject.java and found that the condition to use
> packed depth+stencil buffer is evaluated in the following line (804)
> 
> packedDepthStencilAvail = fullFBOSupport ||
> gl.isExtensionAvailable(GLExtensions.OES_packed_depth_stencil);
> 
> fullFBOSupport is false on the GMA 950 for some reason

full FBO support is only enabled if (GLContext):
              ( isGL3() ||                                                         // GL >= 3.0                
                isExtensionAvailable(GLExtensions.ARB_framebuffer_object) ||       // ARB_framebuffer_object
                ( isExtensionAvailable(GLExtensions.EXT_framebuffer_object) &&     // All EXT_framebuffer_object*
                  isExtensionAvailable(GLExtensions.EXT_framebuffer_multisample) &&
                  isExtensionAvailable(GLExtensions.EXT_framebuffer_blit) &&
                  isExtensionAvailable(GLExtensions.EXT_packed_depth_stencil)

> (pgl.gl.hasFullFBOSupport() returns false), but I know for sure that the
> chipset supports packed depth and stencil because of tests I run earlier.
> Indeed, manually inspecting the extensions string returned by gl, I found
> GL_EXT_packed_depth_stencil. However jogl is checking for
> GL_OES_packed_depth_stencil instead, so I think this is the source of the
> problem.

Yes, can add GLExtensions.EXT_packed_depth_stencil to the above query for packedDepthStencilAvail.

Thank you!
Comment 2 Sven Gothel 2012-10-24 12:54:19 CEST
Fixed w/ commit dedf4ea7ddab1279602208fa194231ea65409251
Comment 3 ac 2012-10-25 17:05:36 CEST
Great, thanks a lot for the quick fix.

Do the most recent autobuilds (jogl-b837-2012-10-23_19-29-45) already incorporate the fix?

(In reply to comment #2)
> Fixed w/ commit dedf4ea7ddab1279602208fa194231ea65409251