xref: /aosp_15_r20/external/deqp/modules/gles3/functional/es3fASTCDecompressionCases.hpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
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 "tcuAstcUtil.hpp"
30 #include "deUniquePtr.hpp"
31 
32 #include <vector>
33 
34 namespace deqp
35 {
36 namespace gles3
37 {
38 namespace Functional
39 {
40 
41 namespace ASTCDecompressionCaseInternal
42 {
43 
44 class ASTCRenderer2D;
45 
46 }
47 
48 // General ASTC block test class.
49 class ASTCBlockCase2D : public TestCase
50 {
51 public:
52     ASTCBlockCase2D(Context &context, const char *name, const char *description, tcu::astc::BlockTestType testType,
53                     tcu::CompressedTexFormat format);
54     ~ASTCBlockCase2D(void);
55 
56     void init(void);
57     void deinit(void);
58     IterateResult iterate(void);
59 
60 private:
61     ASTCBlockCase2D(const ASTCBlockCase2D &other);
62     ASTCBlockCase2D &operator=(const ASTCBlockCase2D &other);
63 
64     const tcu::astc::BlockTestType m_testType;
65     const tcu::CompressedTexFormat m_format;
66     std::vector<uint8_t> m_blockData;
67 
68     int m_numBlocksTested;
69     int m_currentIteration;
70 
71     de::UniquePtr<ASTCDecompressionCaseInternal::ASTCRenderer2D> m_renderer;
72 };
73 
74 // For a format with block size (W, H), test with texture sizes {(k*W + a, k*H + b) | 0 <= a < W, 0 <= b < H } .
75 class ASTCBlockSizeRemainderCase2D : public TestCase
76 {
77 public:
78     ASTCBlockSizeRemainderCase2D(Context &context, const char *name, const char *description,
79                                  tcu::CompressedTexFormat format);
80     ~ASTCBlockSizeRemainderCase2D(void);
81 
82     void init(void);
83     void deinit(void);
84     IterateResult iterate(void);
85 
86 private:
87     enum
88     {
89         MAX_NUM_BLOCKS_X = 5,
90         MAX_NUM_BLOCKS_Y = 5
91     };
92 
93     ASTCBlockSizeRemainderCase2D(const ASTCBlockSizeRemainderCase2D &other);
94     ASTCBlockSizeRemainderCase2D &operator=(const ASTCBlockSizeRemainderCase2D &other);
95 
96     const tcu::CompressedTexFormat m_format;
97 
98     int m_currentIteration;
99 
100     de::UniquePtr<ASTCDecompressionCaseInternal::ASTCRenderer2D> m_renderer;
101 };
102 
103 } // namespace Functional
104 } // namespace gles3
105 } // namespace deqp
106 
107 #endif // _ES3FASTCDECOMPRESSIONCASES_HPP
108