Use the correct attachment parameter when not the default FBO
authorPiers Daniell <pdaniell@nvidia.com>
Mon, 10 Jan 2022 23:14:49 +0000 (16:14 -0700)
committerMatthew Netsch <quic_mnetsch@quicinc.com>
Sat, 15 Jan 2022 05:54:48 +0000 (05:54 +0000)
When using glGetFramebufferAttachmentParameteriv to query the
currently bound framebuffer, the attachment parameter is
different depending on whether the framebuffer is the default
framebuffer or not.

For the default framebuffer GL_DEPTH and GL_STENCIL can be
used, but for non-default these are invalid and
GL_DEPTH_ATTACHMENT and GL_STENCIL_ATTACHMENT must be used.

This CL updates the changes in CL 8180 and CL 8629 to
use the correct attachment parameter when not using
the default framebuffer.

VK-GL-CTS issue: 3092

Affects:
KHR-*.internalformat.renderbuffer.*

Test both with and without: --deqp-surface-type=fbo

Change-Id: Id5f27405861ec62b5fdd84e1a4c2668d8cb272a1

external/openglcts/modules/common/glcInternalformatTests.cpp

index 28adfd0..cd6859a 100644 (file)
@@ -1161,17 +1161,18 @@ tcu::TestNode::IterateResult RenderbufferCase::iterate(void)
        {
                GLint hasDepthBuffer    = 0;
                GLint hasStencilBuffer  = 0;
+               bool  defaultFboIsZero  = m_context.getRenderContext().getDefaultFramebuffer() == 0;
 
                if (separateDepth)
-                       gl.getFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_DEPTH, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &hasDepthBuffer);
+                       gl.getFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, (defaultFboIsZero) ? GL_DEPTH : GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &hasDepthBuffer);
                if (separateStencil)
-                       gl.getFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_STENCIL, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &hasStencilBuffer);
+                       gl.getFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, (defaultFboIsZero) ? GL_STENCIL : GL_STENCIL_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &hasStencilBuffer);
 
                if (hasDepthBuffer != GL_NONE)
-                       gl.getFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_DEPTH, GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE,
+                       gl.getFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, (defaultFboIsZero) ? GL_DEPTH : GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE,
                                                               &defaultFramebufferDepthBits);
                if (hasStencilBuffer != GL_NONE)
-                       gl.getFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_STENCIL, GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE,
+                       gl.getFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, (defaultFboIsZero) ? GL_STENCIL : GL_STENCIL_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE,
                                                               &defaultFramebufferStencilBits);
        }