From ae2e02d8078bd92cf73bf3aeed964fc2c095e2e2 Mon Sep 17 00:00:00 2001 From: "Juan A. Suarez Romero" Date: Mon, 15 Jan 2018 11:10:46 +0000 Subject: [PATCH] Check for depth/stencil buffer in default FBO The affected tests invoke gl.getNamedFramebufferAttachmentParameteriv() with GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE to get the depth bits used in the default FBO. And something similar is done for the stencil bits. But wrongly it assumes that if the FBO does not have an associated depth or stencil buffer, it would return 0. Rather, this function returns an error if it is invoked in a FBO without a depth/stencil buffer attached. So better check first if the default FBO has a depth/stencil buffer attached, and if so then invoke the above functions to get the depth/stencil bits. Components: OpenGL VK-GL-CTS issue: 969 Affects: KHR-*.internalformat.renderbuffer.* Change-Id: I74d28d5d089790fed4dd2728cb5143e7c03d7442 --- .../modules/common/glcInternalformatTests.cpp | 23 ++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/external/openglcts/modules/common/glcInternalformatTests.cpp b/external/openglcts/modules/common/glcInternalformatTests.cpp index 74b8ea2..f5deb48 100644 --- a/external/openglcts/modules/common/glcInternalformatTests.cpp +++ b/external/openglcts/modules/common/glcInternalformatTests.cpp @@ -979,8 +979,8 @@ tcu::TestNode::IterateResult RenderbufferCase::iterate(void) testSurface[0].setSize(m_renderWidth, m_renderHeight); testSurface[1].setSize(m_renderWidth, m_renderHeight); - GLint defaultFramebufferDepthBits = 16; - GLint defaultFramebufferStencilBits = 8; + GLint defaultFramebufferDepthBits = 0; + GLint defaultFramebufferStencilBits = 0; if (glu::isContextTypeES(m_context.getRenderContext().getType())) { gl.getIntegerv(GL_DEPTH_BITS, &defaultFramebufferDepthBits); @@ -988,10 +988,21 @@ tcu::TestNode::IterateResult RenderbufferCase::iterate(void) } else { - gl.getNamedFramebufferAttachmentParameteriv(0, GL_DEPTH, GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE, - &defaultFramebufferDepthBits); - gl.getNamedFramebufferAttachmentParameteriv(0, GL_STENCIL, GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE, - &defaultFramebufferStencilBits); + GLint hasDepthBuffer = 0; + GLint hasStencilBuffer = 0; + + gl.getNamedFramebufferAttachmentParameteriv(0, GL_DEPTH, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, + &hasDepthBuffer); + gl.getNamedFramebufferAttachmentParameteriv(0, GL_STENCIL, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, + &hasStencilBuffer); + + if (hasDepthBuffer != GL_NONE) + gl.getNamedFramebufferAttachmentParameteriv(0, GL_DEPTH, GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE, + &defaultFramebufferDepthBits); + + if (hasStencilBuffer != GL_NONE) + gl.getNamedFramebufferAttachmentParameteriv(0, GL_STENCIL, GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE, + &defaultFramebufferStencilBits); } // Create program that will render texture to screen -- 2.7.4