xref: /aosp_15_r20/external/deqp/modules/gles3/performance/es3pTextureFormatTests.cpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
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 Texture format performance tests.
22  *//*--------------------------------------------------------------------*/
23 
24 #include "es3pTextureFormatTests.hpp"
25 #include "es3pTextureCases.hpp"
26 #include "gluStrUtil.hpp"
27 
28 #include "glwEnums.hpp"
29 
30 using std::string;
31 
32 namespace deqp
33 {
34 namespace gles3
35 {
36 namespace Performance
37 {
38 
TextureFormatTests(Context & context)39 TextureFormatTests::TextureFormatTests(Context &context)
40     : TestCaseGroup(context, "format", "Texture Format Performance Tests")
41 {
42 }
43 
~TextureFormatTests(void)44 TextureFormatTests::~TextureFormatTests(void)
45 {
46 }
47 
init(void)48 void TextureFormatTests::init(void)
49 {
50     struct
51     {
52         const char *name;
53         uint32_t internalFormat;
54     } texFormats[] = {{
55                           "rgba32f",
56                           GL_RGBA32F,
57                       },
58                       {
59                           "rgba32i",
60                           GL_RGBA32I,
61                       },
62                       {
63                           "rgba32ui",
64                           GL_RGBA32UI,
65                       },
66                       {
67                           "rgba16f",
68                           GL_RGBA16F,
69                       },
70                       {
71                           "rgba16i",
72                           GL_RGBA16I,
73                       },
74                       {
75                           "rgba16ui",
76                           GL_RGBA16UI,
77                       },
78                       {
79                           "rgba8",
80                           GL_RGBA8,
81                       },
82                       {
83                           "rgba8i",
84                           GL_RGBA8I,
85                       },
86                       {
87                           "rgba8ui",
88                           GL_RGBA8UI,
89                       },
90                       {
91                           "srgb8_alpha8",
92                           GL_SRGB8_ALPHA8,
93                       },
94                       {
95                           "rgb10_a2",
96                           GL_RGB10_A2,
97                       },
98                       {
99                           "rgb10_a2ui",
100                           GL_RGB10_A2UI,
101                       },
102                       {
103                           "rgba4",
104                           GL_RGBA4,
105                       },
106                       {
107                           "rgb5_a1",
108                           GL_RGB5_A1,
109                       },
110                       {
111                           "rgba8_snorm",
112                           GL_RGBA8_SNORM,
113                       },
114                       {
115                           "rgb8",
116                           GL_RGB8,
117                       },
118                       {
119                           "rgb565",
120                           GL_RGB565,
121                       },
122                       {
123                           "r11f_g11f_b10f",
124                           GL_R11F_G11F_B10F,
125                       },
126                       {
127                           "rgb32f",
128                           GL_RGB32F,
129                       },
130                       {
131                           "rgb32i",
132                           GL_RGB32I,
133                       },
134                       {
135                           "rgb32ui",
136                           GL_RGB32UI,
137                       },
138                       {
139                           "rgb16f",
140                           GL_RGB16F,
141                       },
142                       {
143                           "rgb16i",
144                           GL_RGB16I,
145                       },
146                       {
147                           "rgb16ui",
148                           GL_RGB16UI,
149                       },
150                       {
151                           "rgb8_snorm",
152                           GL_RGB8_SNORM,
153                       },
154                       {
155                           "rgb8i",
156                           GL_RGB8I,
157                       },
158                       {
159                           "rgb8ui",
160                           GL_RGB8UI,
161                       },
162                       {
163                           "srgb8",
164                           GL_SRGB8,
165                       },
166                       {
167                           "rgb9_e5",
168                           GL_RGB9_E5,
169                       },
170                       {
171                           "rg32f",
172                           GL_RG32F,
173                       },
174                       {
175                           "rg32i",
176                           GL_RG32I,
177                       },
178                       {
179                           "rg32ui",
180                           GL_RG32UI,
181                       },
182                       {
183                           "rg16f",
184                           GL_RG16F,
185                       },
186                       {
187                           "rg16i",
188                           GL_RG16I,
189                       },
190                       {
191                           "rg16ui",
192                           GL_RG16UI,
193                       },
194                       {
195                           "rg8",
196                           GL_RG8,
197                       },
198                       {
199                           "rg8i",
200                           GL_RG8I,
201                       },
202                       {
203                           "rg8ui",
204                           GL_RG8UI,
205                       },
206                       {
207                           "rg8_snorm",
208                           GL_RG8_SNORM,
209                       },
210                       {
211                           "r32f",
212                           GL_R32F,
213                       },
214                       {
215                           "r32i",
216                           GL_R32I,
217                       },
218                       {
219                           "r32ui",
220                           GL_R32UI,
221                       },
222                       {
223                           "r16f",
224                           GL_R16F,
225                       },
226                       {
227                           "r16i",
228                           GL_R16I,
229                       },
230                       {
231                           "r16ui",
232                           GL_R16UI,
233                       },
234                       {
235                           "r8",
236                           GL_R8,
237                       },
238                       {
239                           "r8i",
240                           GL_R8I,
241                       },
242                       {
243                           "r8ui",
244                           GL_R8UI,
245                       },
246                       {
247                           "r8_snorm",
248                           GL_R8_SNORM,
249                       }};
250 
251     for (int formatNdx = 0; formatNdx < DE_LENGTH_OF_ARRAY(texFormats); formatNdx++)
252     {
253         uint32_t format        = texFormats[formatNdx].internalFormat;
254         string nameBase        = texFormats[formatNdx].name;
255         uint32_t wrapS         = GL_CLAMP_TO_EDGE;
256         uint32_t wrapT         = GL_CLAMP_TO_EDGE;
257         uint32_t minFilter     = GL_NEAREST;
258         uint32_t magFilter     = GL_NEAREST;
259         int numTextures        = 1;
260         string descriptionBase = glu::getTextureFormatName(format);
261 
262         addChild(new Texture2DRenderCase(m_context, nameBase.c_str(), descriptionBase.c_str(), format, wrapS, wrapT,
263                                          minFilter, magFilter, tcu::Mat3(), numTextures, false /* npot */));
264     }
265 }
266 
267 } // namespace Performance
268 } // namespace gles3
269 } // namespace deqp
270