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 State Query test utils.
22*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
23*35238bceSAndroid Build Coastguard Worker #include "glsStateQueryUtil.hpp"
24*35238bceSAndroid Build Coastguard Worker #include "tcuTestContext.hpp"
25*35238bceSAndroid Build Coastguard Worker #include "tcuFormatUtil.hpp"
26*35238bceSAndroid Build Coastguard Worker #include "gluCallLogWrapper.hpp"
27*35238bceSAndroid Build Coastguard Worker #include "gluStrUtil.hpp"
28*35238bceSAndroid Build Coastguard Worker #include "glwEnums.hpp"
29*35238bceSAndroid Build Coastguard Worker #include "deStringUtil.hpp"
30*35238bceSAndroid Build Coastguard Worker
31*35238bceSAndroid Build Coastguard Worker namespace deqp
32*35238bceSAndroid Build Coastguard Worker {
33*35238bceSAndroid Build Coastguard Worker namespace gls
34*35238bceSAndroid Build Coastguard Worker {
35*35238bceSAndroid Build Coastguard Worker namespace StateQueryUtil
36*35238bceSAndroid Build Coastguard Worker {
37*35238bceSAndroid Build Coastguard Worker
mapBoolToGLBoolean(bool b)38*35238bceSAndroid Build Coastguard Worker static glw::GLboolean mapBoolToGLBoolean(bool b)
39*35238bceSAndroid Build Coastguard Worker {
40*35238bceSAndroid Build Coastguard Worker return (b ? GL_TRUE : GL_FALSE);
41*35238bceSAndroid Build Coastguard Worker }
42*35238bceSAndroid Build Coastguard Worker
checkError(tcu::ResultCollector & result,glu::CallLogWrapper & gl,const char * msg)43*35238bceSAndroid Build Coastguard Worker static bool checkError(tcu::ResultCollector &result, glu::CallLogWrapper &gl, const char *msg)
44*35238bceSAndroid Build Coastguard Worker {
45*35238bceSAndroid Build Coastguard Worker const glw::GLenum errorCode = gl.glGetError();
46*35238bceSAndroid Build Coastguard Worker
47*35238bceSAndroid Build Coastguard Worker if (errorCode == GL_NO_ERROR)
48*35238bceSAndroid Build Coastguard Worker return true;
49*35238bceSAndroid Build Coastguard Worker
50*35238bceSAndroid Build Coastguard Worker result.fail(std::string(msg) + ": glGetError() returned " + glu::getErrorStr(errorCode).toString());
51*35238bceSAndroid Build Coastguard Worker return false;
52*35238bceSAndroid Build Coastguard Worker }
53*35238bceSAndroid Build Coastguard Worker
QueriedState(void)54*35238bceSAndroid Build Coastguard Worker QueriedState::QueriedState(void) : m_type(DATATYPE_LAST)
55*35238bceSAndroid Build Coastguard Worker {
56*35238bceSAndroid Build Coastguard Worker }
57*35238bceSAndroid Build Coastguard Worker
QueriedState(glw::GLint v)58*35238bceSAndroid Build Coastguard Worker QueriedState::QueriedState(glw::GLint v) : m_type(DATATYPE_INTEGER)
59*35238bceSAndroid Build Coastguard Worker {
60*35238bceSAndroid Build Coastguard Worker m_v.vInt = v;
61*35238bceSAndroid Build Coastguard Worker }
62*35238bceSAndroid Build Coastguard Worker
QueriedState(glw::GLint64 v)63*35238bceSAndroid Build Coastguard Worker QueriedState::QueriedState(glw::GLint64 v) : m_type(DATATYPE_INTEGER64)
64*35238bceSAndroid Build Coastguard Worker {
65*35238bceSAndroid Build Coastguard Worker m_v.vInt64 = v;
66*35238bceSAndroid Build Coastguard Worker }
67*35238bceSAndroid Build Coastguard Worker
QueriedState(bool v)68*35238bceSAndroid Build Coastguard Worker QueriedState::QueriedState(bool v) : m_type(DATATYPE_BOOLEAN)
69*35238bceSAndroid Build Coastguard Worker {
70*35238bceSAndroid Build Coastguard Worker m_v.vBool = v;
71*35238bceSAndroid Build Coastguard Worker }
72*35238bceSAndroid Build Coastguard Worker
QueriedState(glw::GLfloat v)73*35238bceSAndroid Build Coastguard Worker QueriedState::QueriedState(glw::GLfloat v) : m_type(DATATYPE_FLOAT)
74*35238bceSAndroid Build Coastguard Worker {
75*35238bceSAndroid Build Coastguard Worker m_v.vFloat = v;
76*35238bceSAndroid Build Coastguard Worker }
77*35238bceSAndroid Build Coastguard Worker
QueriedState(glw::GLuint v)78*35238bceSAndroid Build Coastguard Worker QueriedState::QueriedState(glw::GLuint v) : m_type(DATATYPE_UNSIGNED_INTEGER)
79*35238bceSAndroid Build Coastguard Worker {
80*35238bceSAndroid Build Coastguard Worker m_v.vUint = v;
81*35238bceSAndroid Build Coastguard Worker }
82*35238bceSAndroid Build Coastguard Worker
QueriedState(const GLIntVec3 & v)83*35238bceSAndroid Build Coastguard Worker QueriedState::QueriedState(const GLIntVec3 &v) : m_type(DATATYPE_INTEGER_VEC3)
84*35238bceSAndroid Build Coastguard Worker {
85*35238bceSAndroid Build Coastguard Worker m_v.vIntVec3[0] = v[0];
86*35238bceSAndroid Build Coastguard Worker m_v.vIntVec3[1] = v[1];
87*35238bceSAndroid Build Coastguard Worker m_v.vIntVec3[2] = v[2];
88*35238bceSAndroid Build Coastguard Worker }
89*35238bceSAndroid Build Coastguard Worker
QueriedState(void * v)90*35238bceSAndroid Build Coastguard Worker QueriedState::QueriedState(void *v) : m_type(DATATYPE_POINTER)
91*35238bceSAndroid Build Coastguard Worker {
92*35238bceSAndroid Build Coastguard Worker m_v.vPtr = v;
93*35238bceSAndroid Build Coastguard Worker }
94*35238bceSAndroid Build Coastguard Worker
QueriedState(const GLIntVec4 & v)95*35238bceSAndroid Build Coastguard Worker QueriedState::QueriedState(const GLIntVec4 &v) : m_type(DATATYPE_INTEGER_VEC4)
96*35238bceSAndroid Build Coastguard Worker {
97*35238bceSAndroid Build Coastguard Worker m_v.vIntVec4[0] = v[0];
98*35238bceSAndroid Build Coastguard Worker m_v.vIntVec4[1] = v[1];
99*35238bceSAndroid Build Coastguard Worker m_v.vIntVec4[2] = v[2];
100*35238bceSAndroid Build Coastguard Worker m_v.vIntVec4[3] = v[3];
101*35238bceSAndroid Build Coastguard Worker }
102*35238bceSAndroid Build Coastguard Worker
QueriedState(const GLUintVec4 & v)103*35238bceSAndroid Build Coastguard Worker QueriedState::QueriedState(const GLUintVec4 &v) : m_type(DATATYPE_UNSIGNED_INTEGER_VEC4)
104*35238bceSAndroid Build Coastguard Worker {
105*35238bceSAndroid Build Coastguard Worker m_v.vUintVec4[0] = v[0];
106*35238bceSAndroid Build Coastguard Worker m_v.vUintVec4[1] = v[1];
107*35238bceSAndroid Build Coastguard Worker m_v.vUintVec4[2] = v[2];
108*35238bceSAndroid Build Coastguard Worker m_v.vUintVec4[3] = v[3];
109*35238bceSAndroid Build Coastguard Worker }
110*35238bceSAndroid Build Coastguard Worker
QueriedState(const GLFloatVec4 & v)111*35238bceSAndroid Build Coastguard Worker QueriedState::QueriedState(const GLFloatVec4 &v) : m_type(DATATYPE_FLOAT_VEC4)
112*35238bceSAndroid Build Coastguard Worker {
113*35238bceSAndroid Build Coastguard Worker m_v.vFloatVec4[0] = v[0];
114*35238bceSAndroid Build Coastguard Worker m_v.vFloatVec4[1] = v[1];
115*35238bceSAndroid Build Coastguard Worker m_v.vFloatVec4[2] = v[2];
116*35238bceSAndroid Build Coastguard Worker m_v.vFloatVec4[3] = v[3];
117*35238bceSAndroid Build Coastguard Worker }
118*35238bceSAndroid Build Coastguard Worker
QueriedState(const BooleanVec4 & v)119*35238bceSAndroid Build Coastguard Worker QueriedState::QueriedState(const BooleanVec4 &v) : m_type(DATATYPE_BOOLEAN_VEC4)
120*35238bceSAndroid Build Coastguard Worker {
121*35238bceSAndroid Build Coastguard Worker m_v.vBooleanVec4[0] = v[0];
122*35238bceSAndroid Build Coastguard Worker m_v.vBooleanVec4[1] = v[1];
123*35238bceSAndroid Build Coastguard Worker m_v.vBooleanVec4[2] = v[2];
124*35238bceSAndroid Build Coastguard Worker m_v.vBooleanVec4[3] = v[3];
125*35238bceSAndroid Build Coastguard Worker }
126*35238bceSAndroid Build Coastguard Worker
QueriedState(const GLInt64Vec4 & v)127*35238bceSAndroid Build Coastguard Worker QueriedState::QueriedState(const GLInt64Vec4 &v) : m_type(DATATYPE_INTEGER64_VEC4)
128*35238bceSAndroid Build Coastguard Worker {
129*35238bceSAndroid Build Coastguard Worker m_v.vInt64Vec4[0] = v[0];
130*35238bceSAndroid Build Coastguard Worker m_v.vInt64Vec4[1] = v[1];
131*35238bceSAndroid Build Coastguard Worker m_v.vInt64Vec4[2] = v[2];
132*35238bceSAndroid Build Coastguard Worker m_v.vInt64Vec4[3] = v[3];
133*35238bceSAndroid Build Coastguard Worker }
134*35238bceSAndroid Build Coastguard Worker
isUndefined(void) const135*35238bceSAndroid Build Coastguard Worker bool QueriedState::isUndefined(void) const
136*35238bceSAndroid Build Coastguard Worker {
137*35238bceSAndroid Build Coastguard Worker return m_type == DATATYPE_LAST;
138*35238bceSAndroid Build Coastguard Worker }
139*35238bceSAndroid Build Coastguard Worker
getType(void) const140*35238bceSAndroid Build Coastguard Worker DataType QueriedState::getType(void) const
141*35238bceSAndroid Build Coastguard Worker {
142*35238bceSAndroid Build Coastguard Worker return m_type;
143*35238bceSAndroid Build Coastguard Worker }
144*35238bceSAndroid Build Coastguard Worker
getIntAccess(void)145*35238bceSAndroid Build Coastguard Worker glw::GLint &QueriedState::getIntAccess(void)
146*35238bceSAndroid Build Coastguard Worker {
147*35238bceSAndroid Build Coastguard Worker DE_ASSERT(m_type == DATATYPE_INTEGER);
148*35238bceSAndroid Build Coastguard Worker return m_v.vInt;
149*35238bceSAndroid Build Coastguard Worker }
150*35238bceSAndroid Build Coastguard Worker
getInt64Access(void)151*35238bceSAndroid Build Coastguard Worker glw::GLint64 &QueriedState::getInt64Access(void)
152*35238bceSAndroid Build Coastguard Worker {
153*35238bceSAndroid Build Coastguard Worker DE_ASSERT(m_type == DATATYPE_INTEGER64);
154*35238bceSAndroid Build Coastguard Worker return m_v.vInt64;
155*35238bceSAndroid Build Coastguard Worker }
156*35238bceSAndroid Build Coastguard Worker
getBoolAccess(void)157*35238bceSAndroid Build Coastguard Worker bool &QueriedState::getBoolAccess(void)
158*35238bceSAndroid Build Coastguard Worker {
159*35238bceSAndroid Build Coastguard Worker DE_ASSERT(m_type == DATATYPE_BOOLEAN);
160*35238bceSAndroid Build Coastguard Worker return m_v.vBool;
161*35238bceSAndroid Build Coastguard Worker }
162*35238bceSAndroid Build Coastguard Worker
getFloatAccess(void)163*35238bceSAndroid Build Coastguard Worker glw::GLfloat &QueriedState::getFloatAccess(void)
164*35238bceSAndroid Build Coastguard Worker {
165*35238bceSAndroid Build Coastguard Worker DE_ASSERT(m_type == DATATYPE_FLOAT);
166*35238bceSAndroid Build Coastguard Worker return m_v.vFloat;
167*35238bceSAndroid Build Coastguard Worker }
168*35238bceSAndroid Build Coastguard Worker
getUintAccess(void)169*35238bceSAndroid Build Coastguard Worker glw::GLuint &QueriedState::getUintAccess(void)
170*35238bceSAndroid Build Coastguard Worker {
171*35238bceSAndroid Build Coastguard Worker DE_ASSERT(m_type == DATATYPE_UNSIGNED_INTEGER);
172*35238bceSAndroid Build Coastguard Worker return m_v.vUint;
173*35238bceSAndroid Build Coastguard Worker }
174*35238bceSAndroid Build Coastguard Worker
getIntVec3Access(void)175*35238bceSAndroid Build Coastguard Worker QueriedState::GLIntVec3 &QueriedState::getIntVec3Access(void)
176*35238bceSAndroid Build Coastguard Worker {
177*35238bceSAndroid Build Coastguard Worker DE_ASSERT(m_type == DATATYPE_INTEGER_VEC3);
178*35238bceSAndroid Build Coastguard Worker return m_v.vIntVec3;
179*35238bceSAndroid Build Coastguard Worker }
180*35238bceSAndroid Build Coastguard Worker
getPtrAccess(void)181*35238bceSAndroid Build Coastguard Worker void *&QueriedState::getPtrAccess(void)
182*35238bceSAndroid Build Coastguard Worker {
183*35238bceSAndroid Build Coastguard Worker DE_ASSERT(m_type == DATATYPE_POINTER);
184*35238bceSAndroid Build Coastguard Worker return m_v.vPtr;
185*35238bceSAndroid Build Coastguard Worker }
186*35238bceSAndroid Build Coastguard Worker
getIntVec4Access(void)187*35238bceSAndroid Build Coastguard Worker QueriedState::GLIntVec4 &QueriedState::getIntVec4Access(void)
188*35238bceSAndroid Build Coastguard Worker {
189*35238bceSAndroid Build Coastguard Worker DE_ASSERT(m_type == DATATYPE_INTEGER_VEC4);
190*35238bceSAndroid Build Coastguard Worker return m_v.vIntVec4;
191*35238bceSAndroid Build Coastguard Worker }
192*35238bceSAndroid Build Coastguard Worker
getUintVec4Access(void)193*35238bceSAndroid Build Coastguard Worker QueriedState::GLUintVec4 &QueriedState::getUintVec4Access(void)
194*35238bceSAndroid Build Coastguard Worker {
195*35238bceSAndroid Build Coastguard Worker DE_ASSERT(m_type == DATATYPE_UNSIGNED_INTEGER_VEC4);
196*35238bceSAndroid Build Coastguard Worker return m_v.vUintVec4;
197*35238bceSAndroid Build Coastguard Worker }
198*35238bceSAndroid Build Coastguard Worker
getFloatVec4Access(void)199*35238bceSAndroid Build Coastguard Worker QueriedState::GLFloatVec4 &QueriedState::getFloatVec4Access(void)
200*35238bceSAndroid Build Coastguard Worker {
201*35238bceSAndroid Build Coastguard Worker DE_ASSERT(m_type == DATATYPE_FLOAT_VEC4);
202*35238bceSAndroid Build Coastguard Worker return m_v.vFloatVec4;
203*35238bceSAndroid Build Coastguard Worker }
204*35238bceSAndroid Build Coastguard Worker
getBooleanVec4Access(void)205*35238bceSAndroid Build Coastguard Worker QueriedState::BooleanVec4 &QueriedState::getBooleanVec4Access(void)
206*35238bceSAndroid Build Coastguard Worker {
207*35238bceSAndroid Build Coastguard Worker DE_ASSERT(m_type == DATATYPE_BOOLEAN_VEC4);
208*35238bceSAndroid Build Coastguard Worker return m_v.vBooleanVec4;
209*35238bceSAndroid Build Coastguard Worker }
210*35238bceSAndroid Build Coastguard Worker
getInt64Vec4Access(void)211*35238bceSAndroid Build Coastguard Worker QueriedState::GLInt64Vec4 &QueriedState::getInt64Vec4Access(void)
212*35238bceSAndroid Build Coastguard Worker {
213*35238bceSAndroid Build Coastguard Worker DE_ASSERT(m_type == DATATYPE_INTEGER64_VEC4);
214*35238bceSAndroid Build Coastguard Worker return m_v.vInt64Vec4;
215*35238bceSAndroid Build Coastguard Worker }
216*35238bceSAndroid Build Coastguard Worker
217*35238bceSAndroid Build Coastguard Worker // query
218*35238bceSAndroid Build Coastguard Worker
verifyBooleanValidity(tcu::ResultCollector & result,glw::GLboolean v)219*35238bceSAndroid Build Coastguard Worker static bool verifyBooleanValidity(tcu::ResultCollector &result, glw::GLboolean v)
220*35238bceSAndroid Build Coastguard Worker {
221*35238bceSAndroid Build Coastguard Worker if (v == GL_TRUE || v == GL_FALSE)
222*35238bceSAndroid Build Coastguard Worker return true;
223*35238bceSAndroid Build Coastguard Worker else
224*35238bceSAndroid Build Coastguard Worker {
225*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
226*35238bceSAndroid Build Coastguard Worker buf << "Boolean value was not neither GL_TRUE nor GL_FALSE, got " << de::toString(tcu::Format::Hex<2>(v));
227*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
228*35238bceSAndroid Build Coastguard Worker return false;
229*35238bceSAndroid Build Coastguard Worker }
230*35238bceSAndroid Build Coastguard Worker }
231*35238bceSAndroid Build Coastguard Worker
verifyBooleanVec4Validity(tcu::ResultCollector & result,const glw::GLboolean v[4])232*35238bceSAndroid Build Coastguard Worker static bool verifyBooleanVec4Validity(tcu::ResultCollector &result, const glw::GLboolean v[4])
233*35238bceSAndroid Build Coastguard Worker {
234*35238bceSAndroid Build Coastguard Worker bool valid = true;
235*35238bceSAndroid Build Coastguard Worker
236*35238bceSAndroid Build Coastguard Worker for (int i = 0; i < 4; i++)
237*35238bceSAndroid Build Coastguard Worker {
238*35238bceSAndroid Build Coastguard Worker if (v[i] != GL_TRUE && v[i] != GL_FALSE)
239*35238bceSAndroid Build Coastguard Worker valid = false;
240*35238bceSAndroid Build Coastguard Worker }
241*35238bceSAndroid Build Coastguard Worker
242*35238bceSAndroid Build Coastguard Worker if (!valid)
243*35238bceSAndroid Build Coastguard Worker {
244*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
245*35238bceSAndroid Build Coastguard Worker buf << "Boolean vec4 value was not neither GL_TRUE nor GL_FALSE, got (";
246*35238bceSAndroid Build Coastguard Worker
247*35238bceSAndroid Build Coastguard Worker for (int i = 0; i < 4; i++)
248*35238bceSAndroid Build Coastguard Worker buf << (i > 0 ? ", " : "") << de::toString(tcu::Format::Hex<2>(v[i]));
249*35238bceSAndroid Build Coastguard Worker
250*35238bceSAndroid Build Coastguard Worker buf << ")";
251*35238bceSAndroid Build Coastguard Worker
252*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
253*35238bceSAndroid Build Coastguard Worker }
254*35238bceSAndroid Build Coastguard Worker
255*35238bceSAndroid Build Coastguard Worker return valid;
256*35238bceSAndroid Build Coastguard Worker }
257*35238bceSAndroid Build Coastguard Worker
queryState(tcu::ResultCollector & result,glu::CallLogWrapper & gl,QueryType type,glw::GLenum target,QueriedState & state)258*35238bceSAndroid Build Coastguard Worker void queryState(tcu::ResultCollector &result, glu::CallLogWrapper &gl, QueryType type, glw::GLenum target,
259*35238bceSAndroid Build Coastguard Worker QueriedState &state)
260*35238bceSAndroid Build Coastguard Worker {
261*35238bceSAndroid Build Coastguard Worker switch (type)
262*35238bceSAndroid Build Coastguard Worker {
263*35238bceSAndroid Build Coastguard Worker case QUERY_ISENABLED:
264*35238bceSAndroid Build Coastguard Worker {
265*35238bceSAndroid Build Coastguard Worker const glw::GLboolean value = gl.glIsEnabled(target);
266*35238bceSAndroid Build Coastguard Worker
267*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glIsEnabled"))
268*35238bceSAndroid Build Coastguard Worker return;
269*35238bceSAndroid Build Coastguard Worker
270*35238bceSAndroid Build Coastguard Worker if (!verifyBooleanValidity(result, value))
271*35238bceSAndroid Build Coastguard Worker return;
272*35238bceSAndroid Build Coastguard Worker
273*35238bceSAndroid Build Coastguard Worker state = QueriedState(value == GL_TRUE);
274*35238bceSAndroid Build Coastguard Worker break;
275*35238bceSAndroid Build Coastguard Worker }
276*35238bceSAndroid Build Coastguard Worker
277*35238bceSAndroid Build Coastguard Worker case QUERY_BOOLEAN:
278*35238bceSAndroid Build Coastguard Worker {
279*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLboolean> value;
280*35238bceSAndroid Build Coastguard Worker gl.glGetBooleanv(target, &value);
281*35238bceSAndroid Build Coastguard Worker
282*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetBooleanv"))
283*35238bceSAndroid Build Coastguard Worker return;
284*35238bceSAndroid Build Coastguard Worker
285*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
286*35238bceSAndroid Build Coastguard Worker return;
287*35238bceSAndroid Build Coastguard Worker if (!verifyBooleanValidity(result, value))
288*35238bceSAndroid Build Coastguard Worker return;
289*35238bceSAndroid Build Coastguard Worker
290*35238bceSAndroid Build Coastguard Worker state = QueriedState(value == GL_TRUE);
291*35238bceSAndroid Build Coastguard Worker break;
292*35238bceSAndroid Build Coastguard Worker }
293*35238bceSAndroid Build Coastguard Worker
294*35238bceSAndroid Build Coastguard Worker case QUERY_INTEGER:
295*35238bceSAndroid Build Coastguard Worker {
296*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLint> value;
297*35238bceSAndroid Build Coastguard Worker gl.glGetIntegerv(target, &value);
298*35238bceSAndroid Build Coastguard Worker
299*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetIntegerv"))
300*35238bceSAndroid Build Coastguard Worker return;
301*35238bceSAndroid Build Coastguard Worker
302*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
303*35238bceSAndroid Build Coastguard Worker return;
304*35238bceSAndroid Build Coastguard Worker
305*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
306*35238bceSAndroid Build Coastguard Worker break;
307*35238bceSAndroid Build Coastguard Worker }
308*35238bceSAndroid Build Coastguard Worker
309*35238bceSAndroid Build Coastguard Worker case QUERY_INTEGER64:
310*35238bceSAndroid Build Coastguard Worker {
311*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLint64> value;
312*35238bceSAndroid Build Coastguard Worker gl.glGetInteger64v(target, &value);
313*35238bceSAndroid Build Coastguard Worker
314*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetInteger64v"))
315*35238bceSAndroid Build Coastguard Worker return;
316*35238bceSAndroid Build Coastguard Worker
317*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
318*35238bceSAndroid Build Coastguard Worker return;
319*35238bceSAndroid Build Coastguard Worker
320*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
321*35238bceSAndroid Build Coastguard Worker break;
322*35238bceSAndroid Build Coastguard Worker }
323*35238bceSAndroid Build Coastguard Worker
324*35238bceSAndroid Build Coastguard Worker case QUERY_FLOAT:
325*35238bceSAndroid Build Coastguard Worker {
326*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLfloat> value;
327*35238bceSAndroid Build Coastguard Worker gl.glGetFloatv(target, &value);
328*35238bceSAndroid Build Coastguard Worker
329*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetFloatv"))
330*35238bceSAndroid Build Coastguard Worker return;
331*35238bceSAndroid Build Coastguard Worker
332*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
333*35238bceSAndroid Build Coastguard Worker return;
334*35238bceSAndroid Build Coastguard Worker
335*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
336*35238bceSAndroid Build Coastguard Worker break;
337*35238bceSAndroid Build Coastguard Worker }
338*35238bceSAndroid Build Coastguard Worker
339*35238bceSAndroid Build Coastguard Worker default:
340*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
341*35238bceSAndroid Build Coastguard Worker break;
342*35238bceSAndroid Build Coastguard Worker }
343*35238bceSAndroid Build Coastguard Worker }
344*35238bceSAndroid Build Coastguard Worker
queryIndexedState(tcu::ResultCollector & result,glu::CallLogWrapper & gl,QueryType type,glw::GLenum target,int index,QueriedState & state)345*35238bceSAndroid Build Coastguard Worker void queryIndexedState(tcu::ResultCollector &result, glu::CallLogWrapper &gl, QueryType type, glw::GLenum target,
346*35238bceSAndroid Build Coastguard Worker int index, QueriedState &state)
347*35238bceSAndroid Build Coastguard Worker {
348*35238bceSAndroid Build Coastguard Worker switch (type)
349*35238bceSAndroid Build Coastguard Worker {
350*35238bceSAndroid Build Coastguard Worker case QUERY_INDEXED_BOOLEAN_VEC4:
351*35238bceSAndroid Build Coastguard Worker {
352*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLboolean[4]> value;
353*35238bceSAndroid Build Coastguard Worker gl.glGetBooleani_v(target, index, value);
354*35238bceSAndroid Build Coastguard Worker
355*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetBooleani_v"))
356*35238bceSAndroid Build Coastguard Worker return;
357*35238bceSAndroid Build Coastguard Worker
358*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
359*35238bceSAndroid Build Coastguard Worker return;
360*35238bceSAndroid Build Coastguard Worker
361*35238bceSAndroid Build Coastguard Worker if (!verifyBooleanVec4Validity(result, value))
362*35238bceSAndroid Build Coastguard Worker return;
363*35238bceSAndroid Build Coastguard Worker
364*35238bceSAndroid Build Coastguard Worker {
365*35238bceSAndroid Build Coastguard Worker bool res[4];
366*35238bceSAndroid Build Coastguard Worker
367*35238bceSAndroid Build Coastguard Worker for (int i = 0; i < 4; i++)
368*35238bceSAndroid Build Coastguard Worker res[i] = value[i] == GL_TRUE;
369*35238bceSAndroid Build Coastguard Worker
370*35238bceSAndroid Build Coastguard Worker state = QueriedState(res);
371*35238bceSAndroid Build Coastguard Worker }
372*35238bceSAndroid Build Coastguard Worker
373*35238bceSAndroid Build Coastguard Worker break;
374*35238bceSAndroid Build Coastguard Worker }
375*35238bceSAndroid Build Coastguard Worker
376*35238bceSAndroid Build Coastguard Worker case QUERY_INDEXED_INTEGER_VEC4:
377*35238bceSAndroid Build Coastguard Worker {
378*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLint[4]> value;
379*35238bceSAndroid Build Coastguard Worker gl.glGetIntegeri_v(target, index, value);
380*35238bceSAndroid Build Coastguard Worker
381*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetIntegeri_v"))
382*35238bceSAndroid Build Coastguard Worker return;
383*35238bceSAndroid Build Coastguard Worker
384*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
385*35238bceSAndroid Build Coastguard Worker return;
386*35238bceSAndroid Build Coastguard Worker
387*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
388*35238bceSAndroid Build Coastguard Worker break;
389*35238bceSAndroid Build Coastguard Worker }
390*35238bceSAndroid Build Coastguard Worker
391*35238bceSAndroid Build Coastguard Worker case QUERY_INDEXED_INTEGER64_VEC4:
392*35238bceSAndroid Build Coastguard Worker {
393*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLint64[4]> value;
394*35238bceSAndroid Build Coastguard Worker gl.glGetInteger64i_v(target, index, value);
395*35238bceSAndroid Build Coastguard Worker
396*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetInteger64i_v"))
397*35238bceSAndroid Build Coastguard Worker return;
398*35238bceSAndroid Build Coastguard Worker
399*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
400*35238bceSAndroid Build Coastguard Worker return;
401*35238bceSAndroid Build Coastguard Worker
402*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
403*35238bceSAndroid Build Coastguard Worker break;
404*35238bceSAndroid Build Coastguard Worker }
405*35238bceSAndroid Build Coastguard Worker
406*35238bceSAndroid Build Coastguard Worker case QUERY_INDEXED_ISENABLED:
407*35238bceSAndroid Build Coastguard Worker {
408*35238bceSAndroid Build Coastguard Worker const glw::GLboolean value = gl.glIsEnabledi(target, index);
409*35238bceSAndroid Build Coastguard Worker
410*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glIsEnabledi"))
411*35238bceSAndroid Build Coastguard Worker return;
412*35238bceSAndroid Build Coastguard Worker
413*35238bceSAndroid Build Coastguard Worker if (!verifyBooleanValidity(result, value))
414*35238bceSAndroid Build Coastguard Worker return;
415*35238bceSAndroid Build Coastguard Worker
416*35238bceSAndroid Build Coastguard Worker state = QueriedState(value == GL_TRUE);
417*35238bceSAndroid Build Coastguard Worker break;
418*35238bceSAndroid Build Coastguard Worker }
419*35238bceSAndroid Build Coastguard Worker
420*35238bceSAndroid Build Coastguard Worker case QUERY_INDEXED_BOOLEAN:
421*35238bceSAndroid Build Coastguard Worker {
422*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLboolean> value;
423*35238bceSAndroid Build Coastguard Worker gl.glGetBooleani_v(target, index, &value);
424*35238bceSAndroid Build Coastguard Worker
425*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetBooleani_v"))
426*35238bceSAndroid Build Coastguard Worker return;
427*35238bceSAndroid Build Coastguard Worker
428*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
429*35238bceSAndroid Build Coastguard Worker return;
430*35238bceSAndroid Build Coastguard Worker if (!verifyBooleanValidity(result, value))
431*35238bceSAndroid Build Coastguard Worker return;
432*35238bceSAndroid Build Coastguard Worker
433*35238bceSAndroid Build Coastguard Worker state = QueriedState(value == GL_TRUE);
434*35238bceSAndroid Build Coastguard Worker break;
435*35238bceSAndroid Build Coastguard Worker }
436*35238bceSAndroid Build Coastguard Worker
437*35238bceSAndroid Build Coastguard Worker case QUERY_INDEXED_INTEGER:
438*35238bceSAndroid Build Coastguard Worker {
439*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLint> value;
440*35238bceSAndroid Build Coastguard Worker gl.glGetIntegeri_v(target, index, &value);
441*35238bceSAndroid Build Coastguard Worker
442*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetIntegeri_v"))
443*35238bceSAndroid Build Coastguard Worker return;
444*35238bceSAndroid Build Coastguard Worker
445*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
446*35238bceSAndroid Build Coastguard Worker return;
447*35238bceSAndroid Build Coastguard Worker
448*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
449*35238bceSAndroid Build Coastguard Worker break;
450*35238bceSAndroid Build Coastguard Worker }
451*35238bceSAndroid Build Coastguard Worker
452*35238bceSAndroid Build Coastguard Worker case QUERY_INDEXED_INTEGER64:
453*35238bceSAndroid Build Coastguard Worker {
454*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLint64> value;
455*35238bceSAndroid Build Coastguard Worker gl.glGetInteger64i_v(target, index, &value);
456*35238bceSAndroid Build Coastguard Worker
457*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetInteger64i_v"))
458*35238bceSAndroid Build Coastguard Worker return;
459*35238bceSAndroid Build Coastguard Worker
460*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
461*35238bceSAndroid Build Coastguard Worker return;
462*35238bceSAndroid Build Coastguard Worker
463*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
464*35238bceSAndroid Build Coastguard Worker break;
465*35238bceSAndroid Build Coastguard Worker }
466*35238bceSAndroid Build Coastguard Worker
467*35238bceSAndroid Build Coastguard Worker default:
468*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
469*35238bceSAndroid Build Coastguard Worker break;
470*35238bceSAndroid Build Coastguard Worker }
471*35238bceSAndroid Build Coastguard Worker }
472*35238bceSAndroid Build Coastguard Worker
queryAttributeState(tcu::ResultCollector & result,glu::CallLogWrapper & gl,QueryType type,glw::GLenum target,int index,QueriedState & state)473*35238bceSAndroid Build Coastguard Worker void queryAttributeState(tcu::ResultCollector &result, glu::CallLogWrapper &gl, QueryType type, glw::GLenum target,
474*35238bceSAndroid Build Coastguard Worker int index, QueriedState &state)
475*35238bceSAndroid Build Coastguard Worker {
476*35238bceSAndroid Build Coastguard Worker switch (type)
477*35238bceSAndroid Build Coastguard Worker {
478*35238bceSAndroid Build Coastguard Worker case QUERY_ATTRIBUTE_INTEGER:
479*35238bceSAndroid Build Coastguard Worker {
480*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLint> value;
481*35238bceSAndroid Build Coastguard Worker gl.glGetVertexAttribiv(index, target, &value);
482*35238bceSAndroid Build Coastguard Worker
483*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetVertexAttribiv"))
484*35238bceSAndroid Build Coastguard Worker return;
485*35238bceSAndroid Build Coastguard Worker
486*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
487*35238bceSAndroid Build Coastguard Worker return;
488*35238bceSAndroid Build Coastguard Worker
489*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
490*35238bceSAndroid Build Coastguard Worker break;
491*35238bceSAndroid Build Coastguard Worker }
492*35238bceSAndroid Build Coastguard Worker case QUERY_ATTRIBUTE_FLOAT:
493*35238bceSAndroid Build Coastguard Worker {
494*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLfloat> value;
495*35238bceSAndroid Build Coastguard Worker gl.glGetVertexAttribfv(index, target, &value);
496*35238bceSAndroid Build Coastguard Worker
497*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetVertexAttribfv"))
498*35238bceSAndroid Build Coastguard Worker return;
499*35238bceSAndroid Build Coastguard Worker
500*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
501*35238bceSAndroid Build Coastguard Worker return;
502*35238bceSAndroid Build Coastguard Worker
503*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
504*35238bceSAndroid Build Coastguard Worker break;
505*35238bceSAndroid Build Coastguard Worker }
506*35238bceSAndroid Build Coastguard Worker case QUERY_ATTRIBUTE_PURE_INTEGER:
507*35238bceSAndroid Build Coastguard Worker {
508*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLint> value;
509*35238bceSAndroid Build Coastguard Worker gl.glGetVertexAttribIiv(index, target, &value);
510*35238bceSAndroid Build Coastguard Worker
511*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetVertexAttribIiv"))
512*35238bceSAndroid Build Coastguard Worker return;
513*35238bceSAndroid Build Coastguard Worker
514*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
515*35238bceSAndroid Build Coastguard Worker return;
516*35238bceSAndroid Build Coastguard Worker
517*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
518*35238bceSAndroid Build Coastguard Worker break;
519*35238bceSAndroid Build Coastguard Worker }
520*35238bceSAndroid Build Coastguard Worker case QUERY_ATTRIBUTE_PURE_UNSIGNED_INTEGER:
521*35238bceSAndroid Build Coastguard Worker {
522*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLuint> value;
523*35238bceSAndroid Build Coastguard Worker gl.glGetVertexAttribIuiv(index, target, &value);
524*35238bceSAndroid Build Coastguard Worker
525*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetVertexAttribIuiv"))
526*35238bceSAndroid Build Coastguard Worker return;
527*35238bceSAndroid Build Coastguard Worker
528*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
529*35238bceSAndroid Build Coastguard Worker return;
530*35238bceSAndroid Build Coastguard Worker
531*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
532*35238bceSAndroid Build Coastguard Worker break;
533*35238bceSAndroid Build Coastguard Worker }
534*35238bceSAndroid Build Coastguard Worker default:
535*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
536*35238bceSAndroid Build Coastguard Worker }
537*35238bceSAndroid Build Coastguard Worker }
538*35238bceSAndroid Build Coastguard Worker
queryFramebufferState(tcu::ResultCollector & result,glu::CallLogWrapper & gl,QueryType type,glw::GLenum target,glw::GLenum pname,QueriedState & state)539*35238bceSAndroid Build Coastguard Worker void queryFramebufferState(tcu::ResultCollector &result, glu::CallLogWrapper &gl, QueryType type, glw::GLenum target,
540*35238bceSAndroid Build Coastguard Worker glw::GLenum pname, QueriedState &state)
541*35238bceSAndroid Build Coastguard Worker {
542*35238bceSAndroid Build Coastguard Worker switch (type)
543*35238bceSAndroid Build Coastguard Worker {
544*35238bceSAndroid Build Coastguard Worker case QUERY_FRAMEBUFFER_INTEGER:
545*35238bceSAndroid Build Coastguard Worker {
546*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLint> value;
547*35238bceSAndroid Build Coastguard Worker gl.glGetFramebufferParameteriv(target, pname, &value);
548*35238bceSAndroid Build Coastguard Worker
549*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetVertexAttribiv"))
550*35238bceSAndroid Build Coastguard Worker return;
551*35238bceSAndroid Build Coastguard Worker
552*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
553*35238bceSAndroid Build Coastguard Worker return;
554*35238bceSAndroid Build Coastguard Worker
555*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
556*35238bceSAndroid Build Coastguard Worker break;
557*35238bceSAndroid Build Coastguard Worker }
558*35238bceSAndroid Build Coastguard Worker default:
559*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
560*35238bceSAndroid Build Coastguard Worker }
561*35238bceSAndroid Build Coastguard Worker }
562*35238bceSAndroid Build Coastguard Worker
queryProgramState(tcu::ResultCollector & result,glu::CallLogWrapper & gl,QueryType type,glw::GLuint program,glw::GLenum pname,QueriedState & state)563*35238bceSAndroid Build Coastguard Worker void queryProgramState(tcu::ResultCollector &result, glu::CallLogWrapper &gl, QueryType type, glw::GLuint program,
564*35238bceSAndroid Build Coastguard Worker glw::GLenum pname, QueriedState &state)
565*35238bceSAndroid Build Coastguard Worker {
566*35238bceSAndroid Build Coastguard Worker switch (type)
567*35238bceSAndroid Build Coastguard Worker {
568*35238bceSAndroid Build Coastguard Worker case QUERY_PROGRAM_INTEGER:
569*35238bceSAndroid Build Coastguard Worker {
570*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLint> value;
571*35238bceSAndroid Build Coastguard Worker gl.glGetProgramiv(program, pname, &value);
572*35238bceSAndroid Build Coastguard Worker
573*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetProgramiv"))
574*35238bceSAndroid Build Coastguard Worker return;
575*35238bceSAndroid Build Coastguard Worker
576*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
577*35238bceSAndroid Build Coastguard Worker return;
578*35238bceSAndroid Build Coastguard Worker
579*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
580*35238bceSAndroid Build Coastguard Worker break;
581*35238bceSAndroid Build Coastguard Worker }
582*35238bceSAndroid Build Coastguard Worker case QUERY_PROGRAM_INTEGER_VEC3:
583*35238bceSAndroid Build Coastguard Worker {
584*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLint[3]> value;
585*35238bceSAndroid Build Coastguard Worker gl.glGetProgramiv(program, pname, value);
586*35238bceSAndroid Build Coastguard Worker
587*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetProgramiv"))
588*35238bceSAndroid Build Coastguard Worker return;
589*35238bceSAndroid Build Coastguard Worker
590*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
591*35238bceSAndroid Build Coastguard Worker return;
592*35238bceSAndroid Build Coastguard Worker
593*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
594*35238bceSAndroid Build Coastguard Worker break;
595*35238bceSAndroid Build Coastguard Worker }
596*35238bceSAndroid Build Coastguard Worker default:
597*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
598*35238bceSAndroid Build Coastguard Worker }
599*35238bceSAndroid Build Coastguard Worker }
600*35238bceSAndroid Build Coastguard Worker
queryPipelineState(tcu::ResultCollector & result,glu::CallLogWrapper & gl,QueryType type,glw::GLuint pipeline,glw::GLenum pname,QueriedState & state)601*35238bceSAndroid Build Coastguard Worker void queryPipelineState(tcu::ResultCollector &result, glu::CallLogWrapper &gl, QueryType type, glw::GLuint pipeline,
602*35238bceSAndroid Build Coastguard Worker glw::GLenum pname, QueriedState &state)
603*35238bceSAndroid Build Coastguard Worker {
604*35238bceSAndroid Build Coastguard Worker switch (type)
605*35238bceSAndroid Build Coastguard Worker {
606*35238bceSAndroid Build Coastguard Worker case QUERY_PIPELINE_INTEGER:
607*35238bceSAndroid Build Coastguard Worker {
608*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLint> value;
609*35238bceSAndroid Build Coastguard Worker gl.glGetProgramPipelineiv(pipeline, pname, &value);
610*35238bceSAndroid Build Coastguard Worker
611*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetProgramiv"))
612*35238bceSAndroid Build Coastguard Worker return;
613*35238bceSAndroid Build Coastguard Worker
614*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
615*35238bceSAndroid Build Coastguard Worker return;
616*35238bceSAndroid Build Coastguard Worker
617*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
618*35238bceSAndroid Build Coastguard Worker break;
619*35238bceSAndroid Build Coastguard Worker }
620*35238bceSAndroid Build Coastguard Worker default:
621*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
622*35238bceSAndroid Build Coastguard Worker }
623*35238bceSAndroid Build Coastguard Worker }
624*35238bceSAndroid Build Coastguard Worker
queryTextureParamState(tcu::ResultCollector & result,glu::CallLogWrapper & gl,QueryType type,glw::GLenum target,glw::GLenum pname,QueriedState & state)625*35238bceSAndroid Build Coastguard Worker void queryTextureParamState(tcu::ResultCollector &result, glu::CallLogWrapper &gl, QueryType type, glw::GLenum target,
626*35238bceSAndroid Build Coastguard Worker glw::GLenum pname, QueriedState &state)
627*35238bceSAndroid Build Coastguard Worker {
628*35238bceSAndroid Build Coastguard Worker switch (type)
629*35238bceSAndroid Build Coastguard Worker {
630*35238bceSAndroid Build Coastguard Worker case QUERY_TEXTURE_PARAM_INTEGER:
631*35238bceSAndroid Build Coastguard Worker {
632*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLint> value;
633*35238bceSAndroid Build Coastguard Worker gl.glGetTexParameteriv(target, pname, &value);
634*35238bceSAndroid Build Coastguard Worker
635*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetTexParameteriv"))
636*35238bceSAndroid Build Coastguard Worker return;
637*35238bceSAndroid Build Coastguard Worker
638*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
639*35238bceSAndroid Build Coastguard Worker return;
640*35238bceSAndroid Build Coastguard Worker
641*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
642*35238bceSAndroid Build Coastguard Worker break;
643*35238bceSAndroid Build Coastguard Worker }
644*35238bceSAndroid Build Coastguard Worker case QUERY_TEXTURE_PARAM_FLOAT:
645*35238bceSAndroid Build Coastguard Worker {
646*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLfloat> value;
647*35238bceSAndroid Build Coastguard Worker gl.glGetTexParameterfv(target, pname, &value);
648*35238bceSAndroid Build Coastguard Worker
649*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetTexParameterfv"))
650*35238bceSAndroid Build Coastguard Worker return;
651*35238bceSAndroid Build Coastguard Worker
652*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
653*35238bceSAndroid Build Coastguard Worker return;
654*35238bceSAndroid Build Coastguard Worker
655*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
656*35238bceSAndroid Build Coastguard Worker break;
657*35238bceSAndroid Build Coastguard Worker }
658*35238bceSAndroid Build Coastguard Worker case QUERY_TEXTURE_PARAM_PURE_INTEGER:
659*35238bceSAndroid Build Coastguard Worker {
660*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLint> value;
661*35238bceSAndroid Build Coastguard Worker gl.glGetTexParameterIiv(target, pname, &value);
662*35238bceSAndroid Build Coastguard Worker
663*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "GetTexParameterIiv"))
664*35238bceSAndroid Build Coastguard Worker return;
665*35238bceSAndroid Build Coastguard Worker
666*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
667*35238bceSAndroid Build Coastguard Worker return;
668*35238bceSAndroid Build Coastguard Worker
669*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
670*35238bceSAndroid Build Coastguard Worker break;
671*35238bceSAndroid Build Coastguard Worker }
672*35238bceSAndroid Build Coastguard Worker case QUERY_TEXTURE_PARAM_PURE_UNSIGNED_INTEGER:
673*35238bceSAndroid Build Coastguard Worker {
674*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLuint> value;
675*35238bceSAndroid Build Coastguard Worker gl.glGetTexParameterIuiv(target, pname, &value);
676*35238bceSAndroid Build Coastguard Worker
677*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "GetTexParameterIuiv"))
678*35238bceSAndroid Build Coastguard Worker return;
679*35238bceSAndroid Build Coastguard Worker
680*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
681*35238bceSAndroid Build Coastguard Worker return;
682*35238bceSAndroid Build Coastguard Worker
683*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
684*35238bceSAndroid Build Coastguard Worker break;
685*35238bceSAndroid Build Coastguard Worker }
686*35238bceSAndroid Build Coastguard Worker case QUERY_TEXTURE_PARAM_INTEGER_VEC4:
687*35238bceSAndroid Build Coastguard Worker {
688*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLint[4]> value;
689*35238bceSAndroid Build Coastguard Worker gl.glGetTexParameteriv(target, pname, value);
690*35238bceSAndroid Build Coastguard Worker
691*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetTexParameteriv"))
692*35238bceSAndroid Build Coastguard Worker return;
693*35238bceSAndroid Build Coastguard Worker
694*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
695*35238bceSAndroid Build Coastguard Worker return;
696*35238bceSAndroid Build Coastguard Worker
697*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
698*35238bceSAndroid Build Coastguard Worker break;
699*35238bceSAndroid Build Coastguard Worker }
700*35238bceSAndroid Build Coastguard Worker case QUERY_TEXTURE_PARAM_FLOAT_VEC4:
701*35238bceSAndroid Build Coastguard Worker {
702*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLfloat[4]> value;
703*35238bceSAndroid Build Coastguard Worker gl.glGetTexParameterfv(target, pname, value);
704*35238bceSAndroid Build Coastguard Worker
705*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetTexParameterfv"))
706*35238bceSAndroid Build Coastguard Worker return;
707*35238bceSAndroid Build Coastguard Worker
708*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
709*35238bceSAndroid Build Coastguard Worker return;
710*35238bceSAndroid Build Coastguard Worker
711*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
712*35238bceSAndroid Build Coastguard Worker break;
713*35238bceSAndroid Build Coastguard Worker }
714*35238bceSAndroid Build Coastguard Worker case QUERY_TEXTURE_PARAM_PURE_INTEGER_VEC4:
715*35238bceSAndroid Build Coastguard Worker {
716*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLint[4]> value;
717*35238bceSAndroid Build Coastguard Worker gl.glGetTexParameterIiv(target, pname, value);
718*35238bceSAndroid Build Coastguard Worker
719*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "GetTexParameterIiv"))
720*35238bceSAndroid Build Coastguard Worker return;
721*35238bceSAndroid Build Coastguard Worker
722*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
723*35238bceSAndroid Build Coastguard Worker return;
724*35238bceSAndroid Build Coastguard Worker
725*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
726*35238bceSAndroid Build Coastguard Worker break;
727*35238bceSAndroid Build Coastguard Worker }
728*35238bceSAndroid Build Coastguard Worker case QUERY_TEXTURE_PARAM_PURE_UNSIGNED_INTEGER_VEC4:
729*35238bceSAndroid Build Coastguard Worker {
730*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLuint[4]> value;
731*35238bceSAndroid Build Coastguard Worker gl.glGetTexParameterIuiv(target, pname, value);
732*35238bceSAndroid Build Coastguard Worker
733*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "GetTexParameterIuiv"))
734*35238bceSAndroid Build Coastguard Worker return;
735*35238bceSAndroid Build Coastguard Worker
736*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
737*35238bceSAndroid Build Coastguard Worker return;
738*35238bceSAndroid Build Coastguard Worker
739*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
740*35238bceSAndroid Build Coastguard Worker break;
741*35238bceSAndroid Build Coastguard Worker }
742*35238bceSAndroid Build Coastguard Worker default:
743*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
744*35238bceSAndroid Build Coastguard Worker }
745*35238bceSAndroid Build Coastguard Worker }
746*35238bceSAndroid Build Coastguard Worker
queryTextureLevelState(tcu::ResultCollector & result,glu::CallLogWrapper & gl,QueryType type,glw::GLenum target,int level,glw::GLenum pname,QueriedState & state)747*35238bceSAndroid Build Coastguard Worker void queryTextureLevelState(tcu::ResultCollector &result, glu::CallLogWrapper &gl, QueryType type, glw::GLenum target,
748*35238bceSAndroid Build Coastguard Worker int level, glw::GLenum pname, QueriedState &state)
749*35238bceSAndroid Build Coastguard Worker {
750*35238bceSAndroid Build Coastguard Worker switch (type)
751*35238bceSAndroid Build Coastguard Worker {
752*35238bceSAndroid Build Coastguard Worker case QUERY_TEXTURE_LEVEL_INTEGER:
753*35238bceSAndroid Build Coastguard Worker {
754*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLint> value;
755*35238bceSAndroid Build Coastguard Worker gl.glGetTexLevelParameteriv(target, level, pname, &value);
756*35238bceSAndroid Build Coastguard Worker
757*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetTexLevelParameteriv"))
758*35238bceSAndroid Build Coastguard Worker return;
759*35238bceSAndroid Build Coastguard Worker
760*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
761*35238bceSAndroid Build Coastguard Worker return;
762*35238bceSAndroid Build Coastguard Worker
763*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
764*35238bceSAndroid Build Coastguard Worker break;
765*35238bceSAndroid Build Coastguard Worker }
766*35238bceSAndroid Build Coastguard Worker case QUERY_TEXTURE_LEVEL_FLOAT:
767*35238bceSAndroid Build Coastguard Worker {
768*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLfloat> value;
769*35238bceSAndroid Build Coastguard Worker gl.glGetTexLevelParameterfv(target, level, pname, &value);
770*35238bceSAndroid Build Coastguard Worker
771*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetTexLevelParameterfv"))
772*35238bceSAndroid Build Coastguard Worker return;
773*35238bceSAndroid Build Coastguard Worker
774*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
775*35238bceSAndroid Build Coastguard Worker return;
776*35238bceSAndroid Build Coastguard Worker
777*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
778*35238bceSAndroid Build Coastguard Worker break;
779*35238bceSAndroid Build Coastguard Worker }
780*35238bceSAndroid Build Coastguard Worker default:
781*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
782*35238bceSAndroid Build Coastguard Worker }
783*35238bceSAndroid Build Coastguard Worker }
784*35238bceSAndroid Build Coastguard Worker
queryPointerState(tcu::ResultCollector & result,glu::CallLogWrapper & gl,QueryType type,glw::GLenum pname,QueriedState & state)785*35238bceSAndroid Build Coastguard Worker void queryPointerState(tcu::ResultCollector &result, glu::CallLogWrapper &gl, QueryType type, glw::GLenum pname,
786*35238bceSAndroid Build Coastguard Worker QueriedState &state)
787*35238bceSAndroid Build Coastguard Worker {
788*35238bceSAndroid Build Coastguard Worker switch (type)
789*35238bceSAndroid Build Coastguard Worker {
790*35238bceSAndroid Build Coastguard Worker case QUERY_POINTER:
791*35238bceSAndroid Build Coastguard Worker {
792*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<void *> value;
793*35238bceSAndroid Build Coastguard Worker gl.glGetPointerv(pname, &value);
794*35238bceSAndroid Build Coastguard Worker
795*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetPointerv"))
796*35238bceSAndroid Build Coastguard Worker return;
797*35238bceSAndroid Build Coastguard Worker
798*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
799*35238bceSAndroid Build Coastguard Worker return;
800*35238bceSAndroid Build Coastguard Worker
801*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
802*35238bceSAndroid Build Coastguard Worker break;
803*35238bceSAndroid Build Coastguard Worker }
804*35238bceSAndroid Build Coastguard Worker default:
805*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
806*35238bceSAndroid Build Coastguard Worker }
807*35238bceSAndroid Build Coastguard Worker }
808*35238bceSAndroid Build Coastguard Worker
queryObjectState(tcu::ResultCollector & result,glu::CallLogWrapper & gl,QueryType type,glw::GLuint handle,QueriedState & state)809*35238bceSAndroid Build Coastguard Worker void queryObjectState(tcu::ResultCollector &result, glu::CallLogWrapper &gl, QueryType type, glw::GLuint handle,
810*35238bceSAndroid Build Coastguard Worker QueriedState &state)
811*35238bceSAndroid Build Coastguard Worker {
812*35238bceSAndroid Build Coastguard Worker switch (type)
813*35238bceSAndroid Build Coastguard Worker {
814*35238bceSAndroid Build Coastguard Worker case QUERY_ISTEXTURE:
815*35238bceSAndroid Build Coastguard Worker {
816*35238bceSAndroid Build Coastguard Worker const glw::GLboolean value = gl.glIsTexture(handle);
817*35238bceSAndroid Build Coastguard Worker
818*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glIsTexture"))
819*35238bceSAndroid Build Coastguard Worker return;
820*35238bceSAndroid Build Coastguard Worker
821*35238bceSAndroid Build Coastguard Worker if (!verifyBooleanValidity(result, value))
822*35238bceSAndroid Build Coastguard Worker return;
823*35238bceSAndroid Build Coastguard Worker
824*35238bceSAndroid Build Coastguard Worker state = QueriedState(value == GL_TRUE);
825*35238bceSAndroid Build Coastguard Worker break;
826*35238bceSAndroid Build Coastguard Worker }
827*35238bceSAndroid Build Coastguard Worker default:
828*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
829*35238bceSAndroid Build Coastguard Worker }
830*35238bceSAndroid Build Coastguard Worker }
831*35238bceSAndroid Build Coastguard Worker
queryQueryState(tcu::ResultCollector & result,glu::CallLogWrapper & gl,QueryType type,glw::GLenum target,glw::GLenum pname,QueriedState & state)832*35238bceSAndroid Build Coastguard Worker void queryQueryState(tcu::ResultCollector &result, glu::CallLogWrapper &gl, QueryType type, glw::GLenum target,
833*35238bceSAndroid Build Coastguard Worker glw::GLenum pname, QueriedState &state)
834*35238bceSAndroid Build Coastguard Worker {
835*35238bceSAndroid Build Coastguard Worker switch (type)
836*35238bceSAndroid Build Coastguard Worker {
837*35238bceSAndroid Build Coastguard Worker case QUERY_QUERY:
838*35238bceSAndroid Build Coastguard Worker {
839*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLint> value;
840*35238bceSAndroid Build Coastguard Worker gl.glGetQueryiv(target, pname, &value);
841*35238bceSAndroid Build Coastguard Worker
842*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetQueryiv"))
843*35238bceSAndroid Build Coastguard Worker return;
844*35238bceSAndroid Build Coastguard Worker
845*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
846*35238bceSAndroid Build Coastguard Worker return;
847*35238bceSAndroid Build Coastguard Worker
848*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
849*35238bceSAndroid Build Coastguard Worker break;
850*35238bceSAndroid Build Coastguard Worker }
851*35238bceSAndroid Build Coastguard Worker default:
852*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
853*35238bceSAndroid Build Coastguard Worker }
854*35238bceSAndroid Build Coastguard Worker }
855*35238bceSAndroid Build Coastguard Worker
querySamplerState(tcu::ResultCollector & result,glu::CallLogWrapper & gl,QueryType type,glw::GLuint sampler,glw::GLenum pname,QueriedState & state)856*35238bceSAndroid Build Coastguard Worker void querySamplerState(tcu::ResultCollector &result, glu::CallLogWrapper &gl, QueryType type, glw::GLuint sampler,
857*35238bceSAndroid Build Coastguard Worker glw::GLenum pname, QueriedState &state)
858*35238bceSAndroid Build Coastguard Worker {
859*35238bceSAndroid Build Coastguard Worker switch (type)
860*35238bceSAndroid Build Coastguard Worker {
861*35238bceSAndroid Build Coastguard Worker case QUERY_SAMPLER_PARAM_INTEGER:
862*35238bceSAndroid Build Coastguard Worker {
863*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLint> value;
864*35238bceSAndroid Build Coastguard Worker gl.glGetSamplerParameteriv(sampler, pname, &value);
865*35238bceSAndroid Build Coastguard Worker
866*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetSamplerParameteriv"))
867*35238bceSAndroid Build Coastguard Worker return;
868*35238bceSAndroid Build Coastguard Worker
869*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
870*35238bceSAndroid Build Coastguard Worker return;
871*35238bceSAndroid Build Coastguard Worker
872*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
873*35238bceSAndroid Build Coastguard Worker break;
874*35238bceSAndroid Build Coastguard Worker }
875*35238bceSAndroid Build Coastguard Worker case QUERY_SAMPLER_PARAM_FLOAT:
876*35238bceSAndroid Build Coastguard Worker {
877*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLfloat> value;
878*35238bceSAndroid Build Coastguard Worker gl.glGetSamplerParameterfv(sampler, pname, &value);
879*35238bceSAndroid Build Coastguard Worker
880*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetSamplerParameteriv"))
881*35238bceSAndroid Build Coastguard Worker return;
882*35238bceSAndroid Build Coastguard Worker
883*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
884*35238bceSAndroid Build Coastguard Worker return;
885*35238bceSAndroid Build Coastguard Worker
886*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
887*35238bceSAndroid Build Coastguard Worker break;
888*35238bceSAndroid Build Coastguard Worker }
889*35238bceSAndroid Build Coastguard Worker case QUERY_SAMPLER_PARAM_PURE_INTEGER:
890*35238bceSAndroid Build Coastguard Worker {
891*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLint> value;
892*35238bceSAndroid Build Coastguard Worker gl.glGetSamplerParameterIiv(sampler, pname, &value);
893*35238bceSAndroid Build Coastguard Worker
894*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetSamplerParameterIiv"))
895*35238bceSAndroid Build Coastguard Worker return;
896*35238bceSAndroid Build Coastguard Worker
897*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
898*35238bceSAndroid Build Coastguard Worker return;
899*35238bceSAndroid Build Coastguard Worker
900*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
901*35238bceSAndroid Build Coastguard Worker break;
902*35238bceSAndroid Build Coastguard Worker }
903*35238bceSAndroid Build Coastguard Worker case QUERY_SAMPLER_PARAM_PURE_UNSIGNED_INTEGER:
904*35238bceSAndroid Build Coastguard Worker {
905*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLuint> value;
906*35238bceSAndroid Build Coastguard Worker gl.glGetSamplerParameterIuiv(sampler, pname, &value);
907*35238bceSAndroid Build Coastguard Worker
908*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetSamplerParameterIuiv"))
909*35238bceSAndroid Build Coastguard Worker return;
910*35238bceSAndroid Build Coastguard Worker
911*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
912*35238bceSAndroid Build Coastguard Worker return;
913*35238bceSAndroid Build Coastguard Worker
914*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
915*35238bceSAndroid Build Coastguard Worker break;
916*35238bceSAndroid Build Coastguard Worker }
917*35238bceSAndroid Build Coastguard Worker case QUERY_SAMPLER_PARAM_INTEGER_VEC4:
918*35238bceSAndroid Build Coastguard Worker {
919*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLint[4]> value;
920*35238bceSAndroid Build Coastguard Worker gl.glGetSamplerParameteriv(sampler, pname, value);
921*35238bceSAndroid Build Coastguard Worker
922*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetSamplerParameteriv"))
923*35238bceSAndroid Build Coastguard Worker return;
924*35238bceSAndroid Build Coastguard Worker
925*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
926*35238bceSAndroid Build Coastguard Worker return;
927*35238bceSAndroid Build Coastguard Worker
928*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
929*35238bceSAndroid Build Coastguard Worker break;
930*35238bceSAndroid Build Coastguard Worker }
931*35238bceSAndroid Build Coastguard Worker case QUERY_SAMPLER_PARAM_FLOAT_VEC4:
932*35238bceSAndroid Build Coastguard Worker {
933*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLfloat[4]> value;
934*35238bceSAndroid Build Coastguard Worker gl.glGetSamplerParameterfv(sampler, pname, value);
935*35238bceSAndroid Build Coastguard Worker
936*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetSamplerParameteriv"))
937*35238bceSAndroid Build Coastguard Worker return;
938*35238bceSAndroid Build Coastguard Worker
939*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
940*35238bceSAndroid Build Coastguard Worker return;
941*35238bceSAndroid Build Coastguard Worker
942*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
943*35238bceSAndroid Build Coastguard Worker break;
944*35238bceSAndroid Build Coastguard Worker }
945*35238bceSAndroid Build Coastguard Worker case QUERY_SAMPLER_PARAM_PURE_INTEGER_VEC4:
946*35238bceSAndroid Build Coastguard Worker {
947*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLint[4]> value;
948*35238bceSAndroid Build Coastguard Worker gl.glGetSamplerParameterIiv(sampler, pname, value);
949*35238bceSAndroid Build Coastguard Worker
950*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetSamplerParameterIiv"))
951*35238bceSAndroid Build Coastguard Worker return;
952*35238bceSAndroid Build Coastguard Worker
953*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
954*35238bceSAndroid Build Coastguard Worker return;
955*35238bceSAndroid Build Coastguard Worker
956*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
957*35238bceSAndroid Build Coastguard Worker break;
958*35238bceSAndroid Build Coastguard Worker }
959*35238bceSAndroid Build Coastguard Worker case QUERY_SAMPLER_PARAM_PURE_UNSIGNED_INTEGER_VEC4:
960*35238bceSAndroid Build Coastguard Worker {
961*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<glw::GLuint[4]> value;
962*35238bceSAndroid Build Coastguard Worker gl.glGetSamplerParameterIuiv(sampler, pname, value);
963*35238bceSAndroid Build Coastguard Worker
964*35238bceSAndroid Build Coastguard Worker if (!checkError(result, gl, "glGetSamplerParameterIuiv"))
965*35238bceSAndroid Build Coastguard Worker return;
966*35238bceSAndroid Build Coastguard Worker
967*35238bceSAndroid Build Coastguard Worker if (!value.verifyValidity(result))
968*35238bceSAndroid Build Coastguard Worker return;
969*35238bceSAndroid Build Coastguard Worker
970*35238bceSAndroid Build Coastguard Worker state = QueriedState(value);
971*35238bceSAndroid Build Coastguard Worker break;
972*35238bceSAndroid Build Coastguard Worker }
973*35238bceSAndroid Build Coastguard Worker default:
974*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
975*35238bceSAndroid Build Coastguard Worker }
976*35238bceSAndroid Build Coastguard Worker }
977*35238bceSAndroid Build Coastguard Worker
978*35238bceSAndroid Build Coastguard Worker // verify
979*35238bceSAndroid Build Coastguard Worker
verifyBoolean(tcu::ResultCollector & result,QueriedState & state,bool expected)980*35238bceSAndroid Build Coastguard Worker void verifyBoolean(tcu::ResultCollector &result, QueriedState &state, bool expected)
981*35238bceSAndroid Build Coastguard Worker {
982*35238bceSAndroid Build Coastguard Worker switch (state.getType())
983*35238bceSAndroid Build Coastguard Worker {
984*35238bceSAndroid Build Coastguard Worker case DATATYPE_BOOLEAN:
985*35238bceSAndroid Build Coastguard Worker {
986*35238bceSAndroid Build Coastguard Worker if (state.getBoolAccess() != expected)
987*35238bceSAndroid Build Coastguard Worker {
988*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
989*35238bceSAndroid Build Coastguard Worker buf << "Expected " << glu::getBooleanStr(mapBoolToGLBoolean(expected)) << ", got "
990*35238bceSAndroid Build Coastguard Worker << glu::getBooleanStr(mapBoolToGLBoolean(state.getBoolAccess()));
991*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
992*35238bceSAndroid Build Coastguard Worker }
993*35238bceSAndroid Build Coastguard Worker break;
994*35238bceSAndroid Build Coastguard Worker }
995*35238bceSAndroid Build Coastguard Worker
996*35238bceSAndroid Build Coastguard Worker case DATATYPE_INTEGER:
997*35238bceSAndroid Build Coastguard Worker {
998*35238bceSAndroid Build Coastguard Worker const glw::GLint reference = expected ? 1 : 0;
999*35238bceSAndroid Build Coastguard Worker if (state.getIntAccess() != reference)
1000*35238bceSAndroid Build Coastguard Worker {
1001*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1002*35238bceSAndroid Build Coastguard Worker buf << "Expected " << reference << ", got " << state.getIntAccess();
1003*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1004*35238bceSAndroid Build Coastguard Worker }
1005*35238bceSAndroid Build Coastguard Worker break;
1006*35238bceSAndroid Build Coastguard Worker }
1007*35238bceSAndroid Build Coastguard Worker
1008*35238bceSAndroid Build Coastguard Worker case DATATYPE_INTEGER64:
1009*35238bceSAndroid Build Coastguard Worker {
1010*35238bceSAndroid Build Coastguard Worker const glw::GLint64 reference = expected ? 1 : 0;
1011*35238bceSAndroid Build Coastguard Worker if (state.getInt64Access() != reference)
1012*35238bceSAndroid Build Coastguard Worker {
1013*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1014*35238bceSAndroid Build Coastguard Worker buf << "Expected " << reference << ", got " << state.getInt64Access();
1015*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1016*35238bceSAndroid Build Coastguard Worker }
1017*35238bceSAndroid Build Coastguard Worker break;
1018*35238bceSAndroid Build Coastguard Worker }
1019*35238bceSAndroid Build Coastguard Worker
1020*35238bceSAndroid Build Coastguard Worker case DATATYPE_FLOAT:
1021*35238bceSAndroid Build Coastguard Worker {
1022*35238bceSAndroid Build Coastguard Worker const glw::GLfloat reference = expected ? 1.0f : 0.0f;
1023*35238bceSAndroid Build Coastguard Worker if (state.getFloatAccess() != reference)
1024*35238bceSAndroid Build Coastguard Worker {
1025*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1026*35238bceSAndroid Build Coastguard Worker buf << "Expected " << reference << ", got " << state.getFloatAccess();
1027*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1028*35238bceSAndroid Build Coastguard Worker }
1029*35238bceSAndroid Build Coastguard Worker break;
1030*35238bceSAndroid Build Coastguard Worker }
1031*35238bceSAndroid Build Coastguard Worker
1032*35238bceSAndroid Build Coastguard Worker default:
1033*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
1034*35238bceSAndroid Build Coastguard Worker break;
1035*35238bceSAndroid Build Coastguard Worker }
1036*35238bceSAndroid Build Coastguard Worker }
1037*35238bceSAndroid Build Coastguard Worker
verifyInteger(tcu::ResultCollector & result,QueriedState & state,int expected)1038*35238bceSAndroid Build Coastguard Worker void verifyInteger(tcu::ResultCollector &result, QueriedState &state, int expected)
1039*35238bceSAndroid Build Coastguard Worker {
1040*35238bceSAndroid Build Coastguard Worker switch (state.getType())
1041*35238bceSAndroid Build Coastguard Worker {
1042*35238bceSAndroid Build Coastguard Worker case DATATYPE_BOOLEAN:
1043*35238bceSAndroid Build Coastguard Worker {
1044*35238bceSAndroid Build Coastguard Worker const bool reference = (expected != 0);
1045*35238bceSAndroid Build Coastguard Worker if (state.getBoolAccess() != reference)
1046*35238bceSAndroid Build Coastguard Worker {
1047*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1048*35238bceSAndroid Build Coastguard Worker buf << "Expected " << glu::getBooleanStr(mapBoolToGLBoolean(reference)) << ", got "
1049*35238bceSAndroid Build Coastguard Worker << glu::getBooleanStr(mapBoolToGLBoolean(state.getBoolAccess()));
1050*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1051*35238bceSAndroid Build Coastguard Worker }
1052*35238bceSAndroid Build Coastguard Worker break;
1053*35238bceSAndroid Build Coastguard Worker }
1054*35238bceSAndroid Build Coastguard Worker
1055*35238bceSAndroid Build Coastguard Worker case DATATYPE_INTEGER:
1056*35238bceSAndroid Build Coastguard Worker {
1057*35238bceSAndroid Build Coastguard Worker const glw::GLint reference = expected;
1058*35238bceSAndroid Build Coastguard Worker if (state.getIntAccess() != reference)
1059*35238bceSAndroid Build Coastguard Worker {
1060*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1061*35238bceSAndroid Build Coastguard Worker buf << "Expected " << reference << "(" << de::toString(tcu::Format::Hex<8>(reference)) << ") , got "
1062*35238bceSAndroid Build Coastguard Worker << state.getIntAccess() << "(" << de::toString(tcu::Format::Hex<8>(state.getIntAccess())) << ")";
1063*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1064*35238bceSAndroid Build Coastguard Worker }
1065*35238bceSAndroid Build Coastguard Worker break;
1066*35238bceSAndroid Build Coastguard Worker }
1067*35238bceSAndroid Build Coastguard Worker
1068*35238bceSAndroid Build Coastguard Worker case DATATYPE_INTEGER64:
1069*35238bceSAndroid Build Coastguard Worker {
1070*35238bceSAndroid Build Coastguard Worker const glw::GLint64 reference = (glw::GLint64)expected;
1071*35238bceSAndroid Build Coastguard Worker if (state.getInt64Access() != reference)
1072*35238bceSAndroid Build Coastguard Worker {
1073*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1074*35238bceSAndroid Build Coastguard Worker buf << "Expected " << reference << "(" << de::toString(tcu::Format::Hex<8>(reference)) << "), got "
1075*35238bceSAndroid Build Coastguard Worker << state.getInt64Access() << "(" << de::toString(tcu::Format::Hex<8>(state.getInt64Access())) << ")";
1076*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1077*35238bceSAndroid Build Coastguard Worker }
1078*35238bceSAndroid Build Coastguard Worker break;
1079*35238bceSAndroid Build Coastguard Worker }
1080*35238bceSAndroid Build Coastguard Worker
1081*35238bceSAndroid Build Coastguard Worker case DATATYPE_FLOAT:
1082*35238bceSAndroid Build Coastguard Worker {
1083*35238bceSAndroid Build Coastguard Worker const glw::GLfloat refValueMin = deInt32ToFloatRoundToNegInf(expected);
1084*35238bceSAndroid Build Coastguard Worker const glw::GLfloat refValueMax = deInt32ToFloatRoundToPosInf(expected);
1085*35238bceSAndroid Build Coastguard Worker
1086*35238bceSAndroid Build Coastguard Worker if (state.getFloatAccess() < refValueMin || state.getFloatAccess() > refValueMax ||
1087*35238bceSAndroid Build Coastguard Worker deIsNaN(state.getFloatAccess()))
1088*35238bceSAndroid Build Coastguard Worker {
1089*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1090*35238bceSAndroid Build Coastguard Worker
1091*35238bceSAndroid Build Coastguard Worker if (refValueMin == refValueMax)
1092*35238bceSAndroid Build Coastguard Worker buf << "Expected " << refValueMin << ", got " << state.getFloatAccess();
1093*35238bceSAndroid Build Coastguard Worker else
1094*35238bceSAndroid Build Coastguard Worker buf << "Expected in range [" << refValueMin << ", " << refValueMax << "], got "
1095*35238bceSAndroid Build Coastguard Worker << state.getFloatAccess();
1096*35238bceSAndroid Build Coastguard Worker
1097*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1098*35238bceSAndroid Build Coastguard Worker }
1099*35238bceSAndroid Build Coastguard Worker break;
1100*35238bceSAndroid Build Coastguard Worker }
1101*35238bceSAndroid Build Coastguard Worker
1102*35238bceSAndroid Build Coastguard Worker case DATATYPE_UNSIGNED_INTEGER:
1103*35238bceSAndroid Build Coastguard Worker {
1104*35238bceSAndroid Build Coastguard Worker const glw::GLuint reference = (glw::GLuint)expected;
1105*35238bceSAndroid Build Coastguard Worker if (state.getUintAccess() != reference)
1106*35238bceSAndroid Build Coastguard Worker {
1107*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1108*35238bceSAndroid Build Coastguard Worker buf << "Expected " << reference << "(" << de::toString(tcu::Format::Hex<8>(reference)) << "), got "
1109*35238bceSAndroid Build Coastguard Worker << state.getUintAccess() << "(" << de::toString(tcu::Format::Hex<8>(state.getUintAccess())) << ")";
1110*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1111*35238bceSAndroid Build Coastguard Worker }
1112*35238bceSAndroid Build Coastguard Worker break;
1113*35238bceSAndroid Build Coastguard Worker }
1114*35238bceSAndroid Build Coastguard Worker
1115*35238bceSAndroid Build Coastguard Worker default:
1116*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
1117*35238bceSAndroid Build Coastguard Worker break;
1118*35238bceSAndroid Build Coastguard Worker }
1119*35238bceSAndroid Build Coastguard Worker }
1120*35238bceSAndroid Build Coastguard Worker
verifyIntegerMin(tcu::ResultCollector & result,QueriedState & state,int minValue)1121*35238bceSAndroid Build Coastguard Worker void verifyIntegerMin(tcu::ResultCollector &result, QueriedState &state, int minValue)
1122*35238bceSAndroid Build Coastguard Worker {
1123*35238bceSAndroid Build Coastguard Worker switch (state.getType())
1124*35238bceSAndroid Build Coastguard Worker {
1125*35238bceSAndroid Build Coastguard Worker case DATATYPE_BOOLEAN:
1126*35238bceSAndroid Build Coastguard Worker {
1127*35238bceSAndroid Build Coastguard Worker if (minValue > 0 && state.getBoolAccess() != true)
1128*35238bceSAndroid Build Coastguard Worker {
1129*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1130*35238bceSAndroid Build Coastguard Worker buf << "Expected GL_TRUE, got GL_FALSE";
1131*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1132*35238bceSAndroid Build Coastguard Worker }
1133*35238bceSAndroid Build Coastguard Worker break;
1134*35238bceSAndroid Build Coastguard Worker }
1135*35238bceSAndroid Build Coastguard Worker
1136*35238bceSAndroid Build Coastguard Worker case DATATYPE_INTEGER:
1137*35238bceSAndroid Build Coastguard Worker {
1138*35238bceSAndroid Build Coastguard Worker if (state.getIntAccess() < minValue)
1139*35238bceSAndroid Build Coastguard Worker {
1140*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1141*35238bceSAndroid Build Coastguard Worker buf << "Expected greater or equal to " << minValue << ", got " << state.getIntAccess();
1142*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1143*35238bceSAndroid Build Coastguard Worker }
1144*35238bceSAndroid Build Coastguard Worker break;
1145*35238bceSAndroid Build Coastguard Worker }
1146*35238bceSAndroid Build Coastguard Worker
1147*35238bceSAndroid Build Coastguard Worker case DATATYPE_INTEGER64:
1148*35238bceSAndroid Build Coastguard Worker {
1149*35238bceSAndroid Build Coastguard Worker if (state.getInt64Access() < minValue)
1150*35238bceSAndroid Build Coastguard Worker {
1151*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1152*35238bceSAndroid Build Coastguard Worker buf << "Expected greater or equal to " << minValue << ", got " << state.getInt64Access();
1153*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1154*35238bceSAndroid Build Coastguard Worker }
1155*35238bceSAndroid Build Coastguard Worker break;
1156*35238bceSAndroid Build Coastguard Worker }
1157*35238bceSAndroid Build Coastguard Worker
1158*35238bceSAndroid Build Coastguard Worker case DATATYPE_FLOAT:
1159*35238bceSAndroid Build Coastguard Worker {
1160*35238bceSAndroid Build Coastguard Worker if (state.getFloatAccess() < deInt32ToFloatRoundToNegInf(minValue) || deIsNaN(state.getFloatAccess()))
1161*35238bceSAndroid Build Coastguard Worker {
1162*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1163*35238bceSAndroid Build Coastguard Worker buf << "Expected greater or equal to " << minValue << ", got " << state.getFloatAccess();
1164*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1165*35238bceSAndroid Build Coastguard Worker }
1166*35238bceSAndroid Build Coastguard Worker break;
1167*35238bceSAndroid Build Coastguard Worker }
1168*35238bceSAndroid Build Coastguard Worker
1169*35238bceSAndroid Build Coastguard Worker default:
1170*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
1171*35238bceSAndroid Build Coastguard Worker break;
1172*35238bceSAndroid Build Coastguard Worker }
1173*35238bceSAndroid Build Coastguard Worker }
1174*35238bceSAndroid Build Coastguard Worker
verifyIntegerMax(tcu::ResultCollector & result,QueriedState & state,int maxValue)1175*35238bceSAndroid Build Coastguard Worker void verifyIntegerMax(tcu::ResultCollector &result, QueriedState &state, int maxValue)
1176*35238bceSAndroid Build Coastguard Worker {
1177*35238bceSAndroid Build Coastguard Worker switch (state.getType())
1178*35238bceSAndroid Build Coastguard Worker {
1179*35238bceSAndroid Build Coastguard Worker case DATATYPE_BOOLEAN:
1180*35238bceSAndroid Build Coastguard Worker {
1181*35238bceSAndroid Build Coastguard Worker if (maxValue < 0 && state.getBoolAccess() != true)
1182*35238bceSAndroid Build Coastguard Worker {
1183*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1184*35238bceSAndroid Build Coastguard Worker buf << "Expected GL_TRUE, got GL_FALSE";
1185*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1186*35238bceSAndroid Build Coastguard Worker }
1187*35238bceSAndroid Build Coastguard Worker break;
1188*35238bceSAndroid Build Coastguard Worker }
1189*35238bceSAndroid Build Coastguard Worker
1190*35238bceSAndroid Build Coastguard Worker case DATATYPE_INTEGER:
1191*35238bceSAndroid Build Coastguard Worker {
1192*35238bceSAndroid Build Coastguard Worker if (state.getIntAccess() > maxValue)
1193*35238bceSAndroid Build Coastguard Worker {
1194*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1195*35238bceSAndroid Build Coastguard Worker buf << "Expected less or equal to " << maxValue << ", got " << state.getIntAccess();
1196*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1197*35238bceSAndroid Build Coastguard Worker }
1198*35238bceSAndroid Build Coastguard Worker break;
1199*35238bceSAndroid Build Coastguard Worker }
1200*35238bceSAndroid Build Coastguard Worker
1201*35238bceSAndroid Build Coastguard Worker case DATATYPE_INTEGER64:
1202*35238bceSAndroid Build Coastguard Worker {
1203*35238bceSAndroid Build Coastguard Worker if (state.getInt64Access() > maxValue)
1204*35238bceSAndroid Build Coastguard Worker {
1205*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1206*35238bceSAndroid Build Coastguard Worker buf << "Expected less or equal to " << maxValue << ", got " << state.getInt64Access();
1207*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1208*35238bceSAndroid Build Coastguard Worker }
1209*35238bceSAndroid Build Coastguard Worker break;
1210*35238bceSAndroid Build Coastguard Worker }
1211*35238bceSAndroid Build Coastguard Worker
1212*35238bceSAndroid Build Coastguard Worker case DATATYPE_FLOAT:
1213*35238bceSAndroid Build Coastguard Worker {
1214*35238bceSAndroid Build Coastguard Worker if (state.getFloatAccess() > deInt32ToFloatRoundToPosInf(maxValue) || deIsNaN(state.getFloatAccess()))
1215*35238bceSAndroid Build Coastguard Worker {
1216*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1217*35238bceSAndroid Build Coastguard Worker buf << "Expected less or equal to " << maxValue << ", got " << state.getFloatAccess();
1218*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1219*35238bceSAndroid Build Coastguard Worker }
1220*35238bceSAndroid Build Coastguard Worker break;
1221*35238bceSAndroid Build Coastguard Worker }
1222*35238bceSAndroid Build Coastguard Worker
1223*35238bceSAndroid Build Coastguard Worker default:
1224*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
1225*35238bceSAndroid Build Coastguard Worker break;
1226*35238bceSAndroid Build Coastguard Worker }
1227*35238bceSAndroid Build Coastguard Worker }
1228*35238bceSAndroid Build Coastguard Worker
verifyFloat(tcu::ResultCollector & result,QueriedState & state,float expected)1229*35238bceSAndroid Build Coastguard Worker void verifyFloat(tcu::ResultCollector &result, QueriedState &state, float expected)
1230*35238bceSAndroid Build Coastguard Worker {
1231*35238bceSAndroid Build Coastguard Worker switch (state.getType())
1232*35238bceSAndroid Build Coastguard Worker {
1233*35238bceSAndroid Build Coastguard Worker case DATATYPE_BOOLEAN:
1234*35238bceSAndroid Build Coastguard Worker {
1235*35238bceSAndroid Build Coastguard Worker const bool reference = (expected != 0.0f);
1236*35238bceSAndroid Build Coastguard Worker
1237*35238bceSAndroid Build Coastguard Worker if (state.getBoolAccess() != reference)
1238*35238bceSAndroid Build Coastguard Worker {
1239*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1240*35238bceSAndroid Build Coastguard Worker buf << "Expected " << glu::getBooleanStr(mapBoolToGLBoolean(reference)) << ", got "
1241*35238bceSAndroid Build Coastguard Worker << glu::getBooleanStr(mapBoolToGLBoolean(state.getBoolAccess()));
1242*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1243*35238bceSAndroid Build Coastguard Worker }
1244*35238bceSAndroid Build Coastguard Worker break;
1245*35238bceSAndroid Build Coastguard Worker }
1246*35238bceSAndroid Build Coastguard Worker
1247*35238bceSAndroid Build Coastguard Worker case DATATYPE_INTEGER:
1248*35238bceSAndroid Build Coastguard Worker {
1249*35238bceSAndroid Build Coastguard Worker const glw::GLint refValueMin = roundGLfloatToNearestIntegerHalfDown<glw::GLint>(expected);
1250*35238bceSAndroid Build Coastguard Worker const glw::GLint refValueMax = roundGLfloatToNearestIntegerHalfUp<glw::GLint>(expected);
1251*35238bceSAndroid Build Coastguard Worker
1252*35238bceSAndroid Build Coastguard Worker if (state.getIntAccess() < refValueMin || state.getIntAccess() > refValueMax)
1253*35238bceSAndroid Build Coastguard Worker {
1254*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1255*35238bceSAndroid Build Coastguard Worker
1256*35238bceSAndroid Build Coastguard Worker if (refValueMin == refValueMax)
1257*35238bceSAndroid Build Coastguard Worker buf << "Expected " << refValueMin << ", got " << state.getIntAccess();
1258*35238bceSAndroid Build Coastguard Worker else
1259*35238bceSAndroid Build Coastguard Worker buf << "Expected in range [" << refValueMin << ", " << refValueMax << "], got " << state.getIntAccess();
1260*35238bceSAndroid Build Coastguard Worker
1261*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1262*35238bceSAndroid Build Coastguard Worker }
1263*35238bceSAndroid Build Coastguard Worker break;
1264*35238bceSAndroid Build Coastguard Worker }
1265*35238bceSAndroid Build Coastguard Worker
1266*35238bceSAndroid Build Coastguard Worker case DATATYPE_FLOAT:
1267*35238bceSAndroid Build Coastguard Worker {
1268*35238bceSAndroid Build Coastguard Worker if (state.getFloatAccess() != expected)
1269*35238bceSAndroid Build Coastguard Worker {
1270*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1271*35238bceSAndroid Build Coastguard Worker buf << "Expected " << expected << ", got " << state.getFloatAccess();
1272*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1273*35238bceSAndroid Build Coastguard Worker }
1274*35238bceSAndroid Build Coastguard Worker break;
1275*35238bceSAndroid Build Coastguard Worker }
1276*35238bceSAndroid Build Coastguard Worker
1277*35238bceSAndroid Build Coastguard Worker case DATATYPE_INTEGER64:
1278*35238bceSAndroid Build Coastguard Worker {
1279*35238bceSAndroid Build Coastguard Worker const glw::GLint64 refValueMin = roundGLfloatToNearestIntegerHalfDown<glw::GLint64>(expected);
1280*35238bceSAndroid Build Coastguard Worker const glw::GLint64 refValueMax = roundGLfloatToNearestIntegerHalfUp<glw::GLint64>(expected);
1281*35238bceSAndroid Build Coastguard Worker
1282*35238bceSAndroid Build Coastguard Worker if (state.getInt64Access() < refValueMin || state.getInt64Access() > refValueMax)
1283*35238bceSAndroid Build Coastguard Worker {
1284*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1285*35238bceSAndroid Build Coastguard Worker
1286*35238bceSAndroid Build Coastguard Worker if (refValueMin == refValueMax)
1287*35238bceSAndroid Build Coastguard Worker buf << "Expected " << refValueMin << ", got " << state.getInt64Access();
1288*35238bceSAndroid Build Coastguard Worker else
1289*35238bceSAndroid Build Coastguard Worker buf << "Expected in range [" << refValueMin << ", " << refValueMax << "], got "
1290*35238bceSAndroid Build Coastguard Worker << state.getInt64Access();
1291*35238bceSAndroid Build Coastguard Worker
1292*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1293*35238bceSAndroid Build Coastguard Worker }
1294*35238bceSAndroid Build Coastguard Worker break;
1295*35238bceSAndroid Build Coastguard Worker }
1296*35238bceSAndroid Build Coastguard Worker
1297*35238bceSAndroid Build Coastguard Worker case DATATYPE_UNSIGNED_INTEGER:
1298*35238bceSAndroid Build Coastguard Worker {
1299*35238bceSAndroid Build Coastguard Worker const glw::GLuint refValueMin = roundGLfloatToNearestIntegerHalfDown<glw::GLuint>(expected);
1300*35238bceSAndroid Build Coastguard Worker const glw::GLuint refValueMax = roundGLfloatToNearestIntegerHalfUp<glw::GLuint>(expected);
1301*35238bceSAndroid Build Coastguard Worker
1302*35238bceSAndroid Build Coastguard Worker if (state.getUintAccess() < refValueMin || state.getUintAccess() > refValueMax)
1303*35238bceSAndroid Build Coastguard Worker {
1304*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1305*35238bceSAndroid Build Coastguard Worker
1306*35238bceSAndroid Build Coastguard Worker if (refValueMin == refValueMax)
1307*35238bceSAndroid Build Coastguard Worker buf << "Expected " << refValueMin << ", got " << state.getUintAccess();
1308*35238bceSAndroid Build Coastguard Worker else
1309*35238bceSAndroid Build Coastguard Worker buf << "Expected in range [" << refValueMin << ", " << refValueMax << "], got "
1310*35238bceSAndroid Build Coastguard Worker << state.getUintAccess();
1311*35238bceSAndroid Build Coastguard Worker
1312*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1313*35238bceSAndroid Build Coastguard Worker }
1314*35238bceSAndroid Build Coastguard Worker break;
1315*35238bceSAndroid Build Coastguard Worker }
1316*35238bceSAndroid Build Coastguard Worker
1317*35238bceSAndroid Build Coastguard Worker default:
1318*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
1319*35238bceSAndroid Build Coastguard Worker break;
1320*35238bceSAndroid Build Coastguard Worker }
1321*35238bceSAndroid Build Coastguard Worker }
1322*35238bceSAndroid Build Coastguard Worker
verifyFloatMin(tcu::ResultCollector & result,QueriedState & state,float minValue)1323*35238bceSAndroid Build Coastguard Worker void verifyFloatMin(tcu::ResultCollector &result, QueriedState &state, float minValue)
1324*35238bceSAndroid Build Coastguard Worker {
1325*35238bceSAndroid Build Coastguard Worker switch (state.getType())
1326*35238bceSAndroid Build Coastguard Worker {
1327*35238bceSAndroid Build Coastguard Worker case DATATYPE_BOOLEAN:
1328*35238bceSAndroid Build Coastguard Worker {
1329*35238bceSAndroid Build Coastguard Worker if (minValue > 0.0f && state.getBoolAccess() != true)
1330*35238bceSAndroid Build Coastguard Worker result.fail("expected GL_TRUE, got GL_FALSE");
1331*35238bceSAndroid Build Coastguard Worker break;
1332*35238bceSAndroid Build Coastguard Worker }
1333*35238bceSAndroid Build Coastguard Worker
1334*35238bceSAndroid Build Coastguard Worker case DATATYPE_INTEGER:
1335*35238bceSAndroid Build Coastguard Worker {
1336*35238bceSAndroid Build Coastguard Worker const glw::GLint refValue = roundGLfloatToNearestIntegerHalfDown<glw::GLint>(minValue);
1337*35238bceSAndroid Build Coastguard Worker
1338*35238bceSAndroid Build Coastguard Worker if (state.getIntAccess() < refValue)
1339*35238bceSAndroid Build Coastguard Worker {
1340*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1341*35238bceSAndroid Build Coastguard Worker buf << "Expected greater or equal to " << refValue << ", got " << state.getIntAccess();
1342*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1343*35238bceSAndroid Build Coastguard Worker }
1344*35238bceSAndroid Build Coastguard Worker break;
1345*35238bceSAndroid Build Coastguard Worker }
1346*35238bceSAndroid Build Coastguard Worker
1347*35238bceSAndroid Build Coastguard Worker case DATATYPE_FLOAT:
1348*35238bceSAndroid Build Coastguard Worker {
1349*35238bceSAndroid Build Coastguard Worker if (state.getFloatAccess() < minValue || deIsNaN(state.getFloatAccess()))
1350*35238bceSAndroid Build Coastguard Worker {
1351*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1352*35238bceSAndroid Build Coastguard Worker buf << "Expected greater or equal to " << minValue << ", got " << state.getFloatAccess();
1353*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1354*35238bceSAndroid Build Coastguard Worker }
1355*35238bceSAndroid Build Coastguard Worker break;
1356*35238bceSAndroid Build Coastguard Worker }
1357*35238bceSAndroid Build Coastguard Worker
1358*35238bceSAndroid Build Coastguard Worker case DATATYPE_INTEGER64:
1359*35238bceSAndroid Build Coastguard Worker {
1360*35238bceSAndroid Build Coastguard Worker const glw::GLint64 refValue = roundGLfloatToNearestIntegerHalfDown<glw::GLint64>(minValue);
1361*35238bceSAndroid Build Coastguard Worker
1362*35238bceSAndroid Build Coastguard Worker if (state.getInt64Access() < refValue)
1363*35238bceSAndroid Build Coastguard Worker {
1364*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1365*35238bceSAndroid Build Coastguard Worker buf << "Expected greater or equal to " << refValue << ", got " << state.getInt64Access();
1366*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1367*35238bceSAndroid Build Coastguard Worker }
1368*35238bceSAndroid Build Coastguard Worker break;
1369*35238bceSAndroid Build Coastguard Worker }
1370*35238bceSAndroid Build Coastguard Worker
1371*35238bceSAndroid Build Coastguard Worker default:
1372*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
1373*35238bceSAndroid Build Coastguard Worker break;
1374*35238bceSAndroid Build Coastguard Worker }
1375*35238bceSAndroid Build Coastguard Worker }
1376*35238bceSAndroid Build Coastguard Worker
verifyFloatMax(tcu::ResultCollector & result,QueriedState & state,float maxValue)1377*35238bceSAndroid Build Coastguard Worker void verifyFloatMax(tcu::ResultCollector &result, QueriedState &state, float maxValue)
1378*35238bceSAndroid Build Coastguard Worker {
1379*35238bceSAndroid Build Coastguard Worker switch (state.getType())
1380*35238bceSAndroid Build Coastguard Worker {
1381*35238bceSAndroid Build Coastguard Worker case DATATYPE_BOOLEAN:
1382*35238bceSAndroid Build Coastguard Worker {
1383*35238bceSAndroid Build Coastguard Worker if (maxValue < 0.0f && state.getBoolAccess() != true)
1384*35238bceSAndroid Build Coastguard Worker result.fail("expected GL_TRUE, got GL_FALSE");
1385*35238bceSAndroid Build Coastguard Worker break;
1386*35238bceSAndroid Build Coastguard Worker }
1387*35238bceSAndroid Build Coastguard Worker
1388*35238bceSAndroid Build Coastguard Worker case DATATYPE_INTEGER:
1389*35238bceSAndroid Build Coastguard Worker {
1390*35238bceSAndroid Build Coastguard Worker const glw::GLint refValue = roundGLfloatToNearestIntegerHalfUp<glw::GLint>(maxValue);
1391*35238bceSAndroid Build Coastguard Worker
1392*35238bceSAndroid Build Coastguard Worker if (state.getIntAccess() > refValue)
1393*35238bceSAndroid Build Coastguard Worker {
1394*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1395*35238bceSAndroid Build Coastguard Worker buf << "Expected less or equal to " << refValue << ", got " << state.getIntAccess();
1396*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1397*35238bceSAndroid Build Coastguard Worker }
1398*35238bceSAndroid Build Coastguard Worker break;
1399*35238bceSAndroid Build Coastguard Worker }
1400*35238bceSAndroid Build Coastguard Worker
1401*35238bceSAndroid Build Coastguard Worker case DATATYPE_FLOAT:
1402*35238bceSAndroid Build Coastguard Worker {
1403*35238bceSAndroid Build Coastguard Worker if (state.getFloatAccess() > maxValue || deIsNaN(state.getFloatAccess()))
1404*35238bceSAndroid Build Coastguard Worker {
1405*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1406*35238bceSAndroid Build Coastguard Worker buf << "Expected less or equal to " << maxValue << ", got " << state.getFloatAccess();
1407*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1408*35238bceSAndroid Build Coastguard Worker }
1409*35238bceSAndroid Build Coastguard Worker break;
1410*35238bceSAndroid Build Coastguard Worker }
1411*35238bceSAndroid Build Coastguard Worker
1412*35238bceSAndroid Build Coastguard Worker case DATATYPE_INTEGER64:
1413*35238bceSAndroid Build Coastguard Worker {
1414*35238bceSAndroid Build Coastguard Worker const glw::GLint64 refValue = roundGLfloatToNearestIntegerHalfUp<glw::GLint64>(maxValue);
1415*35238bceSAndroid Build Coastguard Worker
1416*35238bceSAndroid Build Coastguard Worker if (state.getInt64Access() > refValue)
1417*35238bceSAndroid Build Coastguard Worker {
1418*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1419*35238bceSAndroid Build Coastguard Worker buf << "Expected less or equal to " << refValue << ", got " << state.getInt64Access();
1420*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1421*35238bceSAndroid Build Coastguard Worker }
1422*35238bceSAndroid Build Coastguard Worker break;
1423*35238bceSAndroid Build Coastguard Worker }
1424*35238bceSAndroid Build Coastguard Worker
1425*35238bceSAndroid Build Coastguard Worker default:
1426*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
1427*35238bceSAndroid Build Coastguard Worker break;
1428*35238bceSAndroid Build Coastguard Worker }
1429*35238bceSAndroid Build Coastguard Worker }
1430*35238bceSAndroid Build Coastguard Worker
verifyIntegerVec3(tcu::ResultCollector & result,QueriedState & state,const tcu::IVec3 & expected)1431*35238bceSAndroid Build Coastguard Worker void verifyIntegerVec3(tcu::ResultCollector &result, QueriedState &state, const tcu::IVec3 &expected)
1432*35238bceSAndroid Build Coastguard Worker {
1433*35238bceSAndroid Build Coastguard Worker switch (state.getType())
1434*35238bceSAndroid Build Coastguard Worker {
1435*35238bceSAndroid Build Coastguard Worker case DATATYPE_INTEGER_VEC3:
1436*35238bceSAndroid Build Coastguard Worker {
1437*35238bceSAndroid Build Coastguard Worker if (state.getIntVec3Access()[0] != expected[0] || state.getIntVec3Access()[1] != expected[1] ||
1438*35238bceSAndroid Build Coastguard Worker state.getIntVec3Access()[2] != expected[2])
1439*35238bceSAndroid Build Coastguard Worker {
1440*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1441*35238bceSAndroid Build Coastguard Worker buf << "Expected " << expected << ", got " << tcu::formatArray(state.getIntVec3Access());
1442*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1443*35238bceSAndroid Build Coastguard Worker }
1444*35238bceSAndroid Build Coastguard Worker break;
1445*35238bceSAndroid Build Coastguard Worker }
1446*35238bceSAndroid Build Coastguard Worker
1447*35238bceSAndroid Build Coastguard Worker default:
1448*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
1449*35238bceSAndroid Build Coastguard Worker break;
1450*35238bceSAndroid Build Coastguard Worker }
1451*35238bceSAndroid Build Coastguard Worker }
1452*35238bceSAndroid Build Coastguard Worker
verifyIntegerVec4(tcu::ResultCollector & result,QueriedState & state,const tcu::IVec4 & expected)1453*35238bceSAndroid Build Coastguard Worker void verifyIntegerVec4(tcu::ResultCollector &result, QueriedState &state, const tcu::IVec4 &expected)
1454*35238bceSAndroid Build Coastguard Worker {
1455*35238bceSAndroid Build Coastguard Worker switch (state.getType())
1456*35238bceSAndroid Build Coastguard Worker {
1457*35238bceSAndroid Build Coastguard Worker case DATATYPE_INTEGER_VEC4:
1458*35238bceSAndroid Build Coastguard Worker {
1459*35238bceSAndroid Build Coastguard Worker if (state.getIntVec4Access()[0] != expected[0] || state.getIntVec4Access()[1] != expected[1] ||
1460*35238bceSAndroid Build Coastguard Worker state.getIntVec4Access()[2] != expected[2] || state.getIntVec4Access()[3] != expected[3])
1461*35238bceSAndroid Build Coastguard Worker {
1462*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1463*35238bceSAndroid Build Coastguard Worker buf << "Expected " << expected << ", got " << tcu::formatArray(state.getIntVec4Access());
1464*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1465*35238bceSAndroid Build Coastguard Worker }
1466*35238bceSAndroid Build Coastguard Worker break;
1467*35238bceSAndroid Build Coastguard Worker }
1468*35238bceSAndroid Build Coastguard Worker
1469*35238bceSAndroid Build Coastguard Worker default:
1470*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
1471*35238bceSAndroid Build Coastguard Worker break;
1472*35238bceSAndroid Build Coastguard Worker }
1473*35238bceSAndroid Build Coastguard Worker }
1474*35238bceSAndroid Build Coastguard Worker
verifyUnsignedIntegerVec4(tcu::ResultCollector & result,QueriedState & state,const tcu::UVec4 & expected)1475*35238bceSAndroid Build Coastguard Worker void verifyUnsignedIntegerVec4(tcu::ResultCollector &result, QueriedState &state, const tcu::UVec4 &expected)
1476*35238bceSAndroid Build Coastguard Worker {
1477*35238bceSAndroid Build Coastguard Worker switch (state.getType())
1478*35238bceSAndroid Build Coastguard Worker {
1479*35238bceSAndroid Build Coastguard Worker case DATATYPE_UNSIGNED_INTEGER_VEC4:
1480*35238bceSAndroid Build Coastguard Worker {
1481*35238bceSAndroid Build Coastguard Worker if (state.getUintVec4Access()[0] != expected[0] || state.getUintVec4Access()[1] != expected[1] ||
1482*35238bceSAndroid Build Coastguard Worker state.getUintVec4Access()[2] != expected[2] || state.getUintVec4Access()[3] != expected[3])
1483*35238bceSAndroid Build Coastguard Worker {
1484*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1485*35238bceSAndroid Build Coastguard Worker buf << "Expected " << expected << ", got " << tcu::formatArray(state.getUintVec4Access());
1486*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1487*35238bceSAndroid Build Coastguard Worker }
1488*35238bceSAndroid Build Coastguard Worker break;
1489*35238bceSAndroid Build Coastguard Worker }
1490*35238bceSAndroid Build Coastguard Worker
1491*35238bceSAndroid Build Coastguard Worker default:
1492*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
1493*35238bceSAndroid Build Coastguard Worker break;
1494*35238bceSAndroid Build Coastguard Worker }
1495*35238bceSAndroid Build Coastguard Worker }
1496*35238bceSAndroid Build Coastguard Worker
verifyBooleanVec4(tcu::ResultCollector & result,QueriedState & state,const tcu::BVec4 & expected)1497*35238bceSAndroid Build Coastguard Worker void verifyBooleanVec4(tcu::ResultCollector &result, QueriedState &state, const tcu::BVec4 &expected)
1498*35238bceSAndroid Build Coastguard Worker {
1499*35238bceSAndroid Build Coastguard Worker switch (state.getType())
1500*35238bceSAndroid Build Coastguard Worker {
1501*35238bceSAndroid Build Coastguard Worker case DATATYPE_BOOLEAN_VEC4:
1502*35238bceSAndroid Build Coastguard Worker {
1503*35238bceSAndroid Build Coastguard Worker const glw::GLboolean referenceVec4[4] = {mapBoolToGLBoolean(expected[0]), mapBoolToGLBoolean(expected[1]),
1504*35238bceSAndroid Build Coastguard Worker mapBoolToGLBoolean(expected[2]), mapBoolToGLBoolean(expected[3])};
1505*35238bceSAndroid Build Coastguard Worker
1506*35238bceSAndroid Build Coastguard Worker const glw::GLboolean resultVec4[4] = {
1507*35238bceSAndroid Build Coastguard Worker mapBoolToGLBoolean(state.getBooleanVec4Access()[0]), mapBoolToGLBoolean(state.getBooleanVec4Access()[1]),
1508*35238bceSAndroid Build Coastguard Worker mapBoolToGLBoolean(state.getBooleanVec4Access()[2]), mapBoolToGLBoolean(state.getBooleanVec4Access()[3])};
1509*35238bceSAndroid Build Coastguard Worker
1510*35238bceSAndroid Build Coastguard Worker if (resultVec4[0] != referenceVec4[0] || resultVec4[1] != referenceVec4[1] ||
1511*35238bceSAndroid Build Coastguard Worker resultVec4[2] != referenceVec4[2] || resultVec4[3] != referenceVec4[3])
1512*35238bceSAndroid Build Coastguard Worker {
1513*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1514*35238bceSAndroid Build Coastguard Worker buf << "Expected " << glu::getBooleanPointerStr(referenceVec4, 4) << ", got "
1515*35238bceSAndroid Build Coastguard Worker << glu::getBooleanPointerStr(resultVec4, 4);
1516*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1517*35238bceSAndroid Build Coastguard Worker }
1518*35238bceSAndroid Build Coastguard Worker
1519*35238bceSAndroid Build Coastguard Worker break;
1520*35238bceSAndroid Build Coastguard Worker }
1521*35238bceSAndroid Build Coastguard Worker case DATATYPE_FLOAT_VEC4:
1522*35238bceSAndroid Build Coastguard Worker {
1523*35238bceSAndroid Build Coastguard Worker const glw::GLfloat reference[4] = {(expected[0] ? 1.0f : 0.0f), (expected[1] ? 1.0f : 0.0f),
1524*35238bceSAndroid Build Coastguard Worker (expected[2] ? 1.0f : 0.0f), (expected[3] ? 1.0f : 0.0f)};
1525*35238bceSAndroid Build Coastguard Worker
1526*35238bceSAndroid Build Coastguard Worker if (state.getFloatVec4Access()[0] != reference[0] || state.getFloatVec4Access()[1] != reference[1] ||
1527*35238bceSAndroid Build Coastguard Worker state.getFloatVec4Access()[2] != reference[2] || state.getFloatVec4Access()[3] != reference[3])
1528*35238bceSAndroid Build Coastguard Worker {
1529*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1530*35238bceSAndroid Build Coastguard Worker buf << "Expected " << reference << ", got " << tcu::formatArray(state.getFloatVec4Access());
1531*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1532*35238bceSAndroid Build Coastguard Worker }
1533*35238bceSAndroid Build Coastguard Worker break;
1534*35238bceSAndroid Build Coastguard Worker }
1535*35238bceSAndroid Build Coastguard Worker case DATATYPE_INTEGER_VEC4:
1536*35238bceSAndroid Build Coastguard Worker {
1537*35238bceSAndroid Build Coastguard Worker const glw::GLint reference[4] = {(expected[0] ? 1 : 0), (expected[1] ? 1 : 0), (expected[2] ? 1 : 0),
1538*35238bceSAndroid Build Coastguard Worker (expected[3] ? 1 : 0)};
1539*35238bceSAndroid Build Coastguard Worker
1540*35238bceSAndroid Build Coastguard Worker if (state.getIntVec4Access()[0] != reference[0] || state.getIntVec4Access()[1] != reference[1] ||
1541*35238bceSAndroid Build Coastguard Worker state.getIntVec4Access()[2] != reference[2] || state.getIntVec4Access()[3] != reference[3])
1542*35238bceSAndroid Build Coastguard Worker {
1543*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1544*35238bceSAndroid Build Coastguard Worker buf << "Expected " << reference << ", got " << tcu::formatArray(state.getIntVec4Access());
1545*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1546*35238bceSAndroid Build Coastguard Worker }
1547*35238bceSAndroid Build Coastguard Worker break;
1548*35238bceSAndroid Build Coastguard Worker }
1549*35238bceSAndroid Build Coastguard Worker case DATATYPE_INTEGER64_VEC4:
1550*35238bceSAndroid Build Coastguard Worker {
1551*35238bceSAndroid Build Coastguard Worker const glw::GLint64 reference[4] = {(expected[0] ? 1 : 0), (expected[1] ? 1 : 0), (expected[2] ? 1 : 0),
1552*35238bceSAndroid Build Coastguard Worker (expected[3] ? 1 : 0)};
1553*35238bceSAndroid Build Coastguard Worker
1554*35238bceSAndroid Build Coastguard Worker if (state.getInt64Vec4Access()[0] != reference[0] || state.getInt64Vec4Access()[1] != reference[1] ||
1555*35238bceSAndroid Build Coastguard Worker state.getInt64Vec4Access()[2] != reference[2] || state.getInt64Vec4Access()[3] != reference[3])
1556*35238bceSAndroid Build Coastguard Worker {
1557*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1558*35238bceSAndroid Build Coastguard Worker buf << "Expected " << reference << ", got " << tcu::formatArray(state.getInt64Vec4Access());
1559*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1560*35238bceSAndroid Build Coastguard Worker }
1561*35238bceSAndroid Build Coastguard Worker break;
1562*35238bceSAndroid Build Coastguard Worker }
1563*35238bceSAndroid Build Coastguard Worker case DATATYPE_UNSIGNED_INTEGER_VEC4:
1564*35238bceSAndroid Build Coastguard Worker {
1565*35238bceSAndroid Build Coastguard Worker const glw::GLuint reference[4] = {(expected[0] ? 1u : 0u), (expected[1] ? 1u : 0u), (expected[2] ? 1u : 0u),
1566*35238bceSAndroid Build Coastguard Worker (expected[3] ? 1u : 0u)};
1567*35238bceSAndroid Build Coastguard Worker
1568*35238bceSAndroid Build Coastguard Worker if (state.getUintVec4Access()[0] != reference[0] || state.getUintVec4Access()[1] != reference[1] ||
1569*35238bceSAndroid Build Coastguard Worker state.getUintVec4Access()[2] != reference[2] || state.getUintVec4Access()[3] != reference[3])
1570*35238bceSAndroid Build Coastguard Worker {
1571*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1572*35238bceSAndroid Build Coastguard Worker buf << "Expected " << reference << ", got " << tcu::formatArray(state.getUintVec4Access());
1573*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1574*35238bceSAndroid Build Coastguard Worker }
1575*35238bceSAndroid Build Coastguard Worker break;
1576*35238bceSAndroid Build Coastguard Worker }
1577*35238bceSAndroid Build Coastguard Worker
1578*35238bceSAndroid Build Coastguard Worker default:
1579*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
1580*35238bceSAndroid Build Coastguard Worker break;
1581*35238bceSAndroid Build Coastguard Worker }
1582*35238bceSAndroid Build Coastguard Worker }
1583*35238bceSAndroid Build Coastguard Worker
verifyFloatVec4(tcu::ResultCollector & result,QueriedState & state,const tcu::Vec4 & expected)1584*35238bceSAndroid Build Coastguard Worker void verifyFloatVec4(tcu::ResultCollector &result, QueriedState &state, const tcu::Vec4 &expected)
1585*35238bceSAndroid Build Coastguard Worker {
1586*35238bceSAndroid Build Coastguard Worker switch (state.getType())
1587*35238bceSAndroid Build Coastguard Worker {
1588*35238bceSAndroid Build Coastguard Worker case DATATYPE_FLOAT_VEC4:
1589*35238bceSAndroid Build Coastguard Worker {
1590*35238bceSAndroid Build Coastguard Worker if (state.getFloatVec4Access()[0] != expected[0] || state.getFloatVec4Access()[1] != expected[1] ||
1591*35238bceSAndroid Build Coastguard Worker state.getFloatVec4Access()[2] != expected[2] || state.getFloatVec4Access()[3] != expected[3])
1592*35238bceSAndroid Build Coastguard Worker {
1593*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1594*35238bceSAndroid Build Coastguard Worker buf << "Expected " << expected << ", got " << tcu::formatArray(state.getFloatVec4Access());
1595*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1596*35238bceSAndroid Build Coastguard Worker }
1597*35238bceSAndroid Build Coastguard Worker break;
1598*35238bceSAndroid Build Coastguard Worker }
1599*35238bceSAndroid Build Coastguard Worker case DATATYPE_INTEGER_VEC4:
1600*35238bceSAndroid Build Coastguard Worker {
1601*35238bceSAndroid Build Coastguard Worker bool anyError = false;
1602*35238bceSAndroid Build Coastguard Worker std::ostringstream expectation;
1603*35238bceSAndroid Build Coastguard Worker
1604*35238bceSAndroid Build Coastguard Worker for (int ndx = 0; ndx < 4; ++ndx)
1605*35238bceSAndroid Build Coastguard Worker {
1606*35238bceSAndroid Build Coastguard Worker const glw::GLint refValueMin = roundGLfloatToNearestIntegerHalfDown<glw::GLint>(expected[ndx]);
1607*35238bceSAndroid Build Coastguard Worker const glw::GLint refValueMax = roundGLfloatToNearestIntegerHalfUp<glw::GLint>(expected[ndx]);
1608*35238bceSAndroid Build Coastguard Worker
1609*35238bceSAndroid Build Coastguard Worker if (state.getIntVec4Access()[ndx] < refValueMin || state.getIntVec4Access()[ndx] > refValueMax)
1610*35238bceSAndroid Build Coastguard Worker {
1611*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1612*35238bceSAndroid Build Coastguard Worker
1613*35238bceSAndroid Build Coastguard Worker if (ndx > 0)
1614*35238bceSAndroid Build Coastguard Worker expectation << " ,";
1615*35238bceSAndroid Build Coastguard Worker
1616*35238bceSAndroid Build Coastguard Worker if (refValueMin == refValueMax)
1617*35238bceSAndroid Build Coastguard Worker buf << refValueMin;
1618*35238bceSAndroid Build Coastguard Worker else
1619*35238bceSAndroid Build Coastguard Worker buf << "[" << refValueMin << ", " << refValueMax << "]";
1620*35238bceSAndroid Build Coastguard Worker }
1621*35238bceSAndroid Build Coastguard Worker }
1622*35238bceSAndroid Build Coastguard Worker
1623*35238bceSAndroid Build Coastguard Worker if (anyError)
1624*35238bceSAndroid Build Coastguard Worker {
1625*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1626*35238bceSAndroid Build Coastguard Worker buf << "Expected {" << expectation.str() << "}, got " << tcu::formatArray(state.getIntVec4Access());
1627*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1628*35238bceSAndroid Build Coastguard Worker }
1629*35238bceSAndroid Build Coastguard Worker break;
1630*35238bceSAndroid Build Coastguard Worker }
1631*35238bceSAndroid Build Coastguard Worker case DATATYPE_UNSIGNED_INTEGER_VEC4:
1632*35238bceSAndroid Build Coastguard Worker {
1633*35238bceSAndroid Build Coastguard Worker bool anyError = false;
1634*35238bceSAndroid Build Coastguard Worker std::ostringstream expectation;
1635*35238bceSAndroid Build Coastguard Worker
1636*35238bceSAndroid Build Coastguard Worker for (int ndx = 0; ndx < 4; ++ndx)
1637*35238bceSAndroid Build Coastguard Worker {
1638*35238bceSAndroid Build Coastguard Worker const glw::GLuint refValueMin = roundGLfloatToNearestIntegerHalfDown<glw::GLuint>(expected[ndx]);
1639*35238bceSAndroid Build Coastguard Worker const glw::GLuint refValueMax = roundGLfloatToNearestIntegerHalfUp<glw::GLuint>(expected[ndx]);
1640*35238bceSAndroid Build Coastguard Worker
1641*35238bceSAndroid Build Coastguard Worker if (state.getUintVec4Access()[ndx] < refValueMin || state.getUintVec4Access()[ndx] > refValueMax)
1642*35238bceSAndroid Build Coastguard Worker {
1643*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1644*35238bceSAndroid Build Coastguard Worker
1645*35238bceSAndroid Build Coastguard Worker if (ndx > 0)
1646*35238bceSAndroid Build Coastguard Worker expectation << " ,";
1647*35238bceSAndroid Build Coastguard Worker
1648*35238bceSAndroid Build Coastguard Worker if (refValueMin == refValueMax)
1649*35238bceSAndroid Build Coastguard Worker buf << refValueMin;
1650*35238bceSAndroid Build Coastguard Worker else
1651*35238bceSAndroid Build Coastguard Worker buf << "[" << refValueMin << ", " << refValueMax << "]";
1652*35238bceSAndroid Build Coastguard Worker }
1653*35238bceSAndroid Build Coastguard Worker }
1654*35238bceSAndroid Build Coastguard Worker
1655*35238bceSAndroid Build Coastguard Worker if (anyError)
1656*35238bceSAndroid Build Coastguard Worker {
1657*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1658*35238bceSAndroid Build Coastguard Worker buf << "Expected {" << expectation.str() << "}, got " << tcu::formatArray(state.getUintVec4Access());
1659*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1660*35238bceSAndroid Build Coastguard Worker }
1661*35238bceSAndroid Build Coastguard Worker break;
1662*35238bceSAndroid Build Coastguard Worker }
1663*35238bceSAndroid Build Coastguard Worker
1664*35238bceSAndroid Build Coastguard Worker default:
1665*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
1666*35238bceSAndroid Build Coastguard Worker break;
1667*35238bceSAndroid Build Coastguard Worker }
1668*35238bceSAndroid Build Coastguard Worker }
1669*35238bceSAndroid Build Coastguard Worker
verifyPointer(tcu::ResultCollector & result,QueriedState & state,const void * expected)1670*35238bceSAndroid Build Coastguard Worker void verifyPointer(tcu::ResultCollector &result, QueriedState &state, const void *expected)
1671*35238bceSAndroid Build Coastguard Worker {
1672*35238bceSAndroid Build Coastguard Worker switch (state.getType())
1673*35238bceSAndroid Build Coastguard Worker {
1674*35238bceSAndroid Build Coastguard Worker case DATATYPE_POINTER:
1675*35238bceSAndroid Build Coastguard Worker {
1676*35238bceSAndroid Build Coastguard Worker if (state.getPtrAccess() != expected)
1677*35238bceSAndroid Build Coastguard Worker {
1678*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1679*35238bceSAndroid Build Coastguard Worker buf << "Expected " << expected << ", got " << state.getPtrAccess();
1680*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1681*35238bceSAndroid Build Coastguard Worker }
1682*35238bceSAndroid Build Coastguard Worker break;
1683*35238bceSAndroid Build Coastguard Worker }
1684*35238bceSAndroid Build Coastguard Worker
1685*35238bceSAndroid Build Coastguard Worker default:
1686*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
1687*35238bceSAndroid Build Coastguard Worker break;
1688*35238bceSAndroid Build Coastguard Worker }
1689*35238bceSAndroid Build Coastguard Worker }
1690*35238bceSAndroid Build Coastguard Worker
normalizeI32Float(int32_t c)1691*35238bceSAndroid Build Coastguard Worker static float normalizeI32Float(int32_t c)
1692*35238bceSAndroid Build Coastguard Worker {
1693*35238bceSAndroid Build Coastguard Worker return de::max((float)c / float((1ul << 31) - 1u), -1.0f);
1694*35238bceSAndroid Build Coastguard Worker }
1695*35238bceSAndroid Build Coastguard Worker
verifyNormalizedI32Vec4(tcu::ResultCollector & result,QueriedState & state,const tcu::IVec4 & expected)1696*35238bceSAndroid Build Coastguard Worker void verifyNormalizedI32Vec4(tcu::ResultCollector &result, QueriedState &state, const tcu::IVec4 &expected)
1697*35238bceSAndroid Build Coastguard Worker {
1698*35238bceSAndroid Build Coastguard Worker // \note: normalization precision is irrelevant for these tests, we can use very large thresholds
1699*35238bceSAndroid Build Coastguard Worker const float normalizationError = 0.1f;
1700*35238bceSAndroid Build Coastguard Worker const tcu::Vec4 reference(normalizeI32Float(expected[0]), normalizeI32Float(expected[1]),
1701*35238bceSAndroid Build Coastguard Worker normalizeI32Float(expected[2]), normalizeI32Float(expected[3]));
1702*35238bceSAndroid Build Coastguard Worker const tcu::Vec4 validHigh(
1703*35238bceSAndroid Build Coastguard Worker de::min(1.0f, reference[0] + normalizationError), de::min(1.0f, reference[1] + normalizationError),
1704*35238bceSAndroid Build Coastguard Worker de::min(1.0f, reference[2] + normalizationError), de::min(1.0f, reference[3] + normalizationError));
1705*35238bceSAndroid Build Coastguard Worker const tcu::Vec4 validLow(
1706*35238bceSAndroid Build Coastguard Worker de::max(-1.0f, reference[0] - normalizationError), de::max(-1.0f, reference[1] - normalizationError),
1707*35238bceSAndroid Build Coastguard Worker de::max(-1.0f, reference[2] - normalizationError), de::max(-1.0f, reference[3] - normalizationError));
1708*35238bceSAndroid Build Coastguard Worker
1709*35238bceSAndroid Build Coastguard Worker switch (state.getType())
1710*35238bceSAndroid Build Coastguard Worker {
1711*35238bceSAndroid Build Coastguard Worker case DATATYPE_FLOAT_VEC4:
1712*35238bceSAndroid Build Coastguard Worker {
1713*35238bceSAndroid Build Coastguard Worker bool anyError = false;
1714*35238bceSAndroid Build Coastguard Worker std::ostringstream expectation;
1715*35238bceSAndroid Build Coastguard Worker
1716*35238bceSAndroid Build Coastguard Worker for (int ndx = 0; ndx < 4; ++ndx)
1717*35238bceSAndroid Build Coastguard Worker {
1718*35238bceSAndroid Build Coastguard Worker if (state.getFloatVec4Access()[ndx] < validLow[ndx] || state.getFloatVec4Access()[ndx] > validHigh[ndx])
1719*35238bceSAndroid Build Coastguard Worker {
1720*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1721*35238bceSAndroid Build Coastguard Worker
1722*35238bceSAndroid Build Coastguard Worker if (ndx > 0)
1723*35238bceSAndroid Build Coastguard Worker expectation << " ,";
1724*35238bceSAndroid Build Coastguard Worker buf << "[" << validLow[ndx] << ", " << validHigh[ndx] << "]";
1725*35238bceSAndroid Build Coastguard Worker }
1726*35238bceSAndroid Build Coastguard Worker }
1727*35238bceSAndroid Build Coastguard Worker
1728*35238bceSAndroid Build Coastguard Worker if (anyError)
1729*35238bceSAndroid Build Coastguard Worker {
1730*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1731*35238bceSAndroid Build Coastguard Worker buf << "Expected {" << expectation.str() << "}, got " << tcu::formatArray(state.getFloatVec4Access());
1732*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1733*35238bceSAndroid Build Coastguard Worker }
1734*35238bceSAndroid Build Coastguard Worker break;
1735*35238bceSAndroid Build Coastguard Worker }
1736*35238bceSAndroid Build Coastguard Worker case DATATYPE_INTEGER_VEC4:
1737*35238bceSAndroid Build Coastguard Worker {
1738*35238bceSAndroid Build Coastguard Worker bool anyError = false;
1739*35238bceSAndroid Build Coastguard Worker std::ostringstream expectation;
1740*35238bceSAndroid Build Coastguard Worker
1741*35238bceSAndroid Build Coastguard Worker for (int ndx = 0; ndx < 4; ++ndx)
1742*35238bceSAndroid Build Coastguard Worker {
1743*35238bceSAndroid Build Coastguard Worker const glw::GLint refValueMin = roundGLfloatToNearestIntegerHalfDown<glw::GLint>(validHigh[ndx]);
1744*35238bceSAndroid Build Coastguard Worker const glw::GLint refValueMax = roundGLfloatToNearestIntegerHalfUp<glw::GLint>(validLow[ndx]);
1745*35238bceSAndroid Build Coastguard Worker
1746*35238bceSAndroid Build Coastguard Worker if (state.getIntVec4Access()[ndx] < refValueMin || state.getIntVec4Access()[ndx] > refValueMax)
1747*35238bceSAndroid Build Coastguard Worker {
1748*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1749*35238bceSAndroid Build Coastguard Worker
1750*35238bceSAndroid Build Coastguard Worker if (ndx > 0)
1751*35238bceSAndroid Build Coastguard Worker expectation << " ,";
1752*35238bceSAndroid Build Coastguard Worker
1753*35238bceSAndroid Build Coastguard Worker if (refValueMin == refValueMax)
1754*35238bceSAndroid Build Coastguard Worker buf << refValueMin;
1755*35238bceSAndroid Build Coastguard Worker else
1756*35238bceSAndroid Build Coastguard Worker buf << "[" << refValueMin << ", " << refValueMax << "]";
1757*35238bceSAndroid Build Coastguard Worker }
1758*35238bceSAndroid Build Coastguard Worker }
1759*35238bceSAndroid Build Coastguard Worker
1760*35238bceSAndroid Build Coastguard Worker if (anyError)
1761*35238bceSAndroid Build Coastguard Worker {
1762*35238bceSAndroid Build Coastguard Worker std::ostringstream buf;
1763*35238bceSAndroid Build Coastguard Worker buf << "Expected {" << expectation.str() << "}, got " << tcu::formatArray(state.getIntVec4Access());
1764*35238bceSAndroid Build Coastguard Worker result.fail(buf.str());
1765*35238bceSAndroid Build Coastguard Worker }
1766*35238bceSAndroid Build Coastguard Worker break;
1767*35238bceSAndroid Build Coastguard Worker }
1768*35238bceSAndroid Build Coastguard Worker
1769*35238bceSAndroid Build Coastguard Worker default:
1770*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
1771*35238bceSAndroid Build Coastguard Worker break;
1772*35238bceSAndroid Build Coastguard Worker }
1773*35238bceSAndroid Build Coastguard Worker }
1774*35238bceSAndroid Build Coastguard Worker
1775*35238bceSAndroid Build Coastguard Worker // helpers
1776*35238bceSAndroid Build Coastguard Worker
verifyStateBoolean(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLenum target,bool refValue,QueryType type)1777*35238bceSAndroid Build Coastguard Worker void verifyStateBoolean(tcu::ResultCollector &result, glu::CallLogWrapper &gl, glw::GLenum target, bool refValue,
1778*35238bceSAndroid Build Coastguard Worker QueryType type)
1779*35238bceSAndroid Build Coastguard Worker {
1780*35238bceSAndroid Build Coastguard Worker QueriedState state;
1781*35238bceSAndroid Build Coastguard Worker
1782*35238bceSAndroid Build Coastguard Worker queryState(result, gl, type, target, state);
1783*35238bceSAndroid Build Coastguard Worker
1784*35238bceSAndroid Build Coastguard Worker if (!state.isUndefined())
1785*35238bceSAndroid Build Coastguard Worker verifyBoolean(result, state, refValue);
1786*35238bceSAndroid Build Coastguard Worker }
1787*35238bceSAndroid Build Coastguard Worker
verifyStateInteger(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLenum target,int refValue,QueryType type)1788*35238bceSAndroid Build Coastguard Worker void verifyStateInteger(tcu::ResultCollector &result, glu::CallLogWrapper &gl, glw::GLenum target, int refValue,
1789*35238bceSAndroid Build Coastguard Worker QueryType type)
1790*35238bceSAndroid Build Coastguard Worker {
1791*35238bceSAndroid Build Coastguard Worker QueriedState state;
1792*35238bceSAndroid Build Coastguard Worker
1793*35238bceSAndroid Build Coastguard Worker queryState(result, gl, type, target, state);
1794*35238bceSAndroid Build Coastguard Worker
1795*35238bceSAndroid Build Coastguard Worker if (!state.isUndefined())
1796*35238bceSAndroid Build Coastguard Worker verifyInteger(result, state, refValue);
1797*35238bceSAndroid Build Coastguard Worker }
1798*35238bceSAndroid Build Coastguard Worker
verifyStateIntegerMin(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLenum target,int minValue,QueryType type)1799*35238bceSAndroid Build Coastguard Worker void verifyStateIntegerMin(tcu::ResultCollector &result, glu::CallLogWrapper &gl, glw::GLenum target, int minValue,
1800*35238bceSAndroid Build Coastguard Worker QueryType type)
1801*35238bceSAndroid Build Coastguard Worker {
1802*35238bceSAndroid Build Coastguard Worker QueriedState state;
1803*35238bceSAndroid Build Coastguard Worker
1804*35238bceSAndroid Build Coastguard Worker queryState(result, gl, type, target, state);
1805*35238bceSAndroid Build Coastguard Worker
1806*35238bceSAndroid Build Coastguard Worker if (!state.isUndefined())
1807*35238bceSAndroid Build Coastguard Worker verifyIntegerMin(result, state, minValue);
1808*35238bceSAndroid Build Coastguard Worker }
1809*35238bceSAndroid Build Coastguard Worker
verifyStateIntegerMax(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLenum target,int maxValue,QueryType type)1810*35238bceSAndroid Build Coastguard Worker void verifyStateIntegerMax(tcu::ResultCollector &result, glu::CallLogWrapper &gl, glw::GLenum target, int maxValue,
1811*35238bceSAndroid Build Coastguard Worker QueryType type)
1812*35238bceSAndroid Build Coastguard Worker {
1813*35238bceSAndroid Build Coastguard Worker QueriedState state;
1814*35238bceSAndroid Build Coastguard Worker
1815*35238bceSAndroid Build Coastguard Worker queryState(result, gl, type, target, state);
1816*35238bceSAndroid Build Coastguard Worker
1817*35238bceSAndroid Build Coastguard Worker if (!state.isUndefined())
1818*35238bceSAndroid Build Coastguard Worker verifyIntegerMax(result, state, maxValue);
1819*35238bceSAndroid Build Coastguard Worker }
1820*35238bceSAndroid Build Coastguard Worker
verifyStateIntegerEqualToOther(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLenum target,glw::GLenum other,QueryType type)1821*35238bceSAndroid Build Coastguard Worker void verifyStateIntegerEqualToOther(tcu::ResultCollector &result, glu::CallLogWrapper &gl, glw::GLenum target,
1822*35238bceSAndroid Build Coastguard Worker glw::GLenum other, QueryType type)
1823*35238bceSAndroid Build Coastguard Worker {
1824*35238bceSAndroid Build Coastguard Worker QueriedState stateA;
1825*35238bceSAndroid Build Coastguard Worker QueriedState stateB;
1826*35238bceSAndroid Build Coastguard Worker
1827*35238bceSAndroid Build Coastguard Worker queryState(result, gl, type, target, stateA);
1828*35238bceSAndroid Build Coastguard Worker queryState(result, gl, type, other, stateB);
1829*35238bceSAndroid Build Coastguard Worker
1830*35238bceSAndroid Build Coastguard Worker if (stateA.isUndefined() || stateB.isUndefined())
1831*35238bceSAndroid Build Coastguard Worker return;
1832*35238bceSAndroid Build Coastguard Worker
1833*35238bceSAndroid Build Coastguard Worker switch (type)
1834*35238bceSAndroid Build Coastguard Worker {
1835*35238bceSAndroid Build Coastguard Worker case QUERY_BOOLEAN:
1836*35238bceSAndroid Build Coastguard Worker {
1837*35238bceSAndroid Build Coastguard Worker if (stateA.getBoolAccess() != stateB.getBoolAccess())
1838*35238bceSAndroid Build Coastguard Worker result.fail("expected equal results");
1839*35238bceSAndroid Build Coastguard Worker break;
1840*35238bceSAndroid Build Coastguard Worker }
1841*35238bceSAndroid Build Coastguard Worker
1842*35238bceSAndroid Build Coastguard Worker case QUERY_INTEGER:
1843*35238bceSAndroid Build Coastguard Worker {
1844*35238bceSAndroid Build Coastguard Worker if (stateA.getIntAccess() != stateB.getIntAccess())
1845*35238bceSAndroid Build Coastguard Worker result.fail("expected equal results");
1846*35238bceSAndroid Build Coastguard Worker break;
1847*35238bceSAndroid Build Coastguard Worker }
1848*35238bceSAndroid Build Coastguard Worker
1849*35238bceSAndroid Build Coastguard Worker case QUERY_INTEGER64:
1850*35238bceSAndroid Build Coastguard Worker {
1851*35238bceSAndroid Build Coastguard Worker if (stateA.getInt64Access() != stateB.getInt64Access())
1852*35238bceSAndroid Build Coastguard Worker result.fail("expected equal results");
1853*35238bceSAndroid Build Coastguard Worker break;
1854*35238bceSAndroid Build Coastguard Worker }
1855*35238bceSAndroid Build Coastguard Worker
1856*35238bceSAndroid Build Coastguard Worker case QUERY_FLOAT:
1857*35238bceSAndroid Build Coastguard Worker {
1858*35238bceSAndroid Build Coastguard Worker if (stateA.getFloatAccess() != stateB.getFloatAccess())
1859*35238bceSAndroid Build Coastguard Worker result.fail("expected equal results");
1860*35238bceSAndroid Build Coastguard Worker break;
1861*35238bceSAndroid Build Coastguard Worker }
1862*35238bceSAndroid Build Coastguard Worker
1863*35238bceSAndroid Build Coastguard Worker default:
1864*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
1865*35238bceSAndroid Build Coastguard Worker break;
1866*35238bceSAndroid Build Coastguard Worker }
1867*35238bceSAndroid Build Coastguard Worker }
1868*35238bceSAndroid Build Coastguard Worker
verifyStateFloat(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLenum target,float reference,QueryType type)1869*35238bceSAndroid Build Coastguard Worker void verifyStateFloat(tcu::ResultCollector &result, glu::CallLogWrapper &gl, glw::GLenum target, float reference,
1870*35238bceSAndroid Build Coastguard Worker QueryType type)
1871*35238bceSAndroid Build Coastguard Worker {
1872*35238bceSAndroid Build Coastguard Worker QueriedState state;
1873*35238bceSAndroid Build Coastguard Worker
1874*35238bceSAndroid Build Coastguard Worker queryState(result, gl, type, target, state);
1875*35238bceSAndroid Build Coastguard Worker
1876*35238bceSAndroid Build Coastguard Worker if (!state.isUndefined())
1877*35238bceSAndroid Build Coastguard Worker verifyFloat(result, state, reference);
1878*35238bceSAndroid Build Coastguard Worker }
1879*35238bceSAndroid Build Coastguard Worker
verifyStateFloatMin(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLenum target,float minValue,QueryType type)1880*35238bceSAndroid Build Coastguard Worker void verifyStateFloatMin(tcu::ResultCollector &result, glu::CallLogWrapper &gl, glw::GLenum target, float minValue,
1881*35238bceSAndroid Build Coastguard Worker QueryType type)
1882*35238bceSAndroid Build Coastguard Worker {
1883*35238bceSAndroid Build Coastguard Worker QueriedState state;
1884*35238bceSAndroid Build Coastguard Worker
1885*35238bceSAndroid Build Coastguard Worker queryState(result, gl, type, target, state);
1886*35238bceSAndroid Build Coastguard Worker
1887*35238bceSAndroid Build Coastguard Worker if (!state.isUndefined())
1888*35238bceSAndroid Build Coastguard Worker verifyFloatMin(result, state, minValue);
1889*35238bceSAndroid Build Coastguard Worker }
1890*35238bceSAndroid Build Coastguard Worker
verifyStateFloatMax(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLenum target,float maxValue,QueryType type)1891*35238bceSAndroid Build Coastguard Worker void verifyStateFloatMax(tcu::ResultCollector &result, glu::CallLogWrapper &gl, glw::GLenum target, float maxValue,
1892*35238bceSAndroid Build Coastguard Worker QueryType type)
1893*35238bceSAndroid Build Coastguard Worker {
1894*35238bceSAndroid Build Coastguard Worker QueriedState state;
1895*35238bceSAndroid Build Coastguard Worker
1896*35238bceSAndroid Build Coastguard Worker queryState(result, gl, type, target, state);
1897*35238bceSAndroid Build Coastguard Worker
1898*35238bceSAndroid Build Coastguard Worker if (!state.isUndefined())
1899*35238bceSAndroid Build Coastguard Worker verifyFloatMax(result, state, maxValue);
1900*35238bceSAndroid Build Coastguard Worker }
1901*35238bceSAndroid Build Coastguard Worker
verifyStatePointer(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLenum target,const void * expected,QueryType type)1902*35238bceSAndroid Build Coastguard Worker void verifyStatePointer(tcu::ResultCollector &result, glu::CallLogWrapper &gl, glw::GLenum target, const void *expected,
1903*35238bceSAndroid Build Coastguard Worker QueryType type)
1904*35238bceSAndroid Build Coastguard Worker {
1905*35238bceSAndroid Build Coastguard Worker QueriedState state;
1906*35238bceSAndroid Build Coastguard Worker
1907*35238bceSAndroid Build Coastguard Worker queryPointerState(result, gl, type, target, state);
1908*35238bceSAndroid Build Coastguard Worker
1909*35238bceSAndroid Build Coastguard Worker if (!state.isUndefined())
1910*35238bceSAndroid Build Coastguard Worker verifyPointer(result, state, expected);
1911*35238bceSAndroid Build Coastguard Worker }
1912*35238bceSAndroid Build Coastguard Worker
verifyStateIndexedBoolean(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLenum target,int index,bool expected,QueryType type)1913*35238bceSAndroid Build Coastguard Worker void verifyStateIndexedBoolean(tcu::ResultCollector &result, glu::CallLogWrapper &gl, glw::GLenum target, int index,
1914*35238bceSAndroid Build Coastguard Worker bool expected, QueryType type)
1915*35238bceSAndroid Build Coastguard Worker {
1916*35238bceSAndroid Build Coastguard Worker QueriedState state;
1917*35238bceSAndroid Build Coastguard Worker
1918*35238bceSAndroid Build Coastguard Worker queryIndexedState(result, gl, type, target, index, state);
1919*35238bceSAndroid Build Coastguard Worker
1920*35238bceSAndroid Build Coastguard Worker if (!state.isUndefined())
1921*35238bceSAndroid Build Coastguard Worker verifyBoolean(result, state, expected);
1922*35238bceSAndroid Build Coastguard Worker }
1923*35238bceSAndroid Build Coastguard Worker
verifyStateIndexedBooleanVec4(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLenum target,int index,const tcu::BVec4 & expected,QueryType type)1924*35238bceSAndroid Build Coastguard Worker void verifyStateIndexedBooleanVec4(tcu::ResultCollector &result, glu::CallLogWrapper &gl, glw::GLenum target, int index,
1925*35238bceSAndroid Build Coastguard Worker const tcu::BVec4 &expected, QueryType type)
1926*35238bceSAndroid Build Coastguard Worker {
1927*35238bceSAndroid Build Coastguard Worker QueriedState state;
1928*35238bceSAndroid Build Coastguard Worker
1929*35238bceSAndroid Build Coastguard Worker queryIndexedState(result, gl, type, target, index, state);
1930*35238bceSAndroid Build Coastguard Worker
1931*35238bceSAndroid Build Coastguard Worker if (!state.isUndefined())
1932*35238bceSAndroid Build Coastguard Worker verifyBooleanVec4(result, state, expected);
1933*35238bceSAndroid Build Coastguard Worker }
1934*35238bceSAndroid Build Coastguard Worker
verifyStateIndexedInteger(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLenum target,int index,int expected,QueryType type)1935*35238bceSAndroid Build Coastguard Worker void verifyStateIndexedInteger(tcu::ResultCollector &result, glu::CallLogWrapper &gl, glw::GLenum target, int index,
1936*35238bceSAndroid Build Coastguard Worker int expected, QueryType type)
1937*35238bceSAndroid Build Coastguard Worker {
1938*35238bceSAndroid Build Coastguard Worker QueriedState state;
1939*35238bceSAndroid Build Coastguard Worker
1940*35238bceSAndroid Build Coastguard Worker queryIndexedState(result, gl, type, target, index, state);
1941*35238bceSAndroid Build Coastguard Worker
1942*35238bceSAndroid Build Coastguard Worker if (!state.isUndefined())
1943*35238bceSAndroid Build Coastguard Worker verifyInteger(result, state, expected);
1944*35238bceSAndroid Build Coastguard Worker }
1945*35238bceSAndroid Build Coastguard Worker
verifyStateIndexedIntegerMin(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLenum target,int index,int minValue,QueryType type)1946*35238bceSAndroid Build Coastguard Worker void verifyStateIndexedIntegerMin(tcu::ResultCollector &result, glu::CallLogWrapper &gl, glw::GLenum target, int index,
1947*35238bceSAndroid Build Coastguard Worker int minValue, QueryType type)
1948*35238bceSAndroid Build Coastguard Worker {
1949*35238bceSAndroid Build Coastguard Worker QueriedState state;
1950*35238bceSAndroid Build Coastguard Worker
1951*35238bceSAndroid Build Coastguard Worker queryIndexedState(result, gl, type, target, index, state);
1952*35238bceSAndroid Build Coastguard Worker
1953*35238bceSAndroid Build Coastguard Worker if (!state.isUndefined())
1954*35238bceSAndroid Build Coastguard Worker verifyIntegerMin(result, state, minValue);
1955*35238bceSAndroid Build Coastguard Worker }
1956*35238bceSAndroid Build Coastguard Worker
verifyStateAttributeInteger(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLenum target,int index,int expected,QueryType type)1957*35238bceSAndroid Build Coastguard Worker void verifyStateAttributeInteger(tcu::ResultCollector &result, glu::CallLogWrapper &gl, glw::GLenum target, int index,
1958*35238bceSAndroid Build Coastguard Worker int expected, QueryType type)
1959*35238bceSAndroid Build Coastguard Worker {
1960*35238bceSAndroid Build Coastguard Worker QueriedState state;
1961*35238bceSAndroid Build Coastguard Worker
1962*35238bceSAndroid Build Coastguard Worker queryAttributeState(result, gl, type, target, index, state);
1963*35238bceSAndroid Build Coastguard Worker
1964*35238bceSAndroid Build Coastguard Worker if (!state.isUndefined())
1965*35238bceSAndroid Build Coastguard Worker verifyInteger(result, state, expected);
1966*35238bceSAndroid Build Coastguard Worker }
1967*35238bceSAndroid Build Coastguard Worker
verifyStateFramebufferInteger(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLenum target,glw::GLenum pname,int expected,QueryType type)1968*35238bceSAndroid Build Coastguard Worker void verifyStateFramebufferInteger(tcu::ResultCollector &result, glu::CallLogWrapper &gl, glw::GLenum target,
1969*35238bceSAndroid Build Coastguard Worker glw::GLenum pname, int expected, QueryType type)
1970*35238bceSAndroid Build Coastguard Worker {
1971*35238bceSAndroid Build Coastguard Worker QueriedState state;
1972*35238bceSAndroid Build Coastguard Worker
1973*35238bceSAndroid Build Coastguard Worker queryFramebufferState(result, gl, type, target, pname, state);
1974*35238bceSAndroid Build Coastguard Worker
1975*35238bceSAndroid Build Coastguard Worker if (!state.isUndefined())
1976*35238bceSAndroid Build Coastguard Worker verifyInteger(result, state, expected);
1977*35238bceSAndroid Build Coastguard Worker }
1978*35238bceSAndroid Build Coastguard Worker
verifyStateFramebufferIntegerMin(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLenum target,glw::GLenum pname,int minValue,QueryType type)1979*35238bceSAndroid Build Coastguard Worker void verifyStateFramebufferIntegerMin(tcu::ResultCollector &result, glu::CallLogWrapper &gl, glw::GLenum target,
1980*35238bceSAndroid Build Coastguard Worker glw::GLenum pname, int minValue, QueryType type)
1981*35238bceSAndroid Build Coastguard Worker {
1982*35238bceSAndroid Build Coastguard Worker QueriedState state;
1983*35238bceSAndroid Build Coastguard Worker
1984*35238bceSAndroid Build Coastguard Worker queryFramebufferState(result, gl, type, target, pname, state);
1985*35238bceSAndroid Build Coastguard Worker
1986*35238bceSAndroid Build Coastguard Worker if (!state.isUndefined())
1987*35238bceSAndroid Build Coastguard Worker verifyIntegerMin(result, state, minValue);
1988*35238bceSAndroid Build Coastguard Worker }
1989*35238bceSAndroid Build Coastguard Worker
verifyStateProgramInteger(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLuint program,glw::GLenum pname,int expected,QueryType type)1990*35238bceSAndroid Build Coastguard Worker void verifyStateProgramInteger(tcu::ResultCollector &result, glu::CallLogWrapper &gl, glw::GLuint program,
1991*35238bceSAndroid Build Coastguard Worker glw::GLenum pname, int expected, QueryType type)
1992*35238bceSAndroid Build Coastguard Worker {
1993*35238bceSAndroid Build Coastguard Worker QueriedState state;
1994*35238bceSAndroid Build Coastguard Worker
1995*35238bceSAndroid Build Coastguard Worker queryProgramState(result, gl, type, program, pname, state);
1996*35238bceSAndroid Build Coastguard Worker
1997*35238bceSAndroid Build Coastguard Worker if (!state.isUndefined())
1998*35238bceSAndroid Build Coastguard Worker verifyInteger(result, state, expected);
1999*35238bceSAndroid Build Coastguard Worker }
2000*35238bceSAndroid Build Coastguard Worker
verifyStateProgramIntegerVec3(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLuint program,glw::GLenum pname,const tcu::IVec3 & expected,QueryType type)2001*35238bceSAndroid Build Coastguard Worker void verifyStateProgramIntegerVec3(tcu::ResultCollector &result, glu::CallLogWrapper &gl, glw::GLuint program,
2002*35238bceSAndroid Build Coastguard Worker glw::GLenum pname, const tcu::IVec3 &expected, QueryType type)
2003*35238bceSAndroid Build Coastguard Worker {
2004*35238bceSAndroid Build Coastguard Worker QueriedState state;
2005*35238bceSAndroid Build Coastguard Worker
2006*35238bceSAndroid Build Coastguard Worker queryProgramState(result, gl, type, program, pname, state);
2007*35238bceSAndroid Build Coastguard Worker
2008*35238bceSAndroid Build Coastguard Worker if (!state.isUndefined())
2009*35238bceSAndroid Build Coastguard Worker verifyIntegerVec3(result, state, expected);
2010*35238bceSAndroid Build Coastguard Worker }
2011*35238bceSAndroid Build Coastguard Worker
verifyStatePipelineInteger(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLuint pipeline,glw::GLenum pname,int expected,QueryType type)2012*35238bceSAndroid Build Coastguard Worker void verifyStatePipelineInteger(tcu::ResultCollector &result, glu::CallLogWrapper &gl, glw::GLuint pipeline,
2013*35238bceSAndroid Build Coastguard Worker glw::GLenum pname, int expected, QueryType type)
2014*35238bceSAndroid Build Coastguard Worker {
2015*35238bceSAndroid Build Coastguard Worker QueriedState state;
2016*35238bceSAndroid Build Coastguard Worker
2017*35238bceSAndroid Build Coastguard Worker queryPipelineState(result, gl, type, pipeline, pname, state);
2018*35238bceSAndroid Build Coastguard Worker
2019*35238bceSAndroid Build Coastguard Worker if (!state.isUndefined())
2020*35238bceSAndroid Build Coastguard Worker verifyInteger(result, state, expected);
2021*35238bceSAndroid Build Coastguard Worker }
2022*35238bceSAndroid Build Coastguard Worker
verifyStateTextureParamInteger(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLenum target,glw::GLenum pname,int expected,QueryType type)2023*35238bceSAndroid Build Coastguard Worker void verifyStateTextureParamInteger(tcu::ResultCollector &result, glu::CallLogWrapper &gl, glw::GLenum target,
2024*35238bceSAndroid Build Coastguard Worker glw::GLenum pname, int expected, QueryType type)
2025*35238bceSAndroid Build Coastguard Worker {
2026*35238bceSAndroid Build Coastguard Worker QueriedState state;
2027*35238bceSAndroid Build Coastguard Worker
2028*35238bceSAndroid Build Coastguard Worker queryTextureParamState(result, gl, type, target, pname, state);
2029*35238bceSAndroid Build Coastguard Worker
2030*35238bceSAndroid Build Coastguard Worker if (!state.isUndefined())
2031*35238bceSAndroid Build Coastguard Worker verifyInteger(result, state, expected);
2032*35238bceSAndroid Build Coastguard Worker }
2033*35238bceSAndroid Build Coastguard Worker
verifyStateTextureParamFloat(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLenum target,glw::GLenum pname,float expected,QueryType type)2034*35238bceSAndroid Build Coastguard Worker void verifyStateTextureParamFloat(tcu::ResultCollector &result, glu::CallLogWrapper &gl, glw::GLenum target,
2035*35238bceSAndroid Build Coastguard Worker glw::GLenum pname, float expected, QueryType type)
2036*35238bceSAndroid Build Coastguard Worker {
2037*35238bceSAndroid Build Coastguard Worker QueriedState state;
2038*35238bceSAndroid Build Coastguard Worker
2039*35238bceSAndroid Build Coastguard Worker queryTextureParamState(result, gl, type, target, pname, state);
2040*35238bceSAndroid Build Coastguard Worker
2041*35238bceSAndroid Build Coastguard Worker if (!state.isUndefined())
2042*35238bceSAndroid Build Coastguard Worker verifyFloat(result, state, expected);
2043*35238bceSAndroid Build Coastguard Worker }
2044*35238bceSAndroid Build Coastguard Worker
verifyStateTextureParamFloatVec4(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLenum target,glw::GLenum pname,const tcu::Vec4 & expected,QueryType type)2045*35238bceSAndroid Build Coastguard Worker void verifyStateTextureParamFloatVec4(tcu::ResultCollector &result, glu::CallLogWrapper &gl, glw::GLenum target,
2046*35238bceSAndroid Build Coastguard Worker glw::GLenum pname, const tcu::Vec4 &expected, QueryType type)
2047*35238bceSAndroid Build Coastguard Worker {
2048*35238bceSAndroid Build Coastguard Worker QueriedState state;
2049*35238bceSAndroid Build Coastguard Worker
2050*35238bceSAndroid Build Coastguard Worker queryTextureParamState(result, gl, type, target, pname, state);
2051*35238bceSAndroid Build Coastguard Worker
2052*35238bceSAndroid Build Coastguard Worker if (!state.isUndefined())
2053*35238bceSAndroid Build Coastguard Worker verifyFloatVec4(result, state, expected);
2054*35238bceSAndroid Build Coastguard Worker }
2055*35238bceSAndroid Build Coastguard Worker
verifyStateTextureParamNormalizedI32Vec4(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLenum target,glw::GLenum pname,const tcu::IVec4 & expected,QueryType type)2056*35238bceSAndroid Build Coastguard Worker void verifyStateTextureParamNormalizedI32Vec4(tcu::ResultCollector &result, glu::CallLogWrapper &gl, glw::GLenum target,
2057*35238bceSAndroid Build Coastguard Worker glw::GLenum pname, const tcu::IVec4 &expected, QueryType type)
2058*35238bceSAndroid Build Coastguard Worker {
2059*35238bceSAndroid Build Coastguard Worker QueriedState state;
2060*35238bceSAndroid Build Coastguard Worker
2061*35238bceSAndroid Build Coastguard Worker queryTextureParamState(result, gl, type, target, pname, state);
2062*35238bceSAndroid Build Coastguard Worker
2063*35238bceSAndroid Build Coastguard Worker if (!state.isUndefined())
2064*35238bceSAndroid Build Coastguard Worker verifyNormalizedI32Vec4(result, state, expected);
2065*35238bceSAndroid Build Coastguard Worker }
2066*35238bceSAndroid Build Coastguard Worker
verifyStateTextureParamIntegerVec4(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLenum target,glw::GLenum pname,const tcu::IVec4 & expected,QueryType type)2067*35238bceSAndroid Build Coastguard Worker void verifyStateTextureParamIntegerVec4(tcu::ResultCollector &result, glu::CallLogWrapper &gl, glw::GLenum target,
2068*35238bceSAndroid Build Coastguard Worker glw::GLenum pname, const tcu::IVec4 &expected, QueryType type)
2069*35238bceSAndroid Build Coastguard Worker {
2070*35238bceSAndroid Build Coastguard Worker QueriedState state;
2071*35238bceSAndroid Build Coastguard Worker
2072*35238bceSAndroid Build Coastguard Worker queryTextureParamState(result, gl, type, target, pname, state);
2073*35238bceSAndroid Build Coastguard Worker
2074*35238bceSAndroid Build Coastguard Worker if (!state.isUndefined())
2075*35238bceSAndroid Build Coastguard Worker verifyIntegerVec4(result, state, expected);
2076*35238bceSAndroid Build Coastguard Worker }
2077*35238bceSAndroid Build Coastguard Worker
verifyStateTextureParamUnsignedIntegerVec4(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLenum target,glw::GLenum pname,const tcu::UVec4 & expected,QueryType type)2078*35238bceSAndroid Build Coastguard Worker void verifyStateTextureParamUnsignedIntegerVec4(tcu::ResultCollector &result, glu::CallLogWrapper &gl,
2079*35238bceSAndroid Build Coastguard Worker glw::GLenum target, glw::GLenum pname, const tcu::UVec4 &expected,
2080*35238bceSAndroid Build Coastguard Worker QueryType type)
2081*35238bceSAndroid Build Coastguard Worker {
2082*35238bceSAndroid Build Coastguard Worker QueriedState state;
2083*35238bceSAndroid Build Coastguard Worker
2084*35238bceSAndroid Build Coastguard Worker queryTextureParamState(result, gl, type, target, pname, state);
2085*35238bceSAndroid Build Coastguard Worker
2086*35238bceSAndroid Build Coastguard Worker if (!state.isUndefined())
2087*35238bceSAndroid Build Coastguard Worker verifyUnsignedIntegerVec4(result, state, expected);
2088*35238bceSAndroid Build Coastguard Worker }
2089*35238bceSAndroid Build Coastguard Worker
verifyStateTextureLevelInteger(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLenum target,int level,glw::GLenum pname,int expected,QueryType type)2090*35238bceSAndroid Build Coastguard Worker void verifyStateTextureLevelInteger(tcu::ResultCollector &result, glu::CallLogWrapper &gl, glw::GLenum target,
2091*35238bceSAndroid Build Coastguard Worker int level, glw::GLenum pname, int expected, QueryType type)
2092*35238bceSAndroid Build Coastguard Worker {
2093*35238bceSAndroid Build Coastguard Worker QueriedState state;
2094*35238bceSAndroid Build Coastguard Worker
2095*35238bceSAndroid Build Coastguard Worker queryTextureLevelState(result, gl, type, target, level, pname, state);
2096*35238bceSAndroid Build Coastguard Worker
2097*35238bceSAndroid Build Coastguard Worker if (!state.isUndefined())
2098*35238bceSAndroid Build Coastguard Worker verifyInteger(result, state, expected);
2099*35238bceSAndroid Build Coastguard Worker }
2100*35238bceSAndroid Build Coastguard Worker
verifyStateObjectBoolean(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLuint handle,bool expected,QueryType type)2101*35238bceSAndroid Build Coastguard Worker void verifyStateObjectBoolean(tcu::ResultCollector &result, glu::CallLogWrapper &gl, glw::GLuint handle, bool expected,
2102*35238bceSAndroid Build Coastguard Worker QueryType type)
2103*35238bceSAndroid Build Coastguard Worker {
2104*35238bceSAndroid Build Coastguard Worker QueriedState state;
2105*35238bceSAndroid Build Coastguard Worker
2106*35238bceSAndroid Build Coastguard Worker queryObjectState(result, gl, type, handle, state);
2107*35238bceSAndroid Build Coastguard Worker
2108*35238bceSAndroid Build Coastguard Worker if (!state.isUndefined())
2109*35238bceSAndroid Build Coastguard Worker verifyBoolean(result, state, expected);
2110*35238bceSAndroid Build Coastguard Worker }
2111*35238bceSAndroid Build Coastguard Worker
verifyStateQueryInteger(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLenum target,glw::GLenum pname,int expected,QueryType type)2112*35238bceSAndroid Build Coastguard Worker void verifyStateQueryInteger(tcu::ResultCollector &result, glu::CallLogWrapper &gl, glw::GLenum target,
2113*35238bceSAndroid Build Coastguard Worker glw::GLenum pname, int expected, QueryType type)
2114*35238bceSAndroid Build Coastguard Worker {
2115*35238bceSAndroid Build Coastguard Worker QueriedState state;
2116*35238bceSAndroid Build Coastguard Worker
2117*35238bceSAndroid Build Coastguard Worker queryQueryState(result, gl, type, target, pname, state);
2118*35238bceSAndroid Build Coastguard Worker
2119*35238bceSAndroid Build Coastguard Worker if (!state.isUndefined())
2120*35238bceSAndroid Build Coastguard Worker verifyInteger(result, state, expected);
2121*35238bceSAndroid Build Coastguard Worker }
2122*35238bceSAndroid Build Coastguard Worker
verifyStateSamplerParamInteger(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLuint sampler,glw::GLenum pname,int expected,QueryType type)2123*35238bceSAndroid Build Coastguard Worker void verifyStateSamplerParamInteger(tcu::ResultCollector &result, glu::CallLogWrapper &gl, glw::GLuint sampler,
2124*35238bceSAndroid Build Coastguard Worker glw::GLenum pname, int expected, QueryType type)
2125*35238bceSAndroid Build Coastguard Worker {
2126*35238bceSAndroid Build Coastguard Worker QueriedState state;
2127*35238bceSAndroid Build Coastguard Worker
2128*35238bceSAndroid Build Coastguard Worker querySamplerState(result, gl, type, sampler, pname, state);
2129*35238bceSAndroid Build Coastguard Worker
2130*35238bceSAndroid Build Coastguard Worker if (!state.isUndefined())
2131*35238bceSAndroid Build Coastguard Worker verifyInteger(result, state, expected);
2132*35238bceSAndroid Build Coastguard Worker }
2133*35238bceSAndroid Build Coastguard Worker
verifyStateSamplerParamFloat(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLuint sampler,glw::GLenum pname,float expected,QueryType type)2134*35238bceSAndroid Build Coastguard Worker void verifyStateSamplerParamFloat(tcu::ResultCollector &result, glu::CallLogWrapper &gl, glw::GLuint sampler,
2135*35238bceSAndroid Build Coastguard Worker glw::GLenum pname, float expected, QueryType type)
2136*35238bceSAndroid Build Coastguard Worker {
2137*35238bceSAndroid Build Coastguard Worker QueriedState state;
2138*35238bceSAndroid Build Coastguard Worker
2139*35238bceSAndroid Build Coastguard Worker querySamplerState(result, gl, type, sampler, pname, state);
2140*35238bceSAndroid Build Coastguard Worker
2141*35238bceSAndroid Build Coastguard Worker if (!state.isUndefined())
2142*35238bceSAndroid Build Coastguard Worker verifyFloat(result, state, expected);
2143*35238bceSAndroid Build Coastguard Worker }
2144*35238bceSAndroid Build Coastguard Worker
verifyStateSamplerParamFloatVec4(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLuint sampler,glw::GLenum pname,const tcu::Vec4 & expected,QueryType type)2145*35238bceSAndroid Build Coastguard Worker void verifyStateSamplerParamFloatVec4(tcu::ResultCollector &result, glu::CallLogWrapper &gl, glw::GLuint sampler,
2146*35238bceSAndroid Build Coastguard Worker glw::GLenum pname, const tcu::Vec4 &expected, QueryType type)
2147*35238bceSAndroid Build Coastguard Worker {
2148*35238bceSAndroid Build Coastguard Worker QueriedState state;
2149*35238bceSAndroid Build Coastguard Worker
2150*35238bceSAndroid Build Coastguard Worker querySamplerState(result, gl, type, sampler, pname, state);
2151*35238bceSAndroid Build Coastguard Worker
2152*35238bceSAndroid Build Coastguard Worker if (!state.isUndefined())
2153*35238bceSAndroid Build Coastguard Worker verifyFloatVec4(result, state, expected);
2154*35238bceSAndroid Build Coastguard Worker }
2155*35238bceSAndroid Build Coastguard Worker
verifyStateSamplerParamNormalizedI32Vec4(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLuint sampler,glw::GLenum pname,const tcu::IVec4 & expected,QueryType type)2156*35238bceSAndroid Build Coastguard Worker void verifyStateSamplerParamNormalizedI32Vec4(tcu::ResultCollector &result, glu::CallLogWrapper &gl,
2157*35238bceSAndroid Build Coastguard Worker glw::GLuint sampler, glw::GLenum pname, const tcu::IVec4 &expected,
2158*35238bceSAndroid Build Coastguard Worker QueryType type)
2159*35238bceSAndroid Build Coastguard Worker {
2160*35238bceSAndroid Build Coastguard Worker QueriedState state;
2161*35238bceSAndroid Build Coastguard Worker
2162*35238bceSAndroid Build Coastguard Worker querySamplerState(result, gl, type, sampler, pname, state);
2163*35238bceSAndroid Build Coastguard Worker
2164*35238bceSAndroid Build Coastguard Worker if (!state.isUndefined())
2165*35238bceSAndroid Build Coastguard Worker verifyNormalizedI32Vec4(result, state, expected);
2166*35238bceSAndroid Build Coastguard Worker }
2167*35238bceSAndroid Build Coastguard Worker
verifyStateSamplerParamIntegerVec4(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLuint sampler,glw::GLenum pname,const tcu::IVec4 & expected,QueryType type)2168*35238bceSAndroid Build Coastguard Worker void verifyStateSamplerParamIntegerVec4(tcu::ResultCollector &result, glu::CallLogWrapper &gl, glw::GLuint sampler,
2169*35238bceSAndroid Build Coastguard Worker glw::GLenum pname, const tcu::IVec4 &expected, QueryType type)
2170*35238bceSAndroid Build Coastguard Worker {
2171*35238bceSAndroid Build Coastguard Worker QueriedState state;
2172*35238bceSAndroid Build Coastguard Worker
2173*35238bceSAndroid Build Coastguard Worker querySamplerState(result, gl, type, sampler, pname, state);
2174*35238bceSAndroid Build Coastguard Worker
2175*35238bceSAndroid Build Coastguard Worker if (!state.isUndefined())
2176*35238bceSAndroid Build Coastguard Worker verifyIntegerVec4(result, state, expected);
2177*35238bceSAndroid Build Coastguard Worker }
2178*35238bceSAndroid Build Coastguard Worker
verifyStateSamplerParamUnsignedIntegerVec4(tcu::ResultCollector & result,glu::CallLogWrapper & gl,glw::GLuint sampler,glw::GLenum pname,const tcu::UVec4 & expected,QueryType type)2179*35238bceSAndroid Build Coastguard Worker void verifyStateSamplerParamUnsignedIntegerVec4(tcu::ResultCollector &result, glu::CallLogWrapper &gl,
2180*35238bceSAndroid Build Coastguard Worker glw::GLuint sampler, glw::GLenum pname, const tcu::UVec4 &expected,
2181*35238bceSAndroid Build Coastguard Worker QueryType type)
2182*35238bceSAndroid Build Coastguard Worker {
2183*35238bceSAndroid Build Coastguard Worker QueriedState state;
2184*35238bceSAndroid Build Coastguard Worker
2185*35238bceSAndroid Build Coastguard Worker querySamplerState(result, gl, type, sampler, pname, state);
2186*35238bceSAndroid Build Coastguard Worker
2187*35238bceSAndroid Build Coastguard Worker if (!state.isUndefined())
2188*35238bceSAndroid Build Coastguard Worker verifyUnsignedIntegerVec4(result, state, expected);
2189*35238bceSAndroid Build Coastguard Worker }
2190*35238bceSAndroid Build Coastguard Worker
2191*35238bceSAndroid Build Coastguard Worker } // namespace StateQueryUtil
2192*35238bceSAndroid Build Coastguard Worker } // namespace gls
2193*35238bceSAndroid Build Coastguard Worker } // namespace deqp
2194