13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*------------------------------------------------------------------------- 23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program OpenGL ES 2.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 Framebuffer Object API Tests. 223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Notes: 243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * All gl calls are passed thru sgl2::Context class. Reasons: 253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * + Name, object allocation is tracked and live resources are freed 263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * when Context is destroyed. 273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * + Makes it possible to easily log all relevant calls into test log. 283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \todo [pyry] This is not implemented yet 293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "es2fFboApiTest.hpp" 323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "sglrGLContext.hpp" 333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluDefs.hpp" 343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluContextInfo.hpp" 353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluStrUtil.hpp" 363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuRenderTarget.hpp" 373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deString.h" 383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwFunctions.hpp" 393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwEnums.hpp" 403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <iterator> 423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <algorithm> 433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 443c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp 453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 463c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace gles2 473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 483c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace Functional 493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 513c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing std::string; 523c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing std::vector; 533c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing tcu::TestLog; 543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 553c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing glw::GLenum; 563c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing glw::GLint; 573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 583c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic void logComment (tcu::TestContext& testCtx, const char* comment) 593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry testCtx.getLog() << TestLog::Message << "// " << comment << TestLog::EndMessage; 613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 633c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic void checkError (tcu::TestContext& testCtx, sglr::Context& ctx, GLenum expect) 643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLenum result = ctx.getError(); 663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry testCtx.getLog() << TestLog::Message << "// " << (result == expect ? "Pass" : "Fail") << ", expected " << glu::getErrorStr(expect) << TestLog::EndMessage; 673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (result != expect) 693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Error code mismatch"); 703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 723c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic const char* getAttachmentName (GLenum attachment) 733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry switch (attachment) 753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case GL_COLOR_ATTACHMENT0: return "GL_COLOR_ATTACHMENT0"; 773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case GL_DEPTH_ATTACHMENT: return "GL_DEPTH_ATTACHMENT"; 783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case GL_STENCIL_ATTACHMENT: return "GL_STENCIL_ATTACHMENT"; 793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry default: throw tcu::InternalError("Unknown attachment", "", __FILE__, __LINE__); 803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 833c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic const char* getAttachmentParameterName (GLenum pname) 843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry switch (pname) 863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: return "GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE"; 883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: return "GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME"; 893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: return "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL"; 903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: return "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE"; 913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry default: throw tcu::InternalError("Unknown parameter", "", __FILE__, __LINE__); 923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 953c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic string getAttachmentParameterValueName (GLint value) 963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry switch (value) 983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case 0: return "GL_NONE(0)"; 1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case GL_TEXTURE: return "GL_TEXTURE"; 1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case GL_RENDERBUFFER: return "GL_RENDERBUFFER"; 1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case GL_TEXTURE_CUBE_MAP_POSITIVE_X: return "GL_TEXTURE_CUBE_MAP_POSITIVE_X"; 1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: return "GL_TEXTURE_CUBE_MAP_NEGATIVE_X"; 1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: return "GL_TEXTURE_CUBE_MAP_POSITIVE_Y"; 1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: return "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y"; 1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: return "GL_TEXTURE_CUBE_MAP_POSITIVE_Z"; 1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: return "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z"; 1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry default: 1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry char tmp[64]; 1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deSprintf(tmp, sizeof(tmp), "0x%x", value); 1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return string(tmp); 1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic void checkFboAttachmentParam (tcu::TestContext& testCtx, sglr::Context& ctx, GLenum attachment, GLenum pname, GLint expectedValue) 1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TestLog& log = testCtx.getLog(); 1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << "// Querying " << getAttachmentName(attachment) << " " << getAttachmentParameterName(pname) << TestLog::EndMessage; 1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint value = 0xcdcdcdcd; 1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.getFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, attachment, pname, &value); 1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLenum err = ctx.getError(); 1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (value == expectedValue && err == GL_NO_ERROR) 1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << "// Pass" << TestLog::EndMessage; 1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else 1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << "// Fail, expected " << getAttachmentParameterValueName(expectedValue) << " without error" << TestLog::EndMessage; 1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid result for attachment param query"); 1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic void notSupportedTest (tcu::TestContext& testCtx, sglr::Context& context) 1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_UNREF(testCtx); 1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_UNREF(context); 1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry throw tcu::NotSupportedError("Not supported", "", __FILE__, __LINE__); 1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic void textureLevelsTest (tcu::TestContext& testCtx, sglr::Context& context) 1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 tex = 1; 1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 fbo = 1; 1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.bindTexture(GL_TEXTURE_2D, tex); 1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.texImage2D(GL_TEXTURE_2D, 0, GL_RGB, 256, 256); 1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.texImage2D(GL_TEXTURE_2D, 1, GL_RGB, 128, 128); 1513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.bindFramebuffer(GL_FRAMEBUFFER, fbo); 1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry static int levels[] = { 2, 1, 0, -1, 0x7fffffff, 0, 1 }; 1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(levels); ndx++) 1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex, levels[ndx]); 1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkError(testCtx, context, levels[ndx] == 0 ? GL_NO_ERROR : GL_INVALID_VALUE); 1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1633c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic void textureLevelsWithRenderToMipmapTest (tcu::TestContext& testCtx, sglr::Context& context) 1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 tex = 1; 1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 fbo = 1; 1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.bindTexture(GL_TEXTURE_2D, tex); 1693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.texImage2D(GL_TEXTURE_2D, 0, GL_RGB, 256, 256); 1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.texImage2D(GL_TEXTURE_2D, 1, GL_RGB, 128, 128); 1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.bindFramebuffer(GL_FRAMEBUFFER, fbo); 1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry static int levels[] = { 2, 1, 0, -1, 0x7fffffff, 0, 1 }; 1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(levels); ndx++) 1773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex, levels[ndx]); 1793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkError(testCtx, context, de::inBounds(levels[ndx], 0, 16) ? GL_NO_ERROR : GL_INVALID_VALUE); 1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic void validTex2DAttachmentsTest (tcu::TestContext& testCtx, sglr::Context& context) 1843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.bindFramebuffer(GL_FRAMEBUFFER, 1); 1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry static const GLenum attachmentPoints[] = 1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_COLOR_ATTACHMENT0, 1893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_DEPTH_ATTACHMENT, 1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_STENCIL_ATTACHMENT 1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Texture2D 1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 tex2D = 1; 1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.bindTexture(GL_TEXTURE_2D, tex2D); 1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int pointNdx = 0; pointNdx < DE_LENGTH_OF_ARRAY(attachmentPoints); pointNdx++) 1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.framebufferTexture2D(GL_FRAMEBUFFER, attachmentPoints[pointNdx], GL_TEXTURE_2D, tex2D, 0); 1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkError(testCtx, context, GL_NO_ERROR); 2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic void validTexCubeAttachmentsTest (tcu::TestContext& testCtx, sglr::Context& context) 2043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry static const GLenum attachmentPoints[] = 2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_COLOR_ATTACHMENT0, 2083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_DEPTH_ATTACHMENT, 2093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_STENCIL_ATTACHMENT 2103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 2113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry static const GLenum cubeTargets[] = 2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_TEXTURE_CUBE_MAP_POSITIVE_X, 2143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 2153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 2163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 2183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 2193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 2203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.bindFramebuffer(GL_FRAMEBUFFER, 1); 2223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // TextureCube 2243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 texCube = 2; 2253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.bindTexture(GL_TEXTURE_CUBE_MAP, texCube); 2263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int pointNdx = 0; pointNdx < DE_LENGTH_OF_ARRAY(attachmentPoints); pointNdx++) 2273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int targetNdx = 0; targetNdx < DE_LENGTH_OF_ARRAY(cubeTargets); targetNdx++) 2293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.framebufferTexture2D(GL_FRAMEBUFFER, attachmentPoints[pointNdx], cubeTargets[targetNdx], texCube, 0); 2313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkError(testCtx, context, GL_NO_ERROR); 2323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2363c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic void validRboAttachmentsTest (tcu::TestContext& testCtx, sglr::Context& context) 2373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry static const GLenum attachmentPoints[] = 2393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_COLOR_ATTACHMENT0, 2413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_DEPTH_ATTACHMENT, 2423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_STENCIL_ATTACHMENT 2433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 2443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.bindFramebuffer(GL_FRAMEBUFFER, 1); 2463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Renderbuffer 2483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 rbo = 3; 2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.bindRenderbuffer(GL_RENDERBUFFER, rbo); 2503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int pointNdx = 0; pointNdx < DE_LENGTH_OF_ARRAY(attachmentPoints); pointNdx++) 2513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.framebufferRenderbuffer(GL_FRAMEBUFFER, attachmentPoints[pointNdx], GL_RENDERBUFFER, rbo); 2533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkError(testCtx, context, GL_NO_ERROR); 2543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2573c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic void attachToDefaultFramebufferTest (tcu::TestContext& testCtx, sglr::Context& context) 2583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry logComment(testCtx, "Attaching 2D texture to default framebuffer"); 2603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 tex2D = 1; 2623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.bindTexture(GL_TEXTURE_2D, tex2D); 2633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex2D, 0); 2643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkError(testCtx, context, GL_INVALID_OPERATION); 2653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry logComment(testCtx, "Attaching renderbuffer to default framebuffer"); 2673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 rbo = 1; 2693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.bindRenderbuffer(GL_RENDERBUFFER, rbo); 2703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.framebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rbo); 2713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkError(testCtx, context, GL_INVALID_OPERATION); 2723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2743c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic void invalidTex2DAttachmentTest (tcu::TestContext& testCtx, sglr::Context& context) 2753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.bindFramebuffer(GL_FRAMEBUFFER, 1); 2773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry logComment(testCtx, "Attaching 2D texture using GL_TEXTURE_CUBE_MAP_NEGATIVE_X texture target"); 2793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 tex2D = 1; 2813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.bindTexture(GL_TEXTURE_2D, tex2D); 2823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, tex2D, 0); 2833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkError(testCtx, context, GL_INVALID_OPERATION); 2843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry logComment(testCtx, "Attaching deleted 2D texture object"); 2863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.deleteTextures(1, &tex2D); 2873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex2D, 0); 2883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkError(testCtx, context, GL_INVALID_OPERATION); 2893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2913c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic void invalidTexCubeAttachmentTest (tcu::TestContext& testCtx, sglr::Context& context) 2923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.bindFramebuffer(GL_FRAMEBUFFER, 1); 2943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry logComment(testCtx, "Attaching cube texture using GL_TEXTURE_2D texture target"); 2963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 texCube = 2; 2973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.bindTexture(GL_TEXTURE_CUBE_MAP, texCube); 2983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texCube, 0); 2993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkError(testCtx, context, GL_INVALID_OPERATION); 3003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry logComment(testCtx, "Attaching deleted cube texture object"); 3023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.deleteTextures(1, &texCube); 3033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_X, texCube, 0); 3043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkError(testCtx, context, GL_INVALID_OPERATION); 3053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 3063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3073c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic void invalidRboAttachmentTest (tcu::TestContext& testCtx, sglr::Context& context) 3083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.bindFramebuffer(GL_FRAMEBUFFER, 1); 3103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry logComment(testCtx, "Attaching renderbuffer using GL_FRAMEBUFFER renderbuffer target"); 3123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 rbo = 3; 3133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.bindRenderbuffer(GL_RENDERBUFFER, rbo); 3143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.framebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER, rbo); 3153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkError(testCtx, context, GL_INVALID_ENUM); 3163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry logComment(testCtx, "Attaching deleted renderbuffer object"); 3183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.deleteRenderbuffers(1, &rbo); 3193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.framebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rbo); 3203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkError(testCtx, context, GL_INVALID_OPERATION); 3213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 3223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3233c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic void attachNamesTest (tcu::TestContext& testCtx, sglr::Context& context) 3243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.bindFramebuffer(GL_FRAMEBUFFER, 1); 3263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Just allocate some names, don't bind for storage 3283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 reservedTexName; 3293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.genTextures(1, &reservedTexName); 3303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry logComment(testCtx, "Attaching allocated texture name to 2D target"); 3323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, reservedTexName, 0); 3333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkError(testCtx, context, GL_INVALID_OPERATION); 3343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry logComment(testCtx, "Attaching allocated texture name to cube target"); 3363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, reservedTexName, 0); 3373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkError(testCtx, context, GL_INVALID_OPERATION); 3383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 reservedRboName; 3403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.genRenderbuffers(1, &reservedRboName); 3413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry logComment(testCtx, "Attaching allocated renderbuffer name"); 3433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry context.framebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, reservedRboName); 3443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkError(testCtx, context, GL_INVALID_OPERATION); 3453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 3463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3473c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic void attachmentQueryDefaultFboTest (tcu::TestContext& testCtx, sglr::Context& ctx) 3483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Check that proper error codes are returned 3503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint unused = 1; 3513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.getFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &unused); 3523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkError(testCtx, ctx, GL_INVALID_OPERATION); 3533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.getFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &unused); 3543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkError(testCtx, ctx, GL_INVALID_OPERATION); 3553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.getFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL, &unused); 3563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkError(testCtx, ctx, GL_INVALID_OPERATION); 3573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.getFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE, &unused); 3583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkError(testCtx, ctx, GL_INVALID_OPERATION); 3593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 3603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3613c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic void attachmentQueryEmptyFboTest (tcu::TestContext& testCtx, sglr::Context& ctx) 3623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry static const GLenum attachmentPoints[] = 3643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_COLOR_ATTACHMENT0, 3663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_DEPTH_ATTACHMENT, 3673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_STENCIL_ATTACHMENT 3683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 3693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.bindFramebuffer(GL_FRAMEBUFFER, 1); 3713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(attachmentPoints); ndx++) 3733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkFboAttachmentParam(testCtx, ctx, attachmentPoints[ndx], GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, GL_NONE); 3743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Check that proper error codes are returned 3763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint unused = -1; 3773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.getFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &unused); 3783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkError(testCtx, ctx, GL_INVALID_ENUM); 3793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.getFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL, &unused); 3803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkError(testCtx, ctx, GL_INVALID_ENUM); 3813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.getFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE, &unused); 3823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkError(testCtx, ctx, GL_INVALID_ENUM); 3833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 3843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3853c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic void attachmentQueryTex2DTest (tcu::TestContext& testCtx, sglr::Context& ctx) 3863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.bindFramebuffer(GL_FRAMEBUFFER, 1); 3883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.bindTexture(GL_TEXTURE_2D, 1); 3903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 1, 0); 3913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkFboAttachmentParam(testCtx, ctx, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, GL_TEXTURE); 3933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkFboAttachmentParam(testCtx, ctx, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, 1); 3943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkFboAttachmentParam(testCtx, ctx, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL, 0); 3953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkFboAttachmentParam(testCtx, ctx, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE, 0); 3963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 3973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3983c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic void attachmentQueryTexCubeTest (tcu::TestContext& testCtx, sglr::Context& ctx) 3993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 4003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.bindFramebuffer(GL_FRAMEBUFFER, 1); 4013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.bindTexture(GL_TEXTURE_CUBE_MAP, 2); 4033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.framebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 2, 0); 4043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkFboAttachmentParam(testCtx, ctx, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, GL_TEXTURE); 4063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkFboAttachmentParam(testCtx, ctx, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, 2); 4073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkFboAttachmentParam(testCtx, ctx, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL, 0); 4083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkFboAttachmentParam(testCtx, ctx, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y); 4093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 4103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4113c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic void attachmentQueryRboTest (tcu::TestContext& testCtx, sglr::Context& ctx) 4123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 4133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.bindFramebuffer(GL_FRAMEBUFFER, 1); 4143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.bindRenderbuffer(GL_RENDERBUFFER, 3); 4163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.framebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 3); 4173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkFboAttachmentParam(testCtx, ctx, GL_STENCIL_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, GL_RENDERBUFFER); 4193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkFboAttachmentParam(testCtx, ctx, GL_STENCIL_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, 3); 4203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint unused = 0; 4223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.getFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL, &unused); 4233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkError(testCtx, ctx, GL_INVALID_ENUM); 4243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.getFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE, &unused); 4253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkError(testCtx, ctx, GL_INVALID_ENUM); 4263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 4273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4283c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic void deleteTex2DAttachedToBoundFboTest (tcu::TestContext& testCtx, sglr::Context& ctx) 4293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 4303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.bindFramebuffer(GL_FRAMEBUFFER, 1); 4313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 tex2D = 1; 4333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.bindTexture(GL_TEXTURE_2D, tex2D); 4343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex2D, 0); 4353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkFboAttachmentParam(testCtx, ctx, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, GL_TEXTURE); 4373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkFboAttachmentParam(testCtx, ctx, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, tex2D); 4383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.deleteTextures(1, &tex2D); 4403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkFboAttachmentParam(testCtx, ctx, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, GL_NONE); 4423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 4433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4443c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic void deleteTexCubeAttachedToBoundFboTest (tcu::TestContext& testCtx, sglr::Context& ctx) 4453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 4463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.bindFramebuffer(GL_FRAMEBUFFER, 1); 4473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 texCube = 1; 4493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.bindTexture(GL_TEXTURE_CUBE_MAP, texCube); 4503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.framebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_CUBE_MAP_POSITIVE_X, texCube, 0); 4513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkFboAttachmentParam(testCtx, ctx, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, GL_TEXTURE); 4533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkFboAttachmentParam(testCtx, ctx, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, texCube); 4543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.deleteTextures(1, &texCube); 4563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkFboAttachmentParam(testCtx, ctx, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, GL_NONE); 4583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 4593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4603c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic void deleteRboAttachedToBoundFboTest (tcu::TestContext& testCtx, sglr::Context& ctx) 4613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 4623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.bindFramebuffer(GL_FRAMEBUFFER, 1); 4633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 rbo = 1; 4653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.bindRenderbuffer(GL_RENDERBUFFER, rbo); 4663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.framebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rbo); 4673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkFboAttachmentParam(testCtx, ctx, GL_STENCIL_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, GL_RENDERBUFFER); 4693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkFboAttachmentParam(testCtx, ctx, GL_STENCIL_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, rbo); 4703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.deleteRenderbuffers(1, &rbo); 4723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkFboAttachmentParam(testCtx, ctx, GL_STENCIL_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, GL_NONE); 4743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 4753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4763c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic void deleteTex2DAttachedToNotBoundFboTest (tcu::TestContext& testCtx, sglr::Context& ctx) 4773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 4783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.bindFramebuffer(GL_FRAMEBUFFER, 1); 4793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 tex2D = 1; 4813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.bindTexture(GL_TEXTURE_2D, tex2D); 4823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex2D, 0); 4833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkFboAttachmentParam(testCtx, ctx, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, GL_TEXTURE); 4853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkFboAttachmentParam(testCtx, ctx, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, tex2D); 4863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.bindFramebuffer(GL_FRAMEBUFFER, 0); 4883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.deleteTextures(1, &tex2D); 4903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.bindFramebuffer(GL_FRAMEBUFFER, 1); 4923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkFboAttachmentParam(testCtx, ctx, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, GL_TEXTURE); 4943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkFboAttachmentParam(testCtx, ctx, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, tex2D); 4953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 4963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4973c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic void deleteTexCubeAttachedToNotBoundFboTest (tcu::TestContext& testCtx, sglr::Context& ctx) 4983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 4993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.bindFramebuffer(GL_FRAMEBUFFER, 1); 5003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 texCube = 1; 5023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.bindTexture(GL_TEXTURE_CUBE_MAP, texCube); 5033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.framebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_CUBE_MAP_POSITIVE_X, texCube, 0); 5043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkFboAttachmentParam(testCtx, ctx, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, GL_TEXTURE); 5063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkFboAttachmentParam(testCtx, ctx, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, texCube); 5073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.bindFramebuffer(GL_FRAMEBUFFER, 0); 5093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.deleteTextures(1, &texCube); 5113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.bindFramebuffer(GL_FRAMEBUFFER, 1); 5133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkFboAttachmentParam(testCtx, ctx, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, GL_TEXTURE); 5153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkFboAttachmentParam(testCtx, ctx, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, texCube); 5163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 5173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5183c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic void deleteRboAttachedToNotBoundFboTest (tcu::TestContext& testCtx, sglr::Context& ctx) 5193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 5203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.bindFramebuffer(GL_FRAMEBUFFER, 1); 5213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 rbo = 1; 5233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.bindRenderbuffer(GL_RENDERBUFFER, rbo); 5243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.framebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rbo); 5253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkFboAttachmentParam(testCtx, ctx, GL_STENCIL_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, GL_RENDERBUFFER); 5273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkFboAttachmentParam(testCtx, ctx, GL_STENCIL_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, rbo); 5283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.bindFramebuffer(GL_FRAMEBUFFER, 0); 5303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.deleteRenderbuffers(1, &rbo); 5323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.bindFramebuffer(GL_FRAMEBUFFER, 1); 5343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkFboAttachmentParam(testCtx, ctx, GL_STENCIL_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, GL_RENDERBUFFER); 5363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry checkFboAttachmentParam(testCtx, ctx, GL_STENCIL_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, rbo); 5373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 5383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5393c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass FboApiCase : public TestCase 5403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 5413c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 5423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry typedef void (*TestFunc) (tcu::TestContext& testCtx, sglr::Context& context); 5433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry FboApiCase (Context& context, const char* name, const char* description, TestFunc test); 5453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual ~FboApiCase (void); 5463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual IterateResult iterate (void); 5483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5493c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 5503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry FboApiCase (const FboApiCase& other); 5513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry FboApiCase& operator= (const FboApiCase& other); 5523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TestFunc m_testFunc; 5543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 5553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5563c827367444ee418f129b2c238299f49d3264554Jarkko PoyryFboApiCase::FboApiCase (Context& context, const char* name, const char* description, TestFunc test) 5573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : TestCase (context, name, description) 5583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_testFunc (test) 5593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 5603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 5613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5623c827367444ee418f129b2c238299f49d3264554Jarkko PoyryFboApiCase::~FboApiCase (void) 5633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 5643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 5653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5663c827367444ee418f129b2c238299f49d3264554Jarkko PoyryTestCase::IterateResult FboApiCase::iterate (void) 5673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 5683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const glw::Functions& gl = m_context.getRenderContext().getFunctions(); 5693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLU_EXPECT_NO_ERROR(gl.getError(), "Before test case"); 5713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Initialize result to PASS 5733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass"); 5743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Execute test case 5763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 5773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry sglr::GLContext context(m_context.getRenderContext(), m_testCtx.getLog(), sglr::GLCONTEXT_LOG_CALLS, tcu::IVec4(0, 0, m_context.getRenderTarget().getWidth(), m_context.getRenderTarget().getHeight())); 5783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testFunc(m_testCtx, context); 5793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 5803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLU_EXPECT_NO_ERROR(gl.getError(), "After test case"); 5823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return STOP; 5843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 5853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5863c827367444ee418f129b2c238299f49d3264554Jarkko PoyryFboApiTestGroup::FboApiTestGroup (Context& context) 5873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : TestCaseGroup(context, "api", "API Tests") 5883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 5893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 5903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5913c827367444ee418f129b2c238299f49d3264554Jarkko PoyryFboApiTestGroup::~FboApiTestGroup (void) 5923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 5933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 5943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5953c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid FboApiTestGroup::init (void) 5963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 5973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::set<std::string> extensions; 5983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::copy(m_context.getContextInfo().getExtensions().begin(), m_context.getContextInfo().getExtensions().end(), std::inserter(extensions, extensions.begin())); 5993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry bool defaultFboIsZero = m_context.getRenderContext().getDefaultFramebuffer() == 0; 6013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry bool hasRenderToMipmap = extensions.find("GL_OES_fbo_render_mipmap") != extensions.end(); 6023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Valid attachments 6043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new FboApiCase(m_context, "valid_tex2d_attachments", "Valid 2D texture attachments", validTex2DAttachmentsTest)); 6053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new FboApiCase(m_context, "valid_texcube_attachments", "Valid cubemap attachments", validTexCubeAttachmentsTest)); 6063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new FboApiCase(m_context, "valid_rbo_attachments", "Valid renderbuffer attachments", validRboAttachmentsTest)); 6073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Invalid attachments 6093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new FboApiCase(m_context, "attach_to_default_fbo", "Invalid usage: attaching to default FBO", defaultFboIsZero ? attachToDefaultFramebufferTest : notSupportedTest)); 6103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new FboApiCase(m_context, "invalid_tex2d_attachments", "Invalid 2D texture attachments", invalidTex2DAttachmentTest)); 6113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new FboApiCase(m_context, "invalid_texcube_attachments", "Invalid cubemap attachments", invalidTexCubeAttachmentTest)); 6123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new FboApiCase(m_context, "invalid_rbo_attachments", "Invalid renderbuffer attachments", invalidRboAttachmentTest)); 6133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new FboApiCase(m_context, "attach_names", "Attach allocated names without objects", attachNamesTest)); 6143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new FboApiCase(m_context, "texture_levels", "Valid and invalid texturel levels", hasRenderToMipmap ? textureLevelsWithRenderToMipmapTest : textureLevelsTest)); 6163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Attachment queries 6183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new FboApiCase(m_context, "attachment_query_default_fbo", "Query attachments from default FBO", defaultFboIsZero ? attachmentQueryDefaultFboTest : notSupportedTest)); 6193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new FboApiCase(m_context, "attachment_query_empty_fbo", "Query attachments from empty FBO", attachmentQueryEmptyFboTest)); 6203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new FboApiCase(m_context, "attachment_query_tex2d", "Query 2d texture attachment properties", attachmentQueryTex2DTest)); 6213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new FboApiCase(m_context, "attachment_query_texcube", "Query cubemap attachment properties", attachmentQueryTexCubeTest)); 6223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new FboApiCase(m_context, "attachment_query_rbo", "Query renderbuffer attachment properties", attachmentQueryRboTest)); 6233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Delete attachments 6253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new FboApiCase(m_context, "delete_tex_2d_attached_to_bound_fbo", "Delete 2d texture attached to currently bound FBO", deleteTex2DAttachedToBoundFboTest)); 6263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new FboApiCase(m_context, "delete_tex_cube_attached_to_bound_fbo", "Delete cubemap attached to currently bound FBO", deleteTexCubeAttachedToBoundFboTest)); 6273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new FboApiCase(m_context, "delete_rbo_attached_to_bound_fbo", "Delete renderbuffer attached to currently bound FBO", deleteRboAttachedToBoundFboTest)); 6283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new FboApiCase(m_context, "delete_tex_2d_attached_to_not_bound_fbo", "Delete 2d texture attached to FBO", deleteTex2DAttachedToNotBoundFboTest)); 6303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new FboApiCase(m_context, "delete_tex_cube_attached_to_not_bound_fbo", "Delete cubemap attached to FBO", deleteTexCubeAttachedToNotBoundFboTest)); 6313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new FboApiCase(m_context, "delete_rbo_attached_to_not_bound_fbo", "Delete renderbuffer attached to FBO", deleteRboAttachedToNotBoundFboTest)); 6323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 6333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // Functional 6353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // gles2 6363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp 637