Bug 100609

Summary: glGetFramebufferAttachmentParameteriv() returns GL_INVALID_ENUM when getting attachment size from back buffer
Product: Mesa Reporter: nfxjfg
Component: Mesa coreAssignee: mesa-dev
Status: RESOLVED MOVED QA Contact: mesa-dev
Severity: normal    
Priority: medium    
Version: 17.0   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description nfxjfg 2017-04-07 09:34:05 UTC
I'm doing this to determine the default framebuffer depth in "generic" GL code that can't access GLX or EGL:

    glBindFramebuffer(GL_FRAMEBUFFER, 0);
    glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_BACK_LEFT, GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE, &depth_g);

This would be in OpenGL 3 (not sure which versions exactly, probably 3.0 and 3.3 at least).

Mesa causes a GL_INVALID_ENUM error, while nVidia binary drivers accept this and return the expected value.

The GL 3 spec is not entirely clear on this, but there seems to be nothing that disallows using glGetFramebufferAttachmentParameteriv() like this. Some other GL implementations also seem to support it. So I would tend towards considering this a Mesa bug, but of course I'm not sure.

I think this has been happening at least with Mesa 11, up to at least 17.0.2.

The above snippet is simplified from: https://github.com/mpv-player/mpv/blob/master/video/out/opengl/utils.c#L1282
mpv itself might serve as use-case, although current releases use an older version of this code.
Comment 1 nfxjfg 2017-04-07 09:35:04 UTC
By the way, I'm not sure, but this test seems to trigger this case, and expects that it doesn't trigger an error?
https://cgit.freedesktop.org/piglit/tree/tests/bugs/fdo28551.c
Comment 2 GitLab Migration User 2019-09-18 20:25:52 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/1009.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.