13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*------------------------------------------------------------------------- 23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program OpenGL ES 2.0 Module 33c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * ------------------------------------------------- 43c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 53c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Copyright 2014 The Android Open Source Project 63c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 73c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Licensed under the Apache License, Version 2.0 (the "License"); 83c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * you may not use this file except in compliance with the License. 93c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * You may obtain a copy of the License at 103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * http://www.apache.org/licenses/LICENSE-2.0 123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Unless required by applicable law or agreed to in writing, software 143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * distributed under the License is distributed on an "AS IS" BASIS, 153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * See the License for the specific language governing permissions and 173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * limitations under the License. 183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*! 203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \file 213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Buffer Object Query tests. 223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "es2fBufferObjectQueryTests.hpp" 253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glsStateQueryUtil.hpp" 263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "es2fApiCase.hpp" 273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluRenderContext.hpp" 283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwEnums.hpp" 293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwFunctions.hpp" 303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deRandom.hpp" 313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deMath.h" 323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <limits> 343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 353c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing namespace glw; // GLint and other GL types 363c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing deqp::gls::StateQueryUtil::StateQueryMemoryWriteGuard; 373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 393c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp 403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 413c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace gles2 423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 433c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace Functional 443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 453c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace BufferParamVerifiers 463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 483c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid checkIntEquals (tcu::TestContext& testCtx, GLint got, GLint expected) 493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry using tcu::TestLog; 513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (got != expected) 533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry testCtx.getLog() << TestLog::Message << "// ERROR: Expected " << expected << "; got " << got << TestLog::EndMessage; 553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (testCtx.getTestResult() == QP_TEST_RESULT_PASS) 563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry testCtx.setTestResult(QP_TEST_RESULT_FAIL, "got invalid value"); 573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 603c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid checkPointerEquals (tcu::TestContext& testCtx, const void* got, const void* expected) 613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry using tcu::TestLog; 633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (got != expected) 653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry testCtx.getLog() << TestLog::Message << "// ERROR: Expected " << expected << "; got " << got << TestLog::EndMessage; 673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (testCtx.getTestResult() == QP_TEST_RESULT_PASS) 683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry testCtx.setTestResult(QP_TEST_RESULT_FAIL, "got invalid value"); 693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 723c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass BufferParamVerifier : protected glu::CallLogWrapper 733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 743c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry BufferParamVerifier (const glw::Functions& gl, tcu::TestLog& log, const char* testNamePostfix); 763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual ~BufferParamVerifier (); // make GCC happy 773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const char* getTestNamePostfix (void) const; 793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual void verifyInteger (tcu::TestContext& testCtx, GLenum target, GLenum name, GLint reference) = DE_NULL; 813c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const char* const m_testNamePostfix; 833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 853c827367444ee418f129b2c238299f49d3264554Jarkko PoyryBufferParamVerifier::BufferParamVerifier (const glw::Functions& gl, tcu::TestLog& log, const char* testNamePostfix) 863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : glu::CallLogWrapper (gl, log) 873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_testNamePostfix (testNamePostfix) 883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry enableLogging(true); 903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 923c827367444ee418f129b2c238299f49d3264554Jarkko PoyryBufferParamVerifier::~BufferParamVerifier () 933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 963c827367444ee418f129b2c238299f49d3264554Jarkko Poyryconst char* BufferParamVerifier::getTestNamePostfix (void) const 973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return m_testNamePostfix; 993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass GetBufferParameterIVerifier : public BufferParamVerifier 1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GetBufferParameterIVerifier (const glw::Functions& gl, tcu::TestLog& log); 1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void verifyInteger (tcu::TestContext& testCtx, GLenum target, GLenum name, GLint reference); 1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1093c827367444ee418f129b2c238299f49d3264554Jarkko PoyryGetBufferParameterIVerifier::GetBufferParameterIVerifier (const glw::Functions& gl, tcu::TestLog& log) 1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : BufferParamVerifier(gl, log, "_getbufferparameteri") 1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid GetBufferParameterIVerifier::verifyInteger (tcu::TestContext& testCtx, GLenum target, GLenum name, GLint reference) 1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry using tcu::TestLog; 1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry StateQueryMemoryWriteGuard<GLint> state; 1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGetBufferParameteriv(target, name, &state); 1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (!state.verifyValidity(testCtx)) 1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return; 1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (state != reference) 1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry testCtx.getLog() << TestLog::Message << "// ERROR: expected " << reference << "; got " << state << TestLog::EndMessage; 1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (testCtx.getTestResult() == QP_TEST_RESULT_PASS) 1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid value"); 1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // BufferParamVerifiers 1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace 1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing namespace BufferParamVerifiers; 1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// Tests 1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass BufferCase : public ApiCase 1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry BufferCase (Context& context, BufferParamVerifier* verifier, const char* name, const char* description) 1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : ApiCase (context, name, description) 1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_bufferTarget (0) 1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_verifier (verifier) 1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual void testBuffer (void) = DE_NULL; 1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void test (void) 1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const GLenum bufferTargets[] = 1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER 1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int targets = DE_LENGTH_OF_ARRAY(bufferTargets); 1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int ndx = 0; ndx < targets; ++ndx) 1633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_bufferTarget = bufferTargets[ndx]; 1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint bufferId = 0; 1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glGenBuffers(1, &bufferId); 1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBindBuffer(m_bufferTarget, bufferId); 1693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry testBuffer(); 1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glDeleteBuffers(1, &bufferId); 1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprotected: 1793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLenum m_bufferTarget; 1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry BufferParamVerifier* m_verifier; 1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass BufferSizeCase : public BufferCase 1843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1853c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry BufferSizeCase (Context& context, BufferParamVerifier* verifier, const char* name, const char* description) 1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : BufferCase(context, verifier, name, description) 1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void testBuffer (void) 1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int numIteration = 16; 1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry de::Random rnd(0xabcdef); 1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_verifier->verifyInteger(m_testCtx, m_bufferTarget, GL_BUFFER_SIZE, 0); 1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int i = 0; i < numIteration; ++i) 1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const GLint len = rnd.getInt(0, 1024); 2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBufferData(m_bufferTarget, len, DE_NULL, GL_STREAM_DRAW); 2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_verifier->verifyInteger(m_testCtx, m_bufferTarget, GL_BUFFER_SIZE, len); 2053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 2093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2103c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass BufferUsageCase : public BufferCase 2113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry BufferUsageCase (Context& context, BufferParamVerifier* verifier, const char* name, const char* description) 2143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : BufferCase(context, verifier, name, description) 2153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void testBuffer (void) 2193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const GLenum usages[] = 2213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GL_STATIC_DRAW, GL_DYNAMIC_DRAW, GL_STREAM_DRAW 2233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 2243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_verifier->verifyInteger(m_testCtx, m_bufferTarget, GL_BUFFER_USAGE, GL_STATIC_DRAW); 2263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(usages); ++ndx) 2283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glBufferData(m_bufferTarget, 16, DE_NULL, usages[ndx]); 2303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 2313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_verifier->verifyInteger(m_testCtx, m_bufferTarget, GL_BUFFER_USAGE, usages[ndx]); 2333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry expectError(GL_NO_ERROR); 2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 2373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // anonymous 2393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#define FOR_EACH_VERIFIER(VERIFIERS, CODE_BLOCK) \ 2413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int _verifierNdx = 0; _verifierNdx < DE_LENGTH_OF_ARRAY(VERIFIERS); _verifierNdx++) \ 2423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { \ 2433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry BufferParamVerifier* verifier = VERIFIERS[_verifierNdx]; \ 2443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry CODE_BLOCK; \ 2453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2473c827367444ee418f129b2c238299f49d3264554Jarkko PoyryBufferObjectQueryTests::BufferObjectQueryTests (Context& context) 2483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : TestCaseGroup (context, "buffer_object", "Buffer Object Query tests") 2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_verifierInt (DE_NULL) 2503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2533c827367444ee418f129b2c238299f49d3264554Jarkko PoyryBufferObjectQueryTests::~BufferObjectQueryTests (void) 2543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deinit(); 2563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2583c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid BufferObjectQueryTests::init (void) 2593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry using namespace BufferParamVerifiers; 2613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_ASSERT(m_verifierInt == DE_NULL); 2633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_verifierInt = new GetBufferParameterIVerifier (m_context.getRenderContext().getFunctions(), m_context.getTestContext().getLog()); 2653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry BufferParamVerifier* verifiers[] = {m_verifierInt}; 2663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry FOR_EACH_VERIFIER(verifiers, addChild(new BufferSizeCase (m_context, verifier, (std::string("buffer_size") + verifier->getTestNamePostfix()).c_str(), "BUFFER_SIZE"))); 2683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry FOR_EACH_VERIFIER(verifiers, addChild(new BufferUsageCase (m_context, verifier, (std::string("buffer_usage") + verifier->getTestNamePostfix()).c_str(), "BUFFER_USAGE"))); 2693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2713c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid BufferObjectQueryTests::deinit (void) 2723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (m_verifierInt) 2743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry delete m_verifierInt; 2763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_verifierInt = NULL; 2773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry this->TestCaseGroup::deinit(); 2803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // Functional 2833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // gles2 2843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp 285