xref: /aosp_15_r20/external/deqp/modules/gles2/performance/es2pTextureCountTests.cpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
1 /*-------------------------------------------------------------------------
2  * drawElements Quality Program OpenGL ES 2.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 count performance tests.
22  *//*--------------------------------------------------------------------*/
23 
24 #include "es2pTextureCountTests.hpp"
25 #include "es2pTextureCases.hpp"
26 #include "gluStrUtil.hpp"
27 
28 #include "deStringUtil.hpp"
29 
30 #include "glwEnums.hpp"
31 
32 using std::string;
33 
34 namespace deqp
35 {
36 namespace gles2
37 {
38 namespace Performance
39 {
40 
TextureCountTests(Context & context)41 TextureCountTests::TextureCountTests(Context &context)
42     : TestCaseGroup(context, "count", "Texture Count Performance Tests")
43 {
44 }
45 
~TextureCountTests(void)46 TextureCountTests::~TextureCountTests(void)
47 {
48 }
49 
init(void)50 void TextureCountTests::init(void)
51 {
52     static const struct
53     {
54         const char *name;
55         uint32_t format;
56         uint32_t dataType;
57     } texFormats[]               = {{"a8", GL_ALPHA, GL_UNSIGNED_BYTE},
58                                     {"rgb565", GL_RGB, GL_UNSIGNED_SHORT_5_6_5},
59                                     {"rgb888", GL_RGB, GL_UNSIGNED_BYTE},
60                                     {"rgba8888", GL_RGBA, GL_UNSIGNED_BYTE}};
61     static const int texCounts[] = {1, 2, 4, 8};
62 
63     for (int formatNdx = 0; formatNdx < DE_LENGTH_OF_ARRAY(texFormats); formatNdx++)
64     {
65         for (int cntNdx = 0; cntNdx < DE_LENGTH_OF_ARRAY(texCounts); cntNdx++)
66         {
67             uint32_t format    = texFormats[formatNdx].format;
68             uint32_t dataType  = texFormats[formatNdx].dataType;
69             uint32_t wrapS     = GL_CLAMP_TO_EDGE;
70             uint32_t wrapT     = GL_CLAMP_TO_EDGE;
71             uint32_t minFilter = GL_NEAREST;
72             uint32_t magFilter = GL_NEAREST;
73             int numTextures    = texCounts[cntNdx];
74             string name        = string(texFormats[formatNdx].name) + "_" + de::toString(numTextures);
75             string description = string(glu::getTextureFormatName(format)) + ", " + glu::getTypeName(dataType);
76 
77             addChild(new Texture2DRenderCase(m_context, name.c_str(), description.c_str(), format, dataType, wrapS,
78                                              wrapT, minFilter, magFilter, tcu::Mat3(), numTextures, false /* npot */));
79         }
80     }
81 }
82 
83 } // namespace Performance
84 } // namespace gles2
85 } // namespace deqp
86