Merge "Fix color change verification in dithering tests" into nougat-cts-dev am:...
[platform/upstream/VK-GL-CTS.git] / modules / gles3 / performance / es3pTextureFormatTests.cpp
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
39 TextureFormatTests::TextureFormatTests (Context& context)
40         : TestCaseGroup(context, "format", "Texture Format Performance Tests")
41 {
42 }
43
44 TextureFormatTests::~TextureFormatTests (void)
45 {
46 }
47
48 void TextureFormatTests::init (void)
49 {
50         struct
51         {
52                 const char*     name;
53                 deUint32        internalFormat;
54         } texFormats[] =
55         {
56                 { "rgba32f",                    GL_RGBA32F,                     },
57                 { "rgba32i",                    GL_RGBA32I,                     },
58                 { "rgba32ui",                   GL_RGBA32UI,            },
59                 { "rgba16f",                    GL_RGBA16F,                     },
60                 { "rgba16i",                    GL_RGBA16I,                     },
61                 { "rgba16ui",                   GL_RGBA16UI,            },
62                 { "rgba8",                              GL_RGBA8,                       },
63                 { "rgba8i",                             GL_RGBA8I,                      },
64                 { "rgba8ui",                    GL_RGBA8UI,                     },
65                 { "srgb8_alpha8",               GL_SRGB8_ALPHA8,        },
66                 { "rgb10_a2",                   GL_RGB10_A2,            },
67                 { "rgb10_a2ui",                 GL_RGB10_A2UI,          },
68                 { "rgba4",                              GL_RGBA4,                       },
69                 { "rgb5_a1",                    GL_RGB5_A1,                     },
70                 { "rgba8_snorm",                GL_RGBA8_SNORM,         },
71                 { "rgb8",                               GL_RGB8,                        },
72                 { "rgb565",                             GL_RGB565,                      },
73                 { "r11f_g11f_b10f",             GL_R11F_G11F_B10F,      },
74                 { "rgb32f",                             GL_RGB32F,                      },
75                 { "rgb32i",                             GL_RGB32I,                      },
76                 { "rgb32ui",                    GL_RGB32UI,                     },
77                 { "rgb16f",                             GL_RGB16F,                      },
78                 { "rgb16i",                             GL_RGB16I,                      },
79                 { "rgb16ui",                    GL_RGB16UI,                     },
80                 { "rgb8_snorm",                 GL_RGB8_SNORM,          },
81                 { "rgb8i",                              GL_RGB8I,                       },
82                 { "rgb8ui",                             GL_RGB8UI,                      },
83                 { "srgb8",                              GL_SRGB8,                       },
84                 { "rgb9_e5",                    GL_RGB9_E5,                     },
85                 { "rg32f",                              GL_RG32F,                       },
86                 { "rg32i",                              GL_RG32I,                       },
87                 { "rg32ui",                             GL_RG32UI,                      },
88                 { "rg16f",                              GL_RG16F,                       },
89                 { "rg16i",                              GL_RG16I,                       },
90                 { "rg16ui",                             GL_RG16UI,                      },
91                 { "rg8",                                GL_RG8,                         },
92                 { "rg8i",                               GL_RG8I,                        },
93                 { "rg8ui",                              GL_RG8UI,                       },
94                 { "rg8_snorm",                  GL_RG8_SNORM,           },
95                 { "r32f",                               GL_R32F,                        },
96                 { "r32i",                               GL_R32I,                        },
97                 { "r32ui",                              GL_R32UI,                       },
98                 { "r16f",                               GL_R16F,                        },
99                 { "r16i",                               GL_R16I,                        },
100                 { "r16ui",                              GL_R16UI,                       },
101                 { "r8",                                 GL_R8,                          },
102                 { "r8i",                                GL_R8I,                         },
103                 { "r8ui",                               GL_R8UI,                        },
104                 { "r8_snorm",                   GL_R8_SNORM,            }
105         };
106
107         for (int formatNdx = 0; formatNdx < DE_LENGTH_OF_ARRAY(texFormats); formatNdx++)
108         {
109                 deUint32        format                  = texFormats[formatNdx].internalFormat;
110                 string          nameBase                = texFormats[formatNdx].name;
111                 deUint32        wrapS                   = GL_CLAMP_TO_EDGE;
112                 deUint32        wrapT                   = GL_CLAMP_TO_EDGE;
113                 deUint32        minFilter               = GL_NEAREST;
114                 deUint32        magFilter               = GL_NEAREST;
115                 int                     numTextures             = 1;
116                 string          descriptionBase = glu::getTextureFormatName(format);
117
118                 addChild(new Texture2DRenderCase(m_context, nameBase.c_str(), descriptionBase.c_str(), format, wrapS, wrapT, minFilter, magFilter, tcu::Mat3(), numTextures, false /* npot */));
119         }
120 }
121
122 } // Performance
123 } // gles3
124 } // deqp