1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program OpenGL (ES) Module
3 * -----------------------------------------------
5 * Copyright 2015 The Android Open Source Project
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 * \brief State Query test utils.
22 *//*--------------------------------------------------------------------*/
23 #include "glsStateQueryUtil.hpp"
24 #include "tcuTestContext.hpp"
25 #include "tcuFormatUtil.hpp"
26 #include "gluCallLogWrapper.hpp"
27 #include "gluStrUtil.hpp"
28 #include "glwEnums.hpp"
29 #include "deStringUtil.hpp"
35 namespace StateQueryUtil
38 static glw::GLboolean mapBoolToGLBoolean (bool b)
40 return (b ? GL_TRUE : GL_FALSE);
43 static bool checkError (tcu::ResultCollector& result, glu::CallLogWrapper& gl, const char* msg)
45 const glw::GLenum errorCode = gl.glGetError();
47 if (errorCode == GL_NO_ERROR)
50 result.fail(std::string(msg) + ": glGetError() returned " + glu::getErrorStr(errorCode).toString());
54 QueriedState::QueriedState (void)
55 : m_type(DATATYPE_LAST)
59 QueriedState::QueriedState (glw::GLint v)
60 : m_type(DATATYPE_INTEGER)
65 QueriedState::QueriedState (glw::GLint64 v)
66 : m_type(DATATYPE_INTEGER64)
71 QueriedState::QueriedState (bool v)
72 : m_type(DATATYPE_BOOLEAN)
77 QueriedState::QueriedState (glw::GLfloat v)
78 : m_type(DATATYPE_FLOAT)
83 QueriedState::QueriedState (glw::GLuint v)
84 : m_type(DATATYPE_UNSIGNED_INTEGER)
89 QueriedState::QueriedState (const GLIntVec3& v)
90 : m_type(DATATYPE_INTEGER_VEC3)
92 m_v.vIntVec3[0] = v[0];
93 m_v.vIntVec3[1] = v[1];
94 m_v.vIntVec3[2] = v[2];
97 QueriedState::QueriedState (void* v)
98 : m_type(DATATYPE_POINTER)
103 QueriedState::QueriedState (const GLIntVec4& v)
104 : m_type(DATATYPE_INTEGER_VEC4)
106 m_v.vIntVec4[0] = v[0];
107 m_v.vIntVec4[1] = v[1];
108 m_v.vIntVec4[2] = v[2];
109 m_v.vIntVec4[3] = v[3];
112 QueriedState::QueriedState (const GLUintVec4& v)
113 : m_type(DATATYPE_UNSIGNED_INTEGER_VEC4)
115 m_v.vUintVec4[0] = v[0];
116 m_v.vUintVec4[1] = v[1];
117 m_v.vUintVec4[2] = v[2];
118 m_v.vUintVec4[3] = v[3];
121 QueriedState::QueriedState (const GLFloatVec4& v)
122 : m_type(DATATYPE_FLOAT_VEC4)
124 m_v.vFloatVec4[0] = v[0];
125 m_v.vFloatVec4[1] = v[1];
126 m_v.vFloatVec4[2] = v[2];
127 m_v.vFloatVec4[3] = v[3];
130 QueriedState::QueriedState (const BooleanVec4& v)
131 : m_type(DATATYPE_BOOLEAN_VEC4)
133 m_v.vBooleanVec4[0] = v[0];
134 m_v.vBooleanVec4[1] = v[1];
135 m_v.vBooleanVec4[2] = v[2];
136 m_v.vBooleanVec4[3] = v[3];
139 QueriedState::QueriedState (const GLInt64Vec4& v)
140 : m_type(DATATYPE_INTEGER64_VEC4)
142 m_v.vInt64Vec4[0] = v[0];
143 m_v.vInt64Vec4[1] = v[1];
144 m_v.vInt64Vec4[2] = v[2];
145 m_v.vInt64Vec4[3] = v[3];
148 bool QueriedState::isUndefined (void) const
150 return m_type == DATATYPE_LAST;
153 DataType QueriedState::getType (void) const
158 glw::GLint& QueriedState::getIntAccess (void)
160 DE_ASSERT(m_type == DATATYPE_INTEGER);
164 glw::GLint64& QueriedState::getInt64Access (void)
166 DE_ASSERT(m_type == DATATYPE_INTEGER64);
170 bool& QueriedState::getBoolAccess (void)
172 DE_ASSERT(m_type == DATATYPE_BOOLEAN);
176 glw::GLfloat& QueriedState::getFloatAccess (void)
178 DE_ASSERT(m_type == DATATYPE_FLOAT);
182 glw::GLuint& QueriedState::getUintAccess (void)
184 DE_ASSERT(m_type == DATATYPE_UNSIGNED_INTEGER);
188 QueriedState::GLIntVec3& QueriedState::getIntVec3Access (void)
190 DE_ASSERT(m_type == DATATYPE_INTEGER_VEC3);
194 void*& QueriedState::getPtrAccess (void)
196 DE_ASSERT(m_type == DATATYPE_POINTER);
200 QueriedState::GLIntVec4& QueriedState::getIntVec4Access (void)
202 DE_ASSERT(m_type == DATATYPE_INTEGER_VEC4);
206 QueriedState::GLUintVec4& QueriedState::getUintVec4Access (void)
208 DE_ASSERT(m_type == DATATYPE_UNSIGNED_INTEGER_VEC4);
209 return m_v.vUintVec4;
212 QueriedState::GLFloatVec4& QueriedState::getFloatVec4Access (void)
214 DE_ASSERT(m_type == DATATYPE_FLOAT_VEC4);
215 return m_v.vFloatVec4;
218 QueriedState::BooleanVec4& QueriedState::getBooleanVec4Access (void)
220 DE_ASSERT(m_type == DATATYPE_BOOLEAN_VEC4);
221 return m_v.vBooleanVec4;
224 QueriedState::GLInt64Vec4& QueriedState::getInt64Vec4Access (void)
226 DE_ASSERT(m_type == DATATYPE_INTEGER64_VEC4);
227 return m_v.vInt64Vec4;
232 static bool verifyBooleanValidity (tcu::ResultCollector& result, glw::GLboolean v)
234 if (v == GL_TRUE || v == GL_FALSE)
238 std::ostringstream buf;
239 buf << "Boolean value was not neither GL_TRUE nor GL_FALSE, got " << de::toString(tcu::Format::Hex<2>(v));
240 result.fail(buf.str());
245 static bool verifyBooleanVec4Validity (tcu::ResultCollector& result, const glw::GLboolean v[4])
249 for (int i = 0; i < 4; i++)
251 if (v[i] != GL_TRUE && v[i] != GL_FALSE)
257 std::ostringstream buf;
258 buf << "Boolean vec4 value was not neither GL_TRUE nor GL_FALSE, got (";
260 for (int i = 0; i < 4; i++)
261 buf << (i > 0 ? ", " : "") << de::toString(tcu::Format::Hex<2>(v[i]));
265 result.fail(buf.str());
271 void queryState (tcu::ResultCollector& result, glu::CallLogWrapper& gl, QueryType type, glw::GLenum target, QueriedState& state)
275 case QUERY_ISENABLED:
277 const glw::GLboolean value = gl.glIsEnabled(target);
279 if (!checkError(result, gl, "glIsEnabled"))
282 if (!verifyBooleanValidity(result, value))
285 state = QueriedState(value == GL_TRUE);
291 StateQueryMemoryWriteGuard<glw::GLboolean> value;
292 gl.glGetBooleanv(target, &value);
294 if (!checkError(result, gl, "glGetBooleanv"))
297 if (!value.verifyValidity(result))
299 if (!verifyBooleanValidity(result, value))
302 state = QueriedState(value == GL_TRUE);
308 StateQueryMemoryWriteGuard<glw::GLint> value;
309 gl.glGetIntegerv(target, &value);
311 if (!checkError(result, gl, "glGetIntegerv"))
314 if (!value.verifyValidity(result))
317 state = QueriedState(value);
321 case QUERY_INTEGER64:
323 StateQueryMemoryWriteGuard<glw::GLint64> value;
324 gl.glGetInteger64v(target, &value);
326 if (!checkError(result, gl, "glGetInteger64v"))
329 if (!value.verifyValidity(result))
332 state = QueriedState(value);
338 StateQueryMemoryWriteGuard<glw::GLfloat> value;
339 gl.glGetFloatv(target, &value);
341 if (!checkError(result, gl, "glGetFloatv"))
344 if (!value.verifyValidity(result))
347 state = QueriedState(value);
357 void queryIndexedState (tcu::ResultCollector& result, glu::CallLogWrapper& gl, QueryType type, glw::GLenum target, int index, QueriedState& state)
361 case QUERY_INDEXED_BOOLEAN_VEC4:
363 StateQueryMemoryWriteGuard<glw::GLboolean[4]> value;
364 gl.glGetBooleani_v(target, index, value);
366 if (!checkError(result, gl, "glGetBooleani_v"))
369 if (!value.verifyValidity(result))
372 if (!verifyBooleanVec4Validity(result, value))
378 for (int i = 0; i < 4; i++)
379 res[i] = value[i] == GL_TRUE;
381 state = QueriedState(res);
387 case QUERY_INDEXED_INTEGER_VEC4:
389 StateQueryMemoryWriteGuard<glw::GLint[4]> value;
390 gl.glGetIntegeri_v(target, index, value);
392 if (!checkError(result, gl, "glGetIntegeri_v"))
395 if (!value.verifyValidity(result))
398 state = QueriedState(value);
402 case QUERY_INDEXED_INTEGER64_VEC4:
404 StateQueryMemoryWriteGuard<glw::GLint64[4]> value;
405 gl.glGetInteger64i_v(target, index, value);
407 if (!checkError(result, gl, "glGetInteger64i_v"))
410 if (!value.verifyValidity(result))
413 state = QueriedState(value);
417 case QUERY_INDEXED_ISENABLED:
419 const glw::GLboolean value = gl.glIsEnabledi(target, index);
421 if (!checkError(result, gl, "glIsEnabledi"))
424 if (!verifyBooleanValidity(result, value))
427 state = QueriedState(value == GL_TRUE);
431 case QUERY_INDEXED_BOOLEAN:
433 StateQueryMemoryWriteGuard<glw::GLboolean> value;
434 gl.glGetBooleani_v(target, index, &value);
436 if (!checkError(result, gl, "glGetBooleani_v"))
439 if (!value.verifyValidity(result))
441 if (!verifyBooleanValidity(result, value))
444 state = QueriedState(value == GL_TRUE);
448 case QUERY_INDEXED_INTEGER:
450 StateQueryMemoryWriteGuard<glw::GLint> value;
451 gl.glGetIntegeri_v(target, index, &value);
453 if (!checkError(result, gl, "glGetIntegeri_v"))
456 if (!value.verifyValidity(result))
459 state = QueriedState(value);
463 case QUERY_INDEXED_INTEGER64:
465 StateQueryMemoryWriteGuard<glw::GLint64> value;
466 gl.glGetInteger64i_v(target, index, &value);
468 if (!checkError(result, gl, "glGetInteger64i_v"))
471 if (!value.verifyValidity(result))
474 state = QueriedState(value);
484 void queryAttributeState (tcu::ResultCollector& result, glu::CallLogWrapper& gl, QueryType type, glw::GLenum target, int index, QueriedState& state)
488 case QUERY_ATTRIBUTE_INTEGER:
490 StateQueryMemoryWriteGuard<glw::GLint> value;
491 gl.glGetVertexAttribiv(index, target, &value);
493 if (!checkError(result, gl, "glGetVertexAttribiv"))
496 if (!value.verifyValidity(result))
499 state = QueriedState(value);
502 case QUERY_ATTRIBUTE_FLOAT:
504 StateQueryMemoryWriteGuard<glw::GLfloat> value;
505 gl.glGetVertexAttribfv(index, target, &value);
507 if (!checkError(result, gl, "glGetVertexAttribfv"))
510 if (!value.verifyValidity(result))
513 state = QueriedState(value);
516 case QUERY_ATTRIBUTE_PURE_INTEGER:
518 StateQueryMemoryWriteGuard<glw::GLint> value;
519 gl.glGetVertexAttribIiv(index, target, &value);
521 if (!checkError(result, gl, "glGetVertexAttribIiv"))
524 if (!value.verifyValidity(result))
527 state = QueriedState(value);
530 case QUERY_ATTRIBUTE_PURE_UNSIGNED_INTEGER:
532 StateQueryMemoryWriteGuard<glw::GLuint> value;
533 gl.glGetVertexAttribIuiv(index, target, &value);
535 if (!checkError(result, gl, "glGetVertexAttribIuiv"))
538 if (!value.verifyValidity(result))
541 state = QueriedState(value);
549 void queryFramebufferState (tcu::ResultCollector& result, glu::CallLogWrapper& gl, QueryType type, glw::GLenum target, glw::GLenum pname, QueriedState& state)
553 case QUERY_FRAMEBUFFER_INTEGER:
555 StateQueryMemoryWriteGuard<glw::GLint> value;
556 gl.glGetFramebufferParameteriv(target, pname, &value);
558 if (!checkError(result, gl, "glGetVertexAttribiv"))
561 if (!value.verifyValidity(result))
564 state = QueriedState(value);
572 void queryProgramState (tcu::ResultCollector& result, glu::CallLogWrapper& gl, QueryType type, glw::GLuint program, glw::GLenum pname, QueriedState& state)
576 case QUERY_PROGRAM_INTEGER:
578 StateQueryMemoryWriteGuard<glw::GLint> value;
579 gl.glGetProgramiv(program, pname, &value);
581 if (!checkError(result, gl, "glGetProgramiv"))
584 if (!value.verifyValidity(result))
587 state = QueriedState(value);
590 case QUERY_PROGRAM_INTEGER_VEC3:
592 StateQueryMemoryWriteGuard<glw::GLint[3]> value;
593 gl.glGetProgramiv(program, pname, value);
595 if (!checkError(result, gl, "glGetProgramiv"))
598 if (!value.verifyValidity(result))
601 state = QueriedState(value);
609 void queryPipelineState (tcu::ResultCollector& result, glu::CallLogWrapper& gl, QueryType type, glw::GLuint pipeline, glw::GLenum pname, QueriedState& state)
613 case QUERY_PIPELINE_INTEGER:
615 StateQueryMemoryWriteGuard<glw::GLint> value;
616 gl.glGetProgramPipelineiv(pipeline, pname, &value);
618 if (!checkError(result, gl, "glGetProgramiv"))
621 if (!value.verifyValidity(result))
624 state = QueriedState(value);
632 void queryTextureParamState (tcu::ResultCollector& result, glu::CallLogWrapper& gl, QueryType type, glw::GLenum target, glw::GLenum pname, QueriedState& state)
636 case QUERY_TEXTURE_PARAM_INTEGER:
638 StateQueryMemoryWriteGuard<glw::GLint> value;
639 gl.glGetTexParameteriv(target, pname, &value);
641 if (!checkError(result, gl, "glGetTexParameteriv"))
644 if (!value.verifyValidity(result))
647 state = QueriedState(value);
650 case QUERY_TEXTURE_PARAM_FLOAT:
652 StateQueryMemoryWriteGuard<glw::GLfloat> value;
653 gl.glGetTexParameterfv(target, pname, &value);
655 if (!checkError(result, gl, "glGetTexParameterfv"))
658 if (!value.verifyValidity(result))
661 state = QueriedState(value);
664 case QUERY_TEXTURE_PARAM_PURE_INTEGER:
666 StateQueryMemoryWriteGuard<glw::GLint> value;
667 gl.glGetTexParameterIiv(target, pname, &value);
669 if (!checkError(result, gl, "GetTexParameterIiv"))
672 if (!value.verifyValidity(result))
675 state = QueriedState(value);
678 case QUERY_TEXTURE_PARAM_PURE_UNSIGNED_INTEGER:
680 StateQueryMemoryWriteGuard<glw::GLuint> value;
681 gl.glGetTexParameterIuiv(target, pname, &value);
683 if (!checkError(result, gl, "GetTexParameterIuiv"))
686 if (!value.verifyValidity(result))
689 state = QueriedState(value);
692 case QUERY_TEXTURE_PARAM_INTEGER_VEC4:
694 StateQueryMemoryWriteGuard<glw::GLint[4]> value;
695 gl.glGetTexParameteriv(target, pname, value);
697 if (!checkError(result, gl, "glGetTexParameteriv"))
700 if (!value.verifyValidity(result))
703 state = QueriedState(value);
706 case QUERY_TEXTURE_PARAM_FLOAT_VEC4:
708 StateQueryMemoryWriteGuard<glw::GLfloat[4]> value;
709 gl.glGetTexParameterfv(target, pname, value);
711 if (!checkError(result, gl, "glGetTexParameterfv"))
714 if (!value.verifyValidity(result))
717 state = QueriedState(value);
720 case QUERY_TEXTURE_PARAM_PURE_INTEGER_VEC4:
722 StateQueryMemoryWriteGuard<glw::GLint[4]> value;
723 gl.glGetTexParameterIiv(target, pname, value);
725 if (!checkError(result, gl, "GetTexParameterIiv"))
728 if (!value.verifyValidity(result))
731 state = QueriedState(value);
734 case QUERY_TEXTURE_PARAM_PURE_UNSIGNED_INTEGER_VEC4:
736 StateQueryMemoryWriteGuard<glw::GLuint[4]> value;
737 gl.glGetTexParameterIuiv(target, pname, value);
739 if (!checkError(result, gl, "GetTexParameterIuiv"))
742 if (!value.verifyValidity(result))
745 state = QueriedState(value);
753 void queryTextureLevelState (tcu::ResultCollector& result, glu::CallLogWrapper& gl, QueryType type, glw::GLenum target, int level, glw::GLenum pname, QueriedState& state)
757 case QUERY_TEXTURE_LEVEL_INTEGER:
759 StateQueryMemoryWriteGuard<glw::GLint> value;
760 gl.glGetTexLevelParameteriv(target, level, pname, &value);
762 if (!checkError(result, gl, "glGetTexLevelParameteriv"))
765 if (!value.verifyValidity(result))
768 state = QueriedState(value);
771 case QUERY_TEXTURE_LEVEL_FLOAT:
773 StateQueryMemoryWriteGuard<glw::GLfloat> value;
774 gl.glGetTexLevelParameterfv(target, level, pname, &value);
776 if (!checkError(result, gl, "glGetTexLevelParameterfv"))
779 if (!value.verifyValidity(result))
782 state = QueriedState(value);
790 void queryPointerState (tcu::ResultCollector& result, glu::CallLogWrapper& gl, QueryType type, glw::GLenum pname, QueriedState& state)
796 StateQueryMemoryWriteGuard<void*> value;
797 gl.glGetPointerv(pname, &value);
799 if (!checkError(result, gl, "glGetPointerv"))
802 if (!value.verifyValidity(result))
805 state = QueriedState(value);
813 void queryObjectState (tcu::ResultCollector& result, glu::CallLogWrapper& gl, QueryType type, glw::GLuint handle, QueriedState& state)
817 case QUERY_ISTEXTURE:
819 const glw::GLboolean value = gl.glIsTexture(handle);
821 if (!checkError(result, gl, "glIsTexture"))
824 if (!verifyBooleanValidity(result, value))
827 state = QueriedState(value == GL_TRUE);
835 void queryQueryState (tcu::ResultCollector& result, glu::CallLogWrapper& gl, QueryType type, glw::GLenum target, glw::GLenum pname, QueriedState& state)
841 StateQueryMemoryWriteGuard<glw::GLint> value;
842 gl.glGetQueryiv(target, pname, &value);
844 if (!checkError(result, gl, "glGetQueryiv"))
847 if (!value.verifyValidity(result))
850 state = QueriedState(value);
858 void querySamplerState (tcu::ResultCollector& result, glu::CallLogWrapper& gl, QueryType type, glw::GLuint sampler, glw::GLenum pname, QueriedState& state)
862 case QUERY_SAMPLER_PARAM_INTEGER:
864 StateQueryMemoryWriteGuard<glw::GLint> value;
865 gl.glGetSamplerParameteriv(sampler, pname, &value);
867 if (!checkError(result, gl, "glGetSamplerParameteriv"))
870 if (!value.verifyValidity(result))
873 state = QueriedState(value);
876 case QUERY_SAMPLER_PARAM_FLOAT:
878 StateQueryMemoryWriteGuard<glw::GLfloat> value;
879 gl.glGetSamplerParameterfv(sampler, pname, &value);
881 if (!checkError(result, gl, "glGetSamplerParameteriv"))
884 if (!value.verifyValidity(result))
887 state = QueriedState(value);
890 case QUERY_SAMPLER_PARAM_PURE_INTEGER:
892 StateQueryMemoryWriteGuard<glw::GLint> value;
893 gl.glGetSamplerParameterIiv(sampler, pname, &value);
895 if (!checkError(result, gl, "glGetSamplerParameterIiv"))
898 if (!value.verifyValidity(result))
901 state = QueriedState(value);
904 case QUERY_SAMPLER_PARAM_PURE_UNSIGNED_INTEGER:
906 StateQueryMemoryWriteGuard<glw::GLuint> value;
907 gl.glGetSamplerParameterIuiv(sampler, pname, &value);
909 if (!checkError(result, gl, "glGetSamplerParameterIuiv"))
912 if (!value.verifyValidity(result))
915 state = QueriedState(value);
918 case QUERY_SAMPLER_PARAM_INTEGER_VEC4:
920 StateQueryMemoryWriteGuard<glw::GLint[4]> value;
921 gl.glGetSamplerParameteriv(sampler, pname, value);
923 if (!checkError(result, gl, "glGetSamplerParameteriv"))
926 if (!value.verifyValidity(result))
929 state = QueriedState(value);
932 case QUERY_SAMPLER_PARAM_FLOAT_VEC4:
934 StateQueryMemoryWriteGuard<glw::GLfloat[4]> value;
935 gl.glGetSamplerParameterfv(sampler, pname, value);
937 if (!checkError(result, gl, "glGetSamplerParameteriv"))
940 if (!value.verifyValidity(result))
943 state = QueriedState(value);
946 case QUERY_SAMPLER_PARAM_PURE_INTEGER_VEC4:
948 StateQueryMemoryWriteGuard<glw::GLint[4]> value;
949 gl.glGetSamplerParameterIiv(sampler, pname, value);
951 if (!checkError(result, gl, "glGetSamplerParameterIiv"))
954 if (!value.verifyValidity(result))
957 state = QueriedState(value);
960 case QUERY_SAMPLER_PARAM_PURE_UNSIGNED_INTEGER_VEC4:
962 StateQueryMemoryWriteGuard<glw::GLuint[4]> value;
963 gl.glGetSamplerParameterIuiv(sampler, pname, value);
965 if (!checkError(result, gl, "glGetSamplerParameterIuiv"))
968 if (!value.verifyValidity(result))
971 state = QueriedState(value);
981 void verifyBoolean (tcu::ResultCollector& result, QueriedState& state, bool expected)
983 switch (state.getType())
985 case DATATYPE_BOOLEAN:
987 if (state.getBoolAccess() != expected)
989 std::ostringstream buf;
990 buf << "Expected " << glu::getBooleanStr(mapBoolToGLBoolean(expected)) << ", got " << glu::getBooleanStr(mapBoolToGLBoolean(state.getBoolAccess()));
991 result.fail(buf.str());
996 case DATATYPE_INTEGER:
998 const glw::GLint reference = expected ? 1 : 0;
999 if (state.getIntAccess() != reference)
1001 std::ostringstream buf;
1002 buf << "Expected " << reference << ", got " << state.getIntAccess();
1003 result.fail(buf.str());
1008 case DATATYPE_INTEGER64:
1010 const glw::GLint64 reference = expected ? 1 : 0;
1011 if (state.getInt64Access() != reference)
1013 std::ostringstream buf;
1014 buf << "Expected " << reference << ", got " << state.getInt64Access();
1015 result.fail(buf.str());
1020 case DATATYPE_FLOAT:
1022 const glw::GLfloat reference = expected ? 1.0f : 0.0f;
1023 if (state.getFloatAccess() != reference)
1025 std::ostringstream buf;
1026 buf << "Expected " << reference << ", got " << state.getFloatAccess();
1027 result.fail(buf.str());
1033 DE_ASSERT(DE_FALSE);
1038 void verifyInteger (tcu::ResultCollector& result, QueriedState& state, int expected)
1040 switch (state.getType())
1042 case DATATYPE_BOOLEAN:
1044 const bool reference = (expected != 0);
1045 if (state.getBoolAccess() != reference)
1047 std::ostringstream buf;
1048 buf << "Expected " << glu::getBooleanStr(mapBoolToGLBoolean(reference)) << ", got " << glu::getBooleanStr(mapBoolToGLBoolean(state.getBoolAccess()));
1049 result.fail(buf.str());
1054 case DATATYPE_INTEGER:
1056 const glw::GLint reference = expected;
1057 if (state.getIntAccess() != reference)
1059 std::ostringstream buf;
1060 buf << "Expected " << reference << "(" << de::toString(tcu::Format::Hex<8>(reference))
1061 << ") , got " << state.getIntAccess() << "(" << de::toString(tcu::Format::Hex<8>(state.getIntAccess())) << ")";
1062 result.fail(buf.str());
1067 case DATATYPE_INTEGER64:
1069 const glw::GLint64 reference = (glw::GLint64)expected;
1070 if (state.getInt64Access() != reference)
1072 std::ostringstream buf;
1073 buf << "Expected " << reference << "(" << de::toString(tcu::Format::Hex<8>(reference)) << "), got "
1074 << state.getInt64Access() << "(" << de::toString(tcu::Format::Hex<8>(state.getInt64Access())) << ")";
1075 result.fail(buf.str());
1080 case DATATYPE_FLOAT:
1082 const glw::GLfloat refValueMin = deInt32ToFloatRoundToNegInf(expected);
1083 const glw::GLfloat refValueMax = deInt32ToFloatRoundToPosInf(expected);
1085 if (state.getFloatAccess() < refValueMin ||
1086 state.getFloatAccess() > refValueMax ||
1087 deIsNaN(state.getFloatAccess()))
1089 std::ostringstream buf;
1091 if (refValueMin == refValueMax)
1092 buf << "Expected " << refValueMin << ", got " << state.getFloatAccess();
1094 buf << "Expected in range [" << refValueMin << ", " << refValueMax << "], got " << state.getFloatAccess();
1096 result.fail(buf.str());
1101 case DATATYPE_UNSIGNED_INTEGER:
1103 const glw::GLuint reference = (glw::GLuint)expected;
1104 if (state.getUintAccess() != reference)
1106 std::ostringstream buf;
1107 buf << "Expected " << reference << "(" << de::toString(tcu::Format::Hex<8>(reference)) << "), got "
1108 << state.getInt64Access() << "(" << de::toString(tcu::Format::Hex<8>(state.getInt64Access())) << ")";
1109 result.fail(buf.str());
1115 DE_ASSERT(DE_FALSE);
1120 void verifyIntegerMin (tcu::ResultCollector& result, QueriedState& state, int minValue)
1122 switch (state.getType())
1124 case DATATYPE_BOOLEAN:
1126 if (minValue > 0 && state.getBoolAccess() != true)
1128 std::ostringstream buf;
1129 buf << "Expected GL_TRUE, got GL_FALSE";
1130 result.fail(buf.str());
1135 case DATATYPE_INTEGER:
1137 if (state.getIntAccess() < minValue)
1139 std::ostringstream buf;
1140 buf << "Expected greater or equal to " << minValue << ", got " << state.getIntAccess();
1141 result.fail(buf.str());
1146 case DATATYPE_INTEGER64:
1148 if (state.getInt64Access() < minValue)
1150 std::ostringstream buf;
1151 buf << "Expected greater or equal to " << minValue << ", got " << state.getInt64Access();
1152 result.fail(buf.str());
1157 case DATATYPE_FLOAT:
1159 if (state.getFloatAccess() < deInt32ToFloatRoundToNegInf(minValue) || deIsNaN(state.getFloatAccess()))
1161 std::ostringstream buf;
1162 buf << "Expected greater or equal to " << minValue << ", got " << state.getFloatAccess();
1163 result.fail(buf.str());
1169 DE_ASSERT(DE_FALSE);
1174 void verifyIntegerMax (tcu::ResultCollector& result, QueriedState& state, int maxValue)
1176 switch (state.getType())
1178 case DATATYPE_BOOLEAN:
1180 if (maxValue < 0 && state.getBoolAccess() != true)
1182 std::ostringstream buf;
1183 buf << "Expected GL_TRUE, got GL_FALSE";
1184 result.fail(buf.str());
1189 case DATATYPE_INTEGER:
1191 if (state.getIntAccess() > maxValue)
1193 std::ostringstream buf;
1194 buf << "Expected less or equal to " << maxValue << ", got " << state.getIntAccess();
1195 result.fail(buf.str());
1200 case DATATYPE_INTEGER64:
1202 if (state.getInt64Access() > maxValue)
1204 std::ostringstream buf;
1205 buf << "Expected less or equal to " << maxValue << ", got " << state.getInt64Access();
1206 result.fail(buf.str());
1211 case DATATYPE_FLOAT:
1213 if (state.getFloatAccess() > deInt32ToFloatRoundToPosInf(maxValue) || deIsNaN(state.getFloatAccess()))
1215 std::ostringstream buf;
1216 buf << "Expected less or equal to " << maxValue << ", got " << state.getFloatAccess();
1217 result.fail(buf.str());
1223 DE_ASSERT(DE_FALSE);
1228 void verifyFloat (tcu::ResultCollector& result, QueriedState& state, float expected)
1230 switch (state.getType())
1232 case DATATYPE_BOOLEAN:
1234 const bool reference = (expected != 0.0f);
1236 if (state.getBoolAccess() != reference)
1238 std::ostringstream buf;
1239 buf << "Expected " << glu::getBooleanStr(mapBoolToGLBoolean(reference)) << ", got " << glu::getBooleanStr(mapBoolToGLBoolean(state.getBoolAccess()));
1240 result.fail(buf.str());
1245 case DATATYPE_INTEGER:
1247 const glw::GLint refValueMin = roundGLfloatToNearestIntegerHalfDown<glw::GLint>(expected);
1248 const glw::GLint refValueMax = roundGLfloatToNearestIntegerHalfUp<glw::GLint>(expected);
1250 if (state.getIntAccess() < refValueMin ||
1251 state.getIntAccess() > refValueMax)
1253 std::ostringstream buf;
1255 if (refValueMin == refValueMax)
1256 buf << "Expected " << refValueMin << ", got " << state.getIntAccess();
1258 buf << "Expected in range [" << refValueMin << ", " << refValueMax << "], got " << state.getIntAccess();
1260 result.fail(buf.str());
1265 case DATATYPE_FLOAT:
1267 if (state.getFloatAccess() != expected)
1269 std::ostringstream buf;
1270 buf << "Expected " << expected << ", got " << state.getFloatAccess();
1271 result.fail(buf.str());
1276 case DATATYPE_INTEGER64:
1278 const glw::GLint64 refValueMin = roundGLfloatToNearestIntegerHalfDown<glw::GLint64>(expected);
1279 const glw::GLint64 refValueMax = roundGLfloatToNearestIntegerHalfUp<glw::GLint64>(expected);
1281 if (state.getInt64Access() < refValueMin ||
1282 state.getInt64Access() > refValueMax)
1284 std::ostringstream buf;
1286 if (refValueMin == refValueMax)
1287 buf << "Expected " << refValueMin << ", got " << state.getInt64Access();
1289 buf << "Expected in range [" << refValueMin << ", " << refValueMax << "], got " << state.getInt64Access();
1291 result.fail(buf.str());
1296 case DATATYPE_UNSIGNED_INTEGER:
1298 const glw::GLuint refValueMin = roundGLfloatToNearestIntegerHalfDown<glw::GLuint>(expected);
1299 const glw::GLuint refValueMax = roundGLfloatToNearestIntegerHalfUp<glw::GLuint>(expected);
1301 if (state.getUintAccess() < refValueMin ||
1302 state.getUintAccess() > refValueMax)
1304 std::ostringstream buf;
1306 if (refValueMin == refValueMax)
1307 buf << "Expected " << refValueMin << ", got " << state.getUintAccess();
1309 buf << "Expected in range [" << refValueMin << ", " << refValueMax << "], got " << state.getUintAccess();
1311 result.fail(buf.str());
1317 DE_ASSERT(DE_FALSE);
1322 void verifyFloatMin (tcu::ResultCollector& result, QueriedState& state, float minValue)
1324 switch (state.getType())
1326 case DATATYPE_BOOLEAN:
1328 if (minValue > 0.0f && state.getBoolAccess() != true)
1329 result.fail("expected GL_TRUE, got GL_FALSE");
1333 case DATATYPE_INTEGER:
1335 const glw::GLint refValue = roundGLfloatToNearestIntegerHalfDown<glw::GLint>(minValue);
1337 if (state.getIntAccess() < refValue)
1339 std::ostringstream buf;
1340 buf << "Expected greater or equal to " << refValue << ", got " << state.getIntAccess();
1341 result.fail(buf.str());
1346 case DATATYPE_FLOAT:
1348 if (state.getFloatAccess() < minValue || deIsNaN(state.getFloatAccess()))
1350 std::ostringstream buf;
1351 buf << "Expected greater or equal to " << minValue << ", got " << state.getFloatAccess();
1352 result.fail(buf.str());
1357 case DATATYPE_INTEGER64:
1359 const glw::GLint64 refValue = roundGLfloatToNearestIntegerHalfDown<glw::GLint64>(minValue);
1361 if (state.getInt64Access() < refValue)
1363 std::ostringstream buf;
1364 buf << "Expected greater or equal to " << refValue << ", got " << state.getInt64Access();
1365 result.fail(buf.str());
1371 DE_ASSERT(DE_FALSE);
1376 void verifyFloatMax (tcu::ResultCollector& result, QueriedState& state, float maxValue)
1378 switch (state.getType())
1380 case DATATYPE_BOOLEAN:
1382 if (maxValue < 0.0f && state.getBoolAccess() != true)
1383 result.fail("expected GL_TRUE, got GL_FALSE");
1387 case DATATYPE_INTEGER:
1389 const glw::GLint refValue = roundGLfloatToNearestIntegerHalfUp<glw::GLint>(maxValue);
1391 if (state.getIntAccess() > refValue)
1393 std::ostringstream buf;
1394 buf << "Expected less or equal to " << refValue << ", got " << state.getIntAccess();
1395 result.fail(buf.str());
1400 case DATATYPE_FLOAT:
1402 if (state.getFloatAccess() > maxValue || deIsNaN(state.getFloatAccess()))
1404 std::ostringstream buf;
1405 buf << "Expected less or equal to " << maxValue << ", got " << state.getFloatAccess();
1406 result.fail(buf.str());
1411 case DATATYPE_INTEGER64:
1413 const glw::GLint64 refValue = roundGLfloatToNearestIntegerHalfUp<glw::GLint64>(maxValue);
1415 if (state.getInt64Access() > refValue)
1417 std::ostringstream buf;
1418 buf << "Expected less or equal to " << refValue << ", got " << state.getInt64Access();
1419 result.fail(buf.str());
1425 DE_ASSERT(DE_FALSE);
1430 void verifyIntegerVec3 (tcu::ResultCollector& result, QueriedState& state, const tcu::IVec3& expected)
1432 switch (state.getType())
1434 case DATATYPE_INTEGER_VEC3:
1436 if (state.getIntVec3Access()[0] != expected[0] ||
1437 state.getIntVec3Access()[1] != expected[1] ||
1438 state.getIntVec3Access()[2] != expected[2])
1440 std::ostringstream buf;
1441 buf << "Expected " << expected << ", got " << tcu::formatArray(state.getIntVec3Access());
1442 result.fail(buf.str());
1448 DE_ASSERT(DE_FALSE);
1453 void verifyIntegerVec4 (tcu::ResultCollector& result, QueriedState& state, const tcu::IVec4& expected)
1455 switch (state.getType())
1457 case DATATYPE_INTEGER_VEC4:
1459 if (state.getIntVec4Access()[0] != expected[0] ||
1460 state.getIntVec4Access()[1] != expected[1] ||
1461 state.getIntVec4Access()[2] != expected[2] ||
1462 state.getIntVec4Access()[3] != expected[3])
1464 std::ostringstream buf;
1465 buf << "Expected " << expected << ", got " << tcu::formatArray(state.getIntVec4Access());
1466 result.fail(buf.str());
1472 DE_ASSERT(DE_FALSE);
1477 void verifyUnsignedIntegerVec4 (tcu::ResultCollector& result, QueriedState& state, const tcu::UVec4& expected)
1479 switch (state.getType())
1481 case DATATYPE_UNSIGNED_INTEGER_VEC4:
1483 if (state.getUintVec4Access()[0] != expected[0] ||
1484 state.getUintVec4Access()[1] != expected[1] ||
1485 state.getUintVec4Access()[2] != expected[2] ||
1486 state.getUintVec4Access()[3] != expected[3])
1488 std::ostringstream buf;
1489 buf << "Expected " << expected << ", got " << tcu::formatArray(state.getUintVec4Access());
1490 result.fail(buf.str());
1496 DE_ASSERT(DE_FALSE);
1501 void verifyBooleanVec4 (tcu::ResultCollector& result, QueriedState& state, const tcu::BVec4& expected)
1503 switch (state.getType())
1505 case DATATYPE_BOOLEAN_VEC4:
1507 const glw::GLboolean referenceVec4[4] =
1509 mapBoolToGLBoolean(expected[0]),
1510 mapBoolToGLBoolean(expected[1]),
1511 mapBoolToGLBoolean(expected[2]),
1512 mapBoolToGLBoolean(expected[3])
1515 const glw::GLboolean resultVec4[4] =
1517 mapBoolToGLBoolean(state.getBooleanVec4Access()[0]),
1518 mapBoolToGLBoolean(state.getBooleanVec4Access()[1]),
1519 mapBoolToGLBoolean(state.getBooleanVec4Access()[2]),
1520 mapBoolToGLBoolean(state.getBooleanVec4Access()[3])
1523 if (resultVec4[0] != referenceVec4[0] ||
1524 resultVec4[1] != referenceVec4[1] ||
1525 resultVec4[2] != referenceVec4[2] ||
1526 resultVec4[3] != referenceVec4[3])
1528 std::ostringstream buf;
1529 buf << "Expected " << glu::getBooleanPointerStr(referenceVec4, 4) << ", got " << glu::getBooleanPointerStr(resultVec4, 4);
1530 result.fail(buf.str());
1535 case DATATYPE_FLOAT_VEC4:
1537 const glw::GLfloat reference[4] =
1539 (expected[0] ? 1.0f : 0.0f),
1540 (expected[1] ? 1.0f : 0.0f),
1541 (expected[2] ? 1.0f : 0.0f),
1542 (expected[3] ? 1.0f : 0.0f)
1545 if (state.getFloatVec4Access()[0] != reference[0] ||
1546 state.getFloatVec4Access()[1] != reference[1] ||
1547 state.getFloatVec4Access()[2] != reference[2] ||
1548 state.getFloatVec4Access()[3] != reference[3])
1550 std::ostringstream buf;
1551 buf << "Expected " << reference << ", got " << tcu::formatArray(state.getFloatVec4Access());
1552 result.fail(buf.str());
1556 case DATATYPE_INTEGER_VEC4:
1558 const glw::GLint reference[4] =
1560 (expected[0] ? 1 : 0),
1561 (expected[1] ? 1 : 0),
1562 (expected[2] ? 1 : 0),
1563 (expected[3] ? 1 : 0)
1566 if (state.getIntVec4Access()[0] != reference[0] ||
1567 state.getIntVec4Access()[1] != reference[1] ||
1568 state.getIntVec4Access()[2] != reference[2] ||
1569 state.getIntVec4Access()[3] != reference[3])
1571 std::ostringstream buf;
1572 buf << "Expected " << reference << ", got " << tcu::formatArray(state.getIntVec4Access());
1573 result.fail(buf.str());
1577 case DATATYPE_INTEGER64_VEC4:
1579 const glw::GLint64 reference[4] =
1581 (expected[0] ? 1 : 0),
1582 (expected[1] ? 1 : 0),
1583 (expected[2] ? 1 : 0),
1584 (expected[3] ? 1 : 0)
1587 if (state.getInt64Vec4Access()[0] != reference[0] ||
1588 state.getInt64Vec4Access()[1] != reference[1] ||
1589 state.getInt64Vec4Access()[2] != reference[2] ||
1590 state.getInt64Vec4Access()[3] != reference[3])
1592 std::ostringstream buf;
1593 buf << "Expected " << reference << ", got " << tcu::formatArray(state.getInt64Vec4Access());
1594 result.fail(buf.str());
1598 case DATATYPE_UNSIGNED_INTEGER_VEC4:
1600 const glw::GLuint reference[4] =
1602 (expected[0] ? 1u : 0u),
1603 (expected[1] ? 1u : 0u),
1604 (expected[2] ? 1u : 0u),
1605 (expected[3] ? 1u : 0u)
1608 if (state.getUintVec4Access()[0] != reference[0] ||
1609 state.getUintVec4Access()[1] != reference[1] ||
1610 state.getUintVec4Access()[2] != reference[2] ||
1611 state.getUintVec4Access()[3] != reference[3])
1613 std::ostringstream buf;
1614 buf << "Expected " << reference << ", got " << tcu::formatArray(state.getUintVec4Access());
1615 result.fail(buf.str());
1621 DE_ASSERT(DE_FALSE);
1626 void verifyFloatVec4 (tcu::ResultCollector& result, QueriedState& state, const tcu::Vec4& expected)
1628 switch (state.getType())
1630 case DATATYPE_FLOAT_VEC4:
1632 if (state.getFloatVec4Access()[0] != expected[0] ||
1633 state.getFloatVec4Access()[1] != expected[1] ||
1634 state.getFloatVec4Access()[2] != expected[2] ||
1635 state.getFloatVec4Access()[3] != expected[3])
1637 std::ostringstream buf;
1638 buf << "Expected " << expected << ", got " << tcu::formatArray(state.getFloatVec4Access());
1639 result.fail(buf.str());
1643 case DATATYPE_INTEGER_VEC4:
1645 bool anyError = false;
1646 std::ostringstream expectation;
1648 for (int ndx = 0; ndx < 4; ++ndx)
1650 const glw::GLint refValueMin = roundGLfloatToNearestIntegerHalfDown<glw::GLint>(expected[ndx]);
1651 const glw::GLint refValueMax = roundGLfloatToNearestIntegerHalfUp<glw::GLint>(expected[ndx]);
1653 if (state.getIntVec4Access()[ndx] < refValueMin ||
1654 state.getIntVec4Access()[ndx] > refValueMax)
1656 std::ostringstream buf;
1659 expectation << " ,";
1661 if (refValueMin == refValueMax)
1664 buf << "[" << refValueMin << ", " << refValueMax << "]";
1670 std::ostringstream buf;
1671 buf << "Expected {" << expectation.str() << "}, got " << tcu::formatArray(state.getIntVec4Access());
1672 result.fail(buf.str());
1676 case DATATYPE_UNSIGNED_INTEGER_VEC4:
1678 bool anyError = false;
1679 std::ostringstream expectation;
1681 for (int ndx = 0; ndx < 4; ++ndx)
1683 const glw::GLuint refValueMin = roundGLfloatToNearestIntegerHalfDown<glw::GLuint>(expected[ndx]);
1684 const glw::GLuint refValueMax = roundGLfloatToNearestIntegerHalfUp<glw::GLuint>(expected[ndx]);
1686 if (state.getUintVec4Access()[ndx] < refValueMin ||
1687 state.getUintVec4Access()[ndx] > refValueMax)
1689 std::ostringstream buf;
1692 expectation << " ,";
1694 if (refValueMin == refValueMax)
1697 buf << "[" << refValueMin << ", " << refValueMax << "]";
1703 std::ostringstream buf;
1704 buf << "Expected {" << expectation.str() << "}, got " << tcu::formatArray(state.getUintVec4Access());
1705 result.fail(buf.str());
1711 DE_ASSERT(DE_FALSE);
1716 void verifyPointer (tcu::ResultCollector& result, QueriedState& state, const void* expected)
1718 switch (state.getType())
1720 case DATATYPE_POINTER:
1722 if (state.getPtrAccess() != expected)
1724 std::ostringstream buf;
1725 buf << "Expected " << expected << ", got " << state.getPtrAccess();
1726 result.fail(buf.str());
1732 DE_ASSERT(DE_FALSE);
1737 static float normalizeI32Float (deInt32 c)
1739 return de::max((float)c / float((1ul << 31) - 1u), -1.0f);
1742 void verifyNormalizedI32Vec4 (tcu::ResultCollector& result, QueriedState& state, const tcu::IVec4& expected)
1744 // \note: normalization precision is irrelevant for these tests, we can use very large thresholds
1745 const float normalizationError = 0.1f;
1746 const tcu::Vec4 reference (normalizeI32Float(expected[0]),
1747 normalizeI32Float(expected[1]),
1748 normalizeI32Float(expected[2]),
1749 normalizeI32Float(expected[3]));
1750 const tcu::Vec4 validHigh (de::min( 1.0f, reference[0] + normalizationError),
1751 de::min( 1.0f, reference[1] + normalizationError),
1752 de::min( 1.0f, reference[2] + normalizationError),
1753 de::min( 1.0f, reference[3] + normalizationError));
1754 const tcu::Vec4 validLow (de::max(-1.0f, reference[0] - normalizationError),
1755 de::max(-1.0f, reference[1] - normalizationError),
1756 de::max(-1.0f, reference[2] - normalizationError),
1757 de::max(-1.0f, reference[3] - normalizationError));
1759 switch (state.getType())
1761 case DATATYPE_FLOAT_VEC4:
1763 bool anyError = false;
1764 std::ostringstream expectation;
1766 for (int ndx = 0; ndx < 4; ++ndx)
1768 if (state.getFloatVec4Access()[ndx] < validLow[ndx] ||
1769 state.getFloatVec4Access()[ndx] > validHigh[ndx])
1771 std::ostringstream buf;
1774 expectation << " ,";
1775 buf << "[" << validLow[ndx] << ", " << validHigh[ndx] << "]";
1781 std::ostringstream buf;
1782 buf << "Expected {" << expectation.str() << "}, got " << tcu::formatArray(state.getFloatVec4Access());
1783 result.fail(buf.str());
1787 case DATATYPE_INTEGER_VEC4:
1789 bool anyError = false;
1790 std::ostringstream expectation;
1792 for (int ndx = 0; ndx < 4; ++ndx)
1794 const glw::GLint refValueMin = roundGLfloatToNearestIntegerHalfDown<glw::GLint>(validHigh[ndx]);
1795 const glw::GLint refValueMax = roundGLfloatToNearestIntegerHalfUp<glw::GLint>(validLow[ndx]);
1797 if (state.getIntVec4Access()[ndx] < refValueMin ||
1798 state.getIntVec4Access()[ndx] > refValueMax)
1800 std::ostringstream buf;
1803 expectation << " ,";
1805 if (refValueMin == refValueMax)
1808 buf << "[" << refValueMin << ", " << refValueMax << "]";
1814 std::ostringstream buf;
1815 buf << "Expected {" << expectation.str() << "}, got " << tcu::formatArray(state.getIntVec4Access());
1816 result.fail(buf.str());
1822 DE_ASSERT(DE_FALSE);
1829 void verifyStateBoolean (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLenum target, bool refValue, QueryType type)
1833 queryState(result, gl, type, target, state);
1835 if (!state.isUndefined())
1836 verifyBoolean(result, state, refValue);
1839 void verifyStateInteger (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLenum target, int refValue, QueryType type)
1843 queryState(result, gl, type, target, state);
1845 if (!state.isUndefined())
1846 verifyInteger(result, state, refValue);
1849 void verifyStateIntegerMin (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLenum target, int minValue, QueryType type)
1853 queryState(result, gl, type, target, state);
1855 if (!state.isUndefined())
1856 verifyIntegerMin(result, state, minValue);
1859 void verifyStateIntegerMax (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLenum target, int maxValue, QueryType type)
1863 queryState(result, gl, type, target, state);
1865 if (!state.isUndefined())
1866 verifyIntegerMax(result, state, maxValue);
1869 void verifyStateIntegerEqualToOther (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLenum target, glw::GLenum other, QueryType type)
1871 QueriedState stateA;
1872 QueriedState stateB;
1874 queryState(result, gl, type, target, stateA);
1875 queryState(result, gl, type, other, stateB);
1877 if (stateA.isUndefined() || stateB.isUndefined())
1884 if (stateA.getBoolAccess() != stateB.getBoolAccess())
1885 result.fail("expected equal results");
1891 if (stateA.getIntAccess() != stateB.getIntAccess())
1892 result.fail("expected equal results");
1896 case QUERY_INTEGER64:
1898 if (stateA.getInt64Access() != stateB.getInt64Access())
1899 result.fail("expected equal results");
1905 if (stateA.getFloatAccess() != stateB.getFloatAccess())
1906 result.fail("expected equal results");
1911 DE_ASSERT(DE_FALSE);
1916 void verifyStateFloat (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLenum target, float reference, QueryType type)
1920 queryState(result, gl, type, target, state);
1922 if (!state.isUndefined())
1923 verifyFloat(result, state, reference);
1926 void verifyStateFloatMin (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLenum target, float minValue, QueryType type)
1930 queryState(result, gl, type, target, state);
1932 if (!state.isUndefined())
1933 verifyFloatMin(result, state, minValue);
1936 void verifyStateFloatMax (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLenum target, float maxValue, QueryType type)
1940 queryState(result, gl, type, target, state);
1942 if (!state.isUndefined())
1943 verifyFloatMax(result, state, maxValue);
1946 void verifyStatePointer (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLenum target, const void* expected, QueryType type)
1950 queryPointerState(result, gl, type, target, state);
1952 if (!state.isUndefined())
1953 verifyPointer(result, state, expected);
1956 void verifyStateIndexedBoolean (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLenum target, int index, bool expected, QueryType type)
1960 queryIndexedState(result, gl, type, target, index, state);
1962 if (!state.isUndefined())
1963 verifyBoolean(result, state, expected);
1966 void verifyStateIndexedBooleanVec4 (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLenum target, int index, const tcu::BVec4& expected, QueryType type)
1970 queryIndexedState(result, gl, type, target, index, state);
1972 if (!state.isUndefined())
1973 verifyBooleanVec4(result, state, expected);
1976 void verifyStateIndexedInteger (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLenum target, int index, int expected, QueryType type)
1980 queryIndexedState(result, gl, type, target, index, state);
1982 if (!state.isUndefined())
1983 verifyInteger(result, state, expected);
1986 void verifyStateIndexedIntegerMin (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLenum target, int index, int minValue, QueryType type)
1990 queryIndexedState(result, gl, type, target, index, state);
1992 if (!state.isUndefined())
1993 verifyIntegerMin(result, state, minValue);
1996 void verifyStateAttributeInteger (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLenum target, int index, int expected, QueryType type)
2000 queryAttributeState(result, gl, type, target, index, state);
2002 if (!state.isUndefined())
2003 verifyInteger(result, state, expected);
2006 void verifyStateFramebufferInteger (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLenum target, glw::GLenum pname, int expected, QueryType type)
2010 queryFramebufferState(result, gl, type, target, pname, state);
2012 if (!state.isUndefined())
2013 verifyInteger(result, state, expected);
2016 void verifyStateFramebufferIntegerMin (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLenum target, glw::GLenum pname, int minValue, QueryType type)
2020 queryFramebufferState(result, gl, type, target, pname, state);
2022 if (!state.isUndefined())
2023 verifyIntegerMin(result, state, minValue);
2026 void verifyStateProgramInteger (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLuint program, glw::GLenum pname, int expected, QueryType type)
2030 queryProgramState(result, gl, type, program, pname, state);
2032 if (!state.isUndefined())
2033 verifyInteger(result, state, expected);
2036 void verifyStateProgramIntegerVec3 (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLuint program, glw::GLenum pname, const tcu::IVec3& expected, QueryType type)
2040 queryProgramState(result, gl, type, program, pname, state);
2042 if (!state.isUndefined())
2043 verifyIntegerVec3(result, state, expected);
2046 void verifyStatePipelineInteger (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLuint pipeline, glw::GLenum pname, int expected, QueryType type)
2050 queryPipelineState(result, gl, type, pipeline, pname, state);
2052 if (!state.isUndefined())
2053 verifyInteger(result, state, expected);
2056 void verifyStateTextureParamInteger (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLenum target, glw::GLenum pname, int expected, QueryType type)
2060 queryTextureParamState(result, gl, type, target, pname, state);
2062 if (!state.isUndefined())
2063 verifyInteger(result, state, expected);
2066 void verifyStateTextureParamFloat (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLenum target, glw::GLenum pname, float expected, QueryType type)
2070 queryTextureParamState(result, gl, type, target, pname, state);
2072 if (!state.isUndefined())
2073 verifyFloat(result, state, expected);
2076 void verifyStateTextureParamFloatVec4 (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLenum target, glw::GLenum pname, const tcu::Vec4& expected, QueryType type)
2080 queryTextureParamState(result, gl, type, target, pname, state);
2082 if (!state.isUndefined())
2083 verifyFloatVec4(result, state, expected);
2086 void verifyStateTextureParamNormalizedI32Vec4 (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLenum target, glw::GLenum pname, const tcu::IVec4& expected, QueryType type)
2090 queryTextureParamState(result, gl, type, target, pname, state);
2092 if (!state.isUndefined())
2093 verifyNormalizedI32Vec4(result, state, expected);
2096 void verifyStateTextureParamIntegerVec4 (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLenum target, glw::GLenum pname, const tcu::IVec4& expected, QueryType type)
2100 queryTextureParamState(result, gl, type, target, pname, state);
2102 if (!state.isUndefined())
2103 verifyIntegerVec4(result, state, expected);
2106 void verifyStateTextureParamUnsignedIntegerVec4 (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLenum target, glw::GLenum pname, const tcu::UVec4& expected, QueryType type)
2110 queryTextureParamState(result, gl, type, target, pname, state);
2112 if (!state.isUndefined())
2113 verifyUnsignedIntegerVec4(result, state, expected);
2116 void verifyStateTextureLevelInteger (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLenum target, int level, glw::GLenum pname, int expected, QueryType type)
2120 queryTextureLevelState(result, gl, type, target, level, pname, state);
2122 if (!state.isUndefined())
2123 verifyInteger(result, state, expected);
2126 void verifyStateObjectBoolean (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLuint handle, bool expected, QueryType type)
2130 queryObjectState(result, gl, type, handle, state);
2132 if (!state.isUndefined())
2133 verifyBoolean(result, state, expected);
2136 void verifyStateQueryInteger (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLenum target, glw::GLenum pname, int expected, QueryType type)
2140 queryQueryState(result, gl, type, target, pname, state);
2142 if (!state.isUndefined())
2143 verifyInteger(result, state, expected);
2146 void verifyStateSamplerParamInteger (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLuint sampler, glw::GLenum pname, int expected, QueryType type)
2150 querySamplerState(result, gl, type, sampler, pname, state);
2152 if (!state.isUndefined())
2153 verifyInteger(result, state, expected);
2156 void verifyStateSamplerParamFloat (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLuint sampler, glw::GLenum pname, float expected, QueryType type)
2160 querySamplerState(result, gl, type, sampler, pname, state);
2162 if (!state.isUndefined())
2163 verifyFloat(result, state, expected);
2166 void verifyStateSamplerParamFloatVec4 (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLuint sampler, glw::GLenum pname, const tcu::Vec4& expected, QueryType type)
2170 querySamplerState(result, gl, type, sampler, pname, state);
2172 if (!state.isUndefined())
2173 verifyFloatVec4(result, state, expected);
2176 void verifyStateSamplerParamNormalizedI32Vec4 (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLuint sampler, glw::GLenum pname, const tcu::IVec4& expected, QueryType type)
2180 querySamplerState(result, gl, type, sampler, pname, state);
2182 if (!state.isUndefined())
2183 verifyNormalizedI32Vec4(result, state, expected);
2186 void verifyStateSamplerParamIntegerVec4 (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLuint sampler, glw::GLenum pname, const tcu::IVec4& expected, QueryType type)
2190 querySamplerState(result, gl, type, sampler, pname, state);
2192 if (!state.isUndefined())
2193 verifyIntegerVec4(result, state, expected);
2196 void verifyStateSamplerParamUnsignedIntegerVec4 (tcu::ResultCollector& result, glu::CallLogWrapper& gl, glw::GLuint sampler, glw::GLenum pname, const tcu::UVec4& expected, QueryType type)
2200 querySamplerState(result, gl, type, sampler, pname, state);
2202 if (!state.isUndefined())
2203 verifyUnsignedIntegerVec4(result, state, expected);