Bug 31843 - Some OpenGL drivers don't support DEPTH_ATTACHMENT16
Summary: Some OpenGL drivers don't support DEPTH_ATTACHMENT16
Status: ASSIGNED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGL (show other bugs)
Version: 528+ (Nightly build)
Hardware: All OS X 10.5
: P2 Normal
Assignee: Kenneth Russell
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-24 11:56 PST by Chris Marrin
Modified: 2012-12-22 02:34 PST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Marrin 2009-11-24 11:56:45 PST
This causes LayoutTests/fast/canvas/webgl/gl-object-get-calls.html to fail. For now I have changed the test to use DEPTH_ATTACHMENT, which I think all drivers support.
Comment 1 Oliver Hunt 2009-12-01 21:53:04 PST
This should be raised in the WG -- which is the minimum to provide?
Comment 2 Kenneth Russell 2009-12-02 00:32:52 PST
We don't yet know exactly why this test case is failing. Even after changing it to use DEPTH_ATTACHMENT, which is used by the internal FBO allocated by the WebKit WebGL implementation on OS X, the test still fails on the commit bots. More experimentation is needed to understand why the test is failing.

In the various implementations we will probably need to translate DEPTH_ATTACHMENT16 to some other enum better supported on desktop OpenGL. This is legal to do because the get queries explicitly state that the FBO's renderbuffer attachments might be promoted to larger sizes.
Comment 3 Chris Marrin 2009-12-02 10:15:59 PST
I'm not sure this has anything to do with DEPTH_ATTACHMENT16. What's happening is that the FBO is not complete, so it's returning an error that says that. Looking at the FBO code in GraphicsContextMac.cpp, I am calling:

    ::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);

I notice that in the test case, the third param is RGBA. Maybe that's not legal, and maybe some drivers are more picky about it?

We definitely need to support DEPTH_ATTACHMENT16 since it is required by GLES 2.0. We may have to translate it in some implementations.
Comment 4 Kenneth Russell 2009-12-02 10:28:55 PST
(In reply to comment #3)
> I'm not sure this has anything to do with DEPTH_ATTACHMENT16. What's happening
> is that the FBO is not complete, so it's returning an error that says that.
> Looking at the FBO code in GraphicsContextMac.cpp, I am calling:
> 
>     ::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 1, 1, 0, GL_RGBA,
> GL_UNSIGNED_BYTE, 0);
> 
> I notice that in the test case, the third param is RGBA. Maybe that's not
> legal, and maybe some drivers are more picky about it?

I noticed that difference too. However OpenGL ES doesn't expose the GL_RGBA8 constant, and the ES docs for glTexImage2D indicate that GL_RGBA is the only valid RGBA internal format constant. (GL_RGBA4, etc. are used only for glRenderbufferStorage.) One thing we will need to try is converting a texture's internal format of GL_RGBA to an internal format of GL_RGBA8.
Comment 5 Chris Marrin 2009-12-02 10:44:13 PST
RIght, but remember the bots are OpenGL, not OpenGL ES. Maybe as a test you could try passing in the code for RGBA8 and see if that makes a difference? It would be really nice if checkFramebufferStatus gave some decent info about the failure.
Comment 6 Chris Marrin 2009-12-02 10:54:59 PST
Ah, I think I may know what the problem is. The error being returned is FRAMEBUFFER_UNSUPPORTED. That's not one of the errors that checkFramebufferStatus is supposed to return. I wonder if it means that the version of OpenGL that is running on that machine does not support FBO's at all? They are an extension in in OpenGL so support is not guaranteed.

Perhaps you could add some diagnostics that checks the availability of the FBO extension and fails gracefully if not. It will still fail the test, but with a more clear error message.

If that's the case, we will need to implement FBOs on such machines using pbuffers or something.
Comment 7 Kenneth Russell 2009-12-02 11:09:53 PST
(In reply to comment #6)
> Ah, I think I may know what the problem is. The error being returned is
> FRAMEBUFFER_UNSUPPORTED. That's not one of the errors that
> checkFramebufferStatus is supposed to return. I wonder if it means that the
> version of OpenGL that is running on that machine does not support FBO's at
> all? They are an extension in in OpenGL so support is not guaranteed.

GL_FRAMEBUFFER_UNSUPPORTED is a valid return value from glCheckFramebufferStatus. There's a typo in the man page at http://www.khronos.org/opengles/sdk/docs/man/glCheckFramebufferStatus.xml but the ES 2.0 spec has it right. (See section 4.4, Framebuffer Objects, page 116.)

Because the FBO the implementation allocates internally works (the other tests, including your triangle test, pass on the commit bots), I assume we just need to translate some constant or another to one better supported on desktop OpenGL.

I'll start experimenting with this shortly.