From: Juan A. Suarez Romero Date: Mon, 15 Jan 2018 11:10:46 +0000 (+0000) Subject: Check for depth/stencil buffer in default FBO X-Git-Tag: upstream/1.3.5~2789 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ae2e02d8078bd92cf73bf3aeed964fc2c095e2e2;p=platform%2Fupstream%2FVK-GL-CTS.git 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 --- 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