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