1 #ifndef _ES3FASTCDECOMPRESSIONCASES_HPP 2 #define _ES3FASTCDECOMPRESSIONCASES_HPP 3 /*------------------------------------------------------------------------- 4 * drawElements Quality Program OpenGL ES 3.0 Module 5 * ------------------------------------------------- 6 * 7 * Copyright 2014 The Android Open Source Project 8 * 9 * Licensed under the Apache License, Version 2.0 (the "License"); 10 * you may not use this file except in compliance with the License. 11 * You may obtain a copy of the License at 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 15 * Unless required by applicable law or agreed to in writing, software 16 * distributed under the License is distributed on an "AS IS" BASIS, 17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 * See the License for the specific language governing permissions and 19 * limitations under the License. 20 * 21 *//*! 22 * \file 23 * \brief ASTC decompression tests 24 *//*--------------------------------------------------------------------*/ 25 26 #include "deDefs.h" 27 #include "tes3TestCase.hpp" 28 #include "tcuCompressedTexture.hpp" 29 #include "deUniquePtr.hpp" 30 31 #include <vector> 32 33 namespace deqp 34 { 35 namespace gles3 36 { 37 namespace Functional 38 { 39 40 namespace ASTCDecompressionCaseInternal 41 { 42 43 class ASTCRenderer2D; 44 45 } 46 47 enum ASTCBlockTestType 48 { 49 ASTCBLOCKTESTTYPE_VOID_EXTENT_LDR = 0, 50 ASTCBLOCKTESTTYPE_VOID_EXTENT_HDR, 51 ASTCBLOCKTESTTYPE_WEIGHT_GRID, 52 ASTCBLOCKTESTTYPE_WEIGHT_ISE, 53 ASTCBLOCKTESTTYPE_CEMS, 54 ASTCBLOCKTESTTYPE_PARTITION_SEED, 55 ASTCBLOCKTESTTYPE_ENDPOINT_VALUE_LDR, 56 ASTCBLOCKTESTTYPE_ENDPOINT_VALUE_HDR_NO_15, 57 ASTCBLOCKTESTTYPE_ENDPOINT_VALUE_HDR_15, 58 ASTCBLOCKTESTTYPE_ENDPOINT_ISE, 59 ASTCBLOCKTESTTYPE_CCS, 60 ASTCBLOCKTESTTYPE_RANDOM, 61 62 ASTCBLOCKTESTTYPE_LAST 63 }; 64 65 // General ASTC block test class. 66 class ASTCBlockCase2D : public TestCase 67 { 68 public: 69 ASTCBlockCase2D (Context& context, 70 const char* name, 71 const char* description, 72 ASTCBlockTestType testType, 73 tcu::CompressedTexFormat format); 74 ~ASTCBlockCase2D (void); 75 76 void init (void); 77 void deinit (void); 78 IterateResult iterate (void); 79 80 private: 81 static void generateDummyBlocks (deUint8* dst, int num); 82 83 ASTCBlockCase2D (const ASTCBlockCase2D& other); 84 ASTCBlockCase2D& operator= (const ASTCBlockCase2D& other); 85 86 const ASTCBlockTestType m_testType; 87 const tcu::CompressedTexFormat m_format; 88 std::vector<deUint8> m_blockData; 89 90 int m_numBlocksTested; 91 int m_currentIteration; 92 93 de::UniquePtr<ASTCDecompressionCaseInternal::ASTCRenderer2D> m_renderer; 94 }; 95 96 // For a format with block size (W, H), test with texture sizes {(k*W + a, k*H + b) | 0 <= a < W, 0 <= b < H } . 97 class ASTCBlockSizeRemainderCase2D : public TestCase 98 { 99 public: 100 ASTCBlockSizeRemainderCase2D (Context& context, 101 const char* name, 102 const char* description, 103 tcu::CompressedTexFormat format); 104 ~ASTCBlockSizeRemainderCase2D (void); 105 106 void init (void); 107 void deinit (void); 108 IterateResult iterate (void); 109 110 private: 111 enum 112 { 113 MAX_NUM_BLOCKS_X = 5, 114 MAX_NUM_BLOCKS_Y = 5 115 }; 116 117 static void generateDefaultBlockData (deUint8* dst, int numBlocks, int blockWidth, int blockHeight); 118 119 ASTCBlockSizeRemainderCase2D (const ASTCBlockSizeRemainderCase2D& other); 120 ASTCBlockSizeRemainderCase2D& operator= (const ASTCBlockSizeRemainderCase2D& other); 121 122 const tcu::CompressedTexFormat m_format; 123 124 int m_currentIteration; 125 126 de::UniquePtr<ASTCDecompressionCaseInternal::ASTCRenderer2D> m_renderer; 127 }; 128 129 const char* getBlockTestTypeName (ASTCBlockTestType testType); 130 const char* getBlockTestTypeDescription (ASTCBlockTestType testType); 131 bool isBlockTestTypeHDROnly (ASTCBlockTestType testType); 132 133 } // Functional 134 } // gles3 135 } // deqp 136 137 #endif // _ES3FASTCDECOMPRESSIONCASES_HPP 138