Jarkko Poyry | 3c82736 | 2014-09-02 11:48:52 +0300 | [diff] [blame] | 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 | |
| 34 | using std::string; |
| 35 | using tcu::IVec3; |
| 36 | using tcu::CompressedTexture; |
Mika Isojärvi | becd5d5 | 2014-11-04 17:30:50 +0200 | [diff] [blame] | 37 | using tcu::CompressedTexFormat; |
Jarkko Poyry | 3c82736 | 2014-09-02 11:48:52 +0300 | [diff] [blame] | 38 | |
| 39 | namespace deqp |
| 40 | { |
| 41 | namespace gles3 |
| 42 | { |
| 43 | namespace Functional |
| 44 | { |
| 45 | |
Mika Isojärvi | becd5d5 | 2014-11-04 17:30:50 +0200 | [diff] [blame] | 46 | static const string getASTCFormatShortName (CompressedTexFormat format) |
Jarkko Poyry | 3c82736 | 2014-09-02 11:48:52 +0300 | [diff] [blame] | 47 | { |
Mika Isojärvi | becd5d5 | 2014-11-04 17:30:50 +0200 | [diff] [blame] | 48 | DE_ASSERT(tcu::isAstcFormat(format)); |
| 49 | const IVec3 blockSize = tcu::getBlockPixelSize(format); |
Jarkko Poyry | 3c82736 | 2014-09-02 11:48:52 +0300 | [diff] [blame] | 50 | DE_ASSERT(blockSize.z() == 1); |
| 51 | |
Mika Isojärvi | becd5d5 | 2014-11-04 17:30:50 +0200 | [diff] [blame] | 52 | return de::toString(blockSize.x()) + "x" + de::toString(blockSize.y()) + (tcu::isAstcSRGBFormat(format) ? "_srgb" : ""); |
Jarkko Poyry | 3c82736 | 2014-09-02 11:48:52 +0300 | [diff] [blame] | 53 | } |
| 54 | |
| 55 | CompressedTextureTests::CompressedTextureTests (Context& context) |
| 56 | : TestCaseGroup (context, "compressed", "Compressed Texture Tests") |
| 57 | { |
| 58 | } |
| 59 | |
| 60 | CompressedTextureTests::~CompressedTextureTests (void) |
| 61 | { |
| 62 | } |
| 63 | |
| 64 | void 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ärvi | becd5d5 | 2014-11-04 17:30:50 +0200 | [diff] [blame] | 79 | for (int formatI = 0; formatI < tcu::COMPRESSEDTEXFORMAT_LAST; formatI++) |
Jarkko Poyry | 3c82736 | 2014-09-02 11:48:52 +0300 | [diff] [blame] | 80 | { |
Mika Isojärvi | becd5d5 | 2014-11-04 17:30:50 +0200 | [diff] [blame] | 81 | const CompressedTexFormat format = (CompressedTexFormat)formatI; |
Jarkko Poyry | 3c82736 | 2014-09-02 11:48:52 +0300 | [diff] [blame] | 82 | |
Mika Isojärvi | becd5d5 | 2014-11-04 17:30:50 +0200 | [diff] [blame] | 83 | if (!tcu::isAstcFormat(format)) |
Jarkko Poyry | 3c82736 | 2014-09-02 11:48:52 +0300 | [diff] [blame] | 84 | continue; |
Mika Isojärvi | becd5d5 | 2014-11-04 17:30:50 +0200 | [diff] [blame] | 85 | if (tcu::isAstcSRGBFormat(format) && isBlockTestTypeHDROnly(astcTestType)) |
Jarkko Poyry | 3c82736 | 2014-09-02 11:48:52 +0300 | [diff] [blame] | 86 | continue; |
| 87 | |
Jarkko Pöyry | b2e583d | 2015-06-19 13:05:18 -0700 | [diff] [blame^] | 88 | testTypeGroup->addChild(new ASTCBlockCase2D(m_context, getASTCFormatShortName(format).c_str(), glu::getCompressedTextureFormatName(glu::getGLFormat(format)), astcTestType, format)); |
Jarkko Poyry | 3c82736 | 2014-09-02 11:48:52 +0300 | [diff] [blame] | 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 | |
Mika Isojärvi | becd5d5 | 2014-11-04 17:30:50 +0200 | [diff] [blame] | 98 | for (int formatI = 0; formatI < tcu::COMPRESSEDTEXFORMAT_LAST; formatI++) |
Jarkko Poyry | 3c82736 | 2014-09-02 11:48:52 +0300 | [diff] [blame] | 99 | { |
Mika Isojärvi | becd5d5 | 2014-11-04 17:30:50 +0200 | [diff] [blame] | 100 | const CompressedTexFormat format = (CompressedTexFormat)formatI; |
Jarkko Poyry | 3c82736 | 2014-09-02 11:48:52 +0300 | [diff] [blame] | 101 | |
Mika Isojärvi | becd5d5 | 2014-11-04 17:30:50 +0200 | [diff] [blame] | 102 | if (!tcu::isAstcFormat(format)) |
Jarkko Poyry | 3c82736 | 2014-09-02 11:48:52 +0300 | [diff] [blame] | 103 | continue; |
| 104 | |
Jarkko Pöyry | b2e583d | 2015-06-19 13:05:18 -0700 | [diff] [blame^] | 105 | blockSizeRemainderGroup->addChild(new ASTCBlockSizeRemainderCase2D(m_context, getASTCFormatShortName(format).c_str(), glu::getCompressedTextureFormatName(glu::getGLFormat(format)), format)); |
Jarkko Poyry | 3c82736 | 2014-09-02 11:48:52 +0300 | [diff] [blame] | 106 | } |
| 107 | } |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | } // Functional |
| 112 | } // gles3 |
| 113 | } // deqp |