blob: f8e62979a721056915f2a9794373422ecba1bc1a [file] [log] [blame]
Jarkko Poyry3c827362014-09-02 11:48:52 +03001/*-------------------------------------------------------------------------
2 * drawElements Quality Program OpenGL ES 3.0 Module
3 * -------------------------------------------------
4 *
5 * Copyright 2014 The Android Open Source Project
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 *//*!
20 * \file
21 * \brief Compressed texture tests
22 *//*--------------------------------------------------------------------*/
23
24#include "es3fCompressedTextureTests.hpp"
25#include "es3fASTCDecompressionCases.hpp"
26#include "gluStrUtil.hpp"
27#include "gluTextureUtil.hpp"
28#include "tcuCompressedTexture.hpp"
29#include "tcuVector.hpp"
30#include "deStringUtil.hpp"
31
32#include <string>
33
34using std::string;
35using tcu::IVec3;
36using tcu::CompressedTexture;
Mika Isojärvibecd5d52014-11-04 17:30:50 +020037using tcu::CompressedTexFormat;
Jarkko Poyry3c827362014-09-02 11:48:52 +030038
39namespace deqp
40{
41namespace gles3
42{
43namespace Functional
44{
45
Mika Isojärvibecd5d52014-11-04 17:30:50 +020046static const string getASTCFormatShortName (CompressedTexFormat format)
Jarkko Poyry3c827362014-09-02 11:48:52 +030047{
Mika Isojärvibecd5d52014-11-04 17:30:50 +020048 DE_ASSERT(tcu::isAstcFormat(format));
49 const IVec3 blockSize = tcu::getBlockPixelSize(format);
Jarkko Poyry3c827362014-09-02 11:48:52 +030050 DE_ASSERT(blockSize.z() == 1);
51
Mika Isojärvibecd5d52014-11-04 17:30:50 +020052 return de::toString(blockSize.x()) + "x" + de::toString(blockSize.y()) + (tcu::isAstcSRGBFormat(format) ? "_srgb" : "");
Jarkko Poyry3c827362014-09-02 11:48:52 +030053}
54
55CompressedTextureTests::CompressedTextureTests (Context& context)
56 : TestCaseGroup (context, "compressed", "Compressed Texture Tests")
57{
58}
59
60CompressedTextureTests::~CompressedTextureTests (void)
61{
62}
63
64void CompressedTextureTests::init (void)
65{
66 // ASTC cases.
67 {
68 TestCaseGroup* const astcGroup = new TestCaseGroup(m_context, "astc", "ASTC Tests");
69 addChild(astcGroup);
70
71 // Block test cases.
72
73 for (int astcTestTypeI = 0; astcTestTypeI < ASTCBLOCKTESTTYPE_LAST; astcTestTypeI++)
74 {
75 const ASTCBlockTestType astcTestType = (ASTCBlockTestType)astcTestTypeI;
76 TestCaseGroup* const testTypeGroup = new TestCaseGroup(m_context, getBlockTestTypeName(astcTestType), getBlockTestTypeDescription(astcTestType));
77 astcGroup->addChild(testTypeGroup);
78
Mika Isojärvibecd5d52014-11-04 17:30:50 +020079 for (int formatI = 0; formatI < tcu::COMPRESSEDTEXFORMAT_LAST; formatI++)
Jarkko Poyry3c827362014-09-02 11:48:52 +030080 {
Mika Isojärvibecd5d52014-11-04 17:30:50 +020081 const CompressedTexFormat format = (CompressedTexFormat)formatI;
Jarkko Poyry3c827362014-09-02 11:48:52 +030082
Mika Isojärvibecd5d52014-11-04 17:30:50 +020083 if (!tcu::isAstcFormat(format))
Jarkko Poyry3c827362014-09-02 11:48:52 +030084 continue;
Mika Isojärvibecd5d52014-11-04 17:30:50 +020085 if (tcu::isAstcSRGBFormat(format) && isBlockTestTypeHDROnly(astcTestType))
Jarkko Poyry3c827362014-09-02 11:48:52 +030086 continue;
87
Jarkko Pöyryb2e583d2015-06-19 13:05:18 -070088 testTypeGroup->addChild(new ASTCBlockCase2D(m_context, getASTCFormatShortName(format).c_str(), glu::getCompressedTextureFormatName(glu::getGLFormat(format)), astcTestType, format));
Jarkko Poyry3c827362014-09-02 11:48:52 +030089 }
90 }
91
92 // Image size/block size remainder cases.
93
94 {
95 TestCaseGroup* const blockSizeRemainderGroup = new TestCaseGroup(m_context, "block_size_remainder", "Test image size/block size remainders");
96 astcGroup->addChild(blockSizeRemainderGroup);
97
Mika Isojärvibecd5d52014-11-04 17:30:50 +020098 for (int formatI = 0; formatI < tcu::COMPRESSEDTEXFORMAT_LAST; formatI++)
Jarkko Poyry3c827362014-09-02 11:48:52 +030099 {
Mika Isojärvibecd5d52014-11-04 17:30:50 +0200100 const CompressedTexFormat format = (CompressedTexFormat)formatI;
Jarkko Poyry3c827362014-09-02 11:48:52 +0300101
Mika Isojärvibecd5d52014-11-04 17:30:50 +0200102 if (!tcu::isAstcFormat(format))
Jarkko Poyry3c827362014-09-02 11:48:52 +0300103 continue;
104
Jarkko Pöyryb2e583d2015-06-19 13:05:18 -0700105 blockSizeRemainderGroup->addChild(new ASTCBlockSizeRemainderCase2D(m_context, getASTCFormatShortName(format).c_str(), glu::getCompressedTextureFormatName(glu::getGLFormat(format)), format));
Jarkko Poyry3c827362014-09-02 11:48:52 +0300106 }
107 }
108 }
109}
110
111} // Functional
112} // gles3
113} // deqp