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 filtering performance tests.
22 *//*--------------------------------------------------------------------*/
23
24 #include "es3pTextureFilteringTests.hpp"
25 #include "es3pTextureCases.hpp"
26 #include "tcuMatrixUtil.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
TextureFilteringTests(Context & context)39 TextureFilteringTests::TextureFilteringTests(Context &context)
40 : TestCaseGroup(context, "filter", "Texture Filtering Performance Tests")
41 {
42 }
43
~TextureFilteringTests(void)44 TextureFilteringTests::~TextureFilteringTests(void)
45 {
46 }
47
init(void)48 void TextureFilteringTests::init(void)
49 {
50 static const struct
51 {
52 const char *name;
53 uint32_t internalFormat;
54 } texFormats[] = {{"rgb565", GL_RGB565}, {"rgba8", GL_RGBA8}, {"rg16f", GL_RG16F}, {"rgba16f", GL_RGBA16F}};
55 static const struct
56 {
57 const char *name;
58 uint32_t filter;
59 bool minify;
60 } cases[] = {{"nearest", GL_NEAREST, true},
61 {"nearest", GL_NEAREST, false},
62 {"linear", GL_LINEAR, true},
63 {"linear", GL_LINEAR, false},
64 {"nearest_mipmap_nearest", GL_NEAREST_MIPMAP_NEAREST, true},
65 {"nearest_mipmap_linear", GL_NEAREST_MIPMAP_LINEAR, true},
66 {"linear_mipmap_nearest", GL_LINEAR_MIPMAP_NEAREST, true},
67 {"linear_mipmap_linear", GL_LINEAR_MIPMAP_LINEAR, true}};
68
69 tcu::Mat3 minTransform = tcu::translationMatrix(tcu::Vec2(-0.3f, -0.6f)) * tcu::Mat3(tcu::Vec3(1.7f, 2.3f, 1.0f));
70 tcu::Mat3 magTransform = tcu::translationMatrix(tcu::Vec2(0.3f, 0.4f)) * tcu::Mat3(tcu::Vec3(0.3f, 0.2f, 1.0f));
71
72 for (int caseNdx = 0; caseNdx < DE_LENGTH_OF_ARRAY(cases); caseNdx++)
73 {
74 for (int formatNdx = 0; formatNdx < DE_LENGTH_OF_ARRAY(texFormats); formatNdx++)
75 {
76 uint32_t format = texFormats[formatNdx].internalFormat;
77 uint32_t minFilter = cases[caseNdx].filter;
78 uint32_t magFilter = (minFilter == GL_NEAREST || minFilter == GL_LINEAR) ? minFilter : GL_LINEAR;
79 uint32_t wrapS = GL_REPEAT;
80 uint32_t wrapT = GL_REPEAT;
81 int numTextures = 1;
82 bool minify = cases[caseNdx].minify;
83 string name =
84 string(cases[caseNdx].name) + (minify ? "_minify_" : "_magnify_") + texFormats[formatNdx].name;
85
86 addChild(new Texture2DRenderCase(m_context, name.c_str(), "", format, wrapS, wrapT, minFilter, magFilter,
87 minify ? minTransform : magTransform, numTextures, true /* pot */));
88 }
89 }
90 }
91
92 } // namespace Performance
93 } // namespace gles3
94 } // namespace deqp
95