glGetFramebufferAttachmentParameteriv() returns GL_INVALID_ENUM when getting attachment size from back buffer
Submitted by nfx..@..il.com
Assigned to mes..@..op.org
Link to original bug (#100609)
Description
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.
Version: 17.0