13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*------------------------------------------------------------------------- 23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program OpenGL (ES) 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 completeness tests. 223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "es2fFboCompletenessTests.hpp" 253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glsFboCompletenessTests.hpp" 273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluObjectWrapper.hpp" 283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 293c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing namespace glw; 303c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing deqp::gls::Range; 313c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing namespace deqp::gls::FboUtil; 323c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing namespace deqp::gls::FboUtil::config; 333c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace fboc = deqp::gls::fboc; 343c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytypedef tcu::TestCase::IterateResult IterateResult; 353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 363c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp 373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 383c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace gles2 393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 403c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace Functional 413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 433c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic const FormatKey s_es2ColorRenderables[] = 443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_RGBA4, GL_RGB5_A1, GL_RGB565, 463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// GLES2 does not strictly allow these, but this seems to be a bug in the 493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// specification. For now, let's assume the unsized formats corresponding to 503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// the color-renderable sized formats are allowed. 513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// See https://cvs.khronos.org/bugzilla/show_bug.cgi?id=7333 523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 533c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic const FormatKey s_es2UnsizedColorRenderables[] = 543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLS_UNSIZED_FORMATKEY(GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4), 563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLS_UNSIZED_FORMATKEY(GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1), 573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLS_UNSIZED_FORMATKEY(GL_RGB, GL_UNSIGNED_SHORT_5_6_5) 583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 603c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic const FormatKey s_es2DepthRenderables[] = 613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_DEPTH_COMPONENT16, 633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 653c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic const FormatKey s_es2StencilRenderables[] = 663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_STENCIL_INDEX8, 683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 703c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic const FormatEntry s_es2Formats[] = 713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { COLOR_RENDERABLE | TEXTURE_VALID, 733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLS_ARRAY_RANGE(s_es2UnsizedColorRenderables) }, 743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { REQUIRED_RENDERABLE | COLOR_RENDERABLE | RENDERBUFFER_VALID, 753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLS_ARRAY_RANGE(s_es2ColorRenderables) }, 763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { REQUIRED_RENDERABLE | DEPTH_RENDERABLE | RENDERBUFFER_VALID, 773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLS_ARRAY_RANGE(s_es2DepthRenderables) }, 783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { REQUIRED_RENDERABLE | STENCIL_RENDERABLE | RENDERBUFFER_VALID, 793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLS_ARRAY_RANGE(s_es2StencilRenderables) }, 803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// We have here only the extensions that are redundant in vanilla GLES3. Those 833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// that are applicable both to GLES2 and GLES3 are in glsFboCompletenessTests.cpp. 843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// GL_OES_texture_float 863c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic const FormatKey s_oesTextureFloatFormats[] = 873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLS_UNSIZED_FORMATKEY(GL_RGBA, GL_FLOAT), 893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLS_UNSIZED_FORMATKEY(GL_RGB, GL_FLOAT), 903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// GL_OES_texture_half_float 933c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic const FormatKey s_oesTextureHalfFloatFormats[] = 943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLS_UNSIZED_FORMATKEY(GL_RGBA, GL_HALF_FLOAT_OES), 963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLS_UNSIZED_FORMATKEY(GL_RGB, GL_HALF_FLOAT_OES), 973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 99ef47bf903439ca2c12640ec0f397d29e8bd4f197Jarkko Pöyry// GL_EXT_sRGB_write_control 100ef47bf903439ca2c12640ec0f397d29e8bd4f197Jarkko Pöyrystatic const FormatKey s_extSrgbWriteControlFormats[] = 101ef47bf903439ca2c12640ec0f397d29e8bd4f197Jarkko Pöyry{ 102ef47bf903439ca2c12640ec0f397d29e8bd4f197Jarkko Pöyry GL_SRGB8_ALPHA8 103ef47bf903439ca2c12640ec0f397d29e8bd4f197Jarkko Pöyry}; 104ef47bf903439ca2c12640ec0f397d29e8bd4f197Jarkko Pöyry 105bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry// DEQP_gles3_core_no_extension_features 106bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyrystatic const FormatKey s_es3NoExtRboFormats[] = 107bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry{ 108bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry GL_RGB10_A2, 109bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry}; 110bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyrystatic const FormatKey s_es3NoExtTextureFormats[] = 111bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry{ 112bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry GL_R16F, 113bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry GL_RG16F, 114bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry GL_RGB16F, 115bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry GL_RGBA16F, 116bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry GL_R11F_G11F_B10F, 117bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry}; 118bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyrystatic const FormatKey s_es3NoExtTextureColorRenderableFormats[] = 119bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry{ 120bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry GL_R8, 121bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry GL_RG8, 122bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry}; 123bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry 124bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry// with ES3 core and GL_EXT_color_buffer_float 125bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyrystatic const FormatKey s_es3NoExtExtColorBufferFloatFormats[] = 126bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry{ 127bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry // \note Only the GLES2+exts subset of formats 128bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry GL_R11F_G11F_B10F, GL_RGBA16F, GL_RG16F, GL_R16F, 129bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry}; 130bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry 131bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry// with ES3 core with OES_texture_stencil8 132bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyrystatic const FormatKey s_es3NoExtOesTextureStencil8Formats[] = 133bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry{ 134bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry GL_STENCIL_INDEX8, 135bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry}; 136bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry 1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic const FormatExtEntry s_es2ExtFormats[] = 1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // The extension does not specify these to be color-renderable. 1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry "GL_OES_texture_float", 1425489a504dfaafc62f5144efd9aaa299182d92428Pyry Haulos (deUint32)TEXTURE_VALID, 1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLS_ARRAY_RANGE(s_oesTextureFloatFormats) 1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }, 1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry "GL_OES_texture_half_float", 1475489a504dfaafc62f5144efd9aaa299182d92428Pyry Haulos (deUint32)TEXTURE_VALID, 1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLS_ARRAY_RANGE(s_oesTextureHalfFloatFormats) 1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }, 150ef47bf903439ca2c12640ec0f397d29e8bd4f197Jarkko Pöyry 151ef47bf903439ca2c12640ec0f397d29e8bd4f197Jarkko Pöyry // GL_EXT_sRGB_write_control makes SRGB8_ALPHA8 color-renderable 152ef47bf903439ca2c12640ec0f397d29e8bd4f197Jarkko Pöyry { 153ef47bf903439ca2c12640ec0f397d29e8bd4f197Jarkko Pöyry "GL_EXT_sRGB_write_control", 1545489a504dfaafc62f5144efd9aaa299182d92428Pyry Haulos (deUint32)(REQUIRED_RENDERABLE | TEXTURE_VALID | COLOR_RENDERABLE | RENDERBUFFER_VALID), 155ef47bf903439ca2c12640ec0f397d29e8bd4f197Jarkko Pöyry GLS_ARRAY_RANGE(s_extSrgbWriteControlFormats) 156ef47bf903439ca2c12640ec0f397d29e8bd4f197Jarkko Pöyry }, 157bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry 158bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry // Since GLES3 is "backwards compatible" to GLES2, we might actually be running on a GLES3 159bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry // context. Since GLES3 added some features to core with no corresponding GLES2 extension, 160bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry // some tests might produce wrong results (since they are using rules of GLES2 & extensions) 161bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry // 162bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry // To avoid this, require new features of GLES3 that have no matching GLES2 extension if 163bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry // context is GLES3. This can be done with a DEQP_* extensions. 164bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry // 165bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry // \note Not all feature changes are listed here but only those that alter GLES2 subset of 166bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry // the formats 167bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry { 168bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry "DEQP_gles3_core_compatible", 1695489a504dfaafc62f5144efd9aaa299182d92428Pyry Haulos (deUint32)(REQUIRED_RENDERABLE | COLOR_RENDERABLE | RENDERBUFFER_VALID), 170bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry GLS_ARRAY_RANGE(s_es3NoExtRboFormats) 171bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry }, 172bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry { 173bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry "DEQP_gles3_core_compatible", 1745489a504dfaafc62f5144efd9aaa299182d92428Pyry Haulos (deUint32)TEXTURE_VALID, 175bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry GLS_ARRAY_RANGE(s_es3NoExtTextureFormats) 176bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry }, 177bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry { 178bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry "DEQP_gles3_core_compatible", 1791d7c8df82e40052467289e49dd5d20c39a229943Alexander Galazin (deUint32)(REQUIRED_RENDERABLE | TEXTURE_VALID | COLOR_RENDERABLE | RENDERBUFFER_VALID), 180bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry GLS_ARRAY_RANGE(s_es3NoExtTextureColorRenderableFormats) 181bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry }, 182bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry { 183bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry "DEQP_gles3_core_compatible GL_EXT_color_buffer_float", 1845489a504dfaafc62f5144efd9aaa299182d92428Pyry Haulos (deUint32)(REQUIRED_RENDERABLE | COLOR_RENDERABLE | RENDERBUFFER_VALID), 185bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry GLS_ARRAY_RANGE(s_es3NoExtExtColorBufferFloatFormats) 186bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry }, 187bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry { 188bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry "DEQP_gles3_core_compatible GL_OES_texture_stencil8", 1895489a504dfaafc62f5144efd9aaa299182d92428Pyry Haulos (deUint32)(REQUIRED_RENDERABLE | STENCIL_RENDERABLE | TEXTURE_VALID), 190bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry GLS_ARRAY_RANGE(s_es3NoExtOesTextureStencil8Formats) 191bf845c4e3814b85e1a3e23a27f50c8f888f4bd2dJarkko Pöyry }, 1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass ES2Checker : public Checker 1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 1974e5dbcc5c6db2408970d1e9bec76c3936aeee204Jarkko Pöyry ES2Checker (const glu::RenderContext& ctx); 1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void check (GLenum attPoint, const Attachment& att, 1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const Image* image); 2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLsizei m_width; //< The common width of images 2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLsizei m_height; //< The common height of images 2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 2043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2054e5dbcc5c6db2408970d1e9bec76c3936aeee204Jarkko PöyryES2Checker::ES2Checker (const glu::RenderContext& ctx)\ 2064e5dbcc5c6db2408970d1e9bec76c3936aeee204Jarkko Pöyry : Checker (ctx) 2074e5dbcc5c6db2408970d1e9bec76c3936aeee204Jarkko Pöyry , m_width (-1) 2084e5dbcc5c6db2408970d1e9bec76c3936aeee204Jarkko Pöyry , m_height (-1) 2094e5dbcc5c6db2408970d1e9bec76c3936aeee204Jarkko Pöyry{ 2104e5dbcc5c6db2408970d1e9bec76c3936aeee204Jarkko Pöyry} 2114e5dbcc5c6db2408970d1e9bec76c3936aeee204Jarkko Pöyry 2124e5dbcc5c6db2408970d1e9bec76c3936aeee204Jarkko Pöyryvoid ES2Checker::check (GLenum attPoint, const Attachment& att, const Image* image) 2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_UNREF(attPoint); 2153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_UNREF(att); 2163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // GLES2: "All attached images have the same width and height." 2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (m_width == -1) 2183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_width = image->width; 2203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_height = image->height; 2213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2224e5dbcc5c6db2408970d1e9bec76c3936aeee204Jarkko Pöyry else if (image->width != m_width || image->height != m_height) 2233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2244e5dbcc5c6db2408970d1e9bec76c3936aeee204Jarkko Pöyry // Since GLES3 is "backwards compatible" to GLES2, we might actually be running 2254e5dbcc5c6db2408970d1e9bec76c3936aeee204Jarkko Pöyry // on a GLES3 context. On GLES3, FRAMEBUFFER_INCOMPLETE_DIMENSIONS is not generated 2264e5dbcc5c6db2408970d1e9bec76c3936aeee204Jarkko Pöyry // if attachments have different sizes. 2274e5dbcc5c6db2408970d1e9bec76c3936aeee204Jarkko Pöyry if (!gls::FboUtil::checkExtensionSupport(m_renderCtx, "DEQP_gles3_core_compatible")) 2284e5dbcc5c6db2408970d1e9bec76c3936aeee204Jarkko Pöyry { 2294e5dbcc5c6db2408970d1e9bec76c3936aeee204Jarkko Pöyry // running on GLES2 230b5c60b02e542a61a2b658272034c830f92b4c766Jarkko Pöyry addFBOStatus(GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS, "Sizes of attachments differ"); 2314e5dbcc5c6db2408970d1e9bec76c3936aeee204Jarkko Pöyry } 2323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // GLES2, 4.4.5: "some implementations may not support rendering to 2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // particular combinations of internal formats. If the combination of 2353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // formats of the images attached to a framebuffer object are not 2363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // supported by the implementation, then the framebuffer is not complete 2373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // under the clause labeled FRAMEBUFFER_UNSUPPORTED." 2383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // 2393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Hence it is _always_ allowed to report FRAMEBUFFER_UNSUPPORTED. 240b5c60b02e542a61a2b658272034c830f92b4c766Jarkko Pöyry addPotentialFBOStatus(GL_FRAMEBUFFER_UNSUPPORTED, "Particular format combinations need not to be supported"); 2413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2433c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystruct FormatCombination 2443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLenum colorKind; 2463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ImageFormat colorFmt; 2473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLenum depthKind; 2483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ImageFormat depthFmt; 2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLenum stencilKind; 2503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ImageFormat stencilFmt; 2513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 2523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2533c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass SupportedCombinationTest : public fboc::TestBase 2543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2553c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 2563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry SupportedCombinationTest (fboc::Context& ctx, 2573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const char* name, const char* desc) 2583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : TestBase (ctx, name, desc) {} 2593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry IterateResult iterate (void); 2613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry bool tryCombination (const FormatCombination& comb); 2623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLenum formatKind (ImageFormat fmt); 2633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 2643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2653c827367444ee418f129b2c238299f49d3264554Jarkko Poyrybool SupportedCombinationTest::tryCombination (const FormatCombination& comb) 2663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glu::Framebuffer fbo(m_ctx.getRenderContext()); 2683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry FboBuilder builder(*fbo, GL_FRAMEBUFFER, fboc::gl(*this)); 2693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry attachTargetToNew(GL_COLOR_ATTACHMENT0, comb.colorKind, comb.colorFmt, 271653ad0e8a4209754304cbd5b5ceb4fdc7b29c01aPyry Haulos 64, 64, builder); 2723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry attachTargetToNew(GL_DEPTH_ATTACHMENT, comb.depthKind, comb.depthFmt, 2733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 64, 64, builder); 2743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry attachTargetToNew(GL_STENCIL_ATTACHMENT, comb.stencilKind, comb.stencilFmt, 2753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 64, 64, builder); 2763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const GLenum glStatus = fboc::gl(*this).checkFramebufferStatus(GL_FRAMEBUFFER); 2783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return (glStatus == GL_FRAMEBUFFER_COMPLETE); 2803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2823c827367444ee418f129b2c238299f49d3264554Jarkko PoyryGLenum SupportedCombinationTest::formatKind (ImageFormat fmt) 2833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (fmt.format == GL_NONE) 2853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return GL_NONE; 2863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 287b5c60b02e542a61a2b658272034c830f92b4c766Jarkko Pöyry const FormatFlags flags = m_ctx.getCoreFormats().getFormatInfo(fmt); 2883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const bool rbo = (flags & RENDERBUFFER_VALID) != 0; 2893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // exactly one of renderbuffer and texture is supported by vanilla GLES2 formats 2903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_ASSERT(rbo != ((flags & TEXTURE_VALID) != 0)); 2913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return rbo ? GL_RENDERBUFFER : GL_TEXTURE; 2933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2953c827367444ee418f129b2c238299f49d3264554Jarkko PoyryIterateResult SupportedCombinationTest::iterate (void) 2963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 297b5c60b02e542a61a2b658272034c830f92b4c766Jarkko Pöyry const FormatDB& db = m_ctx.getCoreFormats(); 2983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const ImageFormat none = ImageFormat::none(); 2993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Formats colorFmts = db.getFormats(COLOR_RENDERABLE); 3003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Formats depthFmts = db.getFormats(DEPTH_RENDERABLE); 3013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Formats stencilFmts = db.getFormats(STENCIL_RENDERABLE); 3023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry FormatCombination comb; 3033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry bool succ = false; 3043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry colorFmts.insert(none); 3063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry depthFmts.insert(none); 3073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry stencilFmts.insert(none); 3083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (Formats::const_iterator col = colorFmts.begin(); col != colorFmts.end(); col++) 3103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry comb.colorFmt = *col; 3123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry comb.colorKind = formatKind(*col); 3133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (Formats::const_iterator dep = depthFmts.begin(); dep != depthFmts.end(); dep++) 3143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry comb.depthFmt = *dep; 3163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry comb.depthKind = formatKind(*dep); 3173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (Formats::const_iterator stc = stencilFmts.begin(); 3183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry stc != stencilFmts.end(); stc++) 3193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry comb.stencilFmt = *stc; 3213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry comb.stencilKind = formatKind(*stc); 3223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry succ = tryCombination(comb); 3233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (succ) 3243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 3253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (succ) 3303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry pass(); 3313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else 3323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry fail("No supported format combination found"); 3333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return STOP; 3353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 3363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3374e5dbcc5c6db2408970d1e9bec76c3936aeee204Jarkko Pöyryclass ES2CheckerFactory : public CheckerFactory 3384e5dbcc5c6db2408970d1e9bec76c3936aeee204Jarkko Pöyry{ 3393c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 3404e5dbcc5c6db2408970d1e9bec76c3936aeee204Jarkko Pöyry Checker* createChecker (const glu::RenderContext& ctx) { return new ES2Checker(ctx); } 3413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 3423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3433c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass TestGroup : public TestCaseGroup 3443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3453c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 3463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TestGroup (Context& ctx); 3473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void init (void); 3483c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 3493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ES2CheckerFactory m_checkerFactory; 3503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry fboc::Context m_fboc; 3513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 3523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3533c827367444ee418f129b2c238299f49d3264554Jarkko PoyryTestGroup::TestGroup (Context& ctx) 3543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : TestCaseGroup (ctx, "completeness", "Completeness tests") 3553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_checkerFactory () 3563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_fboc (ctx.getTestContext(), ctx.getRenderContext(), m_checkerFactory) 3573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const FormatEntries stdRange = GLS_ARRAY_RANGE(s_es2Formats); 3593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const FormatExtEntries extRange = GLS_ARRAY_RANGE(s_es2ExtFormats); 3603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_fboc.addFormats(stdRange); 3623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_fboc.addExtFormats(extRange); 3633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_fboc.setHaveMulticolorAtts( 3643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.getContextInfo().isExtensionSupported("GL_NV_fbo_color_attachments")); 3653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 3663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3673c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid TestGroup::init (void) 3683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* attCombTests = m_fboc.createAttachmentTests(); 3703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(m_fboc.createRenderableTests()); 3713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry attCombTests->addChild(new SupportedCombinationTest( 3723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_fboc, 3733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry "exists_supported", 3743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry "Test for existence of a supported combination of formats")); 3753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(attCombTests); 3763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(m_fboc.createSizeTests()); 3773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 3783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3793c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytcu::TestCaseGroup* createFboCompletenessTests (Context& context) 3803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return new TestGroup(context); 3823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 3833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // Functional 3853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // gles2 3863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp 387