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