1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program OpenGL ES 3.0 Module
3 * -------------------------------------------------
5 * Copyright 2014 The Android Open Source Project
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 * \brief Texture State Query tests.
22 *//*--------------------------------------------------------------------*/
24 #include "es3fTextureStateQueryTests.hpp"
25 #include "glsStateQueryUtil.hpp"
26 #include "glsTextureStateQueryTests.hpp"
28 #include "gluRenderContext.hpp"
29 #include "glwEnums.hpp"
31 using namespace deqp::gls::StateQueryUtil;
40 static const char* getVerifierSuffix (QueryType type)
44 case QUERY_TEXTURE_PARAM_INTEGER: return "_gettexparameteri";
45 case QUERY_TEXTURE_PARAM_FLOAT: return "_gettexparameterf";
52 #define FOR_EACH_VERIFIER(VERIFIERS, CODE_BLOCK) \
53 for (int _verifierNdx = 0; _verifierNdx < DE_LENGTH_OF_ARRAY(VERIFIERS); _verifierNdx++) \
55 QueryType verifier = VERIFIERS[_verifierNdx]; \
59 TextureStateQueryTests::TextureStateQueryTests (Context& context)
60 : TestCaseGroup(context, "texture", "Texture State Query tests")
64 void TextureStateQueryTests::init (void)
66 using namespace gls::TextureStateQueryTests;
68 static const QueryType verifiers[] =
70 QUERY_TEXTURE_PARAM_INTEGER,
71 QUERY_TEXTURE_PARAM_FLOAT
80 { "texture_2d", GL_TEXTURE_2D },
81 { "texture_3d", GL_TEXTURE_3D },
82 { "texture_2d_array", GL_TEXTURE_2D_ARRAY },
83 { "texture_cube_map", GL_TEXTURE_CUBE_MAP }
92 { "texture_swizzle_r", "TEXTURE_SWIZZLE_R", TESTER_TEXTURE_SWIZZLE_R },
93 { "texture_swizzle_g", "TEXTURE_SWIZZLE_G", TESTER_TEXTURE_SWIZZLE_G },
94 { "texture_swizzle_b", "TEXTURE_SWIZZLE_B", TESTER_TEXTURE_SWIZZLE_B },
95 { "texture_swizzle_a", "TEXTURE_SWIZZLE_A", TESTER_TEXTURE_SWIZZLE_A },
96 { "texture_wrap_s", "TEXTURE_WRAP_S", TESTER_TEXTURE_WRAP_S },
97 { "texture_wrap_t", "TEXTURE_WRAP_T", TESTER_TEXTURE_WRAP_T },
98 { "texture_wrap_r", "TEXTURE_WRAP_R", TESTER_TEXTURE_WRAP_R },
99 { "texture_mag_filter", "TEXTURE_MAG_FILTER", TESTER_TEXTURE_MAG_FILTER },
100 { "texture_min_filter", "TEXTURE_MIN_FILTER", TESTER_TEXTURE_MIN_FILTER },
101 { "texture_min_lod", "TEXTURE_MIN_LOD", TESTER_TEXTURE_MIN_LOD },
102 { "texture_max_lod", "TEXTURE_MAX_LOD", TESTER_TEXTURE_MAX_LOD },
103 { "texture_base_level", "TEXTURE_BASE_LEVEL", TESTER_TEXTURE_BASE_LEVEL },
104 { "texture_max_level", "TEXTURE_MAX_LEVEL", TESTER_TEXTURE_MAX_LEVEL },
105 { "texture_compare_mode", "TEXTURE_COMPARE_MODE", TESTER_TEXTURE_COMPARE_MODE },
106 { "texture_compare_func", "TEXTURE_COMPARE_FUNC", TESTER_TEXTURE_COMPARE_FUNC },
107 { "texture_immutable_levels", "TEXTURE_IMMUTABLE_LEVELS", TESTER_TEXTURE_IMMUTABLE_LEVELS },
108 { "texture_immutable_format", "TEXTURE_IMMUTABLE_FORMAT", TESTER_TEXTURE_IMMUTABLE_FORMAT },
111 for (int targetNdx = 0; targetNdx < DE_LENGTH_OF_ARRAY(textureTargets); ++targetNdx)
113 addChild(createIsTextureTest(m_testCtx,
114 m_context.getRenderContext(),
115 std::string() + textureTargets[targetNdx].name + "_is_texture",
117 textureTargets[targetNdx].target));
119 for (int stateNdx = 0; stateNdx < DE_LENGTH_OF_ARRAY(states); ++stateNdx)
121 if (!isLegalTesterForTarget(textureTargets[targetNdx].target, states[stateNdx].tester))
124 FOR_EACH_VERIFIER(verifiers, addChild(createTexParamTest(m_testCtx,
125 m_context.getRenderContext(),
126 std::string() + textureTargets[targetNdx].name + "_" + states[stateNdx].name + getVerifierSuffix(verifier),
127 states[stateNdx].desc,
129 textureTargets[targetNdx].target,
130 states[stateNdx].tester)));