Bug 30993

Summary: getFramebufferAttachmentParameteriv wrongly generates error
Product: Mesa Reporter: Zhenyao Mo <zmo>
Component: Mesa coreAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: proposed fix/patch

Description Zhenyao Mo 2010-10-19 15:52:38 UTC
when the value of GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is GL_NONE, querying pname GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME should return zero.  Currently GL_INVALID_ENUM is generated.
Comment 1 Brian Paul 2010-10-19 16:09:15 UTC
Created attachment 39558 [details] [review]
proposed fix/patch

Can you test the attached patch?
Comment 2 Ian Romanick 2010-10-19 16:35:01 UTC
Mesa is correct in generating GL_INVALID_ENUM when the object type is not one of GL_TEXTURE or GL_RENDERBUFFER.  The GL_ARB_framebuffer_objects spec says:

            "If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is
            RENDERBUFFER, then

                ...

            If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is
            TEXTURE, then

                ...

            Otherwise, an INVALID_ENUM error is generated."
Comment 3 Brian Paul 2010-10-19 16:38:49 UTC
I looked at the GL_ARB_fbo spec too, but the GL 3.3 spec says (page 276):

"""If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is NONE, no
framebuffer is bound to target. In this case querying pname FRAMEBUFFER_-
ATTACHMENT_OBJECT_NAME will return zero, and all other queries will generate
an INVALID_OPERATION error.
"""

Though I guess since we don't yet support GL 3.3 the code is OK as-is.
Comment 4 Ian Romanick 2010-10-19 17:03:00 UTC
(In reply to comment #3)
> I looked at the GL_ARB_fbo spec too, but the GL 3.3 spec says (page 276):
> 
> """If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is NONE, no
> framebuffer is bound to target. In this case querying pname FRAMEBUFFER_-
> ATTACHMENT_OBJECT_NAME will return zero, and all other queries will generate
> an INVALID_OPERATION error.
> """
> 
> Though I guess since we don't yet support GL 3.3 the code is OK as-is.

ARG!  The same language is in the 3.0 spec, and GL_ARB_framebuffer_objects is supposed to match 3.0.  It seems we've found a spec bug.  I've submitted a bug against the GL_ARB_framebuffer_objects spec.

I've also added piglit test fbo-getframebufferattachmentparameter-01 the reproduces this bug and another similar bug.
Comment 5 Zhenyao Mo 2010-10-19 17:22:20 UTC
(In reply to comment #1)
> Created an attachment (id=39558) [details]
> proposed fix/patch
> 
> Can you test the attached patch?

Tested, the fix works for me.
Comment 6 Brian Paul 2010-12-03 07:25:41 UTC
I've committed the previously attached patch.

The fbo-getframebufferattachmentparameter-01 test does not pass yet but Mesa fails in the same way as NVIDIA's driver.
Comment 7 Marek Olšák 2011-03-02 09:33:34 UTC
Closing because the fix has been committed.

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.