1e5c31af7Sopenharmony_ci/*-------------------------------------------------------------------------
2e5c31af7Sopenharmony_ci * drawElements Quality Program OpenGL (ES) Module
3e5c31af7Sopenharmony_ci * -----------------------------------------------
4e5c31af7Sopenharmony_ci *
5e5c31af7Sopenharmony_ci * Copyright 2015 The Android Open Source Project
6e5c31af7Sopenharmony_ci *
7e5c31af7Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
8e5c31af7Sopenharmony_ci * you may not use this file except in compliance with the License.
9e5c31af7Sopenharmony_ci * You may obtain a copy of the License at
10e5c31af7Sopenharmony_ci *
11e5c31af7Sopenharmony_ci *      http://www.apache.org/licenses/LICENSE-2.0
12e5c31af7Sopenharmony_ci *
13e5c31af7Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
14e5c31af7Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
15e5c31af7Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16e5c31af7Sopenharmony_ci * See the License for the specific language governing permissions and
17e5c31af7Sopenharmony_ci * limitations under the License.
18e5c31af7Sopenharmony_ci *
19e5c31af7Sopenharmony_ci *//*!
20e5c31af7Sopenharmony_ci * \file
21e5c31af7Sopenharmony_ci * \brief Texture State Query tests.
22e5c31af7Sopenharmony_ci *//*--------------------------------------------------------------------*/
23e5c31af7Sopenharmony_ci
24e5c31af7Sopenharmony_ci#include "glsTextureStateQueryTests.hpp"
25e5c31af7Sopenharmony_ci#include "gluStrUtil.hpp"
26e5c31af7Sopenharmony_ci#include "gluObjectWrapper.hpp"
27e5c31af7Sopenharmony_ci#include "gluCallLogWrapper.hpp"
28e5c31af7Sopenharmony_ci#include "gluContextInfo.hpp"
29e5c31af7Sopenharmony_ci#include "gluTextureUtil.hpp"
30e5c31af7Sopenharmony_ci#include "glwEnums.hpp"
31e5c31af7Sopenharmony_ci#include "deUniquePtr.hpp"
32e5c31af7Sopenharmony_ci#include "deRandom.hpp"
33e5c31af7Sopenharmony_ci#include "deStringUtil.hpp"
34e5c31af7Sopenharmony_ci
35e5c31af7Sopenharmony_cinamespace deqp
36e5c31af7Sopenharmony_ci{
37e5c31af7Sopenharmony_cinamespace gls
38e5c31af7Sopenharmony_ci{
39e5c31af7Sopenharmony_cinamespace TextureStateQueryTests
40e5c31af7Sopenharmony_ci{
41e5c31af7Sopenharmony_cinamespace
42e5c31af7Sopenharmony_ci{
43e5c31af7Sopenharmony_ci
44e5c31af7Sopenharmony_ciusing namespace glw;
45e5c31af7Sopenharmony_ciusing namespace gls::StateQueryUtil;
46e5c31af7Sopenharmony_ci
47e5c31af7Sopenharmony_cistatic glw::GLenum mapTesterToPname (TesterType tester)
48e5c31af7Sopenharmony_ci{
49e5c31af7Sopenharmony_ci
50e5c31af7Sopenharmony_ci#define CASE_ALL_SETTERS(X) case X: case X ## _SET_PURE_INT: case X ## _SET_PURE_UINT
51e5c31af7Sopenharmony_ci
52e5c31af7Sopenharmony_ci	switch (tester)
53e5c31af7Sopenharmony_ci	{
54e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_SWIZZLE_R):				return GL_TEXTURE_SWIZZLE_R;
55e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_SWIZZLE_G):				return GL_TEXTURE_SWIZZLE_G;
56e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_SWIZZLE_B):				return GL_TEXTURE_SWIZZLE_B;
57e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_SWIZZLE_A):				return GL_TEXTURE_SWIZZLE_A;
58e5c31af7Sopenharmony_ci
59e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_WRAP_S):
60e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_WRAP_S_CLAMP_TO_BORDER:				return GL_TEXTURE_WRAP_S;
61e5c31af7Sopenharmony_ci
62e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_WRAP_T):
63e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_WRAP_T_CLAMP_TO_BORDER:				return GL_TEXTURE_WRAP_T;
64e5c31af7Sopenharmony_ci
65e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_WRAP_R):
66e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_WRAP_R_CLAMP_TO_BORDER:				return GL_TEXTURE_WRAP_R;
67e5c31af7Sopenharmony_ci
68e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_MAG_FILTER):			return GL_TEXTURE_MAG_FILTER;
69e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_MIN_FILTER):			return GL_TEXTURE_MIN_FILTER;
70e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_MIN_LOD):				return GL_TEXTURE_MIN_LOD;
71e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_MAX_LOD):				return GL_TEXTURE_MAX_LOD;
72e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_BASE_LEVEL):			return GL_TEXTURE_BASE_LEVEL;
73e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_MAX_LEVEL):				return GL_TEXTURE_MAX_LEVEL;
74e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_COMPARE_MODE):			return GL_TEXTURE_COMPARE_MODE;
75e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_COMPARE_FUNC):			return GL_TEXTURE_COMPARE_FUNC;
76e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_IMMUTABLE_LEVELS:					return GL_TEXTURE_IMMUTABLE_LEVELS;
77e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_IMMUTABLE_FORMAT:					return GL_TEXTURE_IMMUTABLE_FORMAT;
78e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_DEPTH_STENCIL_TEXTURE_MODE):	return GL_DEPTH_STENCIL_TEXTURE_MODE;
79e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_SRGB_DECODE_EXT):		return GL_TEXTURE_SRGB_DECODE_EXT;
80e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_BORDER_COLOR:						return GL_TEXTURE_BORDER_COLOR;
81e5c31af7Sopenharmony_ci
82e5c31af7Sopenharmony_ci		default:
83e5c31af7Sopenharmony_ci			DE_ASSERT(false);
84e5c31af7Sopenharmony_ci			return -1;
85e5c31af7Sopenharmony_ci	}
86e5c31af7Sopenharmony_ci
87e5c31af7Sopenharmony_ci#undef CASE_PURE_SETTERS
88e5c31af7Sopenharmony_ci}
89e5c31af7Sopenharmony_ci
90e5c31af7Sopenharmony_cistatic bool querySupportsSigned (QueryType type)
91e5c31af7Sopenharmony_ci{
92e5c31af7Sopenharmony_ci	return	type != QUERY_TEXTURE_PARAM_PURE_UNSIGNED_INTEGER &&
93e5c31af7Sopenharmony_ci			type != QUERY_SAMPLER_PARAM_PURE_UNSIGNED_INTEGER;
94e5c31af7Sopenharmony_ci}
95e5c31af7Sopenharmony_ci
96e5c31af7Sopenharmony_cistatic bool isPureIntTester (TesterType tester)
97e5c31af7Sopenharmony_ci{
98e5c31af7Sopenharmony_ci#define HANDLE_ALL_SETTERS(X) \
99e5c31af7Sopenharmony_ci		case X: \
100e5c31af7Sopenharmony_ci		case X ## _SET_PURE_UINT: return false; \
101e5c31af7Sopenharmony_ci		case X ## _SET_PURE_INT: return true;
102e5c31af7Sopenharmony_ci
103e5c31af7Sopenharmony_ci	switch (tester)
104e5c31af7Sopenharmony_ci	{
105e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_TEXTURE_SWIZZLE_R)
106e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_TEXTURE_SWIZZLE_G)
107e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_TEXTURE_SWIZZLE_B)
108e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_TEXTURE_SWIZZLE_A)
109e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_TEXTURE_WRAP_S)
110e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_TEXTURE_WRAP_T)
111e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_TEXTURE_WRAP_R)
112e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_TEXTURE_MAG_FILTER)
113e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_TEXTURE_MIN_FILTER)
114e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_TEXTURE_MIN_LOD)
115e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_TEXTURE_MAX_LOD)
116e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_TEXTURE_BASE_LEVEL)
117e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_TEXTURE_MAX_LEVEL)
118e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_TEXTURE_COMPARE_MODE)
119e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_TEXTURE_COMPARE_FUNC)
120e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_DEPTH_STENCIL_TEXTURE_MODE)
121e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_TEXTURE_SRGB_DECODE_EXT)
122e5c31af7Sopenharmony_ci
123e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_IMMUTABLE_LEVELS:
124e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_IMMUTABLE_FORMAT:
125e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_WRAP_S_CLAMP_TO_BORDER:
126e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_WRAP_T_CLAMP_TO_BORDER:
127e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_WRAP_R_CLAMP_TO_BORDER:
128e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_BORDER_COLOR:
129e5c31af7Sopenharmony_ci			return false;
130e5c31af7Sopenharmony_ci
131e5c31af7Sopenharmony_ci		default:
132e5c31af7Sopenharmony_ci			DE_ASSERT(false);
133e5c31af7Sopenharmony_ci			return false;
134e5c31af7Sopenharmony_ci	}
135e5c31af7Sopenharmony_ci
136e5c31af7Sopenharmony_ci#undef HANDLE_ALL_SETTERS
137e5c31af7Sopenharmony_ci}
138e5c31af7Sopenharmony_ci
139e5c31af7Sopenharmony_cistatic bool isPureUintTester (TesterType tester)
140e5c31af7Sopenharmony_ci{
141e5c31af7Sopenharmony_ci#define HANDLE_ALL_SETTERS(X) \
142e5c31af7Sopenharmony_ci		case X: \
143e5c31af7Sopenharmony_ci		case X ## _SET_PURE_INT: return false; \
144e5c31af7Sopenharmony_ci		case X ## _SET_PURE_UINT: return true;
145e5c31af7Sopenharmony_ci
146e5c31af7Sopenharmony_ci	switch (tester)
147e5c31af7Sopenharmony_ci	{
148e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_TEXTURE_SWIZZLE_R)
149e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_TEXTURE_SWIZZLE_G)
150e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_TEXTURE_SWIZZLE_B)
151e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_TEXTURE_SWIZZLE_A)
152e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_TEXTURE_WRAP_S)
153e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_TEXTURE_WRAP_T)
154e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_TEXTURE_WRAP_R)
155e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_TEXTURE_MAG_FILTER)
156e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_TEXTURE_MIN_FILTER)
157e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_TEXTURE_MIN_LOD)
158e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_TEXTURE_MAX_LOD)
159e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_TEXTURE_BASE_LEVEL)
160e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_TEXTURE_MAX_LEVEL)
161e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_TEXTURE_COMPARE_MODE)
162e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_TEXTURE_COMPARE_FUNC)
163e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_DEPTH_STENCIL_TEXTURE_MODE)
164e5c31af7Sopenharmony_ci		HANDLE_ALL_SETTERS(TESTER_TEXTURE_SRGB_DECODE_EXT)
165e5c31af7Sopenharmony_ci
166e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_IMMUTABLE_LEVELS:
167e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_IMMUTABLE_FORMAT:
168e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_WRAP_S_CLAMP_TO_BORDER:
169e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_WRAP_T_CLAMP_TO_BORDER:
170e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_WRAP_R_CLAMP_TO_BORDER:
171e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_BORDER_COLOR:
172e5c31af7Sopenharmony_ci			return false;
173e5c31af7Sopenharmony_ci
174e5c31af7Sopenharmony_ci		default:
175e5c31af7Sopenharmony_ci			DE_ASSERT(false);
176e5c31af7Sopenharmony_ci			return false;
177e5c31af7Sopenharmony_ci	}
178e5c31af7Sopenharmony_ci
179e5c31af7Sopenharmony_ci#undef HANDLE_ALL_SETTERS
180e5c31af7Sopenharmony_ci}
181e5c31af7Sopenharmony_ci
182e5c31af7Sopenharmony_ciclass RequiredExtensions
183e5c31af7Sopenharmony_ci{
184e5c31af7Sopenharmony_cipublic:
185e5c31af7Sopenharmony_ci								RequiredExtensions	(void)									{ }
186e5c31af7Sopenharmony_ci	explicit					RequiredExtensions	(const char* ext)						{ add(ext);				}
187e5c31af7Sopenharmony_ci								RequiredExtensions	(const char* extA, const char* extB)	{ add(extA); add(extB);	}
188e5c31af7Sopenharmony_ci
189e5c31af7Sopenharmony_ci	void						add					(const char* ext);
190e5c31af7Sopenharmony_ci	void						add					(const RequiredExtensions& other);
191e5c31af7Sopenharmony_ci	void						check				(const glu::ContextInfo&) const;
192e5c31af7Sopenharmony_ci
193e5c31af7Sopenharmony_ciprivate:
194e5c31af7Sopenharmony_ci	std::vector<const char*>	m_extensions;
195e5c31af7Sopenharmony_ci};
196e5c31af7Sopenharmony_ci
197e5c31af7Sopenharmony_civoid RequiredExtensions::add (const char* ext)
198e5c31af7Sopenharmony_ci{
199e5c31af7Sopenharmony_ci	for (int ndx = 0; ndx < (int)m_extensions.size(); ++ndx)
200e5c31af7Sopenharmony_ci		if (deStringEqual(m_extensions[ndx], ext) == DE_TRUE)
201e5c31af7Sopenharmony_ci			return;
202e5c31af7Sopenharmony_ci	m_extensions.push_back(ext);
203e5c31af7Sopenharmony_ci}
204e5c31af7Sopenharmony_ci
205e5c31af7Sopenharmony_civoid RequiredExtensions::add (const RequiredExtensions& other)
206e5c31af7Sopenharmony_ci{
207e5c31af7Sopenharmony_ci	for (int ndx = 0; ndx < (int)other.m_extensions.size(); ++ndx)
208e5c31af7Sopenharmony_ci		add(other.m_extensions[ndx]);
209e5c31af7Sopenharmony_ci}
210e5c31af7Sopenharmony_ci
211e5c31af7Sopenharmony_civoid RequiredExtensions::check (const glu::ContextInfo& ctxInfo) const
212e5c31af7Sopenharmony_ci{
213e5c31af7Sopenharmony_ci	std::vector<const char*> failedExtensions;
214e5c31af7Sopenharmony_ci
215e5c31af7Sopenharmony_ci	for (int ndx = 0; ndx < (int)m_extensions.size(); ++ndx)
216e5c31af7Sopenharmony_ci		if (!ctxInfo.isExtensionSupported(m_extensions[ndx]))
217e5c31af7Sopenharmony_ci			failedExtensions.push_back(m_extensions[ndx]);
218e5c31af7Sopenharmony_ci
219e5c31af7Sopenharmony_ci	if (!failedExtensions.empty())
220e5c31af7Sopenharmony_ci	{
221e5c31af7Sopenharmony_ci		std::ostringstream buf;
222e5c31af7Sopenharmony_ci		buf << "Test requires extension: ";
223e5c31af7Sopenharmony_ci
224e5c31af7Sopenharmony_ci		for (int ndx = 0; ndx < (int)failedExtensions.size(); ++ndx)
225e5c31af7Sopenharmony_ci		{
226e5c31af7Sopenharmony_ci			if (ndx)
227e5c31af7Sopenharmony_ci				buf << ", ";
228e5c31af7Sopenharmony_ci			buf << failedExtensions[ndx];
229e5c31af7Sopenharmony_ci		}
230e5c31af7Sopenharmony_ci
231e5c31af7Sopenharmony_ci		throw tcu::NotSupportedError(buf.str());
232e5c31af7Sopenharmony_ci	}
233e5c31af7Sopenharmony_ci}
234e5c31af7Sopenharmony_ci
235e5c31af7Sopenharmony_cinamespace es30
236e5c31af7Sopenharmony_ci{
237e5c31af7Sopenharmony_ci
238e5c31af7Sopenharmony_cistatic bool isCoreTextureTarget (glw::GLenum target)
239e5c31af7Sopenharmony_ci{
240e5c31af7Sopenharmony_ci	return	target == GL_TEXTURE_2D			||
241e5c31af7Sopenharmony_ci			target == GL_TEXTURE_3D			||
242e5c31af7Sopenharmony_ci			target == GL_TEXTURE_2D_ARRAY	||
243e5c31af7Sopenharmony_ci			target == GL_TEXTURE_CUBE_MAP;
244e5c31af7Sopenharmony_ci}
245e5c31af7Sopenharmony_ci
246e5c31af7Sopenharmony_cistatic RequiredExtensions getTextureTargetExtension (glw::GLenum target)
247e5c31af7Sopenharmony_ci{
248e5c31af7Sopenharmony_ci	DE_UNREF(target);
249e5c31af7Sopenharmony_ci	DE_ASSERT(false);
250e5c31af7Sopenharmony_ci	return RequiredExtensions();
251e5c31af7Sopenharmony_ci}
252e5c31af7Sopenharmony_ci
253e5c31af7Sopenharmony_cistatic bool isCoreTextureParam (glw::GLenum pname)
254e5c31af7Sopenharmony_ci{
255e5c31af7Sopenharmony_ci	return	pname == GL_TEXTURE_BASE_LEVEL			||
256e5c31af7Sopenharmony_ci			pname == GL_TEXTURE_COMPARE_MODE		||
257e5c31af7Sopenharmony_ci			pname == GL_TEXTURE_COMPARE_FUNC		||
258e5c31af7Sopenharmony_ci			pname == GL_TEXTURE_MAG_FILTER			||
259e5c31af7Sopenharmony_ci			pname == GL_TEXTURE_MAX_LEVEL			||
260e5c31af7Sopenharmony_ci			pname == GL_TEXTURE_MAX_LOD				||
261e5c31af7Sopenharmony_ci			pname == GL_TEXTURE_MIN_FILTER			||
262e5c31af7Sopenharmony_ci			pname == GL_TEXTURE_MIN_LOD				||
263e5c31af7Sopenharmony_ci			pname == GL_TEXTURE_SWIZZLE_R			||
264e5c31af7Sopenharmony_ci			pname == GL_TEXTURE_SWIZZLE_G			||
265e5c31af7Sopenharmony_ci			pname == GL_TEXTURE_SWIZZLE_B			||
266e5c31af7Sopenharmony_ci			pname == GL_TEXTURE_SWIZZLE_A			||
267e5c31af7Sopenharmony_ci			pname == GL_TEXTURE_WRAP_S				||
268e5c31af7Sopenharmony_ci			pname == GL_TEXTURE_WRAP_T				||
269e5c31af7Sopenharmony_ci			pname == GL_TEXTURE_WRAP_R				||
270e5c31af7Sopenharmony_ci			pname == GL_TEXTURE_IMMUTABLE_FORMAT	||
271e5c31af7Sopenharmony_ci			pname == GL_TEXTURE_IMMUTABLE_LEVELS;
272e5c31af7Sopenharmony_ci}
273e5c31af7Sopenharmony_ci
274e5c31af7Sopenharmony_cistatic RequiredExtensions getTextureParamExtension (glw::GLenum pname)
275e5c31af7Sopenharmony_ci{
276e5c31af7Sopenharmony_ci	DE_UNREF(pname);
277e5c31af7Sopenharmony_ci	DE_ASSERT(false);
278e5c31af7Sopenharmony_ci	return RequiredExtensions();
279e5c31af7Sopenharmony_ci}
280e5c31af7Sopenharmony_ci
281e5c31af7Sopenharmony_cistatic bool isCoreQuery (QueryType query)
282e5c31af7Sopenharmony_ci{
283e5c31af7Sopenharmony_ci	return	query == QUERY_TEXTURE_PARAM_INTEGER		||
284e5c31af7Sopenharmony_ci			query == QUERY_TEXTURE_PARAM_FLOAT			||
285e5c31af7Sopenharmony_ci			query == QUERY_TEXTURE_PARAM_INTEGER_VEC4	||
286e5c31af7Sopenharmony_ci			query == QUERY_TEXTURE_PARAM_FLOAT_VEC4		||
287e5c31af7Sopenharmony_ci			query == QUERY_SAMPLER_PARAM_INTEGER		||
288e5c31af7Sopenharmony_ci			query == QUERY_SAMPLER_PARAM_FLOAT			||
289e5c31af7Sopenharmony_ci			query == QUERY_SAMPLER_PARAM_INTEGER_VEC4	||
290e5c31af7Sopenharmony_ci			query == QUERY_SAMPLER_PARAM_FLOAT_VEC4;
291e5c31af7Sopenharmony_ci}
292e5c31af7Sopenharmony_ci
293e5c31af7Sopenharmony_cistatic RequiredExtensions getQueryExtension (QueryType query)
294e5c31af7Sopenharmony_ci{
295e5c31af7Sopenharmony_ci	DE_UNREF(query);
296e5c31af7Sopenharmony_ci	DE_ASSERT(false);
297e5c31af7Sopenharmony_ci	return RequiredExtensions();
298e5c31af7Sopenharmony_ci}
299e5c31af7Sopenharmony_ci
300e5c31af7Sopenharmony_cistatic bool isCoreTester (TesterType tester)
301e5c31af7Sopenharmony_ci{
302e5c31af7Sopenharmony_ci	return	tester == TESTER_TEXTURE_SWIZZLE_R			||
303e5c31af7Sopenharmony_ci			tester == TESTER_TEXTURE_SWIZZLE_G			||
304e5c31af7Sopenharmony_ci			tester == TESTER_TEXTURE_SWIZZLE_B			||
305e5c31af7Sopenharmony_ci			tester == TESTER_TEXTURE_SWIZZLE_A			||
306e5c31af7Sopenharmony_ci			tester == TESTER_TEXTURE_WRAP_S				||
307e5c31af7Sopenharmony_ci			tester == TESTER_TEXTURE_WRAP_T				||
308e5c31af7Sopenharmony_ci			tester == TESTER_TEXTURE_WRAP_R				||
309e5c31af7Sopenharmony_ci			tester == TESTER_TEXTURE_MAG_FILTER			||
310e5c31af7Sopenharmony_ci			tester == TESTER_TEXTURE_MIN_FILTER			||
311e5c31af7Sopenharmony_ci			tester == TESTER_TEXTURE_MIN_LOD			||
312e5c31af7Sopenharmony_ci			tester == TESTER_TEXTURE_MAX_LOD			||
313e5c31af7Sopenharmony_ci			tester == TESTER_TEXTURE_BASE_LEVEL			||
314e5c31af7Sopenharmony_ci			tester == TESTER_TEXTURE_MAX_LEVEL			||
315e5c31af7Sopenharmony_ci			tester == TESTER_TEXTURE_COMPARE_MODE		||
316e5c31af7Sopenharmony_ci			tester == TESTER_TEXTURE_COMPARE_FUNC		||
317e5c31af7Sopenharmony_ci			tester == TESTER_TEXTURE_IMMUTABLE_LEVELS	||
318e5c31af7Sopenharmony_ci			tester == TESTER_TEXTURE_IMMUTABLE_FORMAT;
319e5c31af7Sopenharmony_ci}
320e5c31af7Sopenharmony_ci
321e5c31af7Sopenharmony_cistatic RequiredExtensions getTesterExtension (TesterType tester)
322e5c31af7Sopenharmony_ci{
323e5c31af7Sopenharmony_ci	DE_UNREF(tester);
324e5c31af7Sopenharmony_ci	DE_ASSERT(false);
325e5c31af7Sopenharmony_ci	return RequiredExtensions();
326e5c31af7Sopenharmony_ci}
327e5c31af7Sopenharmony_ci
328e5c31af7Sopenharmony_ci} // es30
329e5c31af7Sopenharmony_ci
330e5c31af7Sopenharmony_cinamespace es31
331e5c31af7Sopenharmony_ci{
332e5c31af7Sopenharmony_ci
333e5c31af7Sopenharmony_cistatic bool isCoreTextureTarget (glw::GLenum target)
334e5c31af7Sopenharmony_ci{
335e5c31af7Sopenharmony_ci	return	es30::isCoreTextureTarget(target) ||
336e5c31af7Sopenharmony_ci			target == GL_TEXTURE_2D_MULTISAMPLE;
337e5c31af7Sopenharmony_ci}
338e5c31af7Sopenharmony_ci
339e5c31af7Sopenharmony_cistatic RequiredExtensions getTextureTargetExtension (glw::GLenum target)
340e5c31af7Sopenharmony_ci{
341e5c31af7Sopenharmony_ci	switch (target)
342e5c31af7Sopenharmony_ci	{
343e5c31af7Sopenharmony_ci		case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:	return RequiredExtensions("GL_OES_texture_storage_multisample_2d_array");
344e5c31af7Sopenharmony_ci		case GL_TEXTURE_BUFFER:					return RequiredExtensions("GL_EXT_texture_buffer");
345e5c31af7Sopenharmony_ci		case GL_TEXTURE_CUBE_MAP_ARRAY:			return RequiredExtensions("GL_EXT_texture_cube_map_array");
346e5c31af7Sopenharmony_ci		default:
347e5c31af7Sopenharmony_ci			DE_ASSERT(false);
348e5c31af7Sopenharmony_ci			return RequiredExtensions();
349e5c31af7Sopenharmony_ci	}
350e5c31af7Sopenharmony_ci}
351e5c31af7Sopenharmony_ci
352e5c31af7Sopenharmony_cistatic bool isCoreTextureParam (glw::GLenum pname)
353e5c31af7Sopenharmony_ci{
354e5c31af7Sopenharmony_ci	return	es30::isCoreTextureParam(pname) ||
355e5c31af7Sopenharmony_ci			pname == GL_DEPTH_STENCIL_TEXTURE_MODE;
356e5c31af7Sopenharmony_ci}
357e5c31af7Sopenharmony_ci
358e5c31af7Sopenharmony_cistatic RequiredExtensions getTextureParamExtension (glw::GLenum pname)
359e5c31af7Sopenharmony_ci{
360e5c31af7Sopenharmony_ci	switch (pname)
361e5c31af7Sopenharmony_ci	{
362e5c31af7Sopenharmony_ci		case GL_TEXTURE_SRGB_DECODE_EXT:	return RequiredExtensions("GL_EXT_texture_sRGB_decode");
363e5c31af7Sopenharmony_ci		case GL_TEXTURE_BORDER_COLOR:		return RequiredExtensions("GL_EXT_texture_border_clamp");
364e5c31af7Sopenharmony_ci		default:
365e5c31af7Sopenharmony_ci			DE_ASSERT(false);
366e5c31af7Sopenharmony_ci			return RequiredExtensions();
367e5c31af7Sopenharmony_ci	}
368e5c31af7Sopenharmony_ci}
369e5c31af7Sopenharmony_ci
370e5c31af7Sopenharmony_cistatic bool isCoreQuery (QueryType query)
371e5c31af7Sopenharmony_ci{
372e5c31af7Sopenharmony_ci	return es30::isCoreQuery(query);
373e5c31af7Sopenharmony_ci}
374e5c31af7Sopenharmony_ci
375e5c31af7Sopenharmony_cistatic RequiredExtensions getQueryExtension (QueryType query)
376e5c31af7Sopenharmony_ci{
377e5c31af7Sopenharmony_ci	switch (query)
378e5c31af7Sopenharmony_ci	{
379e5c31af7Sopenharmony_ci		case QUERY_TEXTURE_PARAM_PURE_INTEGER:
380e5c31af7Sopenharmony_ci		case QUERY_TEXTURE_PARAM_PURE_UNSIGNED_INTEGER:
381e5c31af7Sopenharmony_ci		case QUERY_TEXTURE_PARAM_PURE_INTEGER_VEC4:
382e5c31af7Sopenharmony_ci		case QUERY_TEXTURE_PARAM_PURE_UNSIGNED_INTEGER_VEC4:
383e5c31af7Sopenharmony_ci		case QUERY_SAMPLER_PARAM_PURE_INTEGER:
384e5c31af7Sopenharmony_ci		case QUERY_SAMPLER_PARAM_PURE_UNSIGNED_INTEGER:
385e5c31af7Sopenharmony_ci		case QUERY_SAMPLER_PARAM_PURE_INTEGER_VEC4:
386e5c31af7Sopenharmony_ci		case QUERY_SAMPLER_PARAM_PURE_UNSIGNED_INTEGER_VEC4:
387e5c31af7Sopenharmony_ci			return RequiredExtensions("GL_EXT_texture_border_clamp");
388e5c31af7Sopenharmony_ci
389e5c31af7Sopenharmony_ci		default:
390e5c31af7Sopenharmony_ci			DE_ASSERT(false);
391e5c31af7Sopenharmony_ci			return RequiredExtensions();
392e5c31af7Sopenharmony_ci	}
393e5c31af7Sopenharmony_ci}
394e5c31af7Sopenharmony_ci
395e5c31af7Sopenharmony_cistatic bool isCoreTester (TesterType tester)
396e5c31af7Sopenharmony_ci{
397e5c31af7Sopenharmony_ci	return	es30::isCoreTester(tester)							||
398e5c31af7Sopenharmony_ci			tester == TESTER_DEPTH_STENCIL_TEXTURE_MODE;
399e5c31af7Sopenharmony_ci}
400e5c31af7Sopenharmony_ci
401e5c31af7Sopenharmony_cistatic RequiredExtensions getTesterExtension (TesterType tester)
402e5c31af7Sopenharmony_ci{
403e5c31af7Sopenharmony_ci#define CASE_PURE_SETTERS(X) case X ## _SET_PURE_INT: case X ## _SET_PURE_UINT
404e5c31af7Sopenharmony_ci
405e5c31af7Sopenharmony_ci	switch (tester)
406e5c31af7Sopenharmony_ci	{
407e5c31af7Sopenharmony_ci		CASE_PURE_SETTERS(TESTER_TEXTURE_SWIZZLE_R):
408e5c31af7Sopenharmony_ci		CASE_PURE_SETTERS(TESTER_TEXTURE_SWIZZLE_G):
409e5c31af7Sopenharmony_ci		CASE_PURE_SETTERS(TESTER_TEXTURE_SWIZZLE_B):
410e5c31af7Sopenharmony_ci		CASE_PURE_SETTERS(TESTER_TEXTURE_SWIZZLE_A):
411e5c31af7Sopenharmony_ci		CASE_PURE_SETTERS(TESTER_TEXTURE_WRAP_S):
412e5c31af7Sopenharmony_ci		CASE_PURE_SETTERS(TESTER_TEXTURE_WRAP_T):
413e5c31af7Sopenharmony_ci		CASE_PURE_SETTERS(TESTER_TEXTURE_WRAP_R):
414e5c31af7Sopenharmony_ci		CASE_PURE_SETTERS(TESTER_TEXTURE_MAG_FILTER):
415e5c31af7Sopenharmony_ci		CASE_PURE_SETTERS(TESTER_TEXTURE_MIN_FILTER):
416e5c31af7Sopenharmony_ci		CASE_PURE_SETTERS(TESTER_TEXTURE_MIN_LOD):
417e5c31af7Sopenharmony_ci		CASE_PURE_SETTERS(TESTER_TEXTURE_MAX_LOD):
418e5c31af7Sopenharmony_ci		CASE_PURE_SETTERS(TESTER_TEXTURE_BASE_LEVEL):
419e5c31af7Sopenharmony_ci		CASE_PURE_SETTERS(TESTER_TEXTURE_MAX_LEVEL):
420e5c31af7Sopenharmony_ci		CASE_PURE_SETTERS(TESTER_TEXTURE_COMPARE_MODE):
421e5c31af7Sopenharmony_ci		CASE_PURE_SETTERS(TESTER_TEXTURE_COMPARE_FUNC):
422e5c31af7Sopenharmony_ci		CASE_PURE_SETTERS(TESTER_DEPTH_STENCIL_TEXTURE_MODE):
423e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_WRAP_S_CLAMP_TO_BORDER:
424e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_WRAP_T_CLAMP_TO_BORDER:
425e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_WRAP_R_CLAMP_TO_BORDER:
426e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_BORDER_COLOR:
427e5c31af7Sopenharmony_ci			return RequiredExtensions("GL_EXT_texture_border_clamp");
428e5c31af7Sopenharmony_ci
429e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_SRGB_DECODE_EXT:
430e5c31af7Sopenharmony_ci			return RequiredExtensions("GL_EXT_texture_sRGB_decode");
431e5c31af7Sopenharmony_ci
432e5c31af7Sopenharmony_ci		CASE_PURE_SETTERS(TESTER_TEXTURE_SRGB_DECODE_EXT):
433e5c31af7Sopenharmony_ci			return RequiredExtensions("GL_EXT_texture_sRGB_decode", "GL_EXT_texture_border_clamp");
434e5c31af7Sopenharmony_ci
435e5c31af7Sopenharmony_ci		default:
436e5c31af7Sopenharmony_ci			DE_ASSERT(false);
437e5c31af7Sopenharmony_ci			return RequiredExtensions();
438e5c31af7Sopenharmony_ci	}
439e5c31af7Sopenharmony_ci
440e5c31af7Sopenharmony_ci#undef CASE_PURE_SETTERS
441e5c31af7Sopenharmony_ci}
442e5c31af7Sopenharmony_ci
443e5c31af7Sopenharmony_ci} // es31
444e5c31af7Sopenharmony_ci
445e5c31af7Sopenharmony_cinamespace es32
446e5c31af7Sopenharmony_ci{
447e5c31af7Sopenharmony_ci
448e5c31af7Sopenharmony_cistatic bool isCoreTextureTarget (glw::GLenum target)
449e5c31af7Sopenharmony_ci{
450e5c31af7Sopenharmony_ci	return	es31::isCoreTextureTarget(target)			||
451e5c31af7Sopenharmony_ci			target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY	||
452e5c31af7Sopenharmony_ci			target == GL_TEXTURE_BUFFER					||
453e5c31af7Sopenharmony_ci			target == GL_TEXTURE_CUBE_MAP_ARRAY;
454e5c31af7Sopenharmony_ci}
455e5c31af7Sopenharmony_ci
456e5c31af7Sopenharmony_cistatic RequiredExtensions getTextureTargetExtension (glw::GLenum target)
457e5c31af7Sopenharmony_ci{
458e5c31af7Sopenharmony_ci	DE_UNREF(target);
459e5c31af7Sopenharmony_ci	DE_ASSERT(false);
460e5c31af7Sopenharmony_ci	return RequiredExtensions();
461e5c31af7Sopenharmony_ci}
462e5c31af7Sopenharmony_ci
463e5c31af7Sopenharmony_cistatic bool isCoreTextureParam (glw::GLenum pname)
464e5c31af7Sopenharmony_ci{
465e5c31af7Sopenharmony_ci	return	es31::isCoreTextureParam(pname)		||
466e5c31af7Sopenharmony_ci			pname == GL_TEXTURE_BORDER_COLOR;
467e5c31af7Sopenharmony_ci}
468e5c31af7Sopenharmony_ci
469e5c31af7Sopenharmony_cistatic RequiredExtensions getTextureParamExtension (glw::GLenum pname)
470e5c31af7Sopenharmony_ci{
471e5c31af7Sopenharmony_ci	switch (pname)
472e5c31af7Sopenharmony_ci	{
473e5c31af7Sopenharmony_ci		case GL_TEXTURE_SRGB_DECODE_EXT:	return RequiredExtensions("GL_EXT_texture_sRGB_decode");
474e5c31af7Sopenharmony_ci		default:
475e5c31af7Sopenharmony_ci			DE_ASSERT(false);
476e5c31af7Sopenharmony_ci			return RequiredExtensions();
477e5c31af7Sopenharmony_ci	}
478e5c31af7Sopenharmony_ci}
479e5c31af7Sopenharmony_ci
480e5c31af7Sopenharmony_cistatic bool isCoreQuery (QueryType query)
481e5c31af7Sopenharmony_ci{
482e5c31af7Sopenharmony_ci	return	es31::isCoreQuery(query)								||
483e5c31af7Sopenharmony_ci			query == QUERY_TEXTURE_PARAM_PURE_INTEGER				||
484e5c31af7Sopenharmony_ci			query == QUERY_TEXTURE_PARAM_PURE_UNSIGNED_INTEGER		||
485e5c31af7Sopenharmony_ci			query == QUERY_TEXTURE_PARAM_PURE_INTEGER_VEC4			||
486e5c31af7Sopenharmony_ci			query == QUERY_TEXTURE_PARAM_PURE_UNSIGNED_INTEGER_VEC4	||
487e5c31af7Sopenharmony_ci			query == QUERY_SAMPLER_PARAM_PURE_INTEGER				||
488e5c31af7Sopenharmony_ci			query == QUERY_SAMPLER_PARAM_PURE_UNSIGNED_INTEGER		||
489e5c31af7Sopenharmony_ci			query == QUERY_SAMPLER_PARAM_PURE_INTEGER_VEC4			||
490e5c31af7Sopenharmony_ci			query == QUERY_SAMPLER_PARAM_PURE_UNSIGNED_INTEGER_VEC4;
491e5c31af7Sopenharmony_ci}
492e5c31af7Sopenharmony_ci
493e5c31af7Sopenharmony_cistatic RequiredExtensions getQueryExtension (QueryType query)
494e5c31af7Sopenharmony_ci{
495e5c31af7Sopenharmony_ci	DE_UNREF(query);
496e5c31af7Sopenharmony_ci	DE_ASSERT(false);
497e5c31af7Sopenharmony_ci	return RequiredExtensions();
498e5c31af7Sopenharmony_ci}
499e5c31af7Sopenharmony_ci
500e5c31af7Sopenharmony_cistatic bool isCoreTester (TesterType tester)
501e5c31af7Sopenharmony_ci{
502e5c31af7Sopenharmony_ci#define COMPARE_PURE_SETTERS(TESTER, X) ((TESTER) == X ## _SET_PURE_INT) || ((TESTER) == X ## _SET_PURE_UINT)
503e5c31af7Sopenharmony_ci
504e5c31af7Sopenharmony_ci	return	es31::isCoreTester(tester)										||
505e5c31af7Sopenharmony_ci			COMPARE_PURE_SETTERS(tester, TESTER_TEXTURE_SWIZZLE_R)			||
506e5c31af7Sopenharmony_ci			COMPARE_PURE_SETTERS(tester, TESTER_TEXTURE_SWIZZLE_G)			||
507e5c31af7Sopenharmony_ci			COMPARE_PURE_SETTERS(tester, TESTER_TEXTURE_SWIZZLE_B)			||
508e5c31af7Sopenharmony_ci			COMPARE_PURE_SETTERS(tester, TESTER_TEXTURE_SWIZZLE_A)			||
509e5c31af7Sopenharmony_ci			COMPARE_PURE_SETTERS(tester, TESTER_TEXTURE_WRAP_S)				||
510e5c31af7Sopenharmony_ci			COMPARE_PURE_SETTERS(tester, TESTER_TEXTURE_WRAP_T)				||
511e5c31af7Sopenharmony_ci			COMPARE_PURE_SETTERS(tester, TESTER_TEXTURE_WRAP_R)				||
512e5c31af7Sopenharmony_ci			COMPARE_PURE_SETTERS(tester, TESTER_TEXTURE_MAG_FILTER)			||
513e5c31af7Sopenharmony_ci			COMPARE_PURE_SETTERS(tester, TESTER_TEXTURE_MIN_FILTER)			||
514e5c31af7Sopenharmony_ci			COMPARE_PURE_SETTERS(tester, TESTER_TEXTURE_MIN_LOD)			||
515e5c31af7Sopenharmony_ci			COMPARE_PURE_SETTERS(tester, TESTER_TEXTURE_MAX_LOD)			||
516e5c31af7Sopenharmony_ci			COMPARE_PURE_SETTERS(tester, TESTER_TEXTURE_BASE_LEVEL)			||
517e5c31af7Sopenharmony_ci			COMPARE_PURE_SETTERS(tester, TESTER_TEXTURE_MAX_LEVEL)			||
518e5c31af7Sopenharmony_ci			COMPARE_PURE_SETTERS(tester, TESTER_TEXTURE_COMPARE_MODE)		||
519e5c31af7Sopenharmony_ci			COMPARE_PURE_SETTERS(tester, TESTER_TEXTURE_COMPARE_FUNC)		||
520e5c31af7Sopenharmony_ci			COMPARE_PURE_SETTERS(tester, TESTER_DEPTH_STENCIL_TEXTURE_MODE)	||
521e5c31af7Sopenharmony_ci			tester == TESTER_TEXTURE_WRAP_S_CLAMP_TO_BORDER					||
522e5c31af7Sopenharmony_ci			tester == TESTER_TEXTURE_WRAP_T_CLAMP_TO_BORDER					||
523e5c31af7Sopenharmony_ci			tester == TESTER_TEXTURE_WRAP_R_CLAMP_TO_BORDER					||
524e5c31af7Sopenharmony_ci			tester == TESTER_TEXTURE_BORDER_COLOR;
525e5c31af7Sopenharmony_ci
526e5c31af7Sopenharmony_ci#undef COMPARE_PURE_SETTERS
527e5c31af7Sopenharmony_ci}
528e5c31af7Sopenharmony_ci
529e5c31af7Sopenharmony_cistatic RequiredExtensions getTesterExtension (TesterType tester)
530e5c31af7Sopenharmony_ci{
531e5c31af7Sopenharmony_ci#define CASE_PURE_SETTERS(X) case X ## _SET_PURE_INT: case X ## _SET_PURE_UINT
532e5c31af7Sopenharmony_ci
533e5c31af7Sopenharmony_ci	switch (tester)
534e5c31af7Sopenharmony_ci	{
535e5c31af7Sopenharmony_ci		CASE_PURE_SETTERS(TESTER_TEXTURE_SRGB_DECODE_EXT):
536e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_SRGB_DECODE_EXT:
537e5c31af7Sopenharmony_ci			return RequiredExtensions("GL_EXT_texture_sRGB_decode");
538e5c31af7Sopenharmony_ci
539e5c31af7Sopenharmony_ci		default:
540e5c31af7Sopenharmony_ci			DE_ASSERT(false);
541e5c31af7Sopenharmony_ci			return RequiredExtensions();
542e5c31af7Sopenharmony_ci	}
543e5c31af7Sopenharmony_ci
544e5c31af7Sopenharmony_ci#undef CASE_PURE_SETTERS
545e5c31af7Sopenharmony_ci}
546e5c31af7Sopenharmony_ci
547e5c31af7Sopenharmony_ci} // es32
548e5c31af7Sopenharmony_ci
549e5c31af7Sopenharmony_cinamespace gl45
550e5c31af7Sopenharmony_ci{
551e5c31af7Sopenharmony_ci
552e5c31af7Sopenharmony_cistatic bool isCoreTextureTarget (glw::GLenum target)
553e5c31af7Sopenharmony_ci{
554e5c31af7Sopenharmony_ci	return es31::isCoreTextureTarget(target);
555e5c31af7Sopenharmony_ci}
556e5c31af7Sopenharmony_ci
557e5c31af7Sopenharmony_cistatic RequiredExtensions getTextureTargetExtension (glw::GLenum target)
558e5c31af7Sopenharmony_ci{
559e5c31af7Sopenharmony_ci	DE_UNREF(target);
560e5c31af7Sopenharmony_ci	return RequiredExtensions();
561e5c31af7Sopenharmony_ci}
562e5c31af7Sopenharmony_ci
563e5c31af7Sopenharmony_cistatic bool isCoreTextureParam (glw::GLenum pname)
564e5c31af7Sopenharmony_ci{
565e5c31af7Sopenharmony_ci	return es31::isCoreTextureParam(pname);
566e5c31af7Sopenharmony_ci}
567e5c31af7Sopenharmony_ci
568e5c31af7Sopenharmony_cistatic RequiredExtensions getTextureParamExtension (glw::GLenum pname)
569e5c31af7Sopenharmony_ci{
570e5c31af7Sopenharmony_ci	DE_UNREF(pname);
571e5c31af7Sopenharmony_ci	return RequiredExtensions();
572e5c31af7Sopenharmony_ci}
573e5c31af7Sopenharmony_ci
574e5c31af7Sopenharmony_cistatic bool isCoreQuery (QueryType query)
575e5c31af7Sopenharmony_ci{
576e5c31af7Sopenharmony_ci	return es31::isCoreQuery(query);
577e5c31af7Sopenharmony_ci}
578e5c31af7Sopenharmony_ci
579e5c31af7Sopenharmony_cistatic RequiredExtensions getQueryExtension (QueryType query)
580e5c31af7Sopenharmony_ci{
581e5c31af7Sopenharmony_ci	DE_UNREF(query);
582e5c31af7Sopenharmony_ci	return RequiredExtensions();
583e5c31af7Sopenharmony_ci}
584e5c31af7Sopenharmony_ci
585e5c31af7Sopenharmony_cistatic bool isCoreTester (TesterType tester)
586e5c31af7Sopenharmony_ci{
587e5c31af7Sopenharmony_ci	return es31::isCoreTester(tester);
588e5c31af7Sopenharmony_ci}
589e5c31af7Sopenharmony_ci
590e5c31af7Sopenharmony_cistatic RequiredExtensions getTesterExtension (TesterType tester)
591e5c31af7Sopenharmony_ci{
592e5c31af7Sopenharmony_ci	DE_UNREF(tester);
593e5c31af7Sopenharmony_ci	return RequiredExtensions();
594e5c31af7Sopenharmony_ci}
595e5c31af7Sopenharmony_ci
596e5c31af7Sopenharmony_ci} // gl45
597e5c31af7Sopenharmony_ci
598e5c31af7Sopenharmony_cistatic bool isCoreTextureTarget (const glu::ContextType& contextType, glw::GLenum target)
599e5c31af7Sopenharmony_ci{
600e5c31af7Sopenharmony_ci	if (contextSupports(contextType, glu::ApiType::core(4,5)))
601e5c31af7Sopenharmony_ci		return gl45::isCoreTextureTarget(target);
602e5c31af7Sopenharmony_ci	else if (contextSupports(contextType, glu::ApiType::es(3,2)))
603e5c31af7Sopenharmony_ci		return es32::isCoreTextureTarget(target);
604e5c31af7Sopenharmony_ci	else if (contextSupports(contextType, glu::ApiType::es(3,1)))
605e5c31af7Sopenharmony_ci		return es31::isCoreTextureTarget(target);
606e5c31af7Sopenharmony_ci	else if (contextSupports(contextType, glu::ApiType::es(3,0)))
607e5c31af7Sopenharmony_ci		return es30::isCoreTextureTarget(target);
608e5c31af7Sopenharmony_ci	else
609e5c31af7Sopenharmony_ci	{
610e5c31af7Sopenharmony_ci		DE_ASSERT(false);
611e5c31af7Sopenharmony_ci		return DE_NULL;
612e5c31af7Sopenharmony_ci	}
613e5c31af7Sopenharmony_ci}
614e5c31af7Sopenharmony_ci
615e5c31af7Sopenharmony_cistatic bool isCoreTextureParam (const glu::ContextType& contextType, glw::GLenum pname)
616e5c31af7Sopenharmony_ci{
617e5c31af7Sopenharmony_ci	if (contextSupports(contextType, glu::ApiType::core(4,5)))
618e5c31af7Sopenharmony_ci		return gl45::isCoreTextureParam(pname);
619e5c31af7Sopenharmony_ci	else if (contextSupports(contextType, glu::ApiType::es(3,2)))
620e5c31af7Sopenharmony_ci		return es32::isCoreTextureParam(pname);
621e5c31af7Sopenharmony_ci	else if (contextSupports(contextType, glu::ApiType::es(3,1)))
622e5c31af7Sopenharmony_ci		return es31::isCoreTextureParam(pname);
623e5c31af7Sopenharmony_ci	else if (contextSupports(contextType, glu::ApiType::es(3,0)))
624e5c31af7Sopenharmony_ci		return es30::isCoreTextureParam(pname);
625e5c31af7Sopenharmony_ci	else
626e5c31af7Sopenharmony_ci	{
627e5c31af7Sopenharmony_ci		DE_ASSERT(false);
628e5c31af7Sopenharmony_ci		return DE_NULL;
629e5c31af7Sopenharmony_ci	}
630e5c31af7Sopenharmony_ci}
631e5c31af7Sopenharmony_ci
632e5c31af7Sopenharmony_cistatic bool isCoreQuery (const glu::ContextType& contextType, QueryType query)
633e5c31af7Sopenharmony_ci{
634e5c31af7Sopenharmony_ci	if (contextSupports(contextType, glu::ApiType::core(4,5)))
635e5c31af7Sopenharmony_ci		return gl45::isCoreQuery(query);
636e5c31af7Sopenharmony_ci	else if (contextSupports(contextType, glu::ApiType::es(3,2)))
637e5c31af7Sopenharmony_ci		return es32::isCoreQuery(query);
638e5c31af7Sopenharmony_ci	else if (contextSupports(contextType, glu::ApiType::es(3,1)))
639e5c31af7Sopenharmony_ci		return es31::isCoreQuery(query);
640e5c31af7Sopenharmony_ci	else if (contextSupports(contextType, glu::ApiType::es(3,0)))
641e5c31af7Sopenharmony_ci		return es30::isCoreQuery(query);
642e5c31af7Sopenharmony_ci	else
643e5c31af7Sopenharmony_ci	{
644e5c31af7Sopenharmony_ci		DE_ASSERT(false);
645e5c31af7Sopenharmony_ci		return DE_NULL;
646e5c31af7Sopenharmony_ci	}
647e5c31af7Sopenharmony_ci}
648e5c31af7Sopenharmony_ci
649e5c31af7Sopenharmony_cistatic bool isCoreTester (const glu::ContextType& contextType, TesterType tester)
650e5c31af7Sopenharmony_ci{
651e5c31af7Sopenharmony_ci	if (contextSupports(contextType, glu::ApiType::core(4,5)))
652e5c31af7Sopenharmony_ci		return gl45::isCoreTester(tester);
653e5c31af7Sopenharmony_ci	else if (contextSupports(contextType, glu::ApiType::es(3,2)))
654e5c31af7Sopenharmony_ci		return es32::isCoreTester(tester);
655e5c31af7Sopenharmony_ci	else if (contextSupports(contextType, glu::ApiType::es(3,1)))
656e5c31af7Sopenharmony_ci		return es31::isCoreTester(tester);
657e5c31af7Sopenharmony_ci	else if (contextSupports(contextType, glu::ApiType::es(3,0)))
658e5c31af7Sopenharmony_ci		return es30::isCoreTester(tester);
659e5c31af7Sopenharmony_ci	else
660e5c31af7Sopenharmony_ci	{
661e5c31af7Sopenharmony_ci		DE_ASSERT(false);
662e5c31af7Sopenharmony_ci		return DE_NULL;
663e5c31af7Sopenharmony_ci	}
664e5c31af7Sopenharmony_ci}
665e5c31af7Sopenharmony_ci
666e5c31af7Sopenharmony_cistatic RequiredExtensions getTextureTargetExtension (const glu::ContextType& contextType, glw::GLenum target)
667e5c31af7Sopenharmony_ci{
668e5c31af7Sopenharmony_ci	DE_ASSERT(!isCoreTextureTarget(contextType, target));
669e5c31af7Sopenharmony_ci
670e5c31af7Sopenharmony_ci	if (contextSupports(contextType, glu::ApiType::core(4,5)))
671e5c31af7Sopenharmony_ci		return gl45::getTextureTargetExtension(target);
672e5c31af7Sopenharmony_ci	else if (contextSupports(contextType, glu::ApiType::es(3,2)))
673e5c31af7Sopenharmony_ci		return es32::getTextureTargetExtension(target);
674e5c31af7Sopenharmony_ci	else if (contextSupports(contextType, glu::ApiType::es(3,1)))
675e5c31af7Sopenharmony_ci		return es31::getTextureTargetExtension(target);
676e5c31af7Sopenharmony_ci	else if (contextSupports(contextType, glu::ApiType::es(3,0)))
677e5c31af7Sopenharmony_ci		return es30::getTextureTargetExtension(target);
678e5c31af7Sopenharmony_ci	else
679e5c31af7Sopenharmony_ci	{
680e5c31af7Sopenharmony_ci		DE_ASSERT(false);
681e5c31af7Sopenharmony_ci		return RequiredExtensions();
682e5c31af7Sopenharmony_ci	}
683e5c31af7Sopenharmony_ci}
684e5c31af7Sopenharmony_ci
685e5c31af7Sopenharmony_cistatic RequiredExtensions getTextureParamExtension (const glu::ContextType& contextType, glw::GLenum pname)
686e5c31af7Sopenharmony_ci{
687e5c31af7Sopenharmony_ci	DE_ASSERT(!isCoreTextureParam(contextType, pname));
688e5c31af7Sopenharmony_ci
689e5c31af7Sopenharmony_ci	if (contextSupports(contextType, glu::ApiType::core(4,5)))
690e5c31af7Sopenharmony_ci		return gl45::getTextureParamExtension(pname);
691e5c31af7Sopenharmony_ci	else if (contextSupports(contextType, glu::ApiType::es(3,2)))
692e5c31af7Sopenharmony_ci		return es32::getTextureParamExtension(pname);
693e5c31af7Sopenharmony_ci	else if (contextSupports(contextType, glu::ApiType::es(3,1)))
694e5c31af7Sopenharmony_ci		return es31::getTextureParamExtension(pname);
695e5c31af7Sopenharmony_ci	else if (contextSupports(contextType, glu::ApiType::es(3,0)))
696e5c31af7Sopenharmony_ci		return es30::getTextureParamExtension(pname);
697e5c31af7Sopenharmony_ci	else
698e5c31af7Sopenharmony_ci	{
699e5c31af7Sopenharmony_ci		DE_ASSERT(false);
700e5c31af7Sopenharmony_ci		return RequiredExtensions();
701e5c31af7Sopenharmony_ci	}
702e5c31af7Sopenharmony_ci}
703e5c31af7Sopenharmony_ci
704e5c31af7Sopenharmony_cistatic RequiredExtensions getQueryExtension (const glu::ContextType& contextType, QueryType query)
705e5c31af7Sopenharmony_ci{
706e5c31af7Sopenharmony_ci	DE_ASSERT(!isCoreQuery(contextType, query));
707e5c31af7Sopenharmony_ci
708e5c31af7Sopenharmony_ci	if (contextSupports(contextType, glu::ApiType::core(4,5)))
709e5c31af7Sopenharmony_ci		return gl45::getQueryExtension(query);
710e5c31af7Sopenharmony_ci	else if (contextSupports(contextType, glu::ApiType::es(3,2)))
711e5c31af7Sopenharmony_ci		return es32::getQueryExtension(query);
712e5c31af7Sopenharmony_ci	else if (contextSupports(contextType, glu::ApiType::es(3,1)))
713e5c31af7Sopenharmony_ci		return es31::getQueryExtension(query);
714e5c31af7Sopenharmony_ci	else if (contextSupports(contextType, glu::ApiType::es(3,0)))
715e5c31af7Sopenharmony_ci		return es30::getQueryExtension(query);
716e5c31af7Sopenharmony_ci	else
717e5c31af7Sopenharmony_ci	{
718e5c31af7Sopenharmony_ci		DE_ASSERT(false);
719e5c31af7Sopenharmony_ci		return RequiredExtensions();
720e5c31af7Sopenharmony_ci	}
721e5c31af7Sopenharmony_ci}
722e5c31af7Sopenharmony_ci
723e5c31af7Sopenharmony_cistatic RequiredExtensions getTesterExtension (const glu::ContextType& contextType, TesterType tester)
724e5c31af7Sopenharmony_ci{
725e5c31af7Sopenharmony_ci	DE_ASSERT(!isCoreTester(contextType, tester));
726e5c31af7Sopenharmony_ci
727e5c31af7Sopenharmony_ci	if (contextSupports(contextType, glu::ApiType::core(4,5)))
728e5c31af7Sopenharmony_ci		return gl45::getTesterExtension(tester);
729e5c31af7Sopenharmony_ci	else if (contextSupports(contextType, glu::ApiType::es(3,2)))
730e5c31af7Sopenharmony_ci		return es32::getTesterExtension(tester);
731e5c31af7Sopenharmony_ci	else if (contextSupports(contextType, glu::ApiType::es(3,1)))
732e5c31af7Sopenharmony_ci		return es31::getTesterExtension(tester);
733e5c31af7Sopenharmony_ci	else if (contextSupports(contextType, glu::ApiType::es(3,0)))
734e5c31af7Sopenharmony_ci		return es30::getTesterExtension(tester);
735e5c31af7Sopenharmony_ci	else
736e5c31af7Sopenharmony_ci	{
737e5c31af7Sopenharmony_ci		DE_ASSERT(false);
738e5c31af7Sopenharmony_ci		return RequiredExtensions();
739e5c31af7Sopenharmony_ci	}
740e5c31af7Sopenharmony_ci}
741e5c31af7Sopenharmony_ci
742e5c31af7Sopenharmony_ciclass TextureTest : public tcu::TestCase
743e5c31af7Sopenharmony_ci{
744e5c31af7Sopenharmony_cipublic:
745e5c31af7Sopenharmony_ci						TextureTest	(tcu::TestContext&			testCtx,
746e5c31af7Sopenharmony_ci									 const glu::RenderContext&	renderCtx,
747e5c31af7Sopenharmony_ci									 const char*				name,
748e5c31af7Sopenharmony_ci									 const char*				desc,
749e5c31af7Sopenharmony_ci									 glw::GLenum				target,
750e5c31af7Sopenharmony_ci									 TesterType					tester,
751e5c31af7Sopenharmony_ci									 QueryType					type);
752e5c31af7Sopenharmony_ci
753e5c31af7Sopenharmony_ci	void				init		(void);
754e5c31af7Sopenharmony_ci	IterateResult		iterate		(void);
755e5c31af7Sopenharmony_ci
756e5c31af7Sopenharmony_ci	virtual void		test		(glu::CallLogWrapper& gl, tcu::ResultCollector& result) const = 0;
757e5c31af7Sopenharmony_ci
758e5c31af7Sopenharmony_ciprotected:
759e5c31af7Sopenharmony_ci	const glu::RenderContext&	m_renderCtx;
760e5c31af7Sopenharmony_ci	const glw::GLenum			m_target;
761e5c31af7Sopenharmony_ci	const glw::GLenum			m_pname;
762e5c31af7Sopenharmony_ci	const TesterType			m_tester;
763e5c31af7Sopenharmony_ci	const QueryType				m_type;
764e5c31af7Sopenharmony_ci};
765e5c31af7Sopenharmony_ci
766e5c31af7Sopenharmony_ciTextureTest::TextureTest (tcu::TestContext&			testCtx,
767e5c31af7Sopenharmony_ci						  const glu::RenderContext&	renderCtx,
768e5c31af7Sopenharmony_ci						  const char*				name,
769e5c31af7Sopenharmony_ci						  const char*				desc,
770e5c31af7Sopenharmony_ci						  glw::GLenum				target,
771e5c31af7Sopenharmony_ci						  TesterType				tester,
772e5c31af7Sopenharmony_ci						  QueryType					type)
773e5c31af7Sopenharmony_ci	: TestCase		(testCtx, name, desc)
774e5c31af7Sopenharmony_ci	, m_renderCtx	(renderCtx)
775e5c31af7Sopenharmony_ci	, m_target		(target)
776e5c31af7Sopenharmony_ci	, m_pname		(mapTesterToPname(tester))
777e5c31af7Sopenharmony_ci	, m_tester		(tester)
778e5c31af7Sopenharmony_ci	, m_type		(type)
779e5c31af7Sopenharmony_ci{
780e5c31af7Sopenharmony_ci}
781e5c31af7Sopenharmony_ci
782e5c31af7Sopenharmony_civoid TextureTest::init (void)
783e5c31af7Sopenharmony_ci{
784e5c31af7Sopenharmony_ci	const de::UniquePtr<glu::ContextInfo>	ctxInfo		(glu::ContextInfo::create(m_renderCtx));
785e5c31af7Sopenharmony_ci	RequiredExtensions						extensions;
786e5c31af7Sopenharmony_ci
787e5c31af7Sopenharmony_ci	// target
788e5c31af7Sopenharmony_ci	if (!isCoreTextureTarget(m_renderCtx.getType(), m_target))
789e5c31af7Sopenharmony_ci		extensions.add(getTextureTargetExtension(m_renderCtx.getType(), m_target));
790e5c31af7Sopenharmony_ci
791e5c31af7Sopenharmony_ci	// param
792e5c31af7Sopenharmony_ci	if (!isCoreTextureParam(m_renderCtx.getType(), m_pname))
793e5c31af7Sopenharmony_ci		extensions.add(getTextureParamExtension(m_renderCtx.getType(), m_pname));
794e5c31af7Sopenharmony_ci
795e5c31af7Sopenharmony_ci	// query
796e5c31af7Sopenharmony_ci	if (!isCoreQuery(m_renderCtx.getType(), m_type))
797e5c31af7Sopenharmony_ci		extensions.add(getQueryExtension(m_renderCtx.getType(), m_type));
798e5c31af7Sopenharmony_ci
799e5c31af7Sopenharmony_ci	// test type
800e5c31af7Sopenharmony_ci	if (!isCoreTester(m_renderCtx.getType(), m_tester))
801e5c31af7Sopenharmony_ci		extensions.add(getTesterExtension(m_renderCtx.getType(), m_tester));
802e5c31af7Sopenharmony_ci
803e5c31af7Sopenharmony_ci	extensions.check(*ctxInfo);
804e5c31af7Sopenharmony_ci}
805e5c31af7Sopenharmony_ci
806e5c31af7Sopenharmony_ciTextureTest::IterateResult TextureTest::iterate (void)
807e5c31af7Sopenharmony_ci{
808e5c31af7Sopenharmony_ci	glu::CallLogWrapper		gl		(m_renderCtx.getFunctions(), m_testCtx.getLog());
809e5c31af7Sopenharmony_ci	tcu::ResultCollector	result	(m_testCtx.getLog(), " // ERROR: ");
810e5c31af7Sopenharmony_ci
811e5c31af7Sopenharmony_ci	gl.enableLogging(true);
812e5c31af7Sopenharmony_ci	test(gl, result);
813e5c31af7Sopenharmony_ci
814e5c31af7Sopenharmony_ci	result.setTestContextResult(m_testCtx);
815e5c31af7Sopenharmony_ci	return STOP;
816e5c31af7Sopenharmony_ci}
817e5c31af7Sopenharmony_ci
818e5c31af7Sopenharmony_ciclass IsTextureCase : public tcu::TestCase
819e5c31af7Sopenharmony_ci{
820e5c31af7Sopenharmony_cipublic:
821e5c31af7Sopenharmony_ci								IsTextureCase	(tcu::TestContext& testCtx, const glu::RenderContext& renderCtx, const char* name, const char* desc, glw::GLenum target);
822e5c31af7Sopenharmony_ci
823e5c31af7Sopenharmony_ci	void						init			(void);
824e5c31af7Sopenharmony_ci	IterateResult				iterate			(void);
825e5c31af7Sopenharmony_ci
826e5c31af7Sopenharmony_ciprotected:
827e5c31af7Sopenharmony_ci	const glu::RenderContext&	m_renderCtx;
828e5c31af7Sopenharmony_ci	const glw::GLenum			m_target;
829e5c31af7Sopenharmony_ci};
830e5c31af7Sopenharmony_ci
831e5c31af7Sopenharmony_ciIsTextureCase::IsTextureCase (tcu::TestContext& testCtx, const glu::RenderContext& renderCtx, const char* name, const char* desc, glw::GLenum target)
832e5c31af7Sopenharmony_ci	: tcu::TestCase	(testCtx, name, desc)
833e5c31af7Sopenharmony_ci	, m_renderCtx	(renderCtx)
834e5c31af7Sopenharmony_ci	, m_target		(target)
835e5c31af7Sopenharmony_ci{
836e5c31af7Sopenharmony_ci}
837e5c31af7Sopenharmony_ci
838e5c31af7Sopenharmony_civoid IsTextureCase::init (void)
839e5c31af7Sopenharmony_ci{
840e5c31af7Sopenharmony_ci	const de::UniquePtr<glu::ContextInfo>	ctxInfo		(glu::ContextInfo::create(m_renderCtx));
841e5c31af7Sopenharmony_ci	RequiredExtensions						extensions;
842e5c31af7Sopenharmony_ci
843e5c31af7Sopenharmony_ci	// target
844e5c31af7Sopenharmony_ci	if (!isCoreTextureTarget(m_renderCtx.getType(), m_target))
845e5c31af7Sopenharmony_ci		extensions.add(getTextureTargetExtension(m_renderCtx.getType(), m_target));
846e5c31af7Sopenharmony_ci
847e5c31af7Sopenharmony_ci	extensions.check(*ctxInfo);
848e5c31af7Sopenharmony_ci}
849e5c31af7Sopenharmony_ci
850e5c31af7Sopenharmony_ciIsTextureCase::IterateResult IsTextureCase::iterate (void)
851e5c31af7Sopenharmony_ci{
852e5c31af7Sopenharmony_ci	glu::CallLogWrapper		gl			(m_renderCtx.getFunctions(), m_testCtx.getLog());
853e5c31af7Sopenharmony_ci	tcu::ResultCollector	result		(m_testCtx.getLog(), " // ERROR: ");
854e5c31af7Sopenharmony_ci	glw::GLuint				textureId	= 0;
855e5c31af7Sopenharmony_ci
856e5c31af7Sopenharmony_ci	gl.enableLogging(true);
857e5c31af7Sopenharmony_ci
858e5c31af7Sopenharmony_ci	gl.glGenTextures(1, &textureId);
859e5c31af7Sopenharmony_ci	gl.glBindTexture(m_target, textureId);
860e5c31af7Sopenharmony_ci	GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glBindTexture");
861e5c31af7Sopenharmony_ci
862e5c31af7Sopenharmony_ci	verifyStateObjectBoolean(result, gl, textureId, true, QUERY_ISTEXTURE);
863e5c31af7Sopenharmony_ci
864e5c31af7Sopenharmony_ci	gl.glDeleteTextures(1, &textureId);
865e5c31af7Sopenharmony_ci	GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glDeleteTextures");
866e5c31af7Sopenharmony_ci
867e5c31af7Sopenharmony_ci	verifyStateObjectBoolean(result, gl, textureId, false, QUERY_ISTEXTURE);
868e5c31af7Sopenharmony_ci
869e5c31af7Sopenharmony_ci	result.setTestContextResult(m_testCtx);
870e5c31af7Sopenharmony_ci	return STOP;
871e5c31af7Sopenharmony_ci}
872e5c31af7Sopenharmony_ci
873e5c31af7Sopenharmony_ciclass DepthStencilModeCase : public TextureTest
874e5c31af7Sopenharmony_ci{
875e5c31af7Sopenharmony_cipublic:
876e5c31af7Sopenharmony_ci			DepthStencilModeCase	(tcu::TestContext& testCtx, const glu::RenderContext& renderContext, const char* name, const char* desc, glw::GLenum target, TesterType tester, QueryType type);
877e5c31af7Sopenharmony_ci	void	test					(glu::CallLogWrapper& gl, tcu::ResultCollector& result) const;
878e5c31af7Sopenharmony_ci};
879e5c31af7Sopenharmony_ci
880e5c31af7Sopenharmony_ciDepthStencilModeCase::DepthStencilModeCase (tcu::TestContext& testCtx, const glu::RenderContext& renderCtx, const char* name, const char* desc, glw::GLenum target, TesterType tester, QueryType type)
881e5c31af7Sopenharmony_ci	: TextureTest(testCtx, renderCtx, name, desc, target, tester, type)
882e5c31af7Sopenharmony_ci{
883e5c31af7Sopenharmony_ci}
884e5c31af7Sopenharmony_ci
885e5c31af7Sopenharmony_civoid DepthStencilModeCase::test (glu::CallLogWrapper& gl, tcu::ResultCollector& result) const
886e5c31af7Sopenharmony_ci{
887e5c31af7Sopenharmony_ci	const bool		isPureCase	= isPureIntTester(m_tester) || isPureUintTester(m_tester);
888e5c31af7Sopenharmony_ci	glu::Texture	texture		(m_renderCtx);
889e5c31af7Sopenharmony_ci
890e5c31af7Sopenharmony_ci	gl.glBindTexture(m_target, *texture);
891e5c31af7Sopenharmony_ci	GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "bind");
892e5c31af7Sopenharmony_ci
893e5c31af7Sopenharmony_ci	if (!isPureCase)
894e5c31af7Sopenharmony_ci	{
895e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial");
896e5c31af7Sopenharmony_ci		verifyStateTextureParamInteger(result, gl, m_target, m_pname, GL_DEPTH_COMPONENT, m_type);
897e5c31af7Sopenharmony_ci	}
898e5c31af7Sopenharmony_ci
899e5c31af7Sopenharmony_ci	if (!isPureCase)
900e5c31af7Sopenharmony_ci	{
901e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection	section				(m_testCtx.getLog(), "Toggle", "Toggle");
902e5c31af7Sopenharmony_ci		const glw::GLint			depthComponentInt	= GL_DEPTH_COMPONENT;
903e5c31af7Sopenharmony_ci		const glw::GLfloat			depthComponentFloat	= (glw::GLfloat)GL_DEPTH_COMPONENT;
904e5c31af7Sopenharmony_ci
905e5c31af7Sopenharmony_ci		gl.glTexParameteri(m_target, m_pname, GL_STENCIL_INDEX);
906e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "set state");
907e5c31af7Sopenharmony_ci		verifyStateTextureParamInteger(result, gl, m_target, m_pname, GL_STENCIL_INDEX, m_type);
908e5c31af7Sopenharmony_ci
909e5c31af7Sopenharmony_ci		gl.glTexParameteriv(m_target, m_pname, &depthComponentInt);
910e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "set state");
911e5c31af7Sopenharmony_ci		verifyStateTextureParamInteger(result, gl, m_target, m_pname, GL_DEPTH_COMPONENT, m_type);
912e5c31af7Sopenharmony_ci
913e5c31af7Sopenharmony_ci		gl.glTexParameterf(m_target, m_pname, GL_STENCIL_INDEX);
914e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "set state");
915e5c31af7Sopenharmony_ci		verifyStateTextureParamInteger(result, gl, m_target, m_pname, GL_STENCIL_INDEX, m_type);
916e5c31af7Sopenharmony_ci
917e5c31af7Sopenharmony_ci		gl.glTexParameterfv(m_target, m_pname, &depthComponentFloat);
918e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "set state");
919e5c31af7Sopenharmony_ci		verifyStateTextureParamInteger(result, gl, m_target, m_pname, GL_DEPTH_COMPONENT, m_type);
920e5c31af7Sopenharmony_ci	}
921e5c31af7Sopenharmony_ci
922e5c31af7Sopenharmony_ci	if (isPureIntTester(m_tester))
923e5c31af7Sopenharmony_ci	{
924e5c31af7Sopenharmony_ci		const glw::GLint depthComponent	= GL_DEPTH_COMPONENT;
925e5c31af7Sopenharmony_ci		const glw::GLint stencilIndex	= GL_STENCIL_INDEX;
926e5c31af7Sopenharmony_ci
927e5c31af7Sopenharmony_ci		gl.glTexParameterIiv(m_target, m_pname, &stencilIndex);
928e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterIiv");
929e5c31af7Sopenharmony_ci		verifyStateTextureParamInteger(result, gl, m_target, m_pname, GL_STENCIL_INDEX, m_type);
930e5c31af7Sopenharmony_ci
931e5c31af7Sopenharmony_ci		gl.glTexParameterIiv(m_target, m_pname, &depthComponent);
932e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterIiv");
933e5c31af7Sopenharmony_ci		verifyStateTextureParamInteger(result, gl, m_target, m_pname, GL_DEPTH_COMPONENT, m_type);
934e5c31af7Sopenharmony_ci	}
935e5c31af7Sopenharmony_ci
936e5c31af7Sopenharmony_ci	if (isPureUintTester(m_tester))
937e5c31af7Sopenharmony_ci	{
938e5c31af7Sopenharmony_ci		const glw::GLuint depthComponent	= GL_DEPTH_COMPONENT;
939e5c31af7Sopenharmony_ci		const glw::GLuint stencilIndex	= GL_STENCIL_INDEX;
940e5c31af7Sopenharmony_ci
941e5c31af7Sopenharmony_ci		gl.glTexParameterIuiv(m_target, m_pname, &stencilIndex);
942e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterIuiv");
943e5c31af7Sopenharmony_ci		verifyStateTextureParamInteger(result, gl, m_target, m_pname, GL_STENCIL_INDEX, m_type);
944e5c31af7Sopenharmony_ci
945e5c31af7Sopenharmony_ci		gl.glTexParameterIuiv(m_target, m_pname, &depthComponent);
946e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterIuiv");
947e5c31af7Sopenharmony_ci		verifyStateTextureParamInteger(result, gl, m_target, m_pname, GL_DEPTH_COMPONENT, m_type);
948e5c31af7Sopenharmony_ci	}
949e5c31af7Sopenharmony_ci}
950e5c31af7Sopenharmony_ci
951e5c31af7Sopenharmony_ciclass TextureSRGBDecodeCase : public TextureTest
952e5c31af7Sopenharmony_ci{
953e5c31af7Sopenharmony_cipublic:
954e5c31af7Sopenharmony_ci			TextureSRGBDecodeCase	(tcu::TestContext& testCtx, const glu::RenderContext& renderContext, const char* name, const char* desc, glw::GLenum target, TesterType tester, QueryType type);
955e5c31af7Sopenharmony_ci	void	test					(glu::CallLogWrapper& gl, tcu::ResultCollector& result) const;
956e5c31af7Sopenharmony_ci};
957e5c31af7Sopenharmony_ci
958e5c31af7Sopenharmony_ciTextureSRGBDecodeCase::TextureSRGBDecodeCase (tcu::TestContext& testCtx, const glu::RenderContext& renderCtx, const char* name, const char* desc, glw::GLenum target, TesterType tester, QueryType type)
959e5c31af7Sopenharmony_ci	: TextureTest(testCtx, renderCtx, name, desc, target, tester, type)
960e5c31af7Sopenharmony_ci{
961e5c31af7Sopenharmony_ci}
962e5c31af7Sopenharmony_ci
963e5c31af7Sopenharmony_civoid TextureSRGBDecodeCase::test (glu::CallLogWrapper& gl, tcu::ResultCollector& result) const
964e5c31af7Sopenharmony_ci{
965e5c31af7Sopenharmony_ci	const bool		isPureCase	= isPureIntTester(m_tester) || isPureUintTester(m_tester);
966e5c31af7Sopenharmony_ci	glu::Texture	texture		(m_renderCtx);
967e5c31af7Sopenharmony_ci
968e5c31af7Sopenharmony_ci	gl.glBindTexture(m_target, *texture);
969e5c31af7Sopenharmony_ci	GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "bind");
970e5c31af7Sopenharmony_ci
971e5c31af7Sopenharmony_ci	if (!isPureCase)
972e5c31af7Sopenharmony_ci	{
973e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial");
974e5c31af7Sopenharmony_ci		verifyStateTextureParamInteger(result, gl, m_target, m_pname, GL_DECODE_EXT, m_type);
975e5c31af7Sopenharmony_ci	}
976e5c31af7Sopenharmony_ci
977e5c31af7Sopenharmony_ci	if (!isPureCase)
978e5c31af7Sopenharmony_ci	{
979e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection	section			(m_testCtx.getLog(), "Toggle", "Toggle");
980e5c31af7Sopenharmony_ci		const glw::GLint			decodeInt		= GL_DECODE_EXT;
981e5c31af7Sopenharmony_ci		const glw::GLfloat			decodeFloat		= (glw::GLfloat)GL_DECODE_EXT;
982e5c31af7Sopenharmony_ci
983e5c31af7Sopenharmony_ci		gl.glTexParameteri(m_target, m_pname, GL_SKIP_DECODE_EXT);
984e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "set state");
985e5c31af7Sopenharmony_ci		verifyStateTextureParamInteger(result, gl, m_target, m_pname, GL_SKIP_DECODE_EXT, m_type);
986e5c31af7Sopenharmony_ci
987e5c31af7Sopenharmony_ci		gl.glTexParameteriv(m_target, m_pname, &decodeInt);
988e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "set state");
989e5c31af7Sopenharmony_ci		verifyStateTextureParamInteger(result, gl, m_target, m_pname, GL_DECODE_EXT, m_type);
990e5c31af7Sopenharmony_ci
991e5c31af7Sopenharmony_ci		gl.glTexParameterf(m_target, m_pname, GL_SKIP_DECODE_EXT);
992e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "set state");
993e5c31af7Sopenharmony_ci		verifyStateTextureParamInteger(result, gl, m_target, m_pname, GL_SKIP_DECODE_EXT, m_type);
994e5c31af7Sopenharmony_ci
995e5c31af7Sopenharmony_ci		gl.glTexParameterfv(m_target, m_pname, &decodeFloat);
996e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "set state");
997e5c31af7Sopenharmony_ci		verifyStateTextureParamInteger(result, gl, m_target, m_pname, GL_DECODE_EXT, m_type);
998e5c31af7Sopenharmony_ci	}
999e5c31af7Sopenharmony_ci
1000e5c31af7Sopenharmony_ci	if (isPureIntTester(m_tester))
1001e5c31af7Sopenharmony_ci	{
1002e5c31af7Sopenharmony_ci		const glw::GLint skipDecode	= GL_SKIP_DECODE_EXT;
1003e5c31af7Sopenharmony_ci		const glw::GLint decode		= GL_DECODE_EXT;
1004e5c31af7Sopenharmony_ci
1005e5c31af7Sopenharmony_ci		gl.glTexParameterIiv(m_target, m_pname, &skipDecode);
1006e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterIiv");
1007e5c31af7Sopenharmony_ci		verifyStateTextureParamInteger(result, gl, m_target, m_pname, GL_SKIP_DECODE_EXT, m_type);
1008e5c31af7Sopenharmony_ci
1009e5c31af7Sopenharmony_ci		gl.glTexParameterIiv(m_target, m_pname, &decode);
1010e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterIiv");
1011e5c31af7Sopenharmony_ci		verifyStateTextureParamInteger(result, gl, m_target, m_pname, GL_DECODE_EXT, m_type);
1012e5c31af7Sopenharmony_ci	}
1013e5c31af7Sopenharmony_ci
1014e5c31af7Sopenharmony_ci	if (isPureUintTester(m_tester))
1015e5c31af7Sopenharmony_ci	{
1016e5c31af7Sopenharmony_ci		const glw::GLuint skipDecode	= GL_SKIP_DECODE_EXT;
1017e5c31af7Sopenharmony_ci		const glw::GLuint decode		= GL_DECODE_EXT;
1018e5c31af7Sopenharmony_ci
1019e5c31af7Sopenharmony_ci		gl.glTexParameterIuiv(m_target, m_pname, &skipDecode);
1020e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterIuiv");
1021e5c31af7Sopenharmony_ci		verifyStateTextureParamInteger(result, gl, m_target, m_pname, GL_SKIP_DECODE_EXT, m_type);
1022e5c31af7Sopenharmony_ci
1023e5c31af7Sopenharmony_ci		gl.glTexParameterIuiv(m_target, m_pname, &decode);
1024e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterIuiv");
1025e5c31af7Sopenharmony_ci		verifyStateTextureParamInteger(result, gl, m_target, m_pname, GL_DECODE_EXT, m_type);
1026e5c31af7Sopenharmony_ci	}
1027e5c31af7Sopenharmony_ci}
1028e5c31af7Sopenharmony_ci
1029e5c31af7Sopenharmony_ciclass TextureSwizzleCase : public TextureTest
1030e5c31af7Sopenharmony_ci{
1031e5c31af7Sopenharmony_cipublic:
1032e5c31af7Sopenharmony_ci			TextureSwizzleCase	(tcu::TestContext& testCtx, const glu::RenderContext& renderContext, const char* name, const char* desc, glw::GLenum target, TesterType tester, QueryType type);
1033e5c31af7Sopenharmony_ci	void	test				(glu::CallLogWrapper& gl, tcu::ResultCollector& result) const;
1034e5c31af7Sopenharmony_ci};
1035e5c31af7Sopenharmony_ci
1036e5c31af7Sopenharmony_ciTextureSwizzleCase::TextureSwizzleCase (tcu::TestContext& testCtx, const glu::RenderContext& renderCtx, const char* name, const char* desc, glw::GLenum target, TesterType tester, QueryType type)
1037e5c31af7Sopenharmony_ci	: TextureTest(testCtx, renderCtx, name, desc, target, tester, type)
1038e5c31af7Sopenharmony_ci{
1039e5c31af7Sopenharmony_ci}
1040e5c31af7Sopenharmony_ci
1041e5c31af7Sopenharmony_civoid TextureSwizzleCase::test (glu::CallLogWrapper& gl, tcu::ResultCollector& result) const
1042e5c31af7Sopenharmony_ci{
1043e5c31af7Sopenharmony_ci	const bool	isPureCase		= isPureIntTester(m_tester) || isPureUintTester(m_tester);
1044e5c31af7Sopenharmony_ci	const int	initialValue	= (m_pname == GL_TEXTURE_SWIZZLE_R) ? (GL_RED) :
1045e5c31af7Sopenharmony_ci								  (m_pname == GL_TEXTURE_SWIZZLE_G) ? (GL_GREEN) :
1046e5c31af7Sopenharmony_ci								  (m_pname == GL_TEXTURE_SWIZZLE_B) ? (GL_BLUE) :
1047e5c31af7Sopenharmony_ci								  (m_pname == GL_TEXTURE_SWIZZLE_A) ? (GL_ALPHA) :
1048e5c31af7Sopenharmony_ci								  (-1);
1049e5c31af7Sopenharmony_ci
1050e5c31af7Sopenharmony_ci	if (!isPureCase)
1051e5c31af7Sopenharmony_ci	{
1052e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial");
1053e5c31af7Sopenharmony_ci		verifyStateTextureParamInteger(result, gl, m_target, m_pname, initialValue, m_type);
1054e5c31af7Sopenharmony_ci	}
1055e5c31af7Sopenharmony_ci
1056e5c31af7Sopenharmony_ci	{
1057e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection	section			(m_testCtx.getLog(), "Set", "Set");
1058e5c31af7Sopenharmony_ci		const GLenum				swizzleValues[]	= {GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA, GL_ZERO, GL_ONE};
1059e5c31af7Sopenharmony_ci
1060e5c31af7Sopenharmony_ci		if (isPureCase)
1061e5c31af7Sopenharmony_ci		{
1062e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(swizzleValues); ++ndx)
1063e5c31af7Sopenharmony_ci			{
1064e5c31af7Sopenharmony_ci				if (isPureIntTester(m_tester))
1065e5c31af7Sopenharmony_ci				{
1066e5c31af7Sopenharmony_ci					const glw::GLint value = (glw::GLint)swizzleValues[ndx];
1067e5c31af7Sopenharmony_ci					gl.glTexParameterIiv(m_target, m_pname, &value);
1068e5c31af7Sopenharmony_ci					GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterIiv");
1069e5c31af7Sopenharmony_ci				}
1070e5c31af7Sopenharmony_ci				else
1071e5c31af7Sopenharmony_ci				{
1072e5c31af7Sopenharmony_ci					DE_ASSERT(isPureUintTester(m_tester));
1073e5c31af7Sopenharmony_ci
1074e5c31af7Sopenharmony_ci					const glw::GLuint value = swizzleValues[ndx];
1075e5c31af7Sopenharmony_ci					gl.glTexParameterIuiv(m_target, m_pname, &value);
1076e5c31af7Sopenharmony_ci					GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterIuiv");
1077e5c31af7Sopenharmony_ci				}
1078e5c31af7Sopenharmony_ci
1079e5c31af7Sopenharmony_ci				verifyStateTextureParamInteger(result, gl, m_target, m_pname, swizzleValues[ndx], m_type);
1080e5c31af7Sopenharmony_ci			}
1081e5c31af7Sopenharmony_ci		}
1082e5c31af7Sopenharmony_ci		else
1083e5c31af7Sopenharmony_ci		{
1084e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(swizzleValues); ++ndx)
1085e5c31af7Sopenharmony_ci			{
1086e5c31af7Sopenharmony_ci				gl.glTexParameteri(m_target, m_pname, swizzleValues[ndx]);
1087e5c31af7Sopenharmony_ci				GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameteri");
1088e5c31af7Sopenharmony_ci
1089e5c31af7Sopenharmony_ci				verifyStateTextureParamInteger(result, gl, m_target, m_pname, swizzleValues[ndx], m_type);
1090e5c31af7Sopenharmony_ci			}
1091e5c31af7Sopenharmony_ci
1092e5c31af7Sopenharmony_ci			//check unit conversions with float
1093e5c31af7Sopenharmony_ci
1094e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(swizzleValues); ++ndx)
1095e5c31af7Sopenharmony_ci			{
1096e5c31af7Sopenharmony_ci				gl.glTexParameterf(m_target, m_pname, (GLfloat)swizzleValues[ndx]);
1097e5c31af7Sopenharmony_ci				GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterf");
1098e5c31af7Sopenharmony_ci
1099e5c31af7Sopenharmony_ci				verifyStateTextureParamInteger(result, gl, m_target, m_pname, swizzleValues[ndx], m_type);
1100e5c31af7Sopenharmony_ci			}
1101e5c31af7Sopenharmony_ci		}
1102e5c31af7Sopenharmony_ci	}
1103e5c31af7Sopenharmony_ci}
1104e5c31af7Sopenharmony_ci
1105e5c31af7Sopenharmony_ciclass TextureWrapCase : public TextureTest
1106e5c31af7Sopenharmony_ci{
1107e5c31af7Sopenharmony_cipublic:
1108e5c31af7Sopenharmony_ci			TextureWrapCase	(tcu::TestContext& testCtx, const glu::RenderContext& renderContext, const char* name, const char* desc, glw::GLenum target, TesterType tester, QueryType type);
1109e5c31af7Sopenharmony_ci	void	test			(glu::CallLogWrapper& gl, tcu::ResultCollector& result) const;
1110e5c31af7Sopenharmony_ci};
1111e5c31af7Sopenharmony_ci
1112e5c31af7Sopenharmony_ciTextureWrapCase::TextureWrapCase (tcu::TestContext& testCtx, const glu::RenderContext& renderCtx, const char* name, const char* desc, glw::GLenum target, TesterType tester, QueryType type)
1113e5c31af7Sopenharmony_ci	: TextureTest(testCtx, renderCtx, name, desc, target, tester, type)
1114e5c31af7Sopenharmony_ci{
1115e5c31af7Sopenharmony_ci}
1116e5c31af7Sopenharmony_ci
1117e5c31af7Sopenharmony_civoid TextureWrapCase::test (glu::CallLogWrapper& gl, tcu::ResultCollector& result) const
1118e5c31af7Sopenharmony_ci{
1119e5c31af7Sopenharmony_ci	const bool isPureCase = isPureIntTester(m_tester) || isPureUintTester(m_tester);
1120e5c31af7Sopenharmony_ci
1121e5c31af7Sopenharmony_ci	if (!isPureCase)
1122e5c31af7Sopenharmony_ci	{
1123e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial");
1124e5c31af7Sopenharmony_ci		verifyStateTextureParamInteger(result, gl, m_target, m_pname, GL_REPEAT, m_type);
1125e5c31af7Sopenharmony_ci	}
1126e5c31af7Sopenharmony_ci
1127e5c31af7Sopenharmony_ci	{
1128e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection	section			(m_testCtx.getLog(), "Set", "Set");
1129e5c31af7Sopenharmony_ci		const GLenum				wrapValues[]	= {GL_CLAMP_TO_EDGE, GL_REPEAT, GL_MIRRORED_REPEAT};
1130e5c31af7Sopenharmony_ci
1131e5c31af7Sopenharmony_ci		if (isPureCase)
1132e5c31af7Sopenharmony_ci		{
1133e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(wrapValues); ++ndx)
1134e5c31af7Sopenharmony_ci			{
1135e5c31af7Sopenharmony_ci				if (isPureIntTester(m_tester))
1136e5c31af7Sopenharmony_ci				{
1137e5c31af7Sopenharmony_ci					const glw::GLint value = (glw::GLint)wrapValues[ndx];
1138e5c31af7Sopenharmony_ci					gl.glTexParameterIiv(m_target, m_pname, &value);
1139e5c31af7Sopenharmony_ci					GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterIiv");
1140e5c31af7Sopenharmony_ci				}
1141e5c31af7Sopenharmony_ci				else
1142e5c31af7Sopenharmony_ci				{
1143e5c31af7Sopenharmony_ci					DE_ASSERT(isPureUintTester(m_tester));
1144e5c31af7Sopenharmony_ci
1145e5c31af7Sopenharmony_ci					const glw::GLuint value = wrapValues[ndx];
1146e5c31af7Sopenharmony_ci					gl.glTexParameterIuiv(m_target, m_pname, &value);
1147e5c31af7Sopenharmony_ci					GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterIuiv");
1148e5c31af7Sopenharmony_ci				}
1149e5c31af7Sopenharmony_ci
1150e5c31af7Sopenharmony_ci				verifyStateTextureParamInteger(result, gl, m_target, m_pname, wrapValues[ndx], m_type);
1151e5c31af7Sopenharmony_ci			}
1152e5c31af7Sopenharmony_ci		}
1153e5c31af7Sopenharmony_ci		else
1154e5c31af7Sopenharmony_ci		{
1155e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(wrapValues); ++ndx)
1156e5c31af7Sopenharmony_ci			{
1157e5c31af7Sopenharmony_ci				gl.glTexParameteri(m_target, m_pname, wrapValues[ndx]);
1158e5c31af7Sopenharmony_ci				GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameteri");
1159e5c31af7Sopenharmony_ci
1160e5c31af7Sopenharmony_ci				verifyStateTextureParamInteger(result, gl, m_target, m_pname, wrapValues[ndx], m_type);
1161e5c31af7Sopenharmony_ci			}
1162e5c31af7Sopenharmony_ci
1163e5c31af7Sopenharmony_ci			//check unit conversions with float
1164e5c31af7Sopenharmony_ci
1165e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(wrapValues); ++ndx)
1166e5c31af7Sopenharmony_ci			{
1167e5c31af7Sopenharmony_ci				gl.glTexParameterf(m_target, m_pname, (GLfloat)wrapValues[ndx]);
1168e5c31af7Sopenharmony_ci				GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterf");
1169e5c31af7Sopenharmony_ci
1170e5c31af7Sopenharmony_ci				verifyStateTextureParamInteger(result, gl, m_target, m_pname, wrapValues[ndx], m_type);
1171e5c31af7Sopenharmony_ci			}
1172e5c31af7Sopenharmony_ci		}
1173e5c31af7Sopenharmony_ci	}
1174e5c31af7Sopenharmony_ci}
1175e5c31af7Sopenharmony_ci
1176e5c31af7Sopenharmony_ciclass TextureFilterCase : public TextureTest
1177e5c31af7Sopenharmony_ci{
1178e5c31af7Sopenharmony_cipublic:
1179e5c31af7Sopenharmony_ci			TextureFilterCase	(tcu::TestContext& testCtx, const glu::RenderContext& renderContext, const char* name, const char* desc, glw::GLenum target, TesterType tester, QueryType type);
1180e5c31af7Sopenharmony_ci	void	test				(glu::CallLogWrapper& gl, tcu::ResultCollector& result) const;
1181e5c31af7Sopenharmony_ci};
1182e5c31af7Sopenharmony_ci
1183e5c31af7Sopenharmony_ciTextureFilterCase::TextureFilterCase (tcu::TestContext& testCtx, const glu::RenderContext& renderCtx, const char* name, const char* desc, glw::GLenum target, TesterType tester, QueryType type)
1184e5c31af7Sopenharmony_ci	: TextureTest(testCtx, renderCtx, name, desc, target, tester, type)
1185e5c31af7Sopenharmony_ci{
1186e5c31af7Sopenharmony_ci}
1187e5c31af7Sopenharmony_ci
1188e5c31af7Sopenharmony_civoid TextureFilterCase::test (glu::CallLogWrapper& gl, tcu::ResultCollector& result) const
1189e5c31af7Sopenharmony_ci{
1190e5c31af7Sopenharmony_ci	const bool			isPureCase	= isPureIntTester(m_tester) || isPureUintTester(m_tester);
1191e5c31af7Sopenharmony_ci	glw::GLenum	initial		= (m_pname == GL_TEXTURE_MAG_FILTER) ? (GL_LINEAR)
1192e5c31af7Sopenharmony_ci									: (m_pname == GL_TEXTURE_MIN_FILTER) ? (GL_NEAREST_MIPMAP_LINEAR)
1193e5c31af7Sopenharmony_ci									: (0);
1194e5c31af7Sopenharmony_ci
1195e5c31af7Sopenharmony_ci	if (!isPureCase)
1196e5c31af7Sopenharmony_ci	{
1197e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial");
1198e5c31af7Sopenharmony_ci		verifyStateTextureParamInteger(result, gl, m_target, m_pname, initial, m_type);
1199e5c31af7Sopenharmony_ci	}
1200e5c31af7Sopenharmony_ci
1201e5c31af7Sopenharmony_ci	{
1202e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection	section		(m_testCtx.getLog(), "Set", "Set");
1203e5c31af7Sopenharmony_ci		std::vector<GLenum>			values;
1204e5c31af7Sopenharmony_ci
1205e5c31af7Sopenharmony_ci		values.push_back(GL_NEAREST);
1206e5c31af7Sopenharmony_ci		values.push_back(GL_LINEAR);
1207e5c31af7Sopenharmony_ci		if (m_pname == GL_TEXTURE_MIN_FILTER)
1208e5c31af7Sopenharmony_ci		{
1209e5c31af7Sopenharmony_ci			values.push_back(GL_NEAREST_MIPMAP_NEAREST);
1210e5c31af7Sopenharmony_ci			values.push_back(GL_NEAREST_MIPMAP_LINEAR);
1211e5c31af7Sopenharmony_ci			values.push_back(GL_LINEAR_MIPMAP_NEAREST);
1212e5c31af7Sopenharmony_ci			values.push_back(GL_LINEAR_MIPMAP_LINEAR);
1213e5c31af7Sopenharmony_ci		}
1214e5c31af7Sopenharmony_ci
1215e5c31af7Sopenharmony_ci		if (isPureCase)
1216e5c31af7Sopenharmony_ci		{
1217e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < (int)values.size(); ++ndx)
1218e5c31af7Sopenharmony_ci			{
1219e5c31af7Sopenharmony_ci				if (isPureIntTester(m_tester))
1220e5c31af7Sopenharmony_ci				{
1221e5c31af7Sopenharmony_ci					const glw::GLint value = (glw::GLint)values[ndx];
1222e5c31af7Sopenharmony_ci					gl.glTexParameterIiv(m_target, m_pname, &value);
1223e5c31af7Sopenharmony_ci					GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterIiv");
1224e5c31af7Sopenharmony_ci				}
1225e5c31af7Sopenharmony_ci				else
1226e5c31af7Sopenharmony_ci				{
1227e5c31af7Sopenharmony_ci					DE_ASSERT(isPureUintTester(m_tester));
1228e5c31af7Sopenharmony_ci
1229e5c31af7Sopenharmony_ci					const glw::GLuint value = values[ndx];
1230e5c31af7Sopenharmony_ci					gl.glTexParameterIuiv(m_target, m_pname, &value);
1231e5c31af7Sopenharmony_ci					GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterIuiv");
1232e5c31af7Sopenharmony_ci				}
1233e5c31af7Sopenharmony_ci
1234e5c31af7Sopenharmony_ci				verifyStateTextureParamInteger(result, gl, m_target, m_pname, values[ndx], m_type);
1235e5c31af7Sopenharmony_ci			}
1236e5c31af7Sopenharmony_ci		}
1237e5c31af7Sopenharmony_ci		else
1238e5c31af7Sopenharmony_ci		{
1239e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < (int)values.size(); ++ndx)
1240e5c31af7Sopenharmony_ci			{
1241e5c31af7Sopenharmony_ci				gl.glTexParameteri(m_target, m_pname, values[ndx]);
1242e5c31af7Sopenharmony_ci				GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameteri");
1243e5c31af7Sopenharmony_ci
1244e5c31af7Sopenharmony_ci				verifyStateTextureParamInteger(result, gl, m_target, m_pname, values[ndx], m_type);
1245e5c31af7Sopenharmony_ci			}
1246e5c31af7Sopenharmony_ci
1247e5c31af7Sopenharmony_ci			//check unit conversions with float
1248e5c31af7Sopenharmony_ci
1249e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < (int)values.size(); ++ndx)
1250e5c31af7Sopenharmony_ci			{
1251e5c31af7Sopenharmony_ci				gl.glTexParameterf(m_target, m_pname, (GLfloat)values[ndx]);
1252e5c31af7Sopenharmony_ci				GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterf");
1253e5c31af7Sopenharmony_ci
1254e5c31af7Sopenharmony_ci				verifyStateTextureParamInteger(result, gl, m_target, m_pname, values[ndx], m_type);
1255e5c31af7Sopenharmony_ci			}
1256e5c31af7Sopenharmony_ci		}
1257e5c31af7Sopenharmony_ci	}
1258e5c31af7Sopenharmony_ci}
1259e5c31af7Sopenharmony_ci
1260e5c31af7Sopenharmony_ciclass TextureLODCase : public TextureTest
1261e5c31af7Sopenharmony_ci{
1262e5c31af7Sopenharmony_cipublic:
1263e5c31af7Sopenharmony_ci			TextureLODCase	(tcu::TestContext& testCtx, const glu::RenderContext& renderContext, const char* name, const char* desc, glw::GLenum target, TesterType tester, QueryType type);
1264e5c31af7Sopenharmony_ci	void	test			(glu::CallLogWrapper& gl, tcu::ResultCollector& result) const;
1265e5c31af7Sopenharmony_ci};
1266e5c31af7Sopenharmony_ci
1267e5c31af7Sopenharmony_ciTextureLODCase::TextureLODCase (tcu::TestContext& testCtx, const glu::RenderContext& renderCtx, const char* name, const char* desc, glw::GLenum target, TesterType tester, QueryType type)
1268e5c31af7Sopenharmony_ci	: TextureTest(testCtx, renderCtx, name, desc, target, tester, type)
1269e5c31af7Sopenharmony_ci{
1270e5c31af7Sopenharmony_ci}
1271e5c31af7Sopenharmony_ci
1272e5c31af7Sopenharmony_civoid TextureLODCase::test (glu::CallLogWrapper& gl, tcu::ResultCollector& result) const
1273e5c31af7Sopenharmony_ci{
1274e5c31af7Sopenharmony_ci	const bool	isPureCase		= isPureIntTester(m_tester) || isPureUintTester(m_tester);
1275e5c31af7Sopenharmony_ci	const int	initialValue	= (m_pname == GL_TEXTURE_MIN_LOD) ? (-1000)
1276e5c31af7Sopenharmony_ci								: (m_pname == GL_TEXTURE_MAX_LOD) ? (1000)
1277e5c31af7Sopenharmony_ci								: (-1);
1278e5c31af7Sopenharmony_ci
1279e5c31af7Sopenharmony_ci	if ((querySupportsSigned(m_type) || initialValue >= 0) && !isPureCase)
1280e5c31af7Sopenharmony_ci	{
1281e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial");
1282e5c31af7Sopenharmony_ci		verifyStateTextureParamInteger(result, gl, m_target, m_pname, initialValue, m_type);
1283e5c31af7Sopenharmony_ci	}
1284e5c31af7Sopenharmony_ci
1285e5c31af7Sopenharmony_ci	{
1286e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection	section			(m_testCtx.getLog(), "Set", "Set");
1287e5c31af7Sopenharmony_ci		const int					numIterations	= 20;
1288e5c31af7Sopenharmony_ci		de::Random					rnd				(0xabcdef);
1289e5c31af7Sopenharmony_ci
1290e5c31af7Sopenharmony_ci		if (isPureCase)
1291e5c31af7Sopenharmony_ci		{
1292e5c31af7Sopenharmony_ci			if (isPureIntTester(m_tester))
1293e5c31af7Sopenharmony_ci			{
1294e5c31af7Sopenharmony_ci				for (int ndx = 0; ndx < numIterations; ++ndx)
1295e5c31af7Sopenharmony_ci				{
1296e5c31af7Sopenharmony_ci					const GLint ref = rnd.getInt(-1000, 1000);
1297e5c31af7Sopenharmony_ci
1298e5c31af7Sopenharmony_ci					gl.glTexParameterIiv(m_target, m_pname, &ref);
1299e5c31af7Sopenharmony_ci					GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterIiv");
1300e5c31af7Sopenharmony_ci
1301e5c31af7Sopenharmony_ci					verifyStateTextureParamFloat(result, gl, m_target, m_pname, (float)ref, m_type);
1302e5c31af7Sopenharmony_ci				}
1303e5c31af7Sopenharmony_ci			}
1304e5c31af7Sopenharmony_ci			else
1305e5c31af7Sopenharmony_ci			{
1306e5c31af7Sopenharmony_ci				DE_ASSERT(isPureUintTester(m_tester));
1307e5c31af7Sopenharmony_ci
1308e5c31af7Sopenharmony_ci				for (int ndx = 0; ndx < numIterations; ++ndx)
1309e5c31af7Sopenharmony_ci				{
1310e5c31af7Sopenharmony_ci					const GLuint ref = (glw::GLuint)rnd.getInt(0, 1000);
1311e5c31af7Sopenharmony_ci
1312e5c31af7Sopenharmony_ci					gl.glTexParameterIuiv(m_target, m_pname, &ref);
1313e5c31af7Sopenharmony_ci					GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterIuiv");
1314e5c31af7Sopenharmony_ci
1315e5c31af7Sopenharmony_ci					verifyStateTextureParamFloat(result, gl, m_target, m_pname, (float)ref, m_type);
1316e5c31af7Sopenharmony_ci				}
1317e5c31af7Sopenharmony_ci			}
1318e5c31af7Sopenharmony_ci		}
1319e5c31af7Sopenharmony_ci		else
1320e5c31af7Sopenharmony_ci		{
1321e5c31af7Sopenharmony_ci			const int minLimit = (querySupportsSigned(m_type)) ? (-1000) : (0);
1322e5c31af7Sopenharmony_ci
1323e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < numIterations; ++ndx)
1324e5c31af7Sopenharmony_ci			{
1325e5c31af7Sopenharmony_ci				const GLfloat ref = rnd.getFloat((float)minLimit, 1000.f);
1326e5c31af7Sopenharmony_ci
1327e5c31af7Sopenharmony_ci				gl.glTexParameterf(m_target, m_pname, ref);
1328e5c31af7Sopenharmony_ci				GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterf");
1329e5c31af7Sopenharmony_ci
1330e5c31af7Sopenharmony_ci				verifyStateTextureParamFloat(result, gl, m_target, m_pname, ref, m_type);
1331e5c31af7Sopenharmony_ci			}
1332e5c31af7Sopenharmony_ci
1333e5c31af7Sopenharmony_ci			// check unit conversions with int
1334e5c31af7Sopenharmony_ci
1335e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < numIterations; ++ndx)
1336e5c31af7Sopenharmony_ci			{
1337e5c31af7Sopenharmony_ci				const GLint ref = rnd.getInt(minLimit, 1000);
1338e5c31af7Sopenharmony_ci
1339e5c31af7Sopenharmony_ci				gl.glTexParameteri(m_target, m_pname, ref);
1340e5c31af7Sopenharmony_ci				GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameteri");
1341e5c31af7Sopenharmony_ci
1342e5c31af7Sopenharmony_ci				verifyStateTextureParamFloat(result, gl, m_target, m_pname, (float)ref, m_type);
1343e5c31af7Sopenharmony_ci			}
1344e5c31af7Sopenharmony_ci		}
1345e5c31af7Sopenharmony_ci	}
1346e5c31af7Sopenharmony_ci}
1347e5c31af7Sopenharmony_ci
1348e5c31af7Sopenharmony_ciclass TextureLevelCase : public TextureTest
1349e5c31af7Sopenharmony_ci{
1350e5c31af7Sopenharmony_cipublic:
1351e5c31af7Sopenharmony_ci			TextureLevelCase	(tcu::TestContext& testCtx, const glu::RenderContext& renderContext, const char* name, const char* desc, glw::GLenum target, TesterType tester, QueryType type);
1352e5c31af7Sopenharmony_ci	void	test				(glu::CallLogWrapper& gl, tcu::ResultCollector& result) const;
1353e5c31af7Sopenharmony_ci};
1354e5c31af7Sopenharmony_ci
1355e5c31af7Sopenharmony_ciTextureLevelCase::TextureLevelCase (tcu::TestContext& testCtx, const glu::RenderContext& renderCtx, const char* name, const char* desc, glw::GLenum target, TesterType tester, QueryType type)
1356e5c31af7Sopenharmony_ci	: TextureTest(testCtx, renderCtx, name, desc, target, tester, type)
1357e5c31af7Sopenharmony_ci{
1358e5c31af7Sopenharmony_ci}
1359e5c31af7Sopenharmony_ci
1360e5c31af7Sopenharmony_civoid TextureLevelCase::test (glu::CallLogWrapper& gl, tcu::ResultCollector& result) const
1361e5c31af7Sopenharmony_ci{
1362e5c31af7Sopenharmony_ci	const bool	isPureCase		= isPureIntTester(m_tester) || isPureUintTester(m_tester);
1363e5c31af7Sopenharmony_ci	const int	initialValue	= (m_pname == GL_TEXTURE_BASE_LEVEL) ? (0)
1364e5c31af7Sopenharmony_ci								: (m_pname == GL_TEXTURE_MAX_LEVEL)	? (1000)
1365e5c31af7Sopenharmony_ci								: (-1);
1366e5c31af7Sopenharmony_ci
1367e5c31af7Sopenharmony_ci	if (!isPureCase)
1368e5c31af7Sopenharmony_ci	{
1369e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial");
1370e5c31af7Sopenharmony_ci		verifyStateTextureParamInteger(result, gl, m_target, m_pname, initialValue, m_type);
1371e5c31af7Sopenharmony_ci	}
1372e5c31af7Sopenharmony_ci
1373e5c31af7Sopenharmony_ci	if (m_target == GL_TEXTURE_2D_MULTISAMPLE		||
1374e5c31af7Sopenharmony_ci		m_target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY)
1375e5c31af7Sopenharmony_ci	{
1376e5c31af7Sopenharmony_ci		// only 0 allowed
1377e5c31af7Sopenharmony_ci		{
1378e5c31af7Sopenharmony_ci			const tcu::ScopedLogSection section(m_testCtx.getLog(), "Set", "Set");
1379e5c31af7Sopenharmony_ci
1380e5c31af7Sopenharmony_ci			gl.glTexParameteri(m_target, m_pname, 0);
1381e5c31af7Sopenharmony_ci			GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameteri");
1382e5c31af7Sopenharmony_ci			verifyStateTextureParamInteger(result, gl, m_target, m_pname, 0, m_type);
1383e5c31af7Sopenharmony_ci
1384e5c31af7Sopenharmony_ci			gl.glTexParameterf(m_target, m_pname, 0.0f);
1385e5c31af7Sopenharmony_ci			GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterf");
1386e5c31af7Sopenharmony_ci			verifyStateTextureParamInteger(result, gl, m_target, m_pname, 0, m_type);
1387e5c31af7Sopenharmony_ci		}
1388e5c31af7Sopenharmony_ci	}
1389e5c31af7Sopenharmony_ci	else
1390e5c31af7Sopenharmony_ci	{
1391e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection	section			(m_testCtx.getLog(), "Set", "Set");
1392e5c31af7Sopenharmony_ci		const int					numIterations	= 20;
1393e5c31af7Sopenharmony_ci		de::Random					rnd				(0xabcdef);
1394e5c31af7Sopenharmony_ci
1395e5c31af7Sopenharmony_ci		if (isPureCase)
1396e5c31af7Sopenharmony_ci		{
1397e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < numIterations; ++ndx)
1398e5c31af7Sopenharmony_ci			{
1399e5c31af7Sopenharmony_ci				const GLint		ref		= rnd.getInt(0, 64000);
1400e5c31af7Sopenharmony_ci				const GLuint	uRef	= (glw::GLuint)ref;
1401e5c31af7Sopenharmony_ci
1402e5c31af7Sopenharmony_ci				if (isPureIntTester(m_tester))
1403e5c31af7Sopenharmony_ci				{
1404e5c31af7Sopenharmony_ci					gl.glTexParameterIiv(m_target, m_pname, &ref);
1405e5c31af7Sopenharmony_ci					GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterIiv");
1406e5c31af7Sopenharmony_ci				}
1407e5c31af7Sopenharmony_ci				else
1408e5c31af7Sopenharmony_ci				{
1409e5c31af7Sopenharmony_ci					DE_ASSERT(isPureUintTester(m_tester));
1410e5c31af7Sopenharmony_ci					gl.glTexParameterIuiv(m_target, m_pname, &uRef);
1411e5c31af7Sopenharmony_ci					GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterIuiv");
1412e5c31af7Sopenharmony_ci				}
1413e5c31af7Sopenharmony_ci
1414e5c31af7Sopenharmony_ci				verifyStateTextureParamInteger(result, gl, m_target, m_pname, ref, m_type);
1415e5c31af7Sopenharmony_ci			}
1416e5c31af7Sopenharmony_ci		}
1417e5c31af7Sopenharmony_ci		else
1418e5c31af7Sopenharmony_ci		{
1419e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < numIterations; ++ndx)
1420e5c31af7Sopenharmony_ci			{
1421e5c31af7Sopenharmony_ci				const GLint ref = rnd.getInt(0, 64000);
1422e5c31af7Sopenharmony_ci
1423e5c31af7Sopenharmony_ci				gl.glTexParameteri(m_target, m_pname, ref);
1424e5c31af7Sopenharmony_ci				GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameteri");
1425e5c31af7Sopenharmony_ci
1426e5c31af7Sopenharmony_ci				verifyStateTextureParamInteger(result, gl, m_target, m_pname, ref, m_type);
1427e5c31af7Sopenharmony_ci			}
1428e5c31af7Sopenharmony_ci
1429e5c31af7Sopenharmony_ci			// check unit conversions with float
1430e5c31af7Sopenharmony_ci
1431e5c31af7Sopenharmony_ci			const float nonSignificantOffsets[] = {-0.45f, -0.25f, 0, 0.45f}; // offsets O so that for any integers z in Z, o in O roundToClosestInt(z+o)==z
1432e5c31af7Sopenharmony_ci
1433e5c31af7Sopenharmony_ci			const int numConversionIterations = 30;
1434e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < numConversionIterations; ++ndx)
1435e5c31af7Sopenharmony_ci			{
1436e5c31af7Sopenharmony_ci				const GLint ref = rnd.getInt(1, 64000);
1437e5c31af7Sopenharmony_ci
1438e5c31af7Sopenharmony_ci				for (int offsetNdx = 0; offsetNdx < DE_LENGTH_OF_ARRAY(nonSignificantOffsets); ++offsetNdx)
1439e5c31af7Sopenharmony_ci				{
1440e5c31af7Sopenharmony_ci					gl.glTexParameterf(m_target, m_pname, ((GLfloat)ref) + nonSignificantOffsets[offsetNdx]);
1441e5c31af7Sopenharmony_ci					GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterf");
1442e5c31af7Sopenharmony_ci
1443e5c31af7Sopenharmony_ci					verifyStateTextureParamInteger(result, gl, m_target, m_pname, ref, m_type);
1444e5c31af7Sopenharmony_ci				}
1445e5c31af7Sopenharmony_ci			}
1446e5c31af7Sopenharmony_ci		}
1447e5c31af7Sopenharmony_ci	}
1448e5c31af7Sopenharmony_ci}
1449e5c31af7Sopenharmony_ci
1450e5c31af7Sopenharmony_ciclass TextureCompareModeCase : public TextureTest
1451e5c31af7Sopenharmony_ci{
1452e5c31af7Sopenharmony_cipublic:
1453e5c31af7Sopenharmony_ci			TextureCompareModeCase	(tcu::TestContext& testCtx, const glu::RenderContext& renderContext, const char* name, const char* desc, glw::GLenum target, TesterType tester, QueryType type);
1454e5c31af7Sopenharmony_ci	void	test					(glu::CallLogWrapper& gl, tcu::ResultCollector& result) const;
1455e5c31af7Sopenharmony_ci};
1456e5c31af7Sopenharmony_ci
1457e5c31af7Sopenharmony_ciTextureCompareModeCase::TextureCompareModeCase (tcu::TestContext& testCtx, const glu::RenderContext& renderCtx, const char* name, const char* desc, glw::GLenum target, TesterType tester, QueryType type)
1458e5c31af7Sopenharmony_ci	: TextureTest(testCtx, renderCtx, name, desc, target, tester, type)
1459e5c31af7Sopenharmony_ci{
1460e5c31af7Sopenharmony_ci}
1461e5c31af7Sopenharmony_ci
1462e5c31af7Sopenharmony_civoid TextureCompareModeCase::test (glu::CallLogWrapper& gl, tcu::ResultCollector& result) const
1463e5c31af7Sopenharmony_ci{
1464e5c31af7Sopenharmony_ci	const bool isPureCase = isPureIntTester(m_tester) || isPureUintTester(m_tester);
1465e5c31af7Sopenharmony_ci
1466e5c31af7Sopenharmony_ci	if (!isPureCase)
1467e5c31af7Sopenharmony_ci	{
1468e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial");
1469e5c31af7Sopenharmony_ci		verifyStateTextureParamInteger(result, gl, m_target, m_pname, GL_NONE, m_type);
1470e5c31af7Sopenharmony_ci	}
1471e5c31af7Sopenharmony_ci
1472e5c31af7Sopenharmony_ci	{
1473e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection	section		(m_testCtx.getLog(), "Set", "Set");
1474e5c31af7Sopenharmony_ci		const GLenum				modes[]		= {GL_COMPARE_REF_TO_TEXTURE, GL_NONE};
1475e5c31af7Sopenharmony_ci
1476e5c31af7Sopenharmony_ci		if (isPureCase)
1477e5c31af7Sopenharmony_ci		{
1478e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(modes); ++ndx)
1479e5c31af7Sopenharmony_ci			{
1480e5c31af7Sopenharmony_ci				if (isPureIntTester(m_tester))
1481e5c31af7Sopenharmony_ci				{
1482e5c31af7Sopenharmony_ci					const glw::GLint value = (glw::GLint)modes[ndx];
1483e5c31af7Sopenharmony_ci					gl.glTexParameterIiv(m_target, m_pname, &value);
1484e5c31af7Sopenharmony_ci					GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterIiv");
1485e5c31af7Sopenharmony_ci				}
1486e5c31af7Sopenharmony_ci				else
1487e5c31af7Sopenharmony_ci				{
1488e5c31af7Sopenharmony_ci					DE_ASSERT(isPureUintTester(m_tester));
1489e5c31af7Sopenharmony_ci
1490e5c31af7Sopenharmony_ci					const glw::GLuint value = modes[ndx];
1491e5c31af7Sopenharmony_ci					gl.glTexParameterIuiv(m_target, m_pname, &value);
1492e5c31af7Sopenharmony_ci					GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterIuiv");
1493e5c31af7Sopenharmony_ci				}
1494e5c31af7Sopenharmony_ci
1495e5c31af7Sopenharmony_ci				verifyStateTextureParamInteger(result, gl, m_target, m_pname, modes[ndx], m_type);
1496e5c31af7Sopenharmony_ci			}
1497e5c31af7Sopenharmony_ci		}
1498e5c31af7Sopenharmony_ci		else
1499e5c31af7Sopenharmony_ci		{
1500e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(modes); ++ndx)
1501e5c31af7Sopenharmony_ci			{
1502e5c31af7Sopenharmony_ci				gl.glTexParameteri(m_target, m_pname, modes[ndx]);
1503e5c31af7Sopenharmony_ci				GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameteri");
1504e5c31af7Sopenharmony_ci
1505e5c31af7Sopenharmony_ci				verifyStateTextureParamInteger(result, gl, m_target, m_pname, modes[ndx], m_type);
1506e5c31af7Sopenharmony_ci			}
1507e5c31af7Sopenharmony_ci
1508e5c31af7Sopenharmony_ci			//check unit conversions with float
1509e5c31af7Sopenharmony_ci
1510e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(modes); ++ndx)
1511e5c31af7Sopenharmony_ci			{
1512e5c31af7Sopenharmony_ci				gl.glTexParameterf(m_target, m_pname, (GLfloat)modes[ndx]);
1513e5c31af7Sopenharmony_ci				GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterf");
1514e5c31af7Sopenharmony_ci
1515e5c31af7Sopenharmony_ci				verifyStateTextureParamInteger(result, gl, m_target, m_pname, modes[ndx], m_type);
1516e5c31af7Sopenharmony_ci			}
1517e5c31af7Sopenharmony_ci		}
1518e5c31af7Sopenharmony_ci	}
1519e5c31af7Sopenharmony_ci}
1520e5c31af7Sopenharmony_ci
1521e5c31af7Sopenharmony_ciclass TextureCompareFuncCase : public TextureTest
1522e5c31af7Sopenharmony_ci{
1523e5c31af7Sopenharmony_cipublic:
1524e5c31af7Sopenharmony_ci			TextureCompareFuncCase	(tcu::TestContext& testCtx, const glu::RenderContext& renderContext, const char* name, const char* desc, glw::GLenum target, TesterType tester, QueryType type);
1525e5c31af7Sopenharmony_ci	void	test					(glu::CallLogWrapper& gl, tcu::ResultCollector& result) const;
1526e5c31af7Sopenharmony_ci};
1527e5c31af7Sopenharmony_ci
1528e5c31af7Sopenharmony_ciTextureCompareFuncCase::TextureCompareFuncCase (tcu::TestContext& testCtx, const glu::RenderContext& renderCtx, const char* name, const char* desc, glw::GLenum target, TesterType tester, QueryType type)
1529e5c31af7Sopenharmony_ci	: TextureTest(testCtx, renderCtx, name, desc, target, tester, type)
1530e5c31af7Sopenharmony_ci{
1531e5c31af7Sopenharmony_ci}
1532e5c31af7Sopenharmony_ci
1533e5c31af7Sopenharmony_civoid TextureCompareFuncCase::test (glu::CallLogWrapper& gl, tcu::ResultCollector& result) const
1534e5c31af7Sopenharmony_ci{
1535e5c31af7Sopenharmony_ci	const bool isPureCase = isPureIntTester(m_tester) || isPureUintTester(m_tester);
1536e5c31af7Sopenharmony_ci
1537e5c31af7Sopenharmony_ci	if (!isPureCase)
1538e5c31af7Sopenharmony_ci	{
1539e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial");
1540e5c31af7Sopenharmony_ci		verifyStateTextureParamInteger(result, gl, m_target, m_pname, GL_LEQUAL, m_type);
1541e5c31af7Sopenharmony_ci	}
1542e5c31af7Sopenharmony_ci
1543e5c31af7Sopenharmony_ci	{
1544e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection	section			(m_testCtx.getLog(), "Set", "Set");
1545e5c31af7Sopenharmony_ci		const GLenum				compareFuncs[]	= {GL_LEQUAL, GL_GEQUAL, GL_LESS, GL_GREATER, GL_EQUAL, GL_NOTEQUAL, GL_ALWAYS, GL_NEVER};
1546e5c31af7Sopenharmony_ci
1547e5c31af7Sopenharmony_ci		if (isPureCase)
1548e5c31af7Sopenharmony_ci		{
1549e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(compareFuncs); ++ndx)
1550e5c31af7Sopenharmony_ci			{
1551e5c31af7Sopenharmony_ci				if (isPureIntTester(m_tester))
1552e5c31af7Sopenharmony_ci				{
1553e5c31af7Sopenharmony_ci					const glw::GLint value = (glw::GLint)compareFuncs[ndx];
1554e5c31af7Sopenharmony_ci					gl.glTexParameterIiv(m_target, m_pname, &value);
1555e5c31af7Sopenharmony_ci					GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterIiv");
1556e5c31af7Sopenharmony_ci				}
1557e5c31af7Sopenharmony_ci				else
1558e5c31af7Sopenharmony_ci				{
1559e5c31af7Sopenharmony_ci					DE_ASSERT(isPureUintTester(m_tester));
1560e5c31af7Sopenharmony_ci
1561e5c31af7Sopenharmony_ci					const glw::GLuint value = compareFuncs[ndx];
1562e5c31af7Sopenharmony_ci					gl.glTexParameterIuiv(m_target, m_pname, &value);
1563e5c31af7Sopenharmony_ci					GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterIuiv");
1564e5c31af7Sopenharmony_ci				}
1565e5c31af7Sopenharmony_ci
1566e5c31af7Sopenharmony_ci				verifyStateTextureParamInteger(result, gl, m_target, m_pname, compareFuncs[ndx], m_type);
1567e5c31af7Sopenharmony_ci			}
1568e5c31af7Sopenharmony_ci		}
1569e5c31af7Sopenharmony_ci		else
1570e5c31af7Sopenharmony_ci		{
1571e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(compareFuncs); ++ndx)
1572e5c31af7Sopenharmony_ci			{
1573e5c31af7Sopenharmony_ci				gl.glTexParameteri(m_target, m_pname, compareFuncs[ndx]);
1574e5c31af7Sopenharmony_ci				GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameteri");
1575e5c31af7Sopenharmony_ci
1576e5c31af7Sopenharmony_ci				verifyStateTextureParamInteger(result, gl, m_target, m_pname, compareFuncs[ndx], m_type);
1577e5c31af7Sopenharmony_ci			}
1578e5c31af7Sopenharmony_ci
1579e5c31af7Sopenharmony_ci			//check unit conversions with float
1580e5c31af7Sopenharmony_ci
1581e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(compareFuncs); ++ndx)
1582e5c31af7Sopenharmony_ci			{
1583e5c31af7Sopenharmony_ci				gl.glTexParameterf(m_target, m_pname, (GLfloat)compareFuncs[ndx]);
1584e5c31af7Sopenharmony_ci				GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterf");
1585e5c31af7Sopenharmony_ci
1586e5c31af7Sopenharmony_ci				verifyStateTextureParamInteger(result, gl, m_target, m_pname, compareFuncs[ndx], m_type);
1587e5c31af7Sopenharmony_ci			}
1588e5c31af7Sopenharmony_ci		}
1589e5c31af7Sopenharmony_ci	}
1590e5c31af7Sopenharmony_ci}
1591e5c31af7Sopenharmony_ci
1592e5c31af7Sopenharmony_ciclass TextureImmutableLevelsCase : public TextureTest
1593e5c31af7Sopenharmony_ci{
1594e5c31af7Sopenharmony_cipublic:
1595e5c31af7Sopenharmony_ci			TextureImmutableLevelsCase	(tcu::TestContext& testCtx, const glu::RenderContext& renderContext, const char* name, const char* desc, glw::GLenum target, QueryType type);
1596e5c31af7Sopenharmony_ci	void	test						(glu::CallLogWrapper& gl, tcu::ResultCollector& result) const;
1597e5c31af7Sopenharmony_ci};
1598e5c31af7Sopenharmony_ci
1599e5c31af7Sopenharmony_ciTextureImmutableLevelsCase::TextureImmutableLevelsCase (tcu::TestContext& testCtx, const glu::RenderContext& renderCtx, const char* name, const char* desc, glw::GLenum target, QueryType type)
1600e5c31af7Sopenharmony_ci	: TextureTest(testCtx, renderCtx, name, desc, target, TESTER_TEXTURE_IMMUTABLE_LEVELS, type)
1601e5c31af7Sopenharmony_ci{
1602e5c31af7Sopenharmony_ci}
1603e5c31af7Sopenharmony_ci
1604e5c31af7Sopenharmony_civoid TextureImmutableLevelsCase::test (glu::CallLogWrapper& gl, tcu::ResultCollector& result) const
1605e5c31af7Sopenharmony_ci{
1606e5c31af7Sopenharmony_ci	{
1607e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial");
1608e5c31af7Sopenharmony_ci		verifyStateTextureParamInteger(result, gl, m_target, m_pname, 0, m_type);
1609e5c31af7Sopenharmony_ci	}
1610e5c31af7Sopenharmony_ci
1611e5c31af7Sopenharmony_ci	if (m_target == GL_TEXTURE_2D_MULTISAMPLE		||
1612e5c31af7Sopenharmony_ci		m_target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY)
1613e5c31af7Sopenharmony_ci	{
1614e5c31af7Sopenharmony_ci		// no levels
1615e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection	section		(m_testCtx.getLog(), "Level", "Level");
1616e5c31af7Sopenharmony_ci		GLuint						textureID	= 0;
1617e5c31af7Sopenharmony_ci
1618e5c31af7Sopenharmony_ci		gl.glGenTextures(1, &textureID);
1619e5c31af7Sopenharmony_ci		gl.glBindTexture(m_target, textureID);
1620e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glBindTexture");
1621e5c31af7Sopenharmony_ci
1622e5c31af7Sopenharmony_ci		if (m_target == GL_TEXTURE_2D_MULTISAMPLE)
1623e5c31af7Sopenharmony_ci			gl.glTexStorage2DMultisample(m_target, 2, GL_RGB8, 64, 64, GL_FALSE);
1624e5c31af7Sopenharmony_ci		else if (m_target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY)
1625e5c31af7Sopenharmony_ci			gl.glTexStorage3DMultisample(m_target, 2, GL_RGB8, 64, 64, 2, GL_FALSE);
1626e5c31af7Sopenharmony_ci		else
1627e5c31af7Sopenharmony_ci			DE_ASSERT(false);
1628e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexStorage");
1629e5c31af7Sopenharmony_ci
1630e5c31af7Sopenharmony_ci		verifyStateTextureParamInteger(result, gl, m_target, m_pname, 1, m_type);
1631e5c31af7Sopenharmony_ci
1632e5c31af7Sopenharmony_ci		gl.glDeleteTextures(1, &textureID);
1633e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glDeleteTextures");
1634e5c31af7Sopenharmony_ci	}
1635e5c31af7Sopenharmony_ci	else
1636e5c31af7Sopenharmony_ci	{
1637e5c31af7Sopenharmony_ci		for (int level = 1; level <= 7; ++level)
1638e5c31af7Sopenharmony_ci		{
1639e5c31af7Sopenharmony_ci			const tcu::ScopedLogSection	section		(m_testCtx.getLog(), "Levels", "Levels = " + de::toString(level));
1640e5c31af7Sopenharmony_ci			GLuint						textureID	= 0;
1641e5c31af7Sopenharmony_ci
1642e5c31af7Sopenharmony_ci			gl.glGenTextures(1, &textureID);
1643e5c31af7Sopenharmony_ci			gl.glBindTexture(m_target, textureID);
1644e5c31af7Sopenharmony_ci			GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glBindTexture");
1645e5c31af7Sopenharmony_ci
1646e5c31af7Sopenharmony_ci			if (m_target == GL_TEXTURE_2D || m_target == GL_TEXTURE_CUBE_MAP)
1647e5c31af7Sopenharmony_ci				gl.glTexStorage2D(m_target, level, GL_RGB8, 64, 64);
1648e5c31af7Sopenharmony_ci			else if (m_target == GL_TEXTURE_2D_ARRAY || m_target == GL_TEXTURE_3D)
1649e5c31af7Sopenharmony_ci				gl.glTexStorage3D(m_target, level, GL_RGB8, 64, 64, 64);
1650e5c31af7Sopenharmony_ci			else if (m_target == GL_TEXTURE_CUBE_MAP_ARRAY)
1651e5c31af7Sopenharmony_ci				gl.glTexStorage3D(m_target, level, GL_RGB8, 64, 64, 6 * 2);
1652e5c31af7Sopenharmony_ci			else
1653e5c31af7Sopenharmony_ci				DE_ASSERT(false);
1654e5c31af7Sopenharmony_ci			GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexStorage");
1655e5c31af7Sopenharmony_ci
1656e5c31af7Sopenharmony_ci			verifyStateTextureParamInteger(result, gl, m_target, m_pname, level, m_type);
1657e5c31af7Sopenharmony_ci
1658e5c31af7Sopenharmony_ci			gl.glDeleteTextures(1, &textureID);
1659e5c31af7Sopenharmony_ci			GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glDeleteTextures");
1660e5c31af7Sopenharmony_ci		}
1661e5c31af7Sopenharmony_ci	}
1662e5c31af7Sopenharmony_ci}
1663e5c31af7Sopenharmony_ci
1664e5c31af7Sopenharmony_ciclass TextureImmutableFormatCase : public TextureTest
1665e5c31af7Sopenharmony_ci{
1666e5c31af7Sopenharmony_cipublic:
1667e5c31af7Sopenharmony_ci			TextureImmutableFormatCase	(tcu::TestContext& testCtx, const glu::RenderContext& renderContext, const char* name, const char* desc, glw::GLenum target, QueryType type);
1668e5c31af7Sopenharmony_ci	void	test						(glu::CallLogWrapper& gl, tcu::ResultCollector& result) const;
1669e5c31af7Sopenharmony_ci};
1670e5c31af7Sopenharmony_ci
1671e5c31af7Sopenharmony_ciTextureImmutableFormatCase::TextureImmutableFormatCase (tcu::TestContext& testCtx, const glu::RenderContext& renderCtx, const char* name, const char* desc, glw::GLenum target, QueryType type)
1672e5c31af7Sopenharmony_ci	: TextureTest(testCtx, renderCtx, name, desc, target, TESTER_TEXTURE_IMMUTABLE_FORMAT, type)
1673e5c31af7Sopenharmony_ci{
1674e5c31af7Sopenharmony_ci}
1675e5c31af7Sopenharmony_ci
1676e5c31af7Sopenharmony_civoid TextureImmutableFormatCase::test (glu::CallLogWrapper& gl, tcu::ResultCollector& result) const
1677e5c31af7Sopenharmony_ci{
1678e5c31af7Sopenharmony_ci	{
1679e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial");
1680e5c31af7Sopenharmony_ci		verifyStateTextureParamInteger(result, gl, m_target, m_pname, 0, m_type);
1681e5c31af7Sopenharmony_ci	}
1682e5c31af7Sopenharmony_ci
1683e5c31af7Sopenharmony_ci	{
1684e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection	subsection	(m_testCtx.getLog(), "Immutable", "Immutable");
1685e5c31af7Sopenharmony_ci		GLuint						textureID	= 0;
1686e5c31af7Sopenharmony_ci
1687e5c31af7Sopenharmony_ci		gl.glGenTextures(1, &textureID);
1688e5c31af7Sopenharmony_ci		gl.glBindTexture(m_target, textureID);
1689e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glBindTexture");
1690e5c31af7Sopenharmony_ci
1691e5c31af7Sopenharmony_ci		switch (m_target)
1692e5c31af7Sopenharmony_ci		{
1693e5c31af7Sopenharmony_ci			case GL_TEXTURE_2D:
1694e5c31af7Sopenharmony_ci			case GL_TEXTURE_CUBE_MAP:
1695e5c31af7Sopenharmony_ci			{
1696e5c31af7Sopenharmony_ci				gl.glTexStorage2D(m_target, 1, GL_RGBA8, 32, 32);
1697e5c31af7Sopenharmony_ci				break;
1698e5c31af7Sopenharmony_ci			}
1699e5c31af7Sopenharmony_ci			case GL_TEXTURE_2D_ARRAY:
1700e5c31af7Sopenharmony_ci			case GL_TEXTURE_3D:
1701e5c31af7Sopenharmony_ci			{
1702e5c31af7Sopenharmony_ci				gl.glTexStorage3D(m_target, 1, GL_RGBA8, 32, 32, 8);
1703e5c31af7Sopenharmony_ci				break;
1704e5c31af7Sopenharmony_ci			}
1705e5c31af7Sopenharmony_ci			case GL_TEXTURE_2D_MULTISAMPLE:
1706e5c31af7Sopenharmony_ci			{
1707e5c31af7Sopenharmony_ci				gl.glTexStorage2DMultisample(m_target, 2, GL_RGB8, 64, 64, GL_FALSE);
1708e5c31af7Sopenharmony_ci				break;
1709e5c31af7Sopenharmony_ci			}
1710e5c31af7Sopenharmony_ci			case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
1711e5c31af7Sopenharmony_ci			{
1712e5c31af7Sopenharmony_ci				gl.glTexStorage3DMultisample(m_target, 2, GL_RGB8, 64, 64, 2, GL_FALSE);
1713e5c31af7Sopenharmony_ci				break;
1714e5c31af7Sopenharmony_ci			}
1715e5c31af7Sopenharmony_ci			case GL_TEXTURE_CUBE_MAP_ARRAY:
1716e5c31af7Sopenharmony_ci			{
1717e5c31af7Sopenharmony_ci				gl.glTexStorage3D(m_target, 1, GL_RGBA8, 32, 32, 6 * 2);
1718e5c31af7Sopenharmony_ci				break;
1719e5c31af7Sopenharmony_ci			}
1720e5c31af7Sopenharmony_ci			default:
1721e5c31af7Sopenharmony_ci				DE_ASSERT(false);
1722e5c31af7Sopenharmony_ci		}
1723e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "setup texture");
1724e5c31af7Sopenharmony_ci
1725e5c31af7Sopenharmony_ci		verifyStateTextureParamInteger(result, gl, m_target, m_pname, 1, m_type);
1726e5c31af7Sopenharmony_ci
1727e5c31af7Sopenharmony_ci		gl.glDeleteTextures(1, &textureID);
1728e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glDeleteTextures");
1729e5c31af7Sopenharmony_ci	}
1730e5c31af7Sopenharmony_ci
1731e5c31af7Sopenharmony_ci	// no mutable
1732e5c31af7Sopenharmony_ci	if (m_target == GL_TEXTURE_2D_MULTISAMPLE ||
1733e5c31af7Sopenharmony_ci		m_target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY)
1734e5c31af7Sopenharmony_ci		return;
1735e5c31af7Sopenharmony_ci
1736e5c31af7Sopenharmony_ci	// test mutable
1737e5c31af7Sopenharmony_ci	{
1738e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection	subsection		(m_testCtx.getLog(), "Mutable", "Mutable");
1739e5c31af7Sopenharmony_ci		GLuint						textureID		= 0;
1740e5c31af7Sopenharmony_ci
1741e5c31af7Sopenharmony_ci		gl.glGenTextures(1, &textureID);
1742e5c31af7Sopenharmony_ci		gl.glBindTexture(m_target, textureID);
1743e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glBindTexture");
1744e5c31af7Sopenharmony_ci
1745e5c31af7Sopenharmony_ci		switch (m_target)
1746e5c31af7Sopenharmony_ci		{
1747e5c31af7Sopenharmony_ci			case GL_TEXTURE_2D:
1748e5c31af7Sopenharmony_ci			{
1749e5c31af7Sopenharmony_ci				gl.glTexImage2D(m_target, 0, GL_RGBA8, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL);
1750e5c31af7Sopenharmony_ci				break;
1751e5c31af7Sopenharmony_ci			}
1752e5c31af7Sopenharmony_ci			case GL_TEXTURE_CUBE_MAP:
1753e5c31af7Sopenharmony_ci			{
1754e5c31af7Sopenharmony_ci				gl.glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGBA8, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL);
1755e5c31af7Sopenharmony_ci				break;
1756e5c31af7Sopenharmony_ci			}
1757e5c31af7Sopenharmony_ci			case GL_TEXTURE_2D_ARRAY:
1758e5c31af7Sopenharmony_ci			case GL_TEXTURE_3D:
1759e5c31af7Sopenharmony_ci			{
1760e5c31af7Sopenharmony_ci				gl.glTexImage3D(m_target, 0, GL_RGBA8, 32, 32, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL);
1761e5c31af7Sopenharmony_ci				break;
1762e5c31af7Sopenharmony_ci			}
1763e5c31af7Sopenharmony_ci			case GL_TEXTURE_CUBE_MAP_ARRAY:
1764e5c31af7Sopenharmony_ci			{
1765e5c31af7Sopenharmony_ci				gl.glTexImage3D(m_target, 0, GL_RGBA8, 32, 32, 6 * 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL);
1766e5c31af7Sopenharmony_ci				break;
1767e5c31af7Sopenharmony_ci			}
1768e5c31af7Sopenharmony_ci			default:
1769e5c31af7Sopenharmony_ci				DE_ASSERT(false);
1770e5c31af7Sopenharmony_ci		}
1771e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "setup texture");
1772e5c31af7Sopenharmony_ci
1773e5c31af7Sopenharmony_ci		verifyStateTextureParamInteger(result, gl, m_target, m_pname, 0, m_type);
1774e5c31af7Sopenharmony_ci
1775e5c31af7Sopenharmony_ci		gl.glDeleteTextures(1, &textureID);
1776e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glDeleteTextures");
1777e5c31af7Sopenharmony_ci	}
1778e5c31af7Sopenharmony_ci}
1779e5c31af7Sopenharmony_ci
1780e5c31af7Sopenharmony_ciclass TextureWrapClampToBorderCase : public TextureTest
1781e5c31af7Sopenharmony_ci{
1782e5c31af7Sopenharmony_cipublic:
1783e5c31af7Sopenharmony_ci			TextureWrapClampToBorderCase	(tcu::TestContext& testCtx, const glu::RenderContext& renderContext, const char* name, const char* desc, glw::GLenum target, TesterType tester, QueryType type);
1784e5c31af7Sopenharmony_ci	void	test							(glu::CallLogWrapper& gl, tcu::ResultCollector& result) const;
1785e5c31af7Sopenharmony_ci};
1786e5c31af7Sopenharmony_ci
1787e5c31af7Sopenharmony_ciTextureWrapClampToBorderCase::TextureWrapClampToBorderCase (tcu::TestContext& testCtx, const glu::RenderContext& renderCtx, const char* name, const char* desc, glw::GLenum target, TesterType tester, QueryType type)
1788e5c31af7Sopenharmony_ci	: TextureTest(testCtx, renderCtx, name, desc, target, tester, type)
1789e5c31af7Sopenharmony_ci{
1790e5c31af7Sopenharmony_ci}
1791e5c31af7Sopenharmony_ci
1792e5c31af7Sopenharmony_civoid TextureWrapClampToBorderCase::test (glu::CallLogWrapper& gl, tcu::ResultCollector& result) const
1793e5c31af7Sopenharmony_ci{
1794e5c31af7Sopenharmony_ci	gl.glTexParameteri(m_target, m_pname, GL_CLAMP_TO_BORDER_EXT);
1795e5c31af7Sopenharmony_ci	GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameteri");
1796e5c31af7Sopenharmony_ci	verifyStateTextureParamInteger(result, gl, m_target, m_pname, GL_CLAMP_TO_BORDER_EXT, m_type);
1797e5c31af7Sopenharmony_ci
1798e5c31af7Sopenharmony_ci	gl.glTexParameteri(m_target, m_pname, GL_REPEAT);
1799e5c31af7Sopenharmony_ci	GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameteri");
1800e5c31af7Sopenharmony_ci
1801e5c31af7Sopenharmony_ci	gl.glTexParameterf(m_target, m_pname, (GLfloat)GL_CLAMP_TO_BORDER_EXT);
1802e5c31af7Sopenharmony_ci	GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterf");
1803e5c31af7Sopenharmony_ci
1804e5c31af7Sopenharmony_ci	verifyStateTextureParamInteger(result, gl, m_target, m_pname, GL_CLAMP_TO_BORDER_EXT, m_type);
1805e5c31af7Sopenharmony_ci}
1806e5c31af7Sopenharmony_ci
1807e5c31af7Sopenharmony_ciclass TextureBorderColorCase : public TextureTest
1808e5c31af7Sopenharmony_ci{
1809e5c31af7Sopenharmony_cipublic:
1810e5c31af7Sopenharmony_ci			TextureBorderColorCase	(tcu::TestContext& testCtx, const glu::RenderContext& renderContext, const char* name, const char* desc, glw::GLenum target, QueryType type);
1811e5c31af7Sopenharmony_ci	void	test					(glu::CallLogWrapper& gl, tcu::ResultCollector& result) const;
1812e5c31af7Sopenharmony_ci};
1813e5c31af7Sopenharmony_ci
1814e5c31af7Sopenharmony_ciTextureBorderColorCase::TextureBorderColorCase (tcu::TestContext& testCtx, const glu::RenderContext& renderCtx, const char* name, const char* desc, glw::GLenum target, QueryType type)
1815e5c31af7Sopenharmony_ci	: TextureTest(testCtx, renderCtx, name, desc, target, TESTER_TEXTURE_BORDER_COLOR, type)
1816e5c31af7Sopenharmony_ci{
1817e5c31af7Sopenharmony_ci}
1818e5c31af7Sopenharmony_ci
1819e5c31af7Sopenharmony_civoid TextureBorderColorCase::test (glu::CallLogWrapper& gl, tcu::ResultCollector& result) const
1820e5c31af7Sopenharmony_ci{
1821e5c31af7Sopenharmony_ci	// border color is undefined if queried with pure type and was not set to pure value
1822e5c31af7Sopenharmony_ci	if (m_type == QUERY_TEXTURE_PARAM_INTEGER_VEC4 || m_type == QUERY_TEXTURE_PARAM_FLOAT_VEC4)
1823e5c31af7Sopenharmony_ci	{
1824e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial");
1825e5c31af7Sopenharmony_ci		verifyStateTextureParamFloatVec4(result, gl, m_target, m_pname, tcu::Vec4(0.0f, 0.0f, 0.0f, 0.0f), m_type);
1826e5c31af7Sopenharmony_ci	}
1827e5c31af7Sopenharmony_ci
1828e5c31af7Sopenharmony_ci	if (m_type == QUERY_TEXTURE_PARAM_PURE_INTEGER_VEC4)
1829e5c31af7Sopenharmony_ci	{
1830e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection	section			(m_testCtx.getLog(), "Set", "Set");
1831e5c31af7Sopenharmony_ci		const tcu::IVec4			color			(0x7FFFFFFF, -2, 3, -128);
1832e5c31af7Sopenharmony_ci
1833e5c31af7Sopenharmony_ci		gl.glTexParameterIiv(m_target, m_pname, color.getPtr());
1834e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterIiv");
1835e5c31af7Sopenharmony_ci
1836e5c31af7Sopenharmony_ci		verifyStateTextureParamIntegerVec4(result, gl, m_target, m_pname, color, m_type);
1837e5c31af7Sopenharmony_ci	}
1838e5c31af7Sopenharmony_ci	else if (m_type == QUERY_TEXTURE_PARAM_PURE_UNSIGNED_INTEGER_VEC4)
1839e5c31af7Sopenharmony_ci	{
1840e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection	section			(m_testCtx.getLog(), "Set", "Set");
1841e5c31af7Sopenharmony_ci		const tcu::UVec4			color			(0x8000000ul, 2, 3, 128);
1842e5c31af7Sopenharmony_ci
1843e5c31af7Sopenharmony_ci		gl.glTexParameterIuiv(m_target, m_pname, color.getPtr());
1844e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterIuiv");
1845e5c31af7Sopenharmony_ci
1846e5c31af7Sopenharmony_ci		verifyStateTextureParamUnsignedIntegerVec4(result, gl, m_target, m_pname, color, m_type);
1847e5c31af7Sopenharmony_ci	}
1848e5c31af7Sopenharmony_ci	else
1849e5c31af7Sopenharmony_ci	{
1850e5c31af7Sopenharmony_ci		DE_ASSERT(m_type == QUERY_TEXTURE_PARAM_INTEGER_VEC4 || m_type == QUERY_TEXTURE_PARAM_FLOAT_VEC4);
1851e5c31af7Sopenharmony_ci
1852e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection	section			(m_testCtx.getLog(), "Set", "Set");
1853e5c31af7Sopenharmony_ci		const tcu::Vec4				color			(0.25f, 1.0f, 0.0f, 0.77f);
1854e5c31af7Sopenharmony_ci		const tcu::IVec4			icolor			(0x8000000ul, 0x7FFFFFFF, 0, 0x0FFFFFFF);
1855e5c31af7Sopenharmony_ci
1856e5c31af7Sopenharmony_ci		gl.glTexParameterfv(m_target, m_pname, color.getPtr());
1857e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameterfv");
1858e5c31af7Sopenharmony_ci
1859e5c31af7Sopenharmony_ci		verifyStateTextureParamFloatVec4(result, gl, m_target, m_pname, color, m_type);
1860e5c31af7Sopenharmony_ci
1861e5c31af7Sopenharmony_ci		gl.glTexParameteriv(m_target, m_pname, icolor.getPtr());
1862e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glTexParameteriv");
1863e5c31af7Sopenharmony_ci
1864e5c31af7Sopenharmony_ci		verifyStateTextureParamNormalizedI32Vec4(result, gl, m_target, m_pname, icolor, m_type);
1865e5c31af7Sopenharmony_ci	}
1866e5c31af7Sopenharmony_ci}
1867e5c31af7Sopenharmony_ci
1868e5c31af7Sopenharmony_ciclass SamplerTest : public tcu::TestCase
1869e5c31af7Sopenharmony_ci{
1870e5c31af7Sopenharmony_cipublic:
1871e5c31af7Sopenharmony_ci						SamplerTest	(tcu::TestContext&			testCtx,
1872e5c31af7Sopenharmony_ci									 const glu::RenderContext&	renderCtx,
1873e5c31af7Sopenharmony_ci									 const char*				name,
1874e5c31af7Sopenharmony_ci									 const char*				desc,
1875e5c31af7Sopenharmony_ci									 TesterType					tester,
1876e5c31af7Sopenharmony_ci									 QueryType					type);
1877e5c31af7Sopenharmony_ci
1878e5c31af7Sopenharmony_ci	void				init		(void);
1879e5c31af7Sopenharmony_ci	IterateResult		iterate		(void);
1880e5c31af7Sopenharmony_ci
1881e5c31af7Sopenharmony_ci	virtual void		test		(glu::CallLogWrapper& gl, tcu::ResultCollector& result) const = 0;
1882e5c31af7Sopenharmony_ci
1883e5c31af7Sopenharmony_ciprotected:
1884e5c31af7Sopenharmony_ci	const glu::RenderContext&	m_renderCtx;
1885e5c31af7Sopenharmony_ci	const glw::GLenum			m_pname;
1886e5c31af7Sopenharmony_ci	const TesterType			m_tester;
1887e5c31af7Sopenharmony_ci	const QueryType				m_type;
1888e5c31af7Sopenharmony_ci	glw::GLuint					m_target;
1889e5c31af7Sopenharmony_ci};
1890e5c31af7Sopenharmony_ci
1891e5c31af7Sopenharmony_ciSamplerTest::SamplerTest (tcu::TestContext&			testCtx,
1892e5c31af7Sopenharmony_ci						  const glu::RenderContext&	renderCtx,
1893e5c31af7Sopenharmony_ci						  const char*				name,
1894e5c31af7Sopenharmony_ci						  const char*				desc,
1895e5c31af7Sopenharmony_ci						  TesterType				tester,
1896e5c31af7Sopenharmony_ci						  QueryType					type)
1897e5c31af7Sopenharmony_ci	: TestCase		(testCtx, name, desc)
1898e5c31af7Sopenharmony_ci	, m_renderCtx	(renderCtx)
1899e5c31af7Sopenharmony_ci	, m_pname		(mapTesterToPname(tester))
1900e5c31af7Sopenharmony_ci	, m_tester		(tester)
1901e5c31af7Sopenharmony_ci	, m_type		(type)
1902e5c31af7Sopenharmony_ci	, m_target		(0)
1903e5c31af7Sopenharmony_ci{
1904e5c31af7Sopenharmony_ci}
1905e5c31af7Sopenharmony_ci
1906e5c31af7Sopenharmony_civoid SamplerTest::init (void)
1907e5c31af7Sopenharmony_ci{
1908e5c31af7Sopenharmony_ci	const de::UniquePtr<glu::ContextInfo>	ctxInfo		(glu::ContextInfo::create(m_renderCtx));
1909e5c31af7Sopenharmony_ci	RequiredExtensions						extensions;
1910e5c31af7Sopenharmony_ci
1911e5c31af7Sopenharmony_ci	// param
1912e5c31af7Sopenharmony_ci	if (!isCoreTextureParam(m_renderCtx.getType(), m_pname))
1913e5c31af7Sopenharmony_ci		extensions.add(getTextureParamExtension(m_renderCtx.getType(), m_pname));
1914e5c31af7Sopenharmony_ci
1915e5c31af7Sopenharmony_ci	// query
1916e5c31af7Sopenharmony_ci	if (!isCoreQuery(m_renderCtx.getType(), m_type))
1917e5c31af7Sopenharmony_ci		extensions.add(getQueryExtension(m_renderCtx.getType(), m_type));
1918e5c31af7Sopenharmony_ci
1919e5c31af7Sopenharmony_ci	// test type
1920e5c31af7Sopenharmony_ci	if (!isCoreTester(m_renderCtx.getType(), m_tester))
1921e5c31af7Sopenharmony_ci		extensions.add(getTesterExtension(m_renderCtx.getType(), m_tester));
1922e5c31af7Sopenharmony_ci
1923e5c31af7Sopenharmony_ci	extensions.check(*ctxInfo);
1924e5c31af7Sopenharmony_ci}
1925e5c31af7Sopenharmony_ci
1926e5c31af7Sopenharmony_ciSamplerTest::IterateResult SamplerTest::iterate (void)
1927e5c31af7Sopenharmony_ci{
1928e5c31af7Sopenharmony_ci	glu::CallLogWrapper		gl		(m_renderCtx.getFunctions(), m_testCtx.getLog());
1929e5c31af7Sopenharmony_ci	tcu::ResultCollector	result	(m_testCtx.getLog(), " // ERROR: ");
1930e5c31af7Sopenharmony_ci	glu::Sampler			sampler	(m_renderCtx);
1931e5c31af7Sopenharmony_ci
1932e5c31af7Sopenharmony_ci	gl.enableLogging(true);
1933e5c31af7Sopenharmony_ci
1934e5c31af7Sopenharmony_ci	m_target = *sampler;
1935e5c31af7Sopenharmony_ci	test(gl, result);
1936e5c31af7Sopenharmony_ci	m_target = 0;
1937e5c31af7Sopenharmony_ci
1938e5c31af7Sopenharmony_ci	result.setTestContextResult(m_testCtx);
1939e5c31af7Sopenharmony_ci	return STOP;
1940e5c31af7Sopenharmony_ci}
1941e5c31af7Sopenharmony_ci
1942e5c31af7Sopenharmony_ciclass SamplerWrapCase : public SamplerTest
1943e5c31af7Sopenharmony_ci{
1944e5c31af7Sopenharmony_cipublic:
1945e5c31af7Sopenharmony_ci			SamplerWrapCase	(tcu::TestContext& testCtx, const glu::RenderContext& renderContext, const char* name, const char* desc, TesterType tester, QueryType type);
1946e5c31af7Sopenharmony_ci	void	test			(glu::CallLogWrapper& gl, tcu::ResultCollector& result) const;
1947e5c31af7Sopenharmony_ci};
1948e5c31af7Sopenharmony_ci
1949e5c31af7Sopenharmony_ciSamplerWrapCase::SamplerWrapCase (tcu::TestContext& testCtx, const glu::RenderContext& renderCtx, const char* name, const char* desc, TesterType tester, QueryType type)
1950e5c31af7Sopenharmony_ci	: SamplerTest(testCtx, renderCtx, name, desc, tester, type)
1951e5c31af7Sopenharmony_ci{
1952e5c31af7Sopenharmony_ci}
1953e5c31af7Sopenharmony_ci
1954e5c31af7Sopenharmony_civoid SamplerWrapCase::test (glu::CallLogWrapper& gl, tcu::ResultCollector& result) const
1955e5c31af7Sopenharmony_ci{
1956e5c31af7Sopenharmony_ci	const bool isPureCase = isPureIntTester(m_tester) || isPureUintTester(m_tester);
1957e5c31af7Sopenharmony_ci
1958e5c31af7Sopenharmony_ci	if (!isPureCase)
1959e5c31af7Sopenharmony_ci	{
1960e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial");
1961e5c31af7Sopenharmony_ci		verifyStateSamplerParamInteger(result, gl, m_target, m_pname, GL_REPEAT, m_type);
1962e5c31af7Sopenharmony_ci	}
1963e5c31af7Sopenharmony_ci
1964e5c31af7Sopenharmony_ci	{
1965e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection	section			(m_testCtx.getLog(), "Set", "Set");
1966e5c31af7Sopenharmony_ci		const GLenum				wrapValues[]	= {GL_CLAMP_TO_EDGE, GL_REPEAT, GL_MIRRORED_REPEAT};
1967e5c31af7Sopenharmony_ci
1968e5c31af7Sopenharmony_ci		if (isPureCase)
1969e5c31af7Sopenharmony_ci		{
1970e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(wrapValues); ++ndx)
1971e5c31af7Sopenharmony_ci			{
1972e5c31af7Sopenharmony_ci				if (isPureIntTester(m_tester))
1973e5c31af7Sopenharmony_ci				{
1974e5c31af7Sopenharmony_ci					const glw::GLint value = (glw::GLint)wrapValues[ndx];
1975e5c31af7Sopenharmony_ci					gl.glSamplerParameterIiv(m_target, m_pname, &value);
1976e5c31af7Sopenharmony_ci					GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glSamplerParameterIiv");
1977e5c31af7Sopenharmony_ci				}
1978e5c31af7Sopenharmony_ci				else
1979e5c31af7Sopenharmony_ci				{
1980e5c31af7Sopenharmony_ci					DE_ASSERT(isPureUintTester(m_tester));
1981e5c31af7Sopenharmony_ci
1982e5c31af7Sopenharmony_ci					const glw::GLuint value = wrapValues[ndx];
1983e5c31af7Sopenharmony_ci					gl.glSamplerParameterIuiv(m_target, m_pname, &value);
1984e5c31af7Sopenharmony_ci					GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glSamplerParameterIuiv");
1985e5c31af7Sopenharmony_ci				}
1986e5c31af7Sopenharmony_ci
1987e5c31af7Sopenharmony_ci				verifyStateSamplerParamInteger(result, gl, m_target, m_pname, wrapValues[ndx], m_type);
1988e5c31af7Sopenharmony_ci			}
1989e5c31af7Sopenharmony_ci		}
1990e5c31af7Sopenharmony_ci		else
1991e5c31af7Sopenharmony_ci		{
1992e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(wrapValues); ++ndx)
1993e5c31af7Sopenharmony_ci			{
1994e5c31af7Sopenharmony_ci				gl.glSamplerParameteri(m_target, m_pname, wrapValues[ndx]);
1995e5c31af7Sopenharmony_ci				GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glSamplerParameteri");
1996e5c31af7Sopenharmony_ci
1997e5c31af7Sopenharmony_ci				verifyStateSamplerParamInteger(result, gl, m_target, m_pname, wrapValues[ndx], m_type);
1998e5c31af7Sopenharmony_ci			}
1999e5c31af7Sopenharmony_ci
2000e5c31af7Sopenharmony_ci			//check unit conversions with float
2001e5c31af7Sopenharmony_ci
2002e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(wrapValues); ++ndx)
2003e5c31af7Sopenharmony_ci			{
2004e5c31af7Sopenharmony_ci				gl.glSamplerParameterf(m_target, m_pname, (GLfloat)wrapValues[ndx]);
2005e5c31af7Sopenharmony_ci				GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glSamplerParameterf");
2006e5c31af7Sopenharmony_ci
2007e5c31af7Sopenharmony_ci				verifyStateSamplerParamInteger(result, gl, m_target, m_pname, wrapValues[ndx], m_type);
2008e5c31af7Sopenharmony_ci			}
2009e5c31af7Sopenharmony_ci		}
2010e5c31af7Sopenharmony_ci	}
2011e5c31af7Sopenharmony_ci}
2012e5c31af7Sopenharmony_ci
2013e5c31af7Sopenharmony_ciclass SamplerFilterCase : public SamplerTest
2014e5c31af7Sopenharmony_ci{
2015e5c31af7Sopenharmony_cipublic:
2016e5c31af7Sopenharmony_ci			SamplerFilterCase	(tcu::TestContext& testCtx, const glu::RenderContext& renderContext, const char* name, const char* desc, TesterType tester, QueryType type);
2017e5c31af7Sopenharmony_ci	void	test				(glu::CallLogWrapper& gl, tcu::ResultCollector& result) const;
2018e5c31af7Sopenharmony_ci};
2019e5c31af7Sopenharmony_ci
2020e5c31af7Sopenharmony_ciSamplerFilterCase::SamplerFilterCase (tcu::TestContext& testCtx, const glu::RenderContext& renderCtx, const char* name, const char* desc, TesterType tester, QueryType type)
2021e5c31af7Sopenharmony_ci	: SamplerTest(testCtx, renderCtx, name, desc, tester, type)
2022e5c31af7Sopenharmony_ci{
2023e5c31af7Sopenharmony_ci}
2024e5c31af7Sopenharmony_ci
2025e5c31af7Sopenharmony_civoid SamplerFilterCase::test (glu::CallLogWrapper& gl, tcu::ResultCollector& result) const
2026e5c31af7Sopenharmony_ci{
2027e5c31af7Sopenharmony_ci	const bool			isPureCase	= isPureIntTester(m_tester) || isPureUintTester(m_tester);
2028e5c31af7Sopenharmony_ci	const glw::GLenum	initial		= (m_pname == GL_TEXTURE_MAG_FILTER) ? (GL_LINEAR)
2029e5c31af7Sopenharmony_ci									: (m_pname == GL_TEXTURE_MIN_FILTER) ? (GL_NEAREST_MIPMAP_LINEAR)
2030e5c31af7Sopenharmony_ci									: (0);
2031e5c31af7Sopenharmony_ci
2032e5c31af7Sopenharmony_ci	if (!isPureCase)
2033e5c31af7Sopenharmony_ci	{
2034e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial");
2035e5c31af7Sopenharmony_ci		verifyStateSamplerParamInteger(result, gl, m_target, m_pname, initial, m_type);
2036e5c31af7Sopenharmony_ci	}
2037e5c31af7Sopenharmony_ci
2038e5c31af7Sopenharmony_ci	{
2039e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection	section		(m_testCtx.getLog(), "Set", "Set");
2040e5c31af7Sopenharmony_ci		std::vector<GLenum>			values;
2041e5c31af7Sopenharmony_ci
2042e5c31af7Sopenharmony_ci		values.push_back(GL_NEAREST);
2043e5c31af7Sopenharmony_ci		values.push_back(GL_LINEAR);
2044e5c31af7Sopenharmony_ci		if (m_pname == GL_TEXTURE_MIN_FILTER)
2045e5c31af7Sopenharmony_ci		{
2046e5c31af7Sopenharmony_ci			values.push_back(GL_NEAREST_MIPMAP_NEAREST);
2047e5c31af7Sopenharmony_ci			values.push_back(GL_NEAREST_MIPMAP_LINEAR);
2048e5c31af7Sopenharmony_ci			values.push_back(GL_LINEAR_MIPMAP_NEAREST);
2049e5c31af7Sopenharmony_ci			values.push_back(GL_LINEAR_MIPMAP_LINEAR);
2050e5c31af7Sopenharmony_ci		}
2051e5c31af7Sopenharmony_ci
2052e5c31af7Sopenharmony_ci		if (isPureCase)
2053e5c31af7Sopenharmony_ci		{
2054e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < (int)values.size(); ++ndx)
2055e5c31af7Sopenharmony_ci			{
2056e5c31af7Sopenharmony_ci				if (isPureIntTester(m_tester))
2057e5c31af7Sopenharmony_ci				{
2058e5c31af7Sopenharmony_ci					const glw::GLint value = (glw::GLint)values[ndx];
2059e5c31af7Sopenharmony_ci					gl.glSamplerParameterIiv(m_target, m_pname, &value);
2060e5c31af7Sopenharmony_ci					GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glSamplerParameterIiv");
2061e5c31af7Sopenharmony_ci				}
2062e5c31af7Sopenharmony_ci				else
2063e5c31af7Sopenharmony_ci				{
2064e5c31af7Sopenharmony_ci					DE_ASSERT(isPureUintTester(m_tester));
2065e5c31af7Sopenharmony_ci
2066e5c31af7Sopenharmony_ci					const glw::GLuint value = values[ndx];
2067e5c31af7Sopenharmony_ci					gl.glSamplerParameterIuiv(m_target, m_pname, &value);
2068e5c31af7Sopenharmony_ci					GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glSamplerParameterIuiv");
2069e5c31af7Sopenharmony_ci				}
2070e5c31af7Sopenharmony_ci
2071e5c31af7Sopenharmony_ci				verifyStateSamplerParamInteger(result, gl, m_target, m_pname, values[ndx], m_type);
2072e5c31af7Sopenharmony_ci			}
2073e5c31af7Sopenharmony_ci		}
2074e5c31af7Sopenharmony_ci		else
2075e5c31af7Sopenharmony_ci		{
2076e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < (int)values.size(); ++ndx)
2077e5c31af7Sopenharmony_ci			{
2078e5c31af7Sopenharmony_ci				gl.glSamplerParameteri(m_target, m_pname, values[ndx]);
2079e5c31af7Sopenharmony_ci				GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glSamplerParameteri");
2080e5c31af7Sopenharmony_ci
2081e5c31af7Sopenharmony_ci				verifyStateSamplerParamInteger(result, gl, m_target, m_pname, values[ndx], m_type);
2082e5c31af7Sopenharmony_ci			}
2083e5c31af7Sopenharmony_ci
2084e5c31af7Sopenharmony_ci			//check unit conversions with float
2085e5c31af7Sopenharmony_ci
2086e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < (int)values.size(); ++ndx)
2087e5c31af7Sopenharmony_ci			{
2088e5c31af7Sopenharmony_ci				gl.glSamplerParameterf(m_target, m_pname, (GLfloat)values[ndx]);
2089e5c31af7Sopenharmony_ci				GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glSamplerParameterf");
2090e5c31af7Sopenharmony_ci
2091e5c31af7Sopenharmony_ci				verifyStateSamplerParamInteger(result, gl, m_target, m_pname, values[ndx], m_type);
2092e5c31af7Sopenharmony_ci			}
2093e5c31af7Sopenharmony_ci		}
2094e5c31af7Sopenharmony_ci	}
2095e5c31af7Sopenharmony_ci}
2096e5c31af7Sopenharmony_ci
2097e5c31af7Sopenharmony_ciclass SamplerLODCase : public SamplerTest
2098e5c31af7Sopenharmony_ci{
2099e5c31af7Sopenharmony_cipublic:
2100e5c31af7Sopenharmony_ci			SamplerLODCase	(tcu::TestContext& testCtx, const glu::RenderContext& renderContext, const char* name, const char* desc, TesterType tester, QueryType type);
2101e5c31af7Sopenharmony_ci	void	test			(glu::CallLogWrapper& gl, tcu::ResultCollector& result) const;
2102e5c31af7Sopenharmony_ci};
2103e5c31af7Sopenharmony_ci
2104e5c31af7Sopenharmony_ciSamplerLODCase::SamplerLODCase (tcu::TestContext& testCtx, const glu::RenderContext& renderCtx, const char* name, const char* desc, TesterType tester, QueryType type)
2105e5c31af7Sopenharmony_ci	: SamplerTest(testCtx, renderCtx, name, desc, tester, type)
2106e5c31af7Sopenharmony_ci{
2107e5c31af7Sopenharmony_ci}
2108e5c31af7Sopenharmony_ci
2109e5c31af7Sopenharmony_civoid SamplerLODCase::test (glu::CallLogWrapper& gl, tcu::ResultCollector& result) const
2110e5c31af7Sopenharmony_ci{
2111e5c31af7Sopenharmony_ci	const bool	isPureCase		= isPureIntTester(m_tester) || isPureUintTester(m_tester);
2112e5c31af7Sopenharmony_ci	const int	initialValue	= (m_pname == GL_TEXTURE_MIN_LOD) ? (-1000)
2113e5c31af7Sopenharmony_ci								: (m_pname == GL_TEXTURE_MAX_LOD) ? (1000)
2114e5c31af7Sopenharmony_ci								: (-1);
2115e5c31af7Sopenharmony_ci
2116e5c31af7Sopenharmony_ci	if ((querySupportsSigned(m_type) || initialValue >= 0) && !isPureCase)
2117e5c31af7Sopenharmony_ci	{
2118e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial");
2119e5c31af7Sopenharmony_ci		verifyStateSamplerParamInteger(result, gl, m_target, m_pname, initialValue, m_type);
2120e5c31af7Sopenharmony_ci	}
2121e5c31af7Sopenharmony_ci
2122e5c31af7Sopenharmony_ci	{
2123e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection	section			(m_testCtx.getLog(), "Set", "Set");
2124e5c31af7Sopenharmony_ci		const int					numIterations	= 20;
2125e5c31af7Sopenharmony_ci		de::Random					rnd				(0xabcdef);
2126e5c31af7Sopenharmony_ci
2127e5c31af7Sopenharmony_ci		if (isPureCase)
2128e5c31af7Sopenharmony_ci		{
2129e5c31af7Sopenharmony_ci			if (isPureIntTester(m_tester))
2130e5c31af7Sopenharmony_ci			{
2131e5c31af7Sopenharmony_ci				for (int ndx = 0; ndx < numIterations; ++ndx)
2132e5c31af7Sopenharmony_ci				{
2133e5c31af7Sopenharmony_ci					const GLint ref = rnd.getInt(-1000, 1000);
2134e5c31af7Sopenharmony_ci
2135e5c31af7Sopenharmony_ci					gl.glSamplerParameterIiv(m_target, m_pname, &ref);
2136e5c31af7Sopenharmony_ci					GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glSamplerParameterIiv");
2137e5c31af7Sopenharmony_ci
2138e5c31af7Sopenharmony_ci					verifyStateSamplerParamFloat(result, gl, m_target, m_pname, (float)ref, m_type);
2139e5c31af7Sopenharmony_ci				}
2140e5c31af7Sopenharmony_ci			}
2141e5c31af7Sopenharmony_ci			else
2142e5c31af7Sopenharmony_ci			{
2143e5c31af7Sopenharmony_ci				DE_ASSERT(isPureUintTester(m_tester));
2144e5c31af7Sopenharmony_ci
2145e5c31af7Sopenharmony_ci				for (int ndx = 0; ndx < numIterations; ++ndx)
2146e5c31af7Sopenharmony_ci				{
2147e5c31af7Sopenharmony_ci					const GLuint ref = (glw::GLuint)rnd.getInt(0, 1000);
2148e5c31af7Sopenharmony_ci
2149e5c31af7Sopenharmony_ci					gl.glSamplerParameterIuiv(m_target, m_pname, &ref);
2150e5c31af7Sopenharmony_ci					GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glSamplerParameterIuiv");
2151e5c31af7Sopenharmony_ci
2152e5c31af7Sopenharmony_ci					verifyStateSamplerParamFloat(result, gl, m_target, m_pname, (float)ref, m_type);
2153e5c31af7Sopenharmony_ci				}
2154e5c31af7Sopenharmony_ci			}
2155e5c31af7Sopenharmony_ci		}
2156e5c31af7Sopenharmony_ci		else
2157e5c31af7Sopenharmony_ci		{
2158e5c31af7Sopenharmony_ci			const int minLimit = (querySupportsSigned(m_type)) ? (-1000) : (0);
2159e5c31af7Sopenharmony_ci
2160e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < numIterations; ++ndx)
2161e5c31af7Sopenharmony_ci			{
2162e5c31af7Sopenharmony_ci				const GLfloat ref = rnd.getFloat((float)minLimit, 1000.f);
2163e5c31af7Sopenharmony_ci
2164e5c31af7Sopenharmony_ci				gl.glSamplerParameterf(m_target, m_pname, ref);
2165e5c31af7Sopenharmony_ci				GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glSamplerParameterf");
2166e5c31af7Sopenharmony_ci
2167e5c31af7Sopenharmony_ci				verifyStateSamplerParamFloat(result, gl, m_target, m_pname, ref, m_type);
2168e5c31af7Sopenharmony_ci			}
2169e5c31af7Sopenharmony_ci
2170e5c31af7Sopenharmony_ci			// check unit conversions with int
2171e5c31af7Sopenharmony_ci
2172e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < numIterations; ++ndx)
2173e5c31af7Sopenharmony_ci			{
2174e5c31af7Sopenharmony_ci				const GLint ref = rnd.getInt(minLimit, 1000);
2175e5c31af7Sopenharmony_ci
2176e5c31af7Sopenharmony_ci				gl.glSamplerParameteri(m_target, m_pname, ref);
2177e5c31af7Sopenharmony_ci				GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glSamplerParameteri");
2178e5c31af7Sopenharmony_ci
2179e5c31af7Sopenharmony_ci				verifyStateSamplerParamFloat(result, gl, m_target, m_pname, (float)ref, m_type);
2180e5c31af7Sopenharmony_ci			}
2181e5c31af7Sopenharmony_ci		}
2182e5c31af7Sopenharmony_ci	}
2183e5c31af7Sopenharmony_ci}
2184e5c31af7Sopenharmony_ci
2185e5c31af7Sopenharmony_ciclass SamplerCompareModeCase : public SamplerTest
2186e5c31af7Sopenharmony_ci{
2187e5c31af7Sopenharmony_cipublic:
2188e5c31af7Sopenharmony_ci			SamplerCompareModeCase	(tcu::TestContext& testCtx, const glu::RenderContext& renderContext, const char* name, const char* desc, TesterType tester, QueryType type);
2189e5c31af7Sopenharmony_ci	void	test					(glu::CallLogWrapper& gl, tcu::ResultCollector& result) const;
2190e5c31af7Sopenharmony_ci};
2191e5c31af7Sopenharmony_ci
2192e5c31af7Sopenharmony_ciSamplerCompareModeCase::SamplerCompareModeCase (tcu::TestContext& testCtx, const glu::RenderContext& renderCtx, const char* name, const char* desc, TesterType tester, QueryType type)
2193e5c31af7Sopenharmony_ci	: SamplerTest(testCtx, renderCtx, name, desc, tester, type)
2194e5c31af7Sopenharmony_ci{
2195e5c31af7Sopenharmony_ci}
2196e5c31af7Sopenharmony_ci
2197e5c31af7Sopenharmony_civoid SamplerCompareModeCase::test (glu::CallLogWrapper& gl, tcu::ResultCollector& result) const
2198e5c31af7Sopenharmony_ci{
2199e5c31af7Sopenharmony_ci	const bool isPureCase = isPureIntTester(m_tester) || isPureUintTester(m_tester);
2200e5c31af7Sopenharmony_ci
2201e5c31af7Sopenharmony_ci	if (!isPureCase)
2202e5c31af7Sopenharmony_ci	{
2203e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial");
2204e5c31af7Sopenharmony_ci		verifyStateSamplerParamInteger(result, gl, m_target, m_pname, GL_NONE, m_type);
2205e5c31af7Sopenharmony_ci	}
2206e5c31af7Sopenharmony_ci
2207e5c31af7Sopenharmony_ci	{
2208e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection	section		(m_testCtx.getLog(), "Set", "Set");
2209e5c31af7Sopenharmony_ci		const GLenum				modes[]		= {GL_COMPARE_REF_TO_TEXTURE, GL_NONE};
2210e5c31af7Sopenharmony_ci
2211e5c31af7Sopenharmony_ci		if (isPureCase)
2212e5c31af7Sopenharmony_ci		{
2213e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(modes); ++ndx)
2214e5c31af7Sopenharmony_ci			{
2215e5c31af7Sopenharmony_ci				if (isPureIntTester(m_tester))
2216e5c31af7Sopenharmony_ci				{
2217e5c31af7Sopenharmony_ci					const glw::GLint value = (glw::GLint)modes[ndx];
2218e5c31af7Sopenharmony_ci					gl.glSamplerParameterIiv(m_target, m_pname, &value);
2219e5c31af7Sopenharmony_ci					GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glSamplerParameterIiv");
2220e5c31af7Sopenharmony_ci				}
2221e5c31af7Sopenharmony_ci				else
2222e5c31af7Sopenharmony_ci				{
2223e5c31af7Sopenharmony_ci					DE_ASSERT(isPureUintTester(m_tester));
2224e5c31af7Sopenharmony_ci
2225e5c31af7Sopenharmony_ci					const glw::GLuint value = modes[ndx];
2226e5c31af7Sopenharmony_ci					gl.glSamplerParameterIuiv(m_target, m_pname, &value);
2227e5c31af7Sopenharmony_ci					GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glSamplerParameterIuiv");
2228e5c31af7Sopenharmony_ci				}
2229e5c31af7Sopenharmony_ci
2230e5c31af7Sopenharmony_ci				verifyStateSamplerParamInteger(result, gl, m_target, m_pname, modes[ndx], m_type);
2231e5c31af7Sopenharmony_ci			}
2232e5c31af7Sopenharmony_ci		}
2233e5c31af7Sopenharmony_ci		else
2234e5c31af7Sopenharmony_ci		{
2235e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(modes); ++ndx)
2236e5c31af7Sopenharmony_ci			{
2237e5c31af7Sopenharmony_ci				gl.glSamplerParameteri(m_target, m_pname, modes[ndx]);
2238e5c31af7Sopenharmony_ci				GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glSamplerParameteri");
2239e5c31af7Sopenharmony_ci
2240e5c31af7Sopenharmony_ci				verifyStateSamplerParamInteger(result, gl, m_target, m_pname, modes[ndx], m_type);
2241e5c31af7Sopenharmony_ci			}
2242e5c31af7Sopenharmony_ci
2243e5c31af7Sopenharmony_ci			//check unit conversions with float
2244e5c31af7Sopenharmony_ci
2245e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(modes); ++ndx)
2246e5c31af7Sopenharmony_ci			{
2247e5c31af7Sopenharmony_ci				gl.glSamplerParameterf(m_target, m_pname, (GLfloat)modes[ndx]);
2248e5c31af7Sopenharmony_ci				GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glSamplerParameterf");
2249e5c31af7Sopenharmony_ci
2250e5c31af7Sopenharmony_ci				verifyStateSamplerParamInteger(result, gl, m_target, m_pname, modes[ndx], m_type);
2251e5c31af7Sopenharmony_ci			}
2252e5c31af7Sopenharmony_ci		}
2253e5c31af7Sopenharmony_ci	}
2254e5c31af7Sopenharmony_ci}
2255e5c31af7Sopenharmony_ci
2256e5c31af7Sopenharmony_ciclass SamplerCompareFuncCase : public SamplerTest
2257e5c31af7Sopenharmony_ci{
2258e5c31af7Sopenharmony_cipublic:
2259e5c31af7Sopenharmony_ci			SamplerCompareFuncCase	(tcu::TestContext& testCtx, const glu::RenderContext& renderContext, const char* name, const char* desc, TesterType tester, QueryType type);
2260e5c31af7Sopenharmony_ci	void	test					(glu::CallLogWrapper& gl, tcu::ResultCollector& result) const;
2261e5c31af7Sopenharmony_ci};
2262e5c31af7Sopenharmony_ci
2263e5c31af7Sopenharmony_ciSamplerCompareFuncCase::SamplerCompareFuncCase (tcu::TestContext& testCtx, const glu::RenderContext& renderCtx, const char* name, const char* desc, TesterType tester, QueryType type)
2264e5c31af7Sopenharmony_ci	: SamplerTest(testCtx, renderCtx, name, desc, tester, type)
2265e5c31af7Sopenharmony_ci{
2266e5c31af7Sopenharmony_ci}
2267e5c31af7Sopenharmony_ci
2268e5c31af7Sopenharmony_civoid SamplerCompareFuncCase::test (glu::CallLogWrapper& gl, tcu::ResultCollector& result) const
2269e5c31af7Sopenharmony_ci{
2270e5c31af7Sopenharmony_ci	const bool isPureCase = isPureIntTester(m_tester) || isPureUintTester(m_tester);
2271e5c31af7Sopenharmony_ci
2272e5c31af7Sopenharmony_ci	if (!isPureCase)
2273e5c31af7Sopenharmony_ci	{
2274e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial");
2275e5c31af7Sopenharmony_ci		verifyStateSamplerParamInteger(result, gl, m_target, m_pname, GL_LEQUAL, m_type);
2276e5c31af7Sopenharmony_ci	}
2277e5c31af7Sopenharmony_ci
2278e5c31af7Sopenharmony_ci	{
2279e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection	section			(m_testCtx.getLog(), "Set", "Set");
2280e5c31af7Sopenharmony_ci		const GLenum				compareFuncs[]	= {GL_LEQUAL, GL_GEQUAL, GL_LESS, GL_GREATER, GL_EQUAL, GL_NOTEQUAL, GL_ALWAYS, GL_NEVER};
2281e5c31af7Sopenharmony_ci
2282e5c31af7Sopenharmony_ci		if (isPureCase)
2283e5c31af7Sopenharmony_ci		{
2284e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(compareFuncs); ++ndx)
2285e5c31af7Sopenharmony_ci			{
2286e5c31af7Sopenharmony_ci				if (isPureIntTester(m_tester))
2287e5c31af7Sopenharmony_ci				{
2288e5c31af7Sopenharmony_ci					const glw::GLint value = (glw::GLint)compareFuncs[ndx];
2289e5c31af7Sopenharmony_ci					gl.glSamplerParameterIiv(m_target, m_pname, &value);
2290e5c31af7Sopenharmony_ci					GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glSamplerParameterIiv");
2291e5c31af7Sopenharmony_ci				}
2292e5c31af7Sopenharmony_ci				else
2293e5c31af7Sopenharmony_ci				{
2294e5c31af7Sopenharmony_ci					DE_ASSERT(isPureUintTester(m_tester));
2295e5c31af7Sopenharmony_ci
2296e5c31af7Sopenharmony_ci					const glw::GLuint value = compareFuncs[ndx];
2297e5c31af7Sopenharmony_ci					gl.glSamplerParameterIuiv(m_target, m_pname, &value);
2298e5c31af7Sopenharmony_ci					GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glSamplerParameterIuiv");
2299e5c31af7Sopenharmony_ci				}
2300e5c31af7Sopenharmony_ci
2301e5c31af7Sopenharmony_ci				verifyStateSamplerParamInteger(result, gl, m_target, m_pname, compareFuncs[ndx], m_type);
2302e5c31af7Sopenharmony_ci			}
2303e5c31af7Sopenharmony_ci		}
2304e5c31af7Sopenharmony_ci		else
2305e5c31af7Sopenharmony_ci		{
2306e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(compareFuncs); ++ndx)
2307e5c31af7Sopenharmony_ci			{
2308e5c31af7Sopenharmony_ci				gl.glSamplerParameteri(m_target, m_pname, compareFuncs[ndx]);
2309e5c31af7Sopenharmony_ci				GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glSamplerParameteri");
2310e5c31af7Sopenharmony_ci
2311e5c31af7Sopenharmony_ci				verifyStateSamplerParamInteger(result, gl, m_target, m_pname, compareFuncs[ndx], m_type);
2312e5c31af7Sopenharmony_ci			}
2313e5c31af7Sopenharmony_ci
2314e5c31af7Sopenharmony_ci			//check unit conversions with float
2315e5c31af7Sopenharmony_ci
2316e5c31af7Sopenharmony_ci			for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(compareFuncs); ++ndx)
2317e5c31af7Sopenharmony_ci			{
2318e5c31af7Sopenharmony_ci				gl.glSamplerParameterf(m_target, m_pname, (GLfloat)compareFuncs[ndx]);
2319e5c31af7Sopenharmony_ci				GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glSamplerParameterf");
2320e5c31af7Sopenharmony_ci
2321e5c31af7Sopenharmony_ci				verifyStateSamplerParamInteger(result, gl, m_target, m_pname, compareFuncs[ndx], m_type);
2322e5c31af7Sopenharmony_ci			}
2323e5c31af7Sopenharmony_ci		}
2324e5c31af7Sopenharmony_ci	}
2325e5c31af7Sopenharmony_ci}
2326e5c31af7Sopenharmony_ci
2327e5c31af7Sopenharmony_ciclass SamplerWrapClampToBorderCase : public SamplerTest
2328e5c31af7Sopenharmony_ci{
2329e5c31af7Sopenharmony_cipublic:
2330e5c31af7Sopenharmony_ci			SamplerWrapClampToBorderCase	(tcu::TestContext& testCtx, const glu::RenderContext& renderContext, const char* name, const char* desc, TesterType tester, QueryType type);
2331e5c31af7Sopenharmony_ci	void	test							(glu::CallLogWrapper& gl, tcu::ResultCollector& result) const;
2332e5c31af7Sopenharmony_ci};
2333e5c31af7Sopenharmony_ci
2334e5c31af7Sopenharmony_ciSamplerWrapClampToBorderCase::SamplerWrapClampToBorderCase (tcu::TestContext& testCtx, const glu::RenderContext& renderCtx, const char* name, const char* desc, TesterType tester, QueryType type)
2335e5c31af7Sopenharmony_ci	: SamplerTest(testCtx, renderCtx, name, desc, tester, type)
2336e5c31af7Sopenharmony_ci{
2337e5c31af7Sopenharmony_ci}
2338e5c31af7Sopenharmony_ci
2339e5c31af7Sopenharmony_civoid SamplerWrapClampToBorderCase::test (glu::CallLogWrapper& gl, tcu::ResultCollector& result) const
2340e5c31af7Sopenharmony_ci{
2341e5c31af7Sopenharmony_ci	gl.glSamplerParameteri(m_target, m_pname, GL_CLAMP_TO_BORDER_EXT);
2342e5c31af7Sopenharmony_ci	GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glSamplerParameteri");
2343e5c31af7Sopenharmony_ci	verifyStateSamplerParamInteger(result, gl, m_target, m_pname, GL_CLAMP_TO_BORDER_EXT, m_type);
2344e5c31af7Sopenharmony_ci
2345e5c31af7Sopenharmony_ci	gl.glSamplerParameteri(m_target, m_pname, GL_REPEAT);
2346e5c31af7Sopenharmony_ci	GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glSamplerParameteri");
2347e5c31af7Sopenharmony_ci
2348e5c31af7Sopenharmony_ci	gl.glSamplerParameterf(m_target, m_pname, (GLfloat)GL_CLAMP_TO_BORDER_EXT);
2349e5c31af7Sopenharmony_ci	GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glSamplerParameterf");
2350e5c31af7Sopenharmony_ci
2351e5c31af7Sopenharmony_ci	verifyStateSamplerParamInteger(result, gl, m_target, m_pname, GL_CLAMP_TO_BORDER_EXT, m_type);
2352e5c31af7Sopenharmony_ci}
2353e5c31af7Sopenharmony_ci
2354e5c31af7Sopenharmony_ciclass SamplerSRGBDecodeCase : public SamplerTest
2355e5c31af7Sopenharmony_ci{
2356e5c31af7Sopenharmony_cipublic:
2357e5c31af7Sopenharmony_ci			SamplerSRGBDecodeCase	(tcu::TestContext& testCtx, const glu::RenderContext& renderContext, const char* name, const char* desc, TesterType tester, QueryType type);
2358e5c31af7Sopenharmony_ci	void	test					(glu::CallLogWrapper& gl, tcu::ResultCollector& result) const;
2359e5c31af7Sopenharmony_ci};
2360e5c31af7Sopenharmony_ci
2361e5c31af7Sopenharmony_ciSamplerSRGBDecodeCase::SamplerSRGBDecodeCase (tcu::TestContext& testCtx, const glu::RenderContext& renderCtx, const char* name, const char* desc, TesterType tester, QueryType type)
2362e5c31af7Sopenharmony_ci	: SamplerTest(testCtx, renderCtx, name, desc, tester, type)
2363e5c31af7Sopenharmony_ci{
2364e5c31af7Sopenharmony_ci}
2365e5c31af7Sopenharmony_ci
2366e5c31af7Sopenharmony_civoid SamplerSRGBDecodeCase::test (glu::CallLogWrapper& gl, tcu::ResultCollector& result) const
2367e5c31af7Sopenharmony_ci{
2368e5c31af7Sopenharmony_ci	const bool isPureCase = isPureIntTester(m_tester) || isPureUintTester(m_tester);
2369e5c31af7Sopenharmony_ci
2370e5c31af7Sopenharmony_ci	if (!isPureCase)
2371e5c31af7Sopenharmony_ci	{
2372e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial");
2373e5c31af7Sopenharmony_ci		verifyStateSamplerParamInteger(result, gl, m_target, m_pname, GL_DECODE_EXT, m_type);
2374e5c31af7Sopenharmony_ci	}
2375e5c31af7Sopenharmony_ci
2376e5c31af7Sopenharmony_ci	{
2377e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection	section			(m_testCtx.getLog(), "Toggle", "Toggle");
2378e5c31af7Sopenharmony_ci		const glw::GLint			decodeInt		= GL_DECODE_EXT;
2379e5c31af7Sopenharmony_ci		const glw::GLfloat			decodeFloat		= (glw::GLfloat)GL_DECODE_EXT;
2380e5c31af7Sopenharmony_ci
2381e5c31af7Sopenharmony_ci		gl.glSamplerParameteri(m_target, m_pname, GL_SKIP_DECODE_EXT);
2382e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "set state");
2383e5c31af7Sopenharmony_ci		verifyStateSamplerParamInteger(result, gl, m_target, m_pname, GL_SKIP_DECODE_EXT, m_type);
2384e5c31af7Sopenharmony_ci
2385e5c31af7Sopenharmony_ci		gl.glSamplerParameteriv(m_target, m_pname, &decodeInt);
2386e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "set state");
2387e5c31af7Sopenharmony_ci		verifyStateSamplerParamInteger(result, gl, m_target, m_pname, GL_DECODE_EXT, m_type);
2388e5c31af7Sopenharmony_ci
2389e5c31af7Sopenharmony_ci		gl.glSamplerParameterf(m_target, m_pname, GL_SKIP_DECODE_EXT);
2390e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "set state");
2391e5c31af7Sopenharmony_ci		verifyStateSamplerParamInteger(result, gl, m_target, m_pname, GL_SKIP_DECODE_EXT, m_type);
2392e5c31af7Sopenharmony_ci
2393e5c31af7Sopenharmony_ci		gl.glSamplerParameterfv(m_target, m_pname, &decodeFloat);
2394e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "set state");
2395e5c31af7Sopenharmony_ci		verifyStateSamplerParamInteger(result, gl, m_target, m_pname, GL_DECODE_EXT, m_type);
2396e5c31af7Sopenharmony_ci	}
2397e5c31af7Sopenharmony_ci
2398e5c31af7Sopenharmony_ci	if (isPureIntTester(m_tester))
2399e5c31af7Sopenharmony_ci	{
2400e5c31af7Sopenharmony_ci		const glw::GLint skipDecode	= GL_SKIP_DECODE_EXT;
2401e5c31af7Sopenharmony_ci		const glw::GLint decode		= GL_DECODE_EXT;
2402e5c31af7Sopenharmony_ci
2403e5c31af7Sopenharmony_ci		gl.glSamplerParameterIiv(m_target, m_pname, &skipDecode);
2404e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glSamplerParameterIiv");
2405e5c31af7Sopenharmony_ci		verifyStateSamplerParamInteger(result, gl, m_target, m_pname, GL_SKIP_DECODE_EXT, m_type);
2406e5c31af7Sopenharmony_ci
2407e5c31af7Sopenharmony_ci		gl.glSamplerParameterIiv(m_target, m_pname, &decode);
2408e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glSamplerParameterIiv");
2409e5c31af7Sopenharmony_ci		verifyStateSamplerParamInteger(result, gl, m_target, m_pname, GL_DECODE_EXT, m_type);
2410e5c31af7Sopenharmony_ci	}
2411e5c31af7Sopenharmony_ci
2412e5c31af7Sopenharmony_ci	if (isPureUintTester(m_tester))
2413e5c31af7Sopenharmony_ci	{
2414e5c31af7Sopenharmony_ci		const glw::GLuint skipDecode	= GL_SKIP_DECODE_EXT;
2415e5c31af7Sopenharmony_ci		const glw::GLuint decode		= GL_DECODE_EXT;
2416e5c31af7Sopenharmony_ci
2417e5c31af7Sopenharmony_ci		gl.glSamplerParameterIuiv(m_target, m_pname, &skipDecode);
2418e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glSamplerParameterIuiv");
2419e5c31af7Sopenharmony_ci		verifyStateSamplerParamInteger(result, gl, m_target, m_pname, GL_SKIP_DECODE_EXT, m_type);
2420e5c31af7Sopenharmony_ci
2421e5c31af7Sopenharmony_ci		gl.glSamplerParameterIuiv(m_target, m_pname, &decode);
2422e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glSamplerParameterIuiv");
2423e5c31af7Sopenharmony_ci		verifyStateSamplerParamInteger(result, gl, m_target, m_pname, GL_DECODE_EXT, m_type);
2424e5c31af7Sopenharmony_ci	}
2425e5c31af7Sopenharmony_ci}
2426e5c31af7Sopenharmony_ci
2427e5c31af7Sopenharmony_ciclass SamplerBorderColorCase : public SamplerTest
2428e5c31af7Sopenharmony_ci{
2429e5c31af7Sopenharmony_cipublic:
2430e5c31af7Sopenharmony_ci			SamplerBorderColorCase	(tcu::TestContext& testCtx, const glu::RenderContext& renderContext, const char* name, const char* desc, QueryType type);
2431e5c31af7Sopenharmony_ci	void	test					(glu::CallLogWrapper& gl, tcu::ResultCollector& result) const;
2432e5c31af7Sopenharmony_ci};
2433e5c31af7Sopenharmony_ci
2434e5c31af7Sopenharmony_ciSamplerBorderColorCase::SamplerBorderColorCase (tcu::TestContext& testCtx, const glu::RenderContext& renderCtx, const char* name, const char* desc, QueryType type)
2435e5c31af7Sopenharmony_ci	: SamplerTest(testCtx, renderCtx, name, desc, TESTER_TEXTURE_BORDER_COLOR, type)
2436e5c31af7Sopenharmony_ci{
2437e5c31af7Sopenharmony_ci	DE_ASSERT(m_type == QUERY_SAMPLER_PARAM_INTEGER_VEC4					||
2438e5c31af7Sopenharmony_ci			  m_type == QUERY_SAMPLER_PARAM_FLOAT_VEC4						||
2439e5c31af7Sopenharmony_ci			  m_type == QUERY_SAMPLER_PARAM_PURE_INTEGER_VEC4				||
2440e5c31af7Sopenharmony_ci			  m_type == QUERY_SAMPLER_PARAM_PURE_UNSIGNED_INTEGER_VEC4);
2441e5c31af7Sopenharmony_ci}
2442e5c31af7Sopenharmony_ci
2443e5c31af7Sopenharmony_civoid SamplerBorderColorCase::test (glu::CallLogWrapper& gl, tcu::ResultCollector& result) const
2444e5c31af7Sopenharmony_ci{
2445e5c31af7Sopenharmony_ci	// border color is undefined if queried with pure type and was not set to pure value
2446e5c31af7Sopenharmony_ci	if (m_type == QUERY_SAMPLER_PARAM_INTEGER_VEC4 || m_type == QUERY_SAMPLER_PARAM_FLOAT_VEC4)
2447e5c31af7Sopenharmony_ci	{
2448e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial");
2449e5c31af7Sopenharmony_ci		verifyStateSamplerParamFloatVec4(result, gl, m_target, m_pname, tcu::Vec4(0.0f, 0.0f, 0.0f, 0.0f), m_type);
2450e5c31af7Sopenharmony_ci	}
2451e5c31af7Sopenharmony_ci
2452e5c31af7Sopenharmony_ci	if (m_type == QUERY_SAMPLER_PARAM_PURE_INTEGER_VEC4)
2453e5c31af7Sopenharmony_ci	{
2454e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection	section			(m_testCtx.getLog(), "Set", "Set");
2455e5c31af7Sopenharmony_ci		const tcu::IVec4			color			(0x7FFFFFFF, -2, 3, -128);
2456e5c31af7Sopenharmony_ci
2457e5c31af7Sopenharmony_ci		gl.glSamplerParameterIiv(m_target, m_pname, color.getPtr());
2458e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glSamplerParameterIiv");
2459e5c31af7Sopenharmony_ci
2460e5c31af7Sopenharmony_ci		verifyStateSamplerParamIntegerVec4(result, gl, m_target, m_pname, color, m_type);
2461e5c31af7Sopenharmony_ci	}
2462e5c31af7Sopenharmony_ci	else if (m_type == QUERY_SAMPLER_PARAM_PURE_UNSIGNED_INTEGER_VEC4)
2463e5c31af7Sopenharmony_ci	{
2464e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection	section			(m_testCtx.getLog(), "Set", "Set");
2465e5c31af7Sopenharmony_ci		const tcu::UVec4			color			(0x8000000ul, 2, 3, 128);
2466e5c31af7Sopenharmony_ci
2467e5c31af7Sopenharmony_ci		gl.glSamplerParameterIuiv(m_target, m_pname, color.getPtr());
2468e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glSamplerParameterIuiv");
2469e5c31af7Sopenharmony_ci
2470e5c31af7Sopenharmony_ci		verifyStateSamplerParamUnsignedIntegerVec4(result, gl, m_target, m_pname, color, m_type);
2471e5c31af7Sopenharmony_ci	}
2472e5c31af7Sopenharmony_ci	else
2473e5c31af7Sopenharmony_ci	{
2474e5c31af7Sopenharmony_ci		DE_ASSERT(m_type == QUERY_SAMPLER_PARAM_INTEGER_VEC4 || m_type == QUERY_SAMPLER_PARAM_FLOAT_VEC4);
2475e5c31af7Sopenharmony_ci
2476e5c31af7Sopenharmony_ci		const tcu::ScopedLogSection	section			(m_testCtx.getLog(), "Set", "Set");
2477e5c31af7Sopenharmony_ci		const tcu::Vec4				color			(0.25f, 1.0f, 0.0f, 0.77f);
2478e5c31af7Sopenharmony_ci		const tcu::IVec4			icolor			(0x8000000ul, 0x7FFFFFFF, 0, 0x0FFFFFFF);
2479e5c31af7Sopenharmony_ci
2480e5c31af7Sopenharmony_ci		gl.glSamplerParameterfv(m_target, m_pname, color.getPtr());
2481e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glSamplerParameterfv");
2482e5c31af7Sopenharmony_ci
2483e5c31af7Sopenharmony_ci		verifyStateSamplerParamFloatVec4(result, gl, m_target, m_pname, color, m_type);
2484e5c31af7Sopenharmony_ci
2485e5c31af7Sopenharmony_ci		gl.glSamplerParameteriv(m_target, m_pname, icolor.getPtr());
2486e5c31af7Sopenharmony_ci		GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glSamplerParameteriv");
2487e5c31af7Sopenharmony_ci
2488e5c31af7Sopenharmony_ci		verifyStateSamplerParamNormalizedI32Vec4(result, gl, m_target, m_pname, icolor, m_type);
2489e5c31af7Sopenharmony_ci	}
2490e5c31af7Sopenharmony_ci}
2491e5c31af7Sopenharmony_ci
2492e5c31af7Sopenharmony_ci} // anonymous
2493e5c31af7Sopenharmony_ci
2494e5c31af7Sopenharmony_cibool isLegalTesterForTarget (glw::GLenum target, TesterType tester)
2495e5c31af7Sopenharmony_ci{
2496e5c31af7Sopenharmony_ci	// no 3d filtering on 2d targets
2497e5c31af7Sopenharmony_ci	if ((tester == TESTER_TEXTURE_WRAP_R || tester == TESTER_TEXTURE_WRAP_R_CLAMP_TO_BORDER) &&  target != GL_TEXTURE_3D)
2498e5c31af7Sopenharmony_ci		return false;
2499e5c31af7Sopenharmony_ci
2500e5c31af7Sopenharmony_ci	// no sampling on multisample
2501e5c31af7Sopenharmony_ci	if (isMultisampleTarget(target) && isSamplerStateTester(tester))
2502e5c31af7Sopenharmony_ci		return false;
2503e5c31af7Sopenharmony_ci
2504e5c31af7Sopenharmony_ci	// no states in buffer
2505e5c31af7Sopenharmony_ci	if (target == GL_TEXTURE_BUFFER)
2506e5c31af7Sopenharmony_ci		return false;
2507e5c31af7Sopenharmony_ci
2508e5c31af7Sopenharmony_ci	return true;
2509e5c31af7Sopenharmony_ci}
2510e5c31af7Sopenharmony_ci
2511e5c31af7Sopenharmony_cibool isMultisampleTarget (glw::GLenum target)
2512e5c31af7Sopenharmony_ci{
2513e5c31af7Sopenharmony_ci	return	target == GL_TEXTURE_2D_MULTISAMPLE			||
2514e5c31af7Sopenharmony_ci			target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY;
2515e5c31af7Sopenharmony_ci}
2516e5c31af7Sopenharmony_ci
2517e5c31af7Sopenharmony_cibool isSamplerStateTester (TesterType tester)
2518e5c31af7Sopenharmony_ci{
2519e5c31af7Sopenharmony_ci	return	tester == TESTER_TEXTURE_WRAP_S					||
2520e5c31af7Sopenharmony_ci			tester == TESTER_TEXTURE_WRAP_T					||
2521e5c31af7Sopenharmony_ci			tester == TESTER_TEXTURE_WRAP_R					||
2522e5c31af7Sopenharmony_ci			tester == TESTER_TEXTURE_MAG_FILTER				||
2523e5c31af7Sopenharmony_ci			tester == TESTER_TEXTURE_MIN_FILTER				||
2524e5c31af7Sopenharmony_ci			tester == TESTER_TEXTURE_MIN_LOD				||
2525e5c31af7Sopenharmony_ci			tester == TESTER_TEXTURE_MAX_LOD				||
2526e5c31af7Sopenharmony_ci			tester == TESTER_TEXTURE_COMPARE_MODE			||
2527e5c31af7Sopenharmony_ci			tester == TESTER_TEXTURE_COMPARE_FUNC			||
2528e5c31af7Sopenharmony_ci			tester == TESTER_TEXTURE_SRGB_DECODE_EXT		||
2529e5c31af7Sopenharmony_ci			tester == TESTER_TEXTURE_BORDER_COLOR			||
2530e5c31af7Sopenharmony_ci			tester == TESTER_TEXTURE_WRAP_S_CLAMP_TO_BORDER	||
2531e5c31af7Sopenharmony_ci			tester == TESTER_TEXTURE_WRAP_T_CLAMP_TO_BORDER	||
2532e5c31af7Sopenharmony_ci			tester == TESTER_TEXTURE_WRAP_R_CLAMP_TO_BORDER;
2533e5c31af7Sopenharmony_ci}
2534e5c31af7Sopenharmony_ci
2535e5c31af7Sopenharmony_citcu::TestCase* createIsTextureTest (tcu::TestContext& testCtx, const glu::RenderContext& renderCtx, const std::string& name, const std::string& description, glw::GLenum target)
2536e5c31af7Sopenharmony_ci{
2537e5c31af7Sopenharmony_ci	return new IsTextureCase(testCtx, renderCtx, name.c_str(), description.c_str(), target);
2538e5c31af7Sopenharmony_ci}
2539e5c31af7Sopenharmony_ci
2540e5c31af7Sopenharmony_citcu::TestCase* createTexParamTest (tcu::TestContext& testCtx, const glu::RenderContext& renderCtx, const std::string& name, const std::string& description, QueryType queryType, glw::GLenum target, TesterType tester)
2541e5c31af7Sopenharmony_ci{
2542e5c31af7Sopenharmony_ci	if (isMultisampleTarget(target) && isSamplerStateTester(tester))
2543e5c31af7Sopenharmony_ci	{
2544e5c31af7Sopenharmony_ci		DE_FATAL("Multisample textures have no sampler state");
2545e5c31af7Sopenharmony_ci		return DE_NULL;
2546e5c31af7Sopenharmony_ci	}
2547e5c31af7Sopenharmony_ci	if (target == GL_TEXTURE_BUFFER)
2548e5c31af7Sopenharmony_ci	{
2549e5c31af7Sopenharmony_ci		DE_FATAL("Buffer textures have no texture state");
2550e5c31af7Sopenharmony_ci		return DE_NULL;
2551e5c31af7Sopenharmony_ci	}
2552e5c31af7Sopenharmony_ci	if (target != GL_TEXTURE_3D && mapTesterToPname(tester) == GL_TEXTURE_WRAP_R)
2553e5c31af7Sopenharmony_ci	{
2554e5c31af7Sopenharmony_ci		DE_FATAL("Only 3D textures have wrap r filter");
2555e5c31af7Sopenharmony_ci		return DE_NULL;
2556e5c31af7Sopenharmony_ci	}
2557e5c31af7Sopenharmony_ci
2558e5c31af7Sopenharmony_ci#define CASE_ALL_SETTERS(X) case X: case X ## _SET_PURE_INT: case X ## _SET_PURE_UINT
2559e5c31af7Sopenharmony_ci
2560e5c31af7Sopenharmony_ci	switch (tester)
2561e5c31af7Sopenharmony_ci	{
2562e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_SWIZZLE_R):
2563e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_SWIZZLE_G):
2564e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_SWIZZLE_B):
2565e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_SWIZZLE_A):
2566e5c31af7Sopenharmony_ci			return new TextureSwizzleCase(testCtx, renderCtx, name.c_str(), description.c_str(), target, tester, queryType);
2567e5c31af7Sopenharmony_ci
2568e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_WRAP_S):
2569e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_WRAP_T):
2570e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_WRAP_R):
2571e5c31af7Sopenharmony_ci			return new TextureWrapCase(testCtx, renderCtx, name.c_str(), description.c_str(), target, tester, queryType);
2572e5c31af7Sopenharmony_ci
2573e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_MAG_FILTER):
2574e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_MIN_FILTER):
2575e5c31af7Sopenharmony_ci			return new TextureFilterCase(testCtx, renderCtx, name.c_str(), description.c_str(), target, tester, queryType);
2576e5c31af7Sopenharmony_ci
2577e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_MIN_LOD):
2578e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_MAX_LOD):
2579e5c31af7Sopenharmony_ci			return new TextureLODCase(testCtx, renderCtx, name.c_str(), description.c_str(), target, tester, queryType);
2580e5c31af7Sopenharmony_ci
2581e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_BASE_LEVEL):
2582e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_MAX_LEVEL):
2583e5c31af7Sopenharmony_ci			return new TextureLevelCase(testCtx, renderCtx, name.c_str(), description.c_str(), target, tester, queryType);
2584e5c31af7Sopenharmony_ci
2585e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_COMPARE_MODE):
2586e5c31af7Sopenharmony_ci			return new TextureCompareModeCase(testCtx, renderCtx, name.c_str(), description.c_str(), target, tester, queryType);
2587e5c31af7Sopenharmony_ci
2588e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_COMPARE_FUNC):
2589e5c31af7Sopenharmony_ci			return new TextureCompareFuncCase(testCtx, renderCtx, name.c_str(), description.c_str(), target, tester, queryType);
2590e5c31af7Sopenharmony_ci
2591e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_IMMUTABLE_LEVELS:
2592e5c31af7Sopenharmony_ci			return new TextureImmutableLevelsCase(testCtx, renderCtx, name.c_str(), description.c_str(), target, queryType);
2593e5c31af7Sopenharmony_ci
2594e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_IMMUTABLE_FORMAT:
2595e5c31af7Sopenharmony_ci			return new TextureImmutableFormatCase(testCtx, renderCtx, name.c_str(), description.c_str(), target, queryType);
2596e5c31af7Sopenharmony_ci
2597e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_WRAP_S_CLAMP_TO_BORDER:
2598e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_WRAP_T_CLAMP_TO_BORDER:
2599e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_WRAP_R_CLAMP_TO_BORDER:
2600e5c31af7Sopenharmony_ci			return new TextureWrapClampToBorderCase(testCtx, renderCtx, name.c_str(), description.c_str(), target, tester, queryType);
2601e5c31af7Sopenharmony_ci
2602e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_DEPTH_STENCIL_TEXTURE_MODE):
2603e5c31af7Sopenharmony_ci			return new DepthStencilModeCase(testCtx, renderCtx, name.c_str(), description.c_str(), target, tester, queryType);
2604e5c31af7Sopenharmony_ci
2605e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_SRGB_DECODE_EXT):
2606e5c31af7Sopenharmony_ci			return new TextureSRGBDecodeCase(testCtx, renderCtx, name.c_str(), description.c_str(), target, tester, queryType);
2607e5c31af7Sopenharmony_ci
2608e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_BORDER_COLOR:
2609e5c31af7Sopenharmony_ci			return new TextureBorderColorCase(testCtx, renderCtx, name.c_str(), description.c_str(), target, queryType);
2610e5c31af7Sopenharmony_ci
2611e5c31af7Sopenharmony_ci		default:
2612e5c31af7Sopenharmony_ci			break;
2613e5c31af7Sopenharmony_ci	}
2614e5c31af7Sopenharmony_ci
2615e5c31af7Sopenharmony_ci#undef CASE_ALL_SETTERS
2616e5c31af7Sopenharmony_ci
2617e5c31af7Sopenharmony_ci	DE_ASSERT(false);
2618e5c31af7Sopenharmony_ci	return DE_NULL;
2619e5c31af7Sopenharmony_ci}
2620e5c31af7Sopenharmony_ci
2621e5c31af7Sopenharmony_citcu::TestCase* createSamplerParamTest (tcu::TestContext& testCtx, const glu::RenderContext& renderCtx, const std::string& name, const std::string& description, StateQueryUtil::QueryType queryType, TesterType tester)
2622e5c31af7Sopenharmony_ci{
2623e5c31af7Sopenharmony_ci#define CASE_ALL_SETTERS(X) case X: case X ## _SET_PURE_INT: case X ## _SET_PURE_UINT
2624e5c31af7Sopenharmony_ci
2625e5c31af7Sopenharmony_ci	switch (tester)
2626e5c31af7Sopenharmony_ci	{
2627e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_WRAP_S):
2628e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_WRAP_T):
2629e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_WRAP_R):
2630e5c31af7Sopenharmony_ci			return new SamplerWrapCase(testCtx, renderCtx, name.c_str(), description.c_str(), tester, queryType);
2631e5c31af7Sopenharmony_ci
2632e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_MAG_FILTER):
2633e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_MIN_FILTER):
2634e5c31af7Sopenharmony_ci			return new SamplerFilterCase(testCtx, renderCtx, name.c_str(), description.c_str(), tester, queryType);
2635e5c31af7Sopenharmony_ci
2636e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_MIN_LOD):
2637e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_MAX_LOD):
2638e5c31af7Sopenharmony_ci			return new SamplerLODCase(testCtx, renderCtx, name.c_str(), description.c_str(), tester, queryType);
2639e5c31af7Sopenharmony_ci
2640e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_COMPARE_MODE):
2641e5c31af7Sopenharmony_ci			return new SamplerCompareModeCase(testCtx, renderCtx, name.c_str(), description.c_str(), tester, queryType);
2642e5c31af7Sopenharmony_ci
2643e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_COMPARE_FUNC):
2644e5c31af7Sopenharmony_ci			return new SamplerCompareFuncCase(testCtx, renderCtx, name.c_str(), description.c_str(), tester, queryType);
2645e5c31af7Sopenharmony_ci
2646e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_WRAP_S_CLAMP_TO_BORDER:
2647e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_WRAP_T_CLAMP_TO_BORDER:
2648e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_WRAP_R_CLAMP_TO_BORDER:
2649e5c31af7Sopenharmony_ci			return new SamplerWrapClampToBorderCase(testCtx, renderCtx, name.c_str(), description.c_str(), tester, queryType);
2650e5c31af7Sopenharmony_ci
2651e5c31af7Sopenharmony_ci		CASE_ALL_SETTERS(TESTER_TEXTURE_SRGB_DECODE_EXT):
2652e5c31af7Sopenharmony_ci			return new SamplerSRGBDecodeCase(testCtx, renderCtx, name.c_str(), description.c_str(), tester, queryType);
2653e5c31af7Sopenharmony_ci
2654e5c31af7Sopenharmony_ci		case TESTER_TEXTURE_BORDER_COLOR:
2655e5c31af7Sopenharmony_ci			return new SamplerBorderColorCase(testCtx, renderCtx, name.c_str(), description.c_str(), queryType);
2656e5c31af7Sopenharmony_ci
2657e5c31af7Sopenharmony_ci		default:
2658e5c31af7Sopenharmony_ci			break;
2659e5c31af7Sopenharmony_ci	}
2660e5c31af7Sopenharmony_ci
2661e5c31af7Sopenharmony_ci#undef CASE_ALL_SETTERS
2662e5c31af7Sopenharmony_ci
2663e5c31af7Sopenharmony_ci	DE_ASSERT(false);
2664e5c31af7Sopenharmony_ci	return DE_NULL;
2665e5c31af7Sopenharmony_ci}
2666e5c31af7Sopenharmony_ci
2667e5c31af7Sopenharmony_ci} // TextureStateQueryTests
2668e5c31af7Sopenharmony_ci} // gls
2669e5c31af7Sopenharmony_ci} // deqp
2670