13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*------------------------------------------------------------------------- 23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program OpenGL ES 3.0 Module 33c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * ------------------------------------------------- 43c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 53c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Copyright 2014 The Android Open Source Project 63c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 73c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Licensed under the Apache License, Version 2.0 (the "License"); 83c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * you may not use this file except in compliance with the License. 93c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * You may obtain a copy of the License at 103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * http://www.apache.org/licenses/LICENSE-2.0 123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Unless required by applicable law or agreed to in writing, software 143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * distributed under the License is distributed on an "AS IS" BASIS, 153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * See the License for the specific language governing permissions and 173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * limitations under the License. 183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*! 203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \file 213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Fbo state query tests. 223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "es3fFboStateQueryTests.hpp" 253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glsStateQueryUtil.hpp" 263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "es3fApiCase.hpp" 273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluRenderContext.hpp" 283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwEnums.hpp" 293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwFunctions.hpp" 303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuRenderTarget.hpp" 313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deMath.h" 323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 333c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing namespace glw; // GLint and other GL types 343c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing deqp::gls::StateQueryUtil::StateQueryMemoryWriteGuard; 353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 373c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp 383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 393c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace gles3 403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 413c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace Functional 423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 433c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace 443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 463c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid checkAttachmentComponentSizeAtLeast (tcu::TestContext& testCtx, glu::CallLogWrapper& gl, GLenum target, GLenum attachment, int r, int g, int b, int a, int d, int s) 473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry using tcu::TestLog; 493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int referenceSizes[] = {r, g, b, a, d, s}; 513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const GLenum paramNames[] = 523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE, GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE, 543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE, GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, 553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE, GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(referenceSizes) == DE_LENGTH_OF_ARRAY(paramNames)); 593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(referenceSizes); ++ndx) 613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (referenceSizes[ndx] == -1) 633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry continue; 643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry StateQueryMemoryWriteGuard<GLint> state; 663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.glGetFramebufferAttachmentParameteriv(target, attachment, paramNames[ndx], &state); 673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (!state.verifyValidity(testCtx)) 693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.glGetError(); // just log the error 713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry continue; 723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (state < referenceSizes[ndx]) 753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry testCtx.getLog() << TestLog::Message << "// ERROR: Expected greater or equal to " << referenceSizes[ndx] << "; got " << state << TestLog::EndMessage; 773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (testCtx.getTestResult() == QP_TEST_RESULT_PASS) 783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry testCtx.setTestResult(QP_TEST_RESULT_FAIL, "got invalid value"); 793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 833c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid checkAttachmentComponentSizeExactly (tcu::TestContext& testCtx, glu::CallLogWrapper& gl, GLenum target, GLenum attachment, int r, int g, int b, int a, int d, int s) 843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry using tcu::TestLog; 863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int referenceSizes[] = {r, g, b, a, d, s}; 883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const GLenum paramNames[] = 893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE, GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE, 913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE, GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, 923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE, GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(referenceSizes) == DE_LENGTH_OF_ARRAY(paramNames)); 963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(referenceSizes); ++ndx) 983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (referenceSizes[ndx] == -1) 1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry continue; 1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry StateQueryMemoryWriteGuard<GLint> state; 1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.glGetFramebufferAttachmentParameteriv(target, attachment, paramNames[ndx], &state); 1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (!state.verifyValidity(testCtx)) 1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.glGetError(); // just log the error 1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry continue; 1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (state != referenceSizes[ndx]) 1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry testCtx.getLog() << TestLog::Message << "// ERROR: Expected " << referenceSizes[ndx] << "; got " << state << TestLog::EndMessage; 1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (testCtx.getTestResult() == QP_TEST_RESULT_PASS) 1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry testCtx.setTestResult(QP_TEST_RESULT_FAIL, "got invalid value"); 1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid checkIntEquals (tcu::TestContext& testCtx, GLint got, GLint expected) 1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry using tcu::TestLog; 1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (got != expected) 1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry testCtx.getLog() << TestLog::Message << "// ERROR: Expected " << expected << "; got " << got << TestLog::EndMessage; 1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (testCtx.getTestResult() == QP_TEST_RESULT_PASS) 1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry testCtx.setTestResult(QP_TEST_RESULT_FAIL, "got invalid value"); 1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid checkIntEqualsAny (tcu::TestContext& testCtx, GLint got, GLint expected0, GLint expected1) 1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry using tcu::TestLog; 1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (got != expected0 && got != expected1) 1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry testCtx.getLog() << TestLog::Message << "// ERROR: Expected " << expected0 << " or " << expected1 << "; got " << got << TestLog::EndMessage; 1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (testCtx.getTestResult() == QP_TEST_RESULT_PASS) 1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry testCtx.setTestResult(QP_TEST_RESULT_FAIL, "got invalid value"); 1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid checkAttachmentParam(tcu::TestContext& testCtx, glu::CallLogWrapper& gl, GLenum target, GLenum attachment, GLenum pname, GLenum reference) 1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry StateQueryMemoryWriteGuard<GLint> state; 1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gl.glGetFramebufferAttachmentParameteriv(target, attachment, pname, &state); 1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (state.verifyValidity(testCtx)) 1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkIntEquals(testCtx, state, reference); 1513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid checkColorAttachmentParam(tcu::TestContext& testCtx, glu::CallLogWrapper& gl, GLenum target, GLenum pname, GLenum reference) 1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkAttachmentParam(testCtx, gl, target, GL_COLOR_ATTACHMENT0, pname, reference); 1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass DefaultFramebufferCase : public ApiCase 1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DefaultFramebufferCase (Context& context, const char* name, const char* description, GLenum framebufferTarget) 1623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : ApiCase (context, name, description) 1633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_framebufferTarget (framebufferTarget) 1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void test (void) 1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const bool hasColorBuffer = m_context.getRenderTarget().getPixelFormat().redBits > 0 || 1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_context.getRenderTarget().getPixelFormat().greenBits > 0 || 1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_context.getRenderTarget().getPixelFormat().blueBits > 0 || 1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_context.getRenderTarget().getPixelFormat().alphaBits > 0; 1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const GLenum attachments[] = 1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_BACK, 1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_DEPTH, 1773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_STENCIL 1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 1793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const bool attachmentExists[] = 1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry hasColorBuffer, 1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_context.getRenderTarget().getDepthBits() > 0, 1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_context.getRenderTarget().getStencilBits() > 0 1843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 1853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(attachments); ++ndx) 1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry StateQueryMemoryWriteGuard<GLint> state; 1893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGetFramebufferAttachmentParameteriv(m_framebufferTarget, attachments[ndx], GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &state); 1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (state.verifyValidity(m_testCtx)) 1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (attachmentExists[ndx]) 1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkIntEquals(m_testCtx, state, GL_FRAMEBUFFER_DEFAULT); 1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else 1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // \note [jarkko] FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE "identifes the type of object which contains the attached image". However, it 2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // is unclear if an object of type FRAMEBUFFER_DEFAULT can contain a null image (or a 0-bits-per-pixel image). Accept both 2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // FRAMEBUFFER_DEFAULT and NONE as valid results in these cases. 2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkIntEqualsAny(m_testCtx, state, GL_FRAMEBUFFER_DEFAULT, GL_NONE); 2043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2093c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 2103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLenum m_framebufferTarget; 2113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass AttachmentObjectCase : public ApiCase 2143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2153c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 2163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry AttachmentObjectCase (Context& context, const char* name, const char* description) 2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : ApiCase(context, name, description) 2183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void test (void) 2223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint framebufferID = 0; 2243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGenFramebuffers(1, &framebufferID); 2253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBindFramebuffer(GL_FRAMEBUFFER, framebufferID); 2263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 2273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // initial 2293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkAttachmentParam(m_testCtx, *this, GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, GL_NONE); 2313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkAttachmentParam(m_testCtx, *this, GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, 0); 2323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 2333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // texture 2363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint textureID = 0; 2383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGenTextures(1, &textureID); 2393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBindTexture(GL_TEXTURE_2D, textureID); 2403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 128, 128, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL); 2413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 2423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureID, 0); 2443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 2453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkColorAttachmentParam(m_testCtx, *this, GL_FRAMEBUFFER, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, GL_TEXTURE); 2473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkColorAttachmentParam(m_testCtx, *this, GL_FRAMEBUFFER, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, textureID); 2483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0); 2503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glDeleteTextures(1, &textureID); 2513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // rb 2543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint renderbufferID = 0; 2563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGenRenderbuffers(1, &renderbufferID); 2573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBindRenderbuffer(GL_RENDERBUFFER, renderbufferID); 2583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glRenderbufferStorage(GL_RENDERBUFFER, GL_RGB8, 128, 128); 2593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 2603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, renderbufferID); 2623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 2633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkColorAttachmentParam(m_testCtx, *this, GL_FRAMEBUFFER, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, GL_RENDERBUFFER); 2653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkColorAttachmentParam(m_testCtx, *this, GL_FRAMEBUFFER, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, renderbufferID); 2663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 0); 2683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glDeleteRenderbuffers(1, &renderbufferID); 2693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glDeleteFramebuffers(1, &framebufferID); 2723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 2733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 2753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2763c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass AttachmentTextureLevelCase : public ApiCase 2773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2783c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 2793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry AttachmentTextureLevelCase (Context& context, const char* name, const char* description) 2803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : ApiCase(context, name, description) 2813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void test (void) 2853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint framebufferID = 0; 2873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGenFramebuffers(1, &framebufferID); 2883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBindFramebuffer(GL_FRAMEBUFFER, framebufferID); 2893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 2903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int mipmapLevel = 0; mipmapLevel < 7; ++mipmapLevel) 2923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint textureID = 0; 2943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGenTextures(1, &textureID); 2953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBindTexture(GL_TEXTURE_2D, textureID); 2963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glTexStorage2D(GL_TEXTURE_2D, 7, GL_RGB8, 128, 128); 2973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 2983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureID, mipmapLevel); 3003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 3013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkColorAttachmentParam(m_testCtx, *this, GL_FRAMEBUFFER, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL, mipmapLevel); 3033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0); 3053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glDeleteTextures(1, &textureID); 3063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glDeleteFramebuffers(1, &framebufferID); 3093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 3103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 3123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3133c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass AttachmentTextureCubeMapFaceCase : public ApiCase 3143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3153c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 3163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry AttachmentTextureCubeMapFaceCase (Context& context, const char* name, const char* description) 3173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : ApiCase(context, name, description) 3183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void test (void) 3223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint framebufferID = 0; 3243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGenFramebuffers(1, &framebufferID); 3253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBindFramebuffer(GL_FRAMEBUFFER, framebufferID); 3263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 3273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint textureID = 0; 3303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGenTextures(1, &textureID); 3313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBindTexture(GL_TEXTURE_CUBE_MAP, textureID); 3323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 3333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glTexStorage2D(GL_TEXTURE_CUBE_MAP, 1, GL_RGB8, 128, 128); 3353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 3363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const GLenum faces[] = 3383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 3403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 3413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 3423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 3433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(faces); ++ndx) 3453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, faces[ndx], textureID, 0); 3473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkColorAttachmentParam(m_testCtx, *this, GL_FRAMEBUFFER, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE, faces[ndx]); 3483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0); 3513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glDeleteTextures(1, &textureID); 3523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glDeleteFramebuffers(1, &framebufferID); 3553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 3563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 3583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3593c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass AttachmentTextureLayerCase : public ApiCase 3603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3613c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 3623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry AttachmentTextureLayerCase (Context& context, const char* name, const char* description) 3633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : ApiCase(context, name, description) 3643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void test (void) 3683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint framebufferID = 0; 3703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGenFramebuffers(1, &framebufferID); 3713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBindFramebuffer(GL_FRAMEBUFFER, framebufferID); 3723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 3733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // tex3d 3753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint textureID = 0; 3773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGenTextures(1, &textureID); 3783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBindTexture(GL_TEXTURE_3D, textureID); 3793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glTexStorage3D(GL_TEXTURE_3D, 1, GL_RGBA8, 16, 16, 16); 3803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int layer = 0; layer < 16; ++layer) 3823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, textureID, 0, layer); 3843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkColorAttachmentParam(m_testCtx, *this, GL_FRAMEBUFFER, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER, layer); 3853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0); 3883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glDeleteTextures(1, &textureID); 3893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // tex2d array 3913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint textureID = 0; 3933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGenTextures(1, &textureID); 3943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBindTexture(GL_TEXTURE_2D_ARRAY, textureID); 3953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glTexStorage3D(GL_TEXTURE_2D_ARRAY, 1, GL_RGBA8, 16, 16, 16); 3963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int layer = 0; layer < 16; ++layer) 3983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, textureID, 0, layer); 4003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkColorAttachmentParam(m_testCtx, *this, GL_FRAMEBUFFER, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER, layer); 4013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0); 4043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glDeleteTextures(1, &textureID); 4053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glDeleteFramebuffers(1, &framebufferID); 4083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 4093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 4113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4123c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass AttachmentTextureColorCodingCase : public ApiCase 4133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 4143c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 4153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry AttachmentTextureColorCodingCase (Context& context, const char* name, const char* description) 4163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : ApiCase(context, name, description) 4173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 4183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void test (void) 4213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 4223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint framebufferID = 0; 4233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGenFramebuffers(1, &framebufferID); 4243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBindFramebuffer(GL_FRAMEBUFFER, framebufferID); 4253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 4263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // rgb8 color 4283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 4293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint renderbufferID = 0; 4303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGenRenderbuffers(1, &renderbufferID); 4313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBindRenderbuffer(GL_RENDERBUFFER, renderbufferID); 4323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glRenderbufferStorage(GL_RENDERBUFFER, GL_RGB8, 128, 128); 4333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 4343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, renderbufferID); 4363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 4373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkColorAttachmentParam(m_testCtx, *this, GL_FRAMEBUFFER, GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING, GL_LINEAR); 4393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 0); 4413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glDeleteRenderbuffers(1, &renderbufferID); 4423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // srgb8_alpha8 color 4453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 4463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint renderbufferID = 0; 4473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGenRenderbuffers(1, &renderbufferID); 4483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBindRenderbuffer(GL_RENDERBUFFER, renderbufferID); 4493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glRenderbufferStorage(GL_RENDERBUFFER, GL_SRGB8_ALPHA8, 128, 128); 4503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 4513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, renderbufferID); 4533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 4543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkColorAttachmentParam(m_testCtx, *this, GL_FRAMEBUFFER, GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING, GL_SRGB); 4563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 0); 4583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glDeleteRenderbuffers(1, &renderbufferID); 4593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // depth 4623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 4633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint renderbufferID = 0; 4643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGenRenderbuffers(1, &renderbufferID); 4653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBindRenderbuffer(GL_RENDERBUFFER, renderbufferID); 4663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, 128, 128); 4673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 4683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, renderbufferID); 4703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 4713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkAttachmentParam(m_testCtx, *this, GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING, GL_LINEAR); 4733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 0); 4753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glDeleteRenderbuffers(1, &renderbufferID); 4763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glDeleteFramebuffers(1, &framebufferID); 4793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 4803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 4823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4833c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass AttachmentTextureComponentTypeCase : public ApiCase 4843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 4853c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 4863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry AttachmentTextureComponentTypeCase (Context& context, const char* name, const char* description) 4873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : ApiCase(context, name, description) 4883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 4893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void test (void) 4923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 4933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint framebufferID = 0; 4943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGenFramebuffers(1, &framebufferID); 4953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBindFramebuffer(GL_FRAMEBUFFER, framebufferID); 4963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 4973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // color-renderable required texture formats 4993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const struct RequiredColorFormat 5003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 5013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLenum internalFormat; 5023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLenum componentType; 5033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } requiredColorformats[] = 5043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 5053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_R8, GL_UNSIGNED_NORMALIZED }, 5063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_RG8, GL_UNSIGNED_NORMALIZED }, 5073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_RGB8, GL_UNSIGNED_NORMALIZED }, 5083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_RGB565, GL_UNSIGNED_NORMALIZED }, 5093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_RGBA4, GL_UNSIGNED_NORMALIZED }, 5103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_RGB5_A1, GL_UNSIGNED_NORMALIZED }, 5113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_RGBA8, GL_UNSIGNED_NORMALIZED }, 5123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_RGB10_A2, GL_UNSIGNED_NORMALIZED }, 5133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_RGB10_A2UI, GL_UNSIGNED_INT }, 5143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_SRGB8_ALPHA8, GL_UNSIGNED_NORMALIZED }, 5153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_R8I, GL_INT }, 5163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_R8UI, GL_UNSIGNED_INT }, 5173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_R16I, GL_INT }, 5183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_R16UI, GL_UNSIGNED_INT }, 5193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_R32I, GL_INT }, 5203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_R32UI, GL_UNSIGNED_INT }, 5213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_RG8I, GL_INT }, 5223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_RG8UI, GL_UNSIGNED_INT }, 5233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_RG16I, GL_INT }, 5243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_RG16UI, GL_UNSIGNED_INT }, 5253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_RG32I, GL_INT }, 5263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_RG32UI, GL_UNSIGNED_INT }, 5273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_RGBA8I, GL_INT }, 5283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_RGBA8UI, GL_UNSIGNED_INT }, 5293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_RGBA16I, GL_INT }, 5303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_RGBA16UI, GL_UNSIGNED_INT }, 5313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_RGBA32I, GL_INT }, 5323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_RGBA32UI, GL_UNSIGNED_INT } 5333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 5343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(requiredColorformats); ++ndx) 5363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 5373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const GLenum colorFormat = requiredColorformats[ndx].internalFormat; 5383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint textureID = 0; 5403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGenTextures(1, &textureID); 5413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBindTexture(GL_TEXTURE_2D, textureID); 5423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glTexStorage2D(GL_TEXTURE_2D, 1, colorFormat, 128, 128); 5433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 5443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureID, 0); 5463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 5473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkColorAttachmentParam(m_testCtx, *this, GL_FRAMEBUFFER, GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE, requiredColorformats[ndx].componentType); 5493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0); 5513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glDeleteTextures(1, &textureID); 5523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 5533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glDeleteFramebuffers(1, &framebufferID); 5553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 5563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 5573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 5583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5593c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass AttachmentSizeInitialCase : public ApiCase 5603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 5613c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 5623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry AttachmentSizeInitialCase (Context& context, const char* name, const char* description) 5633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : ApiCase(context, name, description) 5643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 5653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 5663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void test (void) 5683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 5693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // check default 5703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (attachmentExists(GL_BACK)) 5713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 5723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkAttachmentComponentSizeAtLeast( 5733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx, 5743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *this, 5753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_FRAMEBUFFER, 5763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_BACK, 5773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_context.getRenderTarget().getPixelFormat().redBits, 5783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_context.getRenderTarget().getPixelFormat().greenBits, 5793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_context.getRenderTarget().getPixelFormat().blueBits, 5803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_context.getRenderTarget().getPixelFormat().alphaBits, 5813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry -1, 5823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry -1); 5833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 5843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 5853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (attachmentExists(GL_DEPTH)) 5873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 5883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkAttachmentComponentSizeAtLeast( 5893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx, 5903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *this, 5913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_FRAMEBUFFER, 5923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_DEPTH, 5933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry -1, 5943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry -1, 5953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry -1, 5963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry -1, 5973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_context.getRenderTarget().getDepthBits(), 5983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry -1); 5993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 6003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 6013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (attachmentExists(GL_STENCIL)) 6033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkAttachmentComponentSizeAtLeast( 6053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx, 6063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *this, 6073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_FRAMEBUFFER, 6083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_STENCIL, 6093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry -1, 6103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry -1, 6113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry -1, 6123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry -1, 6133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry -1, 6143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_context.getRenderTarget().getStencilBits()); 6153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 6163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 6173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 6183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry bool attachmentExists (GLenum attachment) 6203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry StateQueryMemoryWriteGuard<GLint> state; 6223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, attachment, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &state); 6233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 6243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return !state.isUndefined() && state != GL_NONE; 6263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 6273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 6283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6293c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass AttachmentSizeCase : public ApiCase 6303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 6313c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 6323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry AttachmentSizeCase (Context& context, const char* name, const char* description) 6333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : ApiCase(context, name, description) 6343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 6363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual void testColorAttachment (GLenum internalFormat, GLenum attachment, GLint bitsR, GLint bitsG, GLint bitsB, GLint bitsA) = DE_NULL; 6383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual void testDepthAttachment (GLenum internalFormat, GLenum attachment, GLint bitsD, GLint bitsS) = DE_NULL; 6403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void test (void) 6423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint framebufferID = 0; 6443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGenFramebuffers(1, &framebufferID); 6453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBindFramebuffer(GL_FRAMEBUFFER, framebufferID); 6463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 6473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // check some color targets 6493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const struct ColorAttachment 6513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLenum internalFormat; 6533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int bitsR, bitsG, bitsB, bitsA; 6543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } colorAttachments[] = 6553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_RGBA8, 8, 8, 8, 8 }, 6573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_RGB565, 5, 6, 5, 0 }, 6583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_RGBA4, 4, 4, 4, 4 }, 6593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_RGB5_A1, 5, 5, 5, 1 }, 6603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_RGBA8I, 8, 8, 8, 8 }, 6613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_RG32UI, 32, 32, 0, 0 } 6623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 6633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(colorAttachments); ++ndx) 6643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry testColorAttachment(colorAttachments[ndx].internalFormat, GL_COLOR_ATTACHMENT0, colorAttachments[ndx].bitsR, colorAttachments[ndx].bitsG, colorAttachments[ndx].bitsB, colorAttachments[ndx].bitsA); 6653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // check some depth targets 6673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const struct DepthAttachment 6693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLenum internalFormat; 6713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLenum attachment; 6723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int dbits; 6733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int sbits; 6743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } depthAttachments[] = 6753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_DEPTH_COMPONENT16, GL_DEPTH_ATTACHMENT, 16, 0 }, 6773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_DEPTH_COMPONENT24, GL_DEPTH_ATTACHMENT, 24, 0 }, 6783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_DEPTH_COMPONENT32F, GL_DEPTH_ATTACHMENT, 32, 0 }, 6793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL_ATTACHMENT, 24, 8 }, 6803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL_ATTACHMENT, 32, 8 }, 6813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 6823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(depthAttachments); ++ndx) 6833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry testDepthAttachment(depthAttachments[ndx].internalFormat, depthAttachments[ndx].attachment, depthAttachments[ndx].dbits, depthAttachments[ndx].sbits); 6843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glDeleteFramebuffers(1, &framebufferID); 6863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 6873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 6883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 6893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6903c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass AttachmentSizeRboCase : public AttachmentSizeCase 6913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 6923c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 6933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry AttachmentSizeRboCase (Context& context, const char* name, const char* description) 6943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : AttachmentSizeCase(context, name, description) 6953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 6973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void testColorAttachment (GLenum internalFormat, GLenum attachment, GLint bitsR, GLint bitsG, GLint bitsB, GLint bitsA) 6993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 7003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint renderbufferID = 0; 7013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGenRenderbuffers(1, &renderbufferID); 7023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBindRenderbuffer(GL_RENDERBUFFER, renderbufferID); 7033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glRenderbufferStorage(GL_RENDERBUFFER, internalFormat, 128, 128); 7043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 7053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferRenderbuffer(GL_FRAMEBUFFER, attachment, GL_RENDERBUFFER, renderbufferID); 7073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 7083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkAttachmentComponentSizeAtLeast (m_testCtx, *this, GL_FRAMEBUFFER, attachment, bitsR, bitsG, bitsB, bitsA, -1, -1); 7103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkAttachmentComponentSizeExactly (m_testCtx, *this, GL_FRAMEBUFFER, attachment, -1, -1, -1, -1, 0, 0); 7113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferRenderbuffer(GL_FRAMEBUFFER, attachment, GL_RENDERBUFFER, 0); 7133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glDeleteRenderbuffers(1, &renderbufferID); 7143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 7153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void testDepthAttachment (GLenum internalFormat, GLenum attachment, GLint bitsD, GLint bitsS) 7173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 7183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint renderbufferID = 0; 7193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGenRenderbuffers(1, &renderbufferID); 7203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBindRenderbuffer(GL_RENDERBUFFER, renderbufferID); 7213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glRenderbufferStorage(GL_RENDERBUFFER, internalFormat, 128, 128); 7223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 7233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferRenderbuffer(GL_FRAMEBUFFER, attachment, GL_RENDERBUFFER, renderbufferID); 7253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 7263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkAttachmentComponentSizeAtLeast (m_testCtx, *this, GL_FRAMEBUFFER, attachment, -1, -1, -1, -1, bitsD, bitsS); 7283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkAttachmentComponentSizeExactly (m_testCtx, *this, GL_FRAMEBUFFER, attachment, 0, 0, 0, 0, -1, -1); 7293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferRenderbuffer(GL_FRAMEBUFFER, attachment, GL_RENDERBUFFER, 0); 7313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glDeleteRenderbuffers(1, &renderbufferID); 7323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 7333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 7343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7353c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass AttachmentSizeTextureCase : public AttachmentSizeCase 7363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 7373c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 7383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry AttachmentSizeTextureCase (Context& context, const char* name, const char* description) 7393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : AttachmentSizeCase(context, name, description) 7403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 7413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 7423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void testColorAttachment (GLenum internalFormat, GLenum attachment, GLint bitsR, GLint bitsG, GLint bitsB, GLint bitsA) 7443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 7453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint textureID = 0; 7463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGenTextures(1, &textureID); 7473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBindTexture(GL_TEXTURE_2D, textureID); 7483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glTexStorage2D(GL_TEXTURE_2D, 1, internalFormat, 128, 128); 7493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 7503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferTexture2D(GL_FRAMEBUFFER, attachment, GL_TEXTURE_2D, textureID, 0); 7523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 7533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkAttachmentComponentSizeAtLeast (m_testCtx, *this, GL_FRAMEBUFFER, attachment, bitsR, bitsG, bitsB, bitsA, -1, -1); 7553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkAttachmentComponentSizeExactly (m_testCtx, *this, GL_FRAMEBUFFER, attachment, -1, -1, -1, -1, 0, 0); 7563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferTexture2D(GL_FRAMEBUFFER, attachment, GL_TEXTURE_2D, 0, 0); 7583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glDeleteTextures(1, &textureID); 7593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 7603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void testDepthAttachment (GLenum internalFormat, GLenum attachment, GLint bitsD, GLint bitsS) 7623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 7633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // don't test stencil formats with textures 7643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) 7653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return; 7663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint textureID = 0; 7683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGenTextures(1, &textureID); 7693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBindTexture(GL_TEXTURE_2D, textureID); 7703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glTexStorage2D(GL_TEXTURE_2D, 1, internalFormat, 128, 128); 7713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 7723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferTexture2D(GL_FRAMEBUFFER, attachment, GL_TEXTURE_2D, textureID, 0); 7743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 7753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkAttachmentComponentSizeAtLeast (m_testCtx, *this, GL_FRAMEBUFFER, attachment, -1, -1, -1, -1, bitsD, bitsS); 7773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkAttachmentComponentSizeExactly (m_testCtx, *this, GL_FRAMEBUFFER, attachment, 0, 0, 0, 0, -1, -1); 7783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferTexture2D(GL_FRAMEBUFFER, attachment, GL_TEXTURE_2D, 0, 0); 7803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glDeleteTextures(1, &textureID); 7813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 7823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 7833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7843c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass UnspecifiedAttachmentTextureColorCodingCase : public ApiCase 7853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 7863c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 7873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry UnspecifiedAttachmentTextureColorCodingCase (Context& context, const char* name, const char* description) 7883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : ApiCase(context, name, description) 7893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 7903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 7913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void test (void) 7933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 7943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint framebufferID = 0; 7953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGenFramebuffers(1, &framebufferID); 7963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBindFramebuffer(GL_FRAMEBUFFER, framebufferID); 7973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 7983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // color 8003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 8013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint renderbufferID = 0; 8023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGenRenderbuffers(1, &renderbufferID); 8033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBindRenderbuffer(GL_RENDERBUFFER, renderbufferID); 8043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 8053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, renderbufferID); 8073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 8083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkColorAttachmentParam(m_testCtx, *this, GL_FRAMEBUFFER, GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING, GL_LINEAR); 8103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 8113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 0); 8133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glDeleteRenderbuffers(1, &renderbufferID); 8143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 8153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // depth 8173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 8183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint renderbufferID = 0; 8193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGenRenderbuffers(1, &renderbufferID); 8203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBindRenderbuffer(GL_RENDERBUFFER, renderbufferID); 8213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 8223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, renderbufferID); 8243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 8253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkAttachmentParam(m_testCtx, *this, GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING, GL_LINEAR); 8273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 0); 8293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glDeleteRenderbuffers(1, &renderbufferID); 8303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 8313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glDeleteFramebuffers(1, &framebufferID); 8333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 8343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 8353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 8363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8373c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass UnspecifiedAttachmentTextureComponentTypeCase : public ApiCase 8383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 8393c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 8403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry UnspecifiedAttachmentTextureComponentTypeCase (Context& context, const char* name, const char* description) 8413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : ApiCase(context, name, description) 8423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 8433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 8443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void test (void) 8463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 8473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint framebufferID = 0; 8483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGenFramebuffers(1, &framebufferID); 8493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBindFramebuffer(GL_FRAMEBUFFER, framebufferID); 8503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 8513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 8533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint textureID = 0; 8543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGenTextures(1, &textureID); 8553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBindTexture(GL_TEXTURE_2D, textureID); 8563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 8573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureID, 0); 8593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 8603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkColorAttachmentParam(m_testCtx, *this, GL_FRAMEBUFFER, GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE, GL_NONE); 8623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 8633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0); 8653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glDeleteTextures(1, &textureID); 8663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 8673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glDeleteFramebuffers(1, &framebufferID); 8693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 8703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 8713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 8723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8733c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass UnspecifiedAttachmentSizeCase : public ApiCase 8743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 8753c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 8763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry UnspecifiedAttachmentSizeCase (Context& context, const char* name, const char* description) 8773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : ApiCase(context, name, description) 8783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 8793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 8803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual void testColorAttachment (void) = DE_NULL; 8823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual void testDepthAttachment (void) = DE_NULL; 8843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void test (void) 8863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 8873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint framebufferID = 0; 8883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGenFramebuffers(1, &framebufferID); 8893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBindFramebuffer(GL_FRAMEBUFFER, framebufferID); 8903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 8913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // check color target 8933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry testColorAttachment(); 8943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // check depth target 8963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry testDepthAttachment(); 8973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glDeleteFramebuffers(1, &framebufferID); 8993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 9003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 9013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 9023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9033c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass UnspecifiedAttachmentSizeRboCase : public UnspecifiedAttachmentSizeCase 9043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 9053c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 9063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry UnspecifiedAttachmentSizeRboCase (Context& context, const char* name, const char* description) 9073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : UnspecifiedAttachmentSizeCase(context, name, description) 9083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 9093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 9103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void testColorAttachment (void) 9123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 9133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint renderbufferID = 0; 9143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGenRenderbuffers(1, &renderbufferID); 9153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBindRenderbuffer(GL_RENDERBUFFER, renderbufferID); 9163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 9173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, renderbufferID); 9193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 9203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkAttachmentComponentSizeExactly (m_testCtx, *this, GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, 0, 0, 0, 0, 0, 0); 9223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 9233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 0); 9253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glDeleteRenderbuffers(1, &renderbufferID); 9263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 9273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void testDepthAttachment (void) 9293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 9303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint renderbufferID = 0; 9313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGenRenderbuffers(1, &renderbufferID); 9323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBindRenderbuffer(GL_RENDERBUFFER, renderbufferID); 9333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 9343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, renderbufferID); 9363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 9373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkAttachmentComponentSizeExactly (m_testCtx, *this, GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, 0, 0, 0, 0, 0, 0); 9393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 9403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, 0); 9423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glDeleteRenderbuffers(1, &renderbufferID); 9433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 9443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 9453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9463c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass UnspecifiedAttachmentSizeTextureCase : public UnspecifiedAttachmentSizeCase 9473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 9483c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 9493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry UnspecifiedAttachmentSizeTextureCase (Context& context, const char* name, const char* description) 9503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : UnspecifiedAttachmentSizeCase(context, name, description) 9513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 9523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 9533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void testColorAttachment (void) 9553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 9563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint textureID = 0; 9573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGenTextures(1, &textureID); 9583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBindTexture(GL_TEXTURE_2D, textureID); 9593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 9603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureID, 0); 9623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 9633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkAttachmentComponentSizeExactly (m_testCtx, *this, GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, 0, 0, 0, 0, 0, 0); 9653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 9663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0); 9683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glDeleteTextures(1, &textureID); 9693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 9703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void testDepthAttachment (void) 9723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 9733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint textureID = 0; 9743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGenTextures(1, &textureID); 9753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBindTexture(GL_TEXTURE_2D, textureID); 9763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 9773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, textureID, 0); 9793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 9803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkAttachmentComponentSizeExactly (m_testCtx, *this, GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, 0, 0, 0, 0, 0, 0); 9823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 9833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, 0, 0); 9853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glDeleteTextures(1, &textureID); 9863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 9873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 9883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // anonymous 9903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9923c827367444ee418f129b2c238299f49d3264554Jarkko PoyryFboStateQueryTests::FboStateQueryTests (Context& context) 9933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : TestCaseGroup(context, "fbo", "Fbo State Query tests") 9943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 9953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 9963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9973c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid FboStateQueryTests::init (void) 9983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 9993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const struct FramebufferTarget 10003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 10013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const char* name; 10023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLenum target; 10033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } fboTargets[] = 10043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 10053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { "draw_framebuffer_", GL_DRAW_FRAMEBUFFER }, 10063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { "read_framebuffer_", GL_READ_FRAMEBUFFER } 10073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 10083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(fboTargets); ++ndx) 10103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new DefaultFramebufferCase(m_context, (std::string(fboTargets[ndx].name) + "default_framebuffer").c_str(), "default framebuffer", fboTargets[ndx].target)); 10113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new AttachmentObjectCase (m_context, "framebuffer_attachment_object", "FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE and FRAMEBUFFER_ATTACHMENT_OBJECT_NAME")); 10133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new AttachmentTextureLevelCase (m_context, "framebuffer_attachment_texture_level", "FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL")); 10143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new AttachmentTextureCubeMapFaceCase (m_context, "framebuffer_attachment_texture_cube_map_face", "FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE")); 10153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new AttachmentTextureLayerCase (m_context, "framebuffer_attachment_texture_layer", "FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER")); 10163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new AttachmentTextureColorCodingCase (m_context, "framebuffer_attachment_color_encoding", "FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING")); 10173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new AttachmentTextureComponentTypeCase (m_context, "framebuffer_attachment_component_type", "FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE")); 10183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new AttachmentSizeInitialCase (m_context, "framebuffer_attachment_x_size_initial", "FRAMEBUFFER_ATTACHMENT_x_SIZE")); 10193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new AttachmentSizeRboCase (m_context, "framebuffer_attachment_x_size_rbo", "FRAMEBUFFER_ATTACHMENT_x_SIZE")); 10203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new AttachmentSizeTextureCase (m_context, "framebuffer_attachment_x_size_texture", "FRAMEBUFFER_ATTACHMENT_x_SIZE")); 10213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new UnspecifiedAttachmentTextureColorCodingCase (m_context, "framebuffer_unspecified_attachment_color_encoding", "FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING")); 10233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new UnspecifiedAttachmentTextureComponentTypeCase (m_context, "framebuffer_unspecified_attachment_component_type", "FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE")); 10243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new UnspecifiedAttachmentSizeRboCase (m_context, "framebuffer_unspecified_attachment_x_size_rbo", "FRAMEBUFFER_ATTACHMENT_x_SIZE")); 10253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new UnspecifiedAttachmentSizeTextureCase (m_context, "framebuffer_unspecified_attachment_x_size_texture", "FRAMEBUFFER_ATTACHMENT_x_SIZE")); 10263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 10273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // Functional 10293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // gles3 10303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp 1031