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 Sampler State Query tests.
22 *//*--------------------------------------------------------------------*/
23
24 #include "es3fSamplerStateQueryTests.hpp"
25 #include "glsStateQueryUtil.hpp"
26 #include "glsTextureStateQueryTests.hpp"
27
28 #include "gluRenderContext.hpp"
29 #include "glwEnums.hpp"
30
31 using namespace deqp::gls::StateQueryUtil;
32
33 namespace deqp
34 {
35 namespace gles3
36 {
37 namespace Functional
38 {
39
getVerifierSuffix(QueryType type)40 static const char *getVerifierSuffix(QueryType type)
41 {
42 switch (type)
43 {
44 case QUERY_SAMPLER_PARAM_INTEGER:
45 return "_getsamplerparameteri";
46 case QUERY_SAMPLER_PARAM_FLOAT:
47 return "_getsamplerparameterf";
48 default:
49 DE_ASSERT(false);
50 return DE_NULL;
51 }
52 }
53
54 #define FOR_EACH_VERIFIER(VERIFIERS, CODE_BLOCK) \
55 for (int _verifierNdx = 0; _verifierNdx < DE_LENGTH_OF_ARRAY(VERIFIERS); _verifierNdx++) \
56 { \
57 QueryType verifier = (VERIFIERS)[_verifierNdx]; \
58 CODE_BLOCK; \
59 }
60
SamplerStateQueryTests(Context & context)61 SamplerStateQueryTests::SamplerStateQueryTests(Context &context)
62 : TestCaseGroup(context, "sampler", "Sampler State Query tests")
63 {
64 }
init(void)65 void SamplerStateQueryTests::init(void)
66 {
67 using namespace gls::TextureStateQueryTests;
68
69 static const QueryType verifiers[] = {QUERY_SAMPLER_PARAM_INTEGER, QUERY_SAMPLER_PARAM_FLOAT};
70 static const struct
71 {
72 const char *name;
73 const char *desc;
74 TesterType tester;
75 } states[] = {
76 {"sampler_texture_wrap_s", "TEXTURE_WRAP_S", TESTER_TEXTURE_WRAP_S},
77 {"sampler_texture_wrap_t", "TEXTURE_WRAP_T", TESTER_TEXTURE_WRAP_T},
78 {"sampler_texture_wrap_r", "TEXTURE_WRAP_R", TESTER_TEXTURE_WRAP_R},
79 {"sampler_texture_mag_filter", "TEXTURE_MAG_FILTER", TESTER_TEXTURE_MAG_FILTER},
80 {"sampler_texture_min_filter", "TEXTURE_MIN_FILTER", TESTER_TEXTURE_MIN_FILTER},
81 {"sampler_texture_min_lod", "TEXTURE_MIN_LOD", TESTER_TEXTURE_MIN_LOD},
82 {"sampler_texture_max_lod", "TEXTURE_MAX_LOD", TESTER_TEXTURE_MAX_LOD},
83 {"sampler_texture_compare_mode", "TEXTURE_COMPARE_MODE", TESTER_TEXTURE_COMPARE_MODE},
84 {"sampler_texture_compare_func", "TEXTURE_COMPARE_FUNC", TESTER_TEXTURE_COMPARE_FUNC},
85 };
86
87 for (int stateNdx = 0; stateNdx < DE_LENGTH_OF_ARRAY(states); ++stateNdx)
88 {
89 FOR_EACH_VERIFIER(verifiers, addChild(createSamplerParamTest(
90 m_testCtx, m_context.getRenderContext(),
91 std::string() + states[stateNdx].name + getVerifierSuffix(verifier),
92 states[stateNdx].desc, verifier, states[stateNdx].tester)))
93 }
94 }
95
96 } // namespace Functional
97 } // namespace gles3
98 } // namespace deqp
99