<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - glGetFramebufferAttachmentParameteriv failing if certain FB attributes are zero"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=90162">90162</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>glGetFramebufferAttachmentParameteriv failing if certain FB attributes are zero
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Mesa
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>10.1
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux (All)
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>GLX
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>mesa-dev@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>martina.kollarova@intel.com
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>mesa-dev@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=115302" name="attach_115302" title="reproducer.output">attachment 115302</a> <a href="attachment.cgi?id=115302&action=edit" title="reproducer.output">[details]</a></span>
reproducer.output

The command
glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_DEPTH,
GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE, &depth_bits)
fails with GL_INVALID_OPERATION if the attribute GLX_DEPTH_SIZE is set to 0 (or
not explicitly set) in the FB config.

The same happens with the command
glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_STENCIL,
GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE, &stencil_bits)
if GLX_STENCIL_SIZE is set to 0 or not explicitly set.

You can reproduce those two cases with
<a href="https://github.com/mkollaro/opengl_snippets/blob/getattachments/glx/main.cpp">https://github.com/mkollaro/opengl_snippets/blob/getattachments/glx/main.cpp</a>
(after building, run with `./build/bin/glx`). My output is in the attachments
as `reproducer.output`.

Additionally, if GLX_DOUBLEBUFFER is set to false, the command
glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_BACK_LEFT,
GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, &alpha_bits);
also fails with GL_INVALID_OPERATION, but not if set to true. This error
happened to me in the Chromium project, but I cannot reproduce it in the above
mentioned code, because I somehow cannot get a context with GLX_DOUBLEBUFFER
set to false (this is probably just my mistake).

I would expect this command to return zero if e.g. the depth size is set to
zero, or at least use some more informative error message, since the command is
correct and only the framebuffer configuration is wrong.

My system is Linux Mint 17.1 Rebecca, more info in the glxinfo.output
attachment.

lspci -vnn|grep VGA
00:02.0 VGA compatible controller [0300]: Intel Corporation 4th Gen Core
Processor Integrated Graphics Controller [8086:0416] (rev 06) (prog-if 00 [VGA
controller])
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation Device [10de:13d8]
(rev a1) (prog-if 00 [VGA controller])</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>