13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*------------------------------------------------------------------------- 23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program OpenGL ES 3.0 Module 33c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * ------------------------------------------------- 43c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 53c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Copyright 2014 The Android Open Source Project 63c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 73c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Licensed under the Apache License, Version 2.0 (the "License"); 83c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * you may not use this file except in compliance with the License. 93c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * You may obtain a copy of the License at 103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * http://www.apache.org/licenses/LICENSE-2.0 123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Unless required by applicable law or agreed to in writing, software 143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * distributed under the License is distributed on an "AS IS" BASIS, 153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * See the License for the specific language governing permissions and 173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * limitations under the License. 183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*! 203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \file 213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Compressed texture tests 223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "es3fCompressedTextureTests.hpp" 253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "es3fASTCDecompressionCases.hpp" 263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluStrUtil.hpp" 273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluTextureUtil.hpp" 283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuCompressedTexture.hpp" 293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuVector.hpp" 303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deStringUtil.hpp" 313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <string> 333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 343c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing std::string; 353c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing tcu::IVec3; 363c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing tcu::CompressedTexture; 37becd5d53015521acf7536ba754de326d8b1da2f3Mika Isojärviusing tcu::CompressedTexFormat; 383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 393c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp 403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 413c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace gles3 423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 433c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace Functional 443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 46becd5d53015521acf7536ba754de326d8b1da2f3Mika Isojärvistatic const string getASTCFormatShortName (CompressedTexFormat format) 473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 48becd5d53015521acf7536ba754de326d8b1da2f3Mika Isojärvi DE_ASSERT(tcu::isAstcFormat(format)); 49becd5d53015521acf7536ba754de326d8b1da2f3Mika Isojärvi const IVec3 blockSize = tcu::getBlockPixelSize(format); 503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_ASSERT(blockSize.z() == 1); 513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 52becd5d53015521acf7536ba754de326d8b1da2f3Mika Isojärvi return de::toString(blockSize.x()) + "x" + de::toString(blockSize.y()) + (tcu::isAstcSRGBFormat(format) ? "_srgb" : ""); 533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 553c827367444ee418f129b2c238299f49d3264554Jarkko PoyryCompressedTextureTests::CompressedTextureTests (Context& context) 563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : TestCaseGroup (context, "compressed", "Compressed Texture Tests") 573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 603c827367444ee418f129b2c238299f49d3264554Jarkko PoyryCompressedTextureTests::~CompressedTextureTests (void) 613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 643c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid CompressedTextureTests::init (void) 653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // ASTC cases. 673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TestCaseGroup* const astcGroup = new TestCaseGroup(m_context, "astc", "ASTC Tests"); 693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(astcGroup); 703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Block test cases. 723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 73efb83e1354edd463650ad0404b18e9a7efc307e4Pyry Haulos for (int astcTestTypeI = 0; astcTestTypeI < tcu::astc::BLOCK_TEST_TYPE_LAST; astcTestTypeI++) 743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 75efb83e1354edd463650ad0404b18e9a7efc307e4Pyry Haulos const tcu::astc::BlockTestType astcTestType = (tcu::astc::BlockTestType)astcTestTypeI; 76efb83e1354edd463650ad0404b18e9a7efc307e4Pyry Haulos TestCaseGroup* const testTypeGroup = new TestCaseGroup(m_context, getBlockTestTypeName(astcTestType), getBlockTestTypeDescription(astcTestType)); 773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry astcGroup->addChild(testTypeGroup); 783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 79becd5d53015521acf7536ba754de326d8b1da2f3Mika Isojärvi for (int formatI = 0; formatI < tcu::COMPRESSEDTEXFORMAT_LAST; formatI++) 803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 81becd5d53015521acf7536ba754de326d8b1da2f3Mika Isojärvi const CompressedTexFormat format = (CompressedTexFormat)formatI; 823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 83becd5d53015521acf7536ba754de326d8b1da2f3Mika Isojärvi if (!tcu::isAstcFormat(format)) 843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry continue; 85efb83e1354edd463650ad0404b18e9a7efc307e4Pyry Haulos if (tcu::isAstcSRGBFormat(format) && tcu::astc::isBlockTestTypeHDROnly(astcTestType)) 863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry continue; 873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 88b2e583dfcd8aa0d4ef254f841213fcf724b2b193Jarkko Pöyry testTypeGroup->addChild(new ASTCBlockCase2D(m_context, getASTCFormatShortName(format).c_str(), glu::getCompressedTextureFormatName(glu::getGLFormat(format)), astcTestType, format)); 893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Image size/block size remainder cases. 933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TestCaseGroup* const blockSizeRemainderGroup = new TestCaseGroup(m_context, "block_size_remainder", "Test image size/block size remainders"); 963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry astcGroup->addChild(blockSizeRemainderGroup); 973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 98becd5d53015521acf7536ba754de326d8b1da2f3Mika Isojärvi for (int formatI = 0; formatI < tcu::COMPRESSEDTEXFORMAT_LAST; formatI++) 993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 100becd5d53015521acf7536ba754de326d8b1da2f3Mika Isojärvi const CompressedTexFormat format = (CompressedTexFormat)formatI; 1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 102becd5d53015521acf7536ba754de326d8b1da2f3Mika Isojärvi if (!tcu::isAstcFormat(format)) 1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry continue; 1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 105b2e583dfcd8aa0d4ef254f841213fcf724b2b193Jarkko Pöyry blockSizeRemainderGroup->addChild(new ASTCBlockSizeRemainderCase2D(m_context, getASTCFormatShortName(format).c_str(), glu::getCompressedTextureFormatName(glu::getGLFormat(format)), format)); 1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // Functional 1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // gles3 1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp 114