1*35238bceSAndroid Build Coastguard Worker /*-------------------------------------------------------------------------
2*35238bceSAndroid Build Coastguard Worker * drawElements Quality Program OpenGL ES 3.0 Module
3*35238bceSAndroid Build Coastguard Worker * -------------------------------------------------
4*35238bceSAndroid Build Coastguard Worker *
5*35238bceSAndroid Build Coastguard Worker * Copyright 2014 The Android Open Source Project
6*35238bceSAndroid Build Coastguard Worker *
7*35238bceSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License");
8*35238bceSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License.
9*35238bceSAndroid Build Coastguard Worker * You may obtain a copy of the License at
10*35238bceSAndroid Build Coastguard Worker *
11*35238bceSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0
12*35238bceSAndroid Build Coastguard Worker *
13*35238bceSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software
14*35238bceSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS,
15*35238bceSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16*35238bceSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and
17*35238bceSAndroid Build Coastguard Worker * limitations under the License.
18*35238bceSAndroid Build Coastguard Worker *
19*35238bceSAndroid Build Coastguard Worker *//*!
20*35238bceSAndroid Build Coastguard Worker * \file
21*35238bceSAndroid Build Coastguard Worker * \brief Compressed texture tests
22*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
23*35238bceSAndroid Build Coastguard Worker
24*35238bceSAndroid Build Coastguard Worker #include "es3fCompressedTextureTests.hpp"
25*35238bceSAndroid Build Coastguard Worker #include "es3fASTCDecompressionCases.hpp"
26*35238bceSAndroid Build Coastguard Worker #include "gluStrUtil.hpp"
27*35238bceSAndroid Build Coastguard Worker #include "gluTextureUtil.hpp"
28*35238bceSAndroid Build Coastguard Worker #include "tcuCompressedTexture.hpp"
29*35238bceSAndroid Build Coastguard Worker #include "tcuVector.hpp"
30*35238bceSAndroid Build Coastguard Worker #include "deStringUtil.hpp"
31*35238bceSAndroid Build Coastguard Worker
32*35238bceSAndroid Build Coastguard Worker #include <string>
33*35238bceSAndroid Build Coastguard Worker
34*35238bceSAndroid Build Coastguard Worker using std::string;
35*35238bceSAndroid Build Coastguard Worker using tcu::CompressedTexFormat;
36*35238bceSAndroid Build Coastguard Worker using tcu::CompressedTexture;
37*35238bceSAndroid Build Coastguard Worker using tcu::IVec3;
38*35238bceSAndroid Build Coastguard Worker
39*35238bceSAndroid Build Coastguard Worker namespace deqp
40*35238bceSAndroid Build Coastguard Worker {
41*35238bceSAndroid Build Coastguard Worker namespace gles3
42*35238bceSAndroid Build Coastguard Worker {
43*35238bceSAndroid Build Coastguard Worker namespace Functional
44*35238bceSAndroid Build Coastguard Worker {
45*35238bceSAndroid Build Coastguard Worker
getASTCFormatShortName(CompressedTexFormat format)46*35238bceSAndroid Build Coastguard Worker static const string getASTCFormatShortName(CompressedTexFormat format)
47*35238bceSAndroid Build Coastguard Worker {
48*35238bceSAndroid Build Coastguard Worker DE_ASSERT(tcu::isAstcFormat(format));
49*35238bceSAndroid Build Coastguard Worker const IVec3 blockSize = tcu::getBlockPixelSize(format);
50*35238bceSAndroid Build Coastguard Worker DE_ASSERT(blockSize.z() == 1);
51*35238bceSAndroid Build Coastguard Worker
52*35238bceSAndroid Build Coastguard Worker return de::toString(blockSize.x()) + "x" + de::toString(blockSize.y()) +
53*35238bceSAndroid Build Coastguard Worker (tcu::isAstcSRGBFormat(format) ? "_srgb" : "");
54*35238bceSAndroid Build Coastguard Worker }
55*35238bceSAndroid Build Coastguard Worker
CompressedTextureTests(Context & context)56*35238bceSAndroid Build Coastguard Worker CompressedTextureTests::CompressedTextureTests(Context &context)
57*35238bceSAndroid Build Coastguard Worker : TestCaseGroup(context, "compressed", "Compressed Texture Tests")
58*35238bceSAndroid Build Coastguard Worker {
59*35238bceSAndroid Build Coastguard Worker }
60*35238bceSAndroid Build Coastguard Worker
~CompressedTextureTests(void)61*35238bceSAndroid Build Coastguard Worker CompressedTextureTests::~CompressedTextureTests(void)
62*35238bceSAndroid Build Coastguard Worker {
63*35238bceSAndroid Build Coastguard Worker }
64*35238bceSAndroid Build Coastguard Worker
init(void)65*35238bceSAndroid Build Coastguard Worker void CompressedTextureTests::init(void)
66*35238bceSAndroid Build Coastguard Worker {
67*35238bceSAndroid Build Coastguard Worker // ASTC cases.
68*35238bceSAndroid Build Coastguard Worker {
69*35238bceSAndroid Build Coastguard Worker TestCaseGroup *const astcGroup = new TestCaseGroup(m_context, "astc", "ASTC Tests");
70*35238bceSAndroid Build Coastguard Worker addChild(astcGroup);
71*35238bceSAndroid Build Coastguard Worker
72*35238bceSAndroid Build Coastguard Worker // Block test cases.
73*35238bceSAndroid Build Coastguard Worker
74*35238bceSAndroid Build Coastguard Worker for (int astcTestTypeI = 0; astcTestTypeI < tcu::astc::BLOCK_TEST_TYPE_LAST; astcTestTypeI++)
75*35238bceSAndroid Build Coastguard Worker {
76*35238bceSAndroid Build Coastguard Worker const tcu::astc::BlockTestType astcTestType = (tcu::astc::BlockTestType)astcTestTypeI;
77*35238bceSAndroid Build Coastguard Worker TestCaseGroup *const testTypeGroup = new TestCaseGroup(m_context, getBlockTestTypeName(astcTestType),
78*35238bceSAndroid Build Coastguard Worker getBlockTestTypeDescription(astcTestType));
79*35238bceSAndroid Build Coastguard Worker astcGroup->addChild(testTypeGroup);
80*35238bceSAndroid Build Coastguard Worker
81*35238bceSAndroid Build Coastguard Worker for (int formatI = 0; formatI < tcu::COMPRESSEDTEXFORMAT_LAST; formatI++)
82*35238bceSAndroid Build Coastguard Worker {
83*35238bceSAndroid Build Coastguard Worker const CompressedTexFormat format = (CompressedTexFormat)formatI;
84*35238bceSAndroid Build Coastguard Worker
85*35238bceSAndroid Build Coastguard Worker if (!tcu::isAstcFormat(format))
86*35238bceSAndroid Build Coastguard Worker continue;
87*35238bceSAndroid Build Coastguard Worker if (tcu::isAstcSRGBFormat(format) && tcu::astc::isBlockTestTypeHDROnly(astcTestType))
88*35238bceSAndroid Build Coastguard Worker continue;
89*35238bceSAndroid Build Coastguard Worker
90*35238bceSAndroid Build Coastguard Worker testTypeGroup->addChild(new ASTCBlockCase2D(
91*35238bceSAndroid Build Coastguard Worker m_context, getASTCFormatShortName(format).c_str(),
92*35238bceSAndroid Build Coastguard Worker glu::getCompressedTextureFormatName(glu::getGLFormat(format)), astcTestType, format));
93*35238bceSAndroid Build Coastguard Worker }
94*35238bceSAndroid Build Coastguard Worker }
95*35238bceSAndroid Build Coastguard Worker
96*35238bceSAndroid Build Coastguard Worker // Image size/block size remainder cases.
97*35238bceSAndroid Build Coastguard Worker
98*35238bceSAndroid Build Coastguard Worker {
99*35238bceSAndroid Build Coastguard Worker TestCaseGroup *const blockSizeRemainderGroup =
100*35238bceSAndroid Build Coastguard Worker new TestCaseGroup(m_context, "block_size_remainder", "Test image size/block size remainders");
101*35238bceSAndroid Build Coastguard Worker astcGroup->addChild(blockSizeRemainderGroup);
102*35238bceSAndroid Build Coastguard Worker
103*35238bceSAndroid Build Coastguard Worker for (int formatI = 0; formatI < tcu::COMPRESSEDTEXFORMAT_LAST; formatI++)
104*35238bceSAndroid Build Coastguard Worker {
105*35238bceSAndroid Build Coastguard Worker const CompressedTexFormat format = (CompressedTexFormat)formatI;
106*35238bceSAndroid Build Coastguard Worker
107*35238bceSAndroid Build Coastguard Worker if (!tcu::isAstcFormat(format))
108*35238bceSAndroid Build Coastguard Worker continue;
109*35238bceSAndroid Build Coastguard Worker
110*35238bceSAndroid Build Coastguard Worker blockSizeRemainderGroup->addChild(new ASTCBlockSizeRemainderCase2D(
111*35238bceSAndroid Build Coastguard Worker m_context, getASTCFormatShortName(format).c_str(),
112*35238bceSAndroid Build Coastguard Worker glu::getCompressedTextureFormatName(glu::getGLFormat(format)), format));
113*35238bceSAndroid Build Coastguard Worker }
114*35238bceSAndroid Build Coastguard Worker }
115*35238bceSAndroid Build Coastguard Worker }
116*35238bceSAndroid Build Coastguard Worker }
117*35238bceSAndroid Build Coastguard Worker
118*35238bceSAndroid Build Coastguard Worker } // namespace Functional
119*35238bceSAndroid Build Coastguard Worker } // namespace gles3
120*35238bceSAndroid Build Coastguard Worker } // namespace deqp
121