Bug 28551

Summary: GetFramebufferAttachmentParameteriv() should work on the onscreen framebuffer
Product: Mesa Reporter: Emmanuele Bassi (:ebassi) <ebassi>
Component: Mesa coreAssignee: Kristian Høgsberg <krh>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Emmanuele Bassi (:ebassi) 2010-06-15 06:09:05 UTC
according to the ARB_framebuffer_object spec, using glGetFramebufferAttachmentParameteriv() on GL_FRAMEBUFFER to retrieve the size of the colors like this:

  GLenum attachment = GL_COLOR_ATTACHMENT0;
  GLenum pname = GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE;

  glGetFramebufferAttachmentParameteriv (GL_FRAMEBUFFER,
                                         attachment,
                                         pname,
                                         &red_bits);

should be functionally equivalent to:

  glGetIntegerv (GL_RED_BITS, &red_bits);

in Mesa, the former works for any FBO, but it doesn't work for the default onscreen framebuffer.
Comment 1 Kristian Høgsberg 2010-06-15 10:30:50 UTC
Added a piglit test case and this commit in mesa:

commit 80dfec3e53fd5b5c8c31fb16376c9910258c91b0
Refs: master, <origin/HEAD>, <origin/master>, mesa_7_6_1_rc1-8853-g80dfec3
Author:     Kristian Høgsberg <krh@bitplanet.net>
AuthorDate: Tue Jun 15 13:07:01 2010 -0400
Commit:     Kristian Høgsberg <krh@bitplanet.net>
CommitDate: Tue Jun 15 13:28:38 2010 -0400

    mesa: Allow querying the system FBO in GetFramebufferAttachmentParameteriv

            If the default framebuffer is bound to <target>, then
            <attachment> must be one of FRONT_LEFT, FRONT_RIGHT, BACK_LEFT,
            BACK_RIGHT, AUXi, DEPTH_BUFFER, or STENCIL_BUFFER, identifying a
            color buffer, the depth buffer, or the stencil buffer, and
            <pname> may be FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE or
            FRAMEBUFFER_ATTACHMENT_OBJECT_NAME.

    as well as these <pname> values

            FRAMEBUFFER_ATTACHMENT_RED_SIZE,
            FRAMEBUFFER_ATTACHMENT_GREEN_SIZE,
            FRAMEBUFFER_ATTACHMENT_BLUE_SIZE,
            FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE,
            FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE,
            FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE,
            FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE, or
            FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING.

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.