es3fCompressedTextureTests.cpp revision efb83e1354edd463650ad0404b18e9a7efc307e4
1/*-------------------------------------------------------------------------
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;
37using tcu::CompressedTexFormat;
38
39namespace deqp
40{
41namespace gles3
42{
43namespace Functional
44{
45
46static const string getASTCFormatShortName (CompressedTexFormat format)
47{
48	DE_ASSERT(tcu::isAstcFormat(format));
49	const IVec3 blockSize = tcu::getBlockPixelSize(format);
50	DE_ASSERT(blockSize.z() == 1);
51
52	return de::toString(blockSize.x()) + "x" + de::toString(blockSize.y()) + (tcu::isAstcSRGBFormat(format) ? "_srgb" : "");
53}
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 < tcu::astc::BLOCK_TEST_TYPE_LAST; astcTestTypeI++)
74		{
75			const tcu::astc::BlockTestType	astcTestType	= (tcu::astc::BlockTestType)astcTestTypeI;
76			TestCaseGroup* const			testTypeGroup	= new TestCaseGroup(m_context, getBlockTestTypeName(astcTestType), getBlockTestTypeDescription(astcTestType));
77			astcGroup->addChild(testTypeGroup);
78
79			for (int formatI = 0; formatI < tcu::COMPRESSEDTEXFORMAT_LAST; formatI++)
80			{
81				const CompressedTexFormat format = (CompressedTexFormat)formatI;
82
83				if (!tcu::isAstcFormat(format))
84					continue;
85				if (tcu::isAstcSRGBFormat(format) && tcu::astc::isBlockTestTypeHDROnly(astcTestType))
86					continue;
87
88				testTypeGroup->addChild(new ASTCBlockCase2D(m_context, getASTCFormatShortName(format).c_str(), glu::getCompressedTextureFormatName(glu::getGLFormat(format)), astcTestType, format));
89			}
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
98			for (int formatI = 0; formatI < tcu::COMPRESSEDTEXFORMAT_LAST; formatI++)
99			{
100				const CompressedTexFormat format = (CompressedTexFormat)formatI;
101
102				if (!tcu::isAstcFormat(format))
103					continue;
104
105				blockSizeRemainderGroup->addChild(new ASTCBlockSizeRemainderCase2D(m_context, getASTCFormatShortName(format).c_str(), glu::getCompressedTextureFormatName(glu::getGLFormat(format)), format));
106			}
107		}
108	}
109}
110
111} // Functional
112} // gles3
113} // deqp
114