xref: /aosp_15_r20/external/deqp/modules/gles3/functional/es3fBufferObjectQueryTests.cpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
1*35238bceSAndroid Build Coastguard Worker /*-------------------------------------------------------------------------
2*35238bceSAndroid Build Coastguard Worker  * drawElements Quality Program OpenGL ES 3.0 Module
3*35238bceSAndroid Build Coastguard Worker  * -------------------------------------------------
4*35238bceSAndroid Build Coastguard Worker  *
5*35238bceSAndroid Build Coastguard Worker  * Copyright 2014 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 Buffer Object Query tests.
22*35238bceSAndroid Build Coastguard Worker  *//*--------------------------------------------------------------------*/
23*35238bceSAndroid Build Coastguard Worker 
24*35238bceSAndroid Build Coastguard Worker #include "es3fBufferObjectQueryTests.hpp"
25*35238bceSAndroid Build Coastguard Worker #include "glsStateQueryUtil.hpp"
26*35238bceSAndroid Build Coastguard Worker #include "es3fApiCase.hpp"
27*35238bceSAndroid Build Coastguard Worker #include "gluRenderContext.hpp"
28*35238bceSAndroid Build Coastguard Worker #include "glwEnums.hpp"
29*35238bceSAndroid Build Coastguard Worker #include "glwFunctions.hpp"
30*35238bceSAndroid Build Coastguard Worker #include "deRandom.hpp"
31*35238bceSAndroid Build Coastguard Worker #include "deMath.h"
32*35238bceSAndroid Build Coastguard Worker 
33*35238bceSAndroid Build Coastguard Worker #include <limits>
34*35238bceSAndroid Build Coastguard Worker 
35*35238bceSAndroid Build Coastguard Worker using namespace glw; // GLint and other GL types
36*35238bceSAndroid Build Coastguard Worker using deqp::gls::StateQueryUtil::StateQueryMemoryWriteGuard;
37*35238bceSAndroid Build Coastguard Worker 
38*35238bceSAndroid Build Coastguard Worker namespace deqp
39*35238bceSAndroid Build Coastguard Worker {
40*35238bceSAndroid Build Coastguard Worker namespace gles3
41*35238bceSAndroid Build Coastguard Worker {
42*35238bceSAndroid Build Coastguard Worker namespace Functional
43*35238bceSAndroid Build Coastguard Worker {
44*35238bceSAndroid Build Coastguard Worker namespace BufferParamVerifiers
45*35238bceSAndroid Build Coastguard Worker {
46*35238bceSAndroid Build Coastguard Worker 
checkIntEquals(tcu::TestContext & testCtx,GLint got,GLint expected)47*35238bceSAndroid Build Coastguard Worker void checkIntEquals(tcu::TestContext &testCtx, GLint got, GLint expected)
48*35238bceSAndroid Build Coastguard Worker {
49*35238bceSAndroid Build Coastguard Worker     using tcu::TestLog;
50*35238bceSAndroid Build Coastguard Worker 
51*35238bceSAndroid Build Coastguard Worker     if (got != expected)
52*35238bceSAndroid Build Coastguard Worker     {
53*35238bceSAndroid Build Coastguard Worker         testCtx.getLog() << TestLog::Message << "// ERROR: Expected " << expected << "; got " << got
54*35238bceSAndroid Build Coastguard Worker                          << TestLog::EndMessage;
55*35238bceSAndroid Build Coastguard Worker         if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
56*35238bceSAndroid Build Coastguard Worker             testCtx.setTestResult(QP_TEST_RESULT_FAIL, "got invalid value");
57*35238bceSAndroid Build Coastguard Worker     }
58*35238bceSAndroid Build Coastguard Worker }
59*35238bceSAndroid Build Coastguard Worker 
checkPointerEquals(tcu::TestContext & testCtx,const void * got,const void * expected)60*35238bceSAndroid Build Coastguard Worker void checkPointerEquals(tcu::TestContext &testCtx, const void *got, const void *expected)
61*35238bceSAndroid Build Coastguard Worker {
62*35238bceSAndroid Build Coastguard Worker     using tcu::TestLog;
63*35238bceSAndroid Build Coastguard Worker 
64*35238bceSAndroid Build Coastguard Worker     if (got != expected)
65*35238bceSAndroid Build Coastguard Worker     {
66*35238bceSAndroid Build Coastguard Worker         testCtx.getLog() << TestLog::Message << "// ERROR: Expected " << expected << "; got " << got
67*35238bceSAndroid Build Coastguard Worker                          << TestLog::EndMessage;
68*35238bceSAndroid Build Coastguard Worker         if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
69*35238bceSAndroid Build Coastguard Worker             testCtx.setTestResult(QP_TEST_RESULT_FAIL, "got invalid value");
70*35238bceSAndroid Build Coastguard Worker     }
71*35238bceSAndroid Build Coastguard Worker }
72*35238bceSAndroid Build Coastguard Worker 
73*35238bceSAndroid Build Coastguard Worker class BufferParamVerifier : protected glu::CallLogWrapper
74*35238bceSAndroid Build Coastguard Worker {
75*35238bceSAndroid Build Coastguard Worker public:
76*35238bceSAndroid Build Coastguard Worker     BufferParamVerifier(const glw::Functions &gl, tcu::TestLog &log, const char *testNamePostfix);
77*35238bceSAndroid Build Coastguard Worker     virtual ~BufferParamVerifier(); // make GCC happy
78*35238bceSAndroid Build Coastguard Worker 
79*35238bceSAndroid Build Coastguard Worker     const char *getTestNamePostfix(void) const;
80*35238bceSAndroid Build Coastguard Worker 
81*35238bceSAndroid Build Coastguard Worker     virtual void verifyInteger(tcu::TestContext &testCtx, GLenum target, GLenum name, GLint reference)     = DE_NULL;
82*35238bceSAndroid Build Coastguard Worker     virtual void verifyInteger64(tcu::TestContext &testCtx, GLenum target, GLenum name, GLint64 reference) = DE_NULL;
83*35238bceSAndroid Build Coastguard Worker 
84*35238bceSAndroid Build Coastguard Worker private:
85*35238bceSAndroid Build Coastguard Worker     const char *const m_testNamePostfix;
86*35238bceSAndroid Build Coastguard Worker };
87*35238bceSAndroid Build Coastguard Worker 
BufferParamVerifier(const glw::Functions & gl,tcu::TestLog & log,const char * testNamePostfix)88*35238bceSAndroid Build Coastguard Worker BufferParamVerifier::BufferParamVerifier(const glw::Functions &gl, tcu::TestLog &log, const char *testNamePostfix)
89*35238bceSAndroid Build Coastguard Worker     : glu::CallLogWrapper(gl, log)
90*35238bceSAndroid Build Coastguard Worker     , m_testNamePostfix(testNamePostfix)
91*35238bceSAndroid Build Coastguard Worker {
92*35238bceSAndroid Build Coastguard Worker     enableLogging(true);
93*35238bceSAndroid Build Coastguard Worker }
94*35238bceSAndroid Build Coastguard Worker 
~BufferParamVerifier()95*35238bceSAndroid Build Coastguard Worker BufferParamVerifier::~BufferParamVerifier()
96*35238bceSAndroid Build Coastguard Worker {
97*35238bceSAndroid Build Coastguard Worker }
98*35238bceSAndroid Build Coastguard Worker 
getTestNamePostfix(void) const99*35238bceSAndroid Build Coastguard Worker const char *BufferParamVerifier::getTestNamePostfix(void) const
100*35238bceSAndroid Build Coastguard Worker {
101*35238bceSAndroid Build Coastguard Worker     return m_testNamePostfix;
102*35238bceSAndroid Build Coastguard Worker }
103*35238bceSAndroid Build Coastguard Worker 
104*35238bceSAndroid Build Coastguard Worker class GetBufferParameterIVerifier : public BufferParamVerifier
105*35238bceSAndroid Build Coastguard Worker {
106*35238bceSAndroid Build Coastguard Worker public:
107*35238bceSAndroid Build Coastguard Worker     GetBufferParameterIVerifier(const glw::Functions &gl, tcu::TestLog &log);
108*35238bceSAndroid Build Coastguard Worker 
109*35238bceSAndroid Build Coastguard Worker     void verifyInteger(tcu::TestContext &testCtx, GLenum target, GLenum name, GLint reference);
110*35238bceSAndroid Build Coastguard Worker     void verifyInteger64(tcu::TestContext &testCtx, GLenum target, GLenum name, GLint64 reference);
111*35238bceSAndroid Build Coastguard Worker };
112*35238bceSAndroid Build Coastguard Worker 
GetBufferParameterIVerifier(const glw::Functions & gl,tcu::TestLog & log)113*35238bceSAndroid Build Coastguard Worker GetBufferParameterIVerifier::GetBufferParameterIVerifier(const glw::Functions &gl, tcu::TestLog &log)
114*35238bceSAndroid Build Coastguard Worker     : BufferParamVerifier(gl, log, "_getbufferparameteri")
115*35238bceSAndroid Build Coastguard Worker {
116*35238bceSAndroid Build Coastguard Worker }
117*35238bceSAndroid Build Coastguard Worker 
verifyInteger(tcu::TestContext & testCtx,GLenum target,GLenum name,GLint reference)118*35238bceSAndroid Build Coastguard Worker void GetBufferParameterIVerifier::verifyInteger(tcu::TestContext &testCtx, GLenum target, GLenum name, GLint reference)
119*35238bceSAndroid Build Coastguard Worker {
120*35238bceSAndroid Build Coastguard Worker     using tcu::TestLog;
121*35238bceSAndroid Build Coastguard Worker 
122*35238bceSAndroid Build Coastguard Worker     StateQueryMemoryWriteGuard<GLint> state;
123*35238bceSAndroid Build Coastguard Worker     glGetBufferParameteriv(target, name, &state);
124*35238bceSAndroid Build Coastguard Worker 
125*35238bceSAndroid Build Coastguard Worker     if (!state.verifyValidity(testCtx))
126*35238bceSAndroid Build Coastguard Worker         return;
127*35238bceSAndroid Build Coastguard Worker 
128*35238bceSAndroid Build Coastguard Worker     if (state != reference)
129*35238bceSAndroid Build Coastguard Worker     {
130*35238bceSAndroid Build Coastguard Worker         testCtx.getLog() << TestLog::Message << "// ERROR: expected " << reference << "; got " << state
131*35238bceSAndroid Build Coastguard Worker                          << TestLog::EndMessage;
132*35238bceSAndroid Build Coastguard Worker 
133*35238bceSAndroid Build Coastguard Worker         if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
134*35238bceSAndroid Build Coastguard Worker             testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid value");
135*35238bceSAndroid Build Coastguard Worker     }
136*35238bceSAndroid Build Coastguard Worker }
137*35238bceSAndroid Build Coastguard Worker 
verifyInteger64(tcu::TestContext & testCtx,GLenum target,GLenum name,GLint64 reference)138*35238bceSAndroid Build Coastguard Worker void GetBufferParameterIVerifier::verifyInteger64(tcu::TestContext &testCtx, GLenum target, GLenum name,
139*35238bceSAndroid Build Coastguard Worker                                                   GLint64 reference)
140*35238bceSAndroid Build Coastguard Worker {
141*35238bceSAndroid Build Coastguard Worker     using tcu::TestLog;
142*35238bceSAndroid Build Coastguard Worker 
143*35238bceSAndroid Build Coastguard Worker     StateQueryMemoryWriteGuard<GLint> state;
144*35238bceSAndroid Build Coastguard Worker     glGetBufferParameteriv(target, name, &state);
145*35238bceSAndroid Build Coastguard Worker 
146*35238bceSAndroid Build Coastguard Worker     if (!state.verifyValidity(testCtx))
147*35238bceSAndroid Build Coastguard Worker         return;
148*35238bceSAndroid Build Coastguard Worker 
149*35238bceSAndroid Build Coastguard Worker     // check that the converted value would be in the correct range, otherwise checking wont tell us anything
150*35238bceSAndroid Build Coastguard Worker     if (!de::inRange(reference, (GLint64)std::numeric_limits<GLint>::min(), (GLint64)std::numeric_limits<GLint>::max()))
151*35238bceSAndroid Build Coastguard Worker         return;
152*35238bceSAndroid Build Coastguard Worker 
153*35238bceSAndroid Build Coastguard Worker     if (state != reference)
154*35238bceSAndroid Build Coastguard Worker     {
155*35238bceSAndroid Build Coastguard Worker         testCtx.getLog() << TestLog::Message << "// ERROR: expected " << reference << "; got " << state
156*35238bceSAndroid Build Coastguard Worker                          << TestLog::EndMessage;
157*35238bceSAndroid Build Coastguard Worker 
158*35238bceSAndroid Build Coastguard Worker         if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
159*35238bceSAndroid Build Coastguard Worker             testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid value");
160*35238bceSAndroid Build Coastguard Worker     }
161*35238bceSAndroid Build Coastguard Worker }
162*35238bceSAndroid Build Coastguard Worker 
163*35238bceSAndroid Build Coastguard Worker class GetBufferParameterI64Verifier : public BufferParamVerifier
164*35238bceSAndroid Build Coastguard Worker {
165*35238bceSAndroid Build Coastguard Worker public:
166*35238bceSAndroid Build Coastguard Worker     GetBufferParameterI64Verifier(const glw::Functions &gl, tcu::TestLog &log);
167*35238bceSAndroid Build Coastguard Worker 
168*35238bceSAndroid Build Coastguard Worker     void verifyInteger(tcu::TestContext &testCtx, GLenum target, GLenum name, GLint reference);
169*35238bceSAndroid Build Coastguard Worker     void verifyInteger64(tcu::TestContext &testCtx, GLenum target, GLenum name, GLint64 reference);
170*35238bceSAndroid Build Coastguard Worker };
171*35238bceSAndroid Build Coastguard Worker 
GetBufferParameterI64Verifier(const glw::Functions & gl,tcu::TestLog & log)172*35238bceSAndroid Build Coastguard Worker GetBufferParameterI64Verifier::GetBufferParameterI64Verifier(const glw::Functions &gl, tcu::TestLog &log)
173*35238bceSAndroid Build Coastguard Worker     : BufferParamVerifier(gl, log, "_getbufferparameteri64")
174*35238bceSAndroid Build Coastguard Worker {
175*35238bceSAndroid Build Coastguard Worker }
176*35238bceSAndroid Build Coastguard Worker 
verifyInteger(tcu::TestContext & testCtx,GLenum target,GLenum name,GLint reference)177*35238bceSAndroid Build Coastguard Worker void GetBufferParameterI64Verifier::verifyInteger(tcu::TestContext &testCtx, GLenum target, GLenum name,
178*35238bceSAndroid Build Coastguard Worker                                                   GLint reference)
179*35238bceSAndroid Build Coastguard Worker {
180*35238bceSAndroid Build Coastguard Worker     using tcu::TestLog;
181*35238bceSAndroid Build Coastguard Worker 
182*35238bceSAndroid Build Coastguard Worker     StateQueryMemoryWriteGuard<GLint64> state;
183*35238bceSAndroid Build Coastguard Worker     glGetBufferParameteri64v(target, name, &state);
184*35238bceSAndroid Build Coastguard Worker 
185*35238bceSAndroid Build Coastguard Worker     if (!state.verifyValidity(testCtx))
186*35238bceSAndroid Build Coastguard Worker         return;
187*35238bceSAndroid Build Coastguard Worker 
188*35238bceSAndroid Build Coastguard Worker     if (state != reference)
189*35238bceSAndroid Build Coastguard Worker     {
190*35238bceSAndroid Build Coastguard Worker         testCtx.getLog() << TestLog::Message << "// ERROR: expected " << reference << "; got " << state
191*35238bceSAndroid Build Coastguard Worker                          << TestLog::EndMessage;
192*35238bceSAndroid Build Coastguard Worker 
193*35238bceSAndroid Build Coastguard Worker         if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
194*35238bceSAndroid Build Coastguard Worker             testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid value");
195*35238bceSAndroid Build Coastguard Worker     }
196*35238bceSAndroid Build Coastguard Worker }
197*35238bceSAndroid Build Coastguard Worker 
verifyInteger64(tcu::TestContext & testCtx,GLenum target,GLenum name,GLint64 reference)198*35238bceSAndroid Build Coastguard Worker void GetBufferParameterI64Verifier::verifyInteger64(tcu::TestContext &testCtx, GLenum target, GLenum name,
199*35238bceSAndroid Build Coastguard Worker                                                     GLint64 reference)
200*35238bceSAndroid Build Coastguard Worker {
201*35238bceSAndroid Build Coastguard Worker     using tcu::TestLog;
202*35238bceSAndroid Build Coastguard Worker 
203*35238bceSAndroid Build Coastguard Worker     StateQueryMemoryWriteGuard<GLint64> state;
204*35238bceSAndroid Build Coastguard Worker     glGetBufferParameteri64v(target, name, &state);
205*35238bceSAndroid Build Coastguard Worker 
206*35238bceSAndroid Build Coastguard Worker     if (!state.verifyValidity(testCtx))
207*35238bceSAndroid Build Coastguard Worker         return;
208*35238bceSAndroid Build Coastguard Worker 
209*35238bceSAndroid Build Coastguard Worker     if (state != reference)
210*35238bceSAndroid Build Coastguard Worker     {
211*35238bceSAndroid Build Coastguard Worker         testCtx.getLog() << TestLog::Message << "// ERROR: expected " << reference << "; got " << state
212*35238bceSAndroid Build Coastguard Worker                          << TestLog::EndMessage;
213*35238bceSAndroid Build Coastguard Worker 
214*35238bceSAndroid Build Coastguard Worker         if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
215*35238bceSAndroid Build Coastguard Worker             testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid value");
216*35238bceSAndroid Build Coastguard Worker     }
217*35238bceSAndroid Build Coastguard Worker }
218*35238bceSAndroid Build Coastguard Worker 
219*35238bceSAndroid Build Coastguard Worker } // namespace BufferParamVerifiers
220*35238bceSAndroid Build Coastguard Worker 
221*35238bceSAndroid Build Coastguard Worker namespace
222*35238bceSAndroid Build Coastguard Worker {
223*35238bceSAndroid Build Coastguard Worker 
224*35238bceSAndroid Build Coastguard Worker using namespace BufferParamVerifiers;
225*35238bceSAndroid Build Coastguard Worker 
226*35238bceSAndroid Build Coastguard Worker // Tests
227*35238bceSAndroid Build Coastguard Worker 
228*35238bceSAndroid Build Coastguard Worker class BufferCase : public ApiCase
229*35238bceSAndroid Build Coastguard Worker {
230*35238bceSAndroid Build Coastguard Worker public:
BufferCase(Context & context,BufferParamVerifier * verifier,const char * name,const char * description)231*35238bceSAndroid Build Coastguard Worker     BufferCase(Context &context, BufferParamVerifier *verifier, const char *name, const char *description)
232*35238bceSAndroid Build Coastguard Worker         : ApiCase(context, name, description)
233*35238bceSAndroid Build Coastguard Worker         , m_bufferTarget(0)
234*35238bceSAndroid Build Coastguard Worker         , m_verifier(verifier)
235*35238bceSAndroid Build Coastguard Worker         , m_testAllTargets(false)
236*35238bceSAndroid Build Coastguard Worker     {
237*35238bceSAndroid Build Coastguard Worker     }
238*35238bceSAndroid Build Coastguard Worker 
239*35238bceSAndroid Build Coastguard Worker     virtual void testBuffer(void) = DE_NULL;
240*35238bceSAndroid Build Coastguard Worker 
test(void)241*35238bceSAndroid Build Coastguard Worker     void test(void)
242*35238bceSAndroid Build Coastguard Worker     {
243*35238bceSAndroid Build Coastguard Worker         const GLenum bufferTargets[] = {
244*35238bceSAndroid Build Coastguard Worker             GL_ARRAY_BUFFER,      GL_COPY_READ_BUFFER,     GL_TRANSFORM_FEEDBACK_BUFFER, GL_UNIFORM_BUFFER,
245*35238bceSAndroid Build Coastguard Worker 
246*35238bceSAndroid Build Coastguard Worker             GL_COPY_WRITE_BUFFER, GL_ELEMENT_ARRAY_BUFFER, GL_PIXEL_PACK_BUFFER,         GL_PIXEL_UNPACK_BUFFER};
247*35238bceSAndroid Build Coastguard Worker 
248*35238bceSAndroid Build Coastguard Worker         // most test need only to be run with a subset of targets
249*35238bceSAndroid Build Coastguard Worker         const int targets = m_testAllTargets ? DE_LENGTH_OF_ARRAY(bufferTargets) : 4;
250*35238bceSAndroid Build Coastguard Worker 
251*35238bceSAndroid Build Coastguard Worker         for (int ndx = 0; ndx < targets; ++ndx)
252*35238bceSAndroid Build Coastguard Worker         {
253*35238bceSAndroid Build Coastguard Worker             m_bufferTarget = bufferTargets[ndx];
254*35238bceSAndroid Build Coastguard Worker 
255*35238bceSAndroid Build Coastguard Worker             GLuint bufferId = 0;
256*35238bceSAndroid Build Coastguard Worker             glGenBuffers(1, &bufferId);
257*35238bceSAndroid Build Coastguard Worker             glBindBuffer(m_bufferTarget, bufferId);
258*35238bceSAndroid Build Coastguard Worker             expectError(GL_NO_ERROR);
259*35238bceSAndroid Build Coastguard Worker 
260*35238bceSAndroid Build Coastguard Worker             testBuffer();
261*35238bceSAndroid Build Coastguard Worker 
262*35238bceSAndroid Build Coastguard Worker             glDeleteBuffers(1, &bufferId);
263*35238bceSAndroid Build Coastguard Worker             expectError(GL_NO_ERROR);
264*35238bceSAndroid Build Coastguard Worker         }
265*35238bceSAndroid Build Coastguard Worker     }
266*35238bceSAndroid Build Coastguard Worker 
267*35238bceSAndroid Build Coastguard Worker protected:
268*35238bceSAndroid Build Coastguard Worker     GLenum m_bufferTarget;
269*35238bceSAndroid Build Coastguard Worker     BufferParamVerifier *m_verifier;
270*35238bceSAndroid Build Coastguard Worker     bool m_testAllTargets;
271*35238bceSAndroid Build Coastguard Worker };
272*35238bceSAndroid Build Coastguard Worker 
273*35238bceSAndroid Build Coastguard Worker class BufferSizeCase : public BufferCase
274*35238bceSAndroid Build Coastguard Worker {
275*35238bceSAndroid Build Coastguard Worker public:
BufferSizeCase(Context & context,BufferParamVerifier * verifier,const char * name,const char * description)276*35238bceSAndroid Build Coastguard Worker     BufferSizeCase(Context &context, BufferParamVerifier *verifier, const char *name, const char *description)
277*35238bceSAndroid Build Coastguard Worker         : BufferCase(context, verifier, name, description)
278*35238bceSAndroid Build Coastguard Worker     {
279*35238bceSAndroid Build Coastguard Worker         m_testAllTargets = true;
280*35238bceSAndroid Build Coastguard Worker     }
281*35238bceSAndroid Build Coastguard Worker 
testBuffer(void)282*35238bceSAndroid Build Coastguard Worker     void testBuffer(void)
283*35238bceSAndroid Build Coastguard Worker     {
284*35238bceSAndroid Build Coastguard Worker         de::Random rnd(0xabcdef);
285*35238bceSAndroid Build Coastguard Worker 
286*35238bceSAndroid Build Coastguard Worker         m_verifier->verifyInteger64(m_testCtx, m_bufferTarget, GL_BUFFER_SIZE, 0);
287*35238bceSAndroid Build Coastguard Worker 
288*35238bceSAndroid Build Coastguard Worker         const int numIterations = 16;
289*35238bceSAndroid Build Coastguard Worker         for (int i = 0; i < numIterations; ++i)
290*35238bceSAndroid Build Coastguard Worker         {
291*35238bceSAndroid Build Coastguard Worker             const GLint len = rnd.getInt(0, 1024);
292*35238bceSAndroid Build Coastguard Worker             glBufferData(m_bufferTarget, len, DE_NULL, GL_STREAM_DRAW);
293*35238bceSAndroid Build Coastguard Worker             expectError(GL_NO_ERROR);
294*35238bceSAndroid Build Coastguard Worker 
295*35238bceSAndroid Build Coastguard Worker             m_verifier->verifyInteger64(m_testCtx, m_bufferTarget, GL_BUFFER_SIZE, len);
296*35238bceSAndroid Build Coastguard Worker             expectError(GL_NO_ERROR);
297*35238bceSAndroid Build Coastguard Worker         }
298*35238bceSAndroid Build Coastguard Worker     }
299*35238bceSAndroid Build Coastguard Worker };
300*35238bceSAndroid Build Coastguard Worker 
301*35238bceSAndroid Build Coastguard Worker class BufferUsageCase : public BufferCase
302*35238bceSAndroid Build Coastguard Worker {
303*35238bceSAndroid Build Coastguard Worker public:
BufferUsageCase(Context & context,BufferParamVerifier * verifier,const char * name,const char * description)304*35238bceSAndroid Build Coastguard Worker     BufferUsageCase(Context &context, BufferParamVerifier *verifier, const char *name, const char *description)
305*35238bceSAndroid Build Coastguard Worker         : BufferCase(context, verifier, name, description)
306*35238bceSAndroid Build Coastguard Worker     {
307*35238bceSAndroid Build Coastguard Worker     }
308*35238bceSAndroid Build Coastguard Worker 
testBuffer(void)309*35238bceSAndroid Build Coastguard Worker     void testBuffer(void)
310*35238bceSAndroid Build Coastguard Worker     {
311*35238bceSAndroid Build Coastguard Worker         m_verifier->verifyInteger(m_testCtx, m_bufferTarget, GL_BUFFER_USAGE, GL_STATIC_DRAW);
312*35238bceSAndroid Build Coastguard Worker 
313*35238bceSAndroid Build Coastguard Worker         const GLenum usages[] = {GL_STREAM_DRAW, GL_STREAM_READ,  GL_STREAM_COPY,  GL_STATIC_DRAW, GL_STATIC_READ,
314*35238bceSAndroid Build Coastguard Worker                                  GL_STATIC_COPY, GL_DYNAMIC_DRAW, GL_DYNAMIC_READ, GL_DYNAMIC_COPY};
315*35238bceSAndroid Build Coastguard Worker 
316*35238bceSAndroid Build Coastguard Worker         for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(usages); ++ndx)
317*35238bceSAndroid Build Coastguard Worker         {
318*35238bceSAndroid Build Coastguard Worker             glBufferData(m_bufferTarget, 16, DE_NULL, usages[ndx]);
319*35238bceSAndroid Build Coastguard Worker             expectError(GL_NO_ERROR);
320*35238bceSAndroid Build Coastguard Worker 
321*35238bceSAndroid Build Coastguard Worker             m_verifier->verifyInteger(m_testCtx, m_bufferTarget, GL_BUFFER_USAGE, usages[ndx]);
322*35238bceSAndroid Build Coastguard Worker             expectError(GL_NO_ERROR);
323*35238bceSAndroid Build Coastguard Worker         }
324*35238bceSAndroid Build Coastguard Worker     }
325*35238bceSAndroid Build Coastguard Worker };
326*35238bceSAndroid Build Coastguard Worker 
327*35238bceSAndroid Build Coastguard Worker class BufferAccessFlagsCase : public BufferCase
328*35238bceSAndroid Build Coastguard Worker {
329*35238bceSAndroid Build Coastguard Worker public:
BufferAccessFlagsCase(Context & context,BufferParamVerifier * verifier,const char * name,const char * description)330*35238bceSAndroid Build Coastguard Worker     BufferAccessFlagsCase(Context &context, BufferParamVerifier *verifier, const char *name, const char *description)
331*35238bceSAndroid Build Coastguard Worker         : BufferCase(context, verifier, name, description)
332*35238bceSAndroid Build Coastguard Worker     {
333*35238bceSAndroid Build Coastguard Worker     }
334*35238bceSAndroid Build Coastguard Worker 
testBuffer(void)335*35238bceSAndroid Build Coastguard Worker     void testBuffer(void)
336*35238bceSAndroid Build Coastguard Worker     {
337*35238bceSAndroid Build Coastguard Worker         m_verifier->verifyInteger(m_testCtx, m_bufferTarget, GL_BUFFER_ACCESS_FLAGS, 0);
338*35238bceSAndroid Build Coastguard Worker 
339*35238bceSAndroid Build Coastguard Worker         const GLenum accessFlags[] = {
340*35238bceSAndroid Build Coastguard Worker             GL_MAP_READ_BIT,
341*35238bceSAndroid Build Coastguard Worker 
342*35238bceSAndroid Build Coastguard Worker             GL_MAP_WRITE_BIT,
343*35238bceSAndroid Build Coastguard Worker             GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_RANGE_BIT,
344*35238bceSAndroid Build Coastguard Worker             GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT,
345*35238bceSAndroid Build Coastguard Worker             GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_RANGE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT,
346*35238bceSAndroid Build Coastguard Worker 
347*35238bceSAndroid Build Coastguard Worker             GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT,
348*35238bceSAndroid Build Coastguard Worker             GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT | GL_MAP_INVALIDATE_RANGE_BIT,
349*35238bceSAndroid Build Coastguard Worker             GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT | GL_MAP_INVALIDATE_BUFFER_BIT,
350*35238bceSAndroid Build Coastguard Worker             GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT | GL_MAP_INVALIDATE_RANGE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT,
351*35238bceSAndroid Build Coastguard Worker 
352*35238bceSAndroid Build Coastguard Worker             GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT,
353*35238bceSAndroid Build Coastguard Worker             GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_INVALIDATE_RANGE_BIT,
354*35238bceSAndroid Build Coastguard Worker             GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_INVALIDATE_BUFFER_BIT,
355*35238bceSAndroid Build Coastguard Worker             GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_INVALIDATE_RANGE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT,
356*35238bceSAndroid Build Coastguard Worker 
357*35238bceSAndroid Build Coastguard Worker             GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_FLUSH_EXPLICIT_BIT,
358*35238bceSAndroid Build Coastguard Worker             GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_FLUSH_EXPLICIT_BIT | GL_MAP_INVALIDATE_RANGE_BIT,
359*35238bceSAndroid Build Coastguard Worker             GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_FLUSH_EXPLICIT_BIT | GL_MAP_INVALIDATE_BUFFER_BIT,
360*35238bceSAndroid Build Coastguard Worker             GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_FLUSH_EXPLICIT_BIT | GL_MAP_INVALIDATE_RANGE_BIT |
361*35238bceSAndroid Build Coastguard Worker                 GL_MAP_INVALIDATE_BUFFER_BIT,
362*35238bceSAndroid Build Coastguard Worker 
363*35238bceSAndroid Build Coastguard Worker         };
364*35238bceSAndroid Build Coastguard Worker 
365*35238bceSAndroid Build Coastguard Worker         for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(accessFlags); ++ndx)
366*35238bceSAndroid Build Coastguard Worker         {
367*35238bceSAndroid Build Coastguard Worker             glBufferData(m_bufferTarget, 16, DE_NULL, GL_DYNAMIC_COPY);
368*35238bceSAndroid Build Coastguard Worker             glMapBufferRange(m_bufferTarget, 0, 16, accessFlags[ndx]);
369*35238bceSAndroid Build Coastguard Worker             expectError(GL_NO_ERROR);
370*35238bceSAndroid Build Coastguard Worker 
371*35238bceSAndroid Build Coastguard Worker             m_verifier->verifyInteger(m_testCtx, m_bufferTarget, GL_BUFFER_ACCESS_FLAGS, accessFlags[ndx]);
372*35238bceSAndroid Build Coastguard Worker             expectError(GL_NO_ERROR);
373*35238bceSAndroid Build Coastguard Worker 
374*35238bceSAndroid Build Coastguard Worker             glUnmapBuffer(m_bufferTarget);
375*35238bceSAndroid Build Coastguard Worker             expectError(GL_NO_ERROR);
376*35238bceSAndroid Build Coastguard Worker         }
377*35238bceSAndroid Build Coastguard Worker     }
378*35238bceSAndroid Build Coastguard Worker };
379*35238bceSAndroid Build Coastguard Worker 
380*35238bceSAndroid Build Coastguard Worker class BufferMappedCase : public BufferCase
381*35238bceSAndroid Build Coastguard Worker {
382*35238bceSAndroid Build Coastguard Worker public:
BufferMappedCase(Context & context,BufferParamVerifier * verifier,const char * name,const char * description)383*35238bceSAndroid Build Coastguard Worker     BufferMappedCase(Context &context, BufferParamVerifier *verifier, const char *name, const char *description)
384*35238bceSAndroid Build Coastguard Worker         : BufferCase(context, verifier, name, description)
385*35238bceSAndroid Build Coastguard Worker     {
386*35238bceSAndroid Build Coastguard Worker     }
387*35238bceSAndroid Build Coastguard Worker 
testBuffer(void)388*35238bceSAndroid Build Coastguard Worker     void testBuffer(void)
389*35238bceSAndroid Build Coastguard Worker     {
390*35238bceSAndroid Build Coastguard Worker         m_verifier->verifyInteger(m_testCtx, m_bufferTarget, GL_BUFFER_MAPPED, GL_FALSE);
391*35238bceSAndroid Build Coastguard Worker 
392*35238bceSAndroid Build Coastguard Worker         glBufferData(m_bufferTarget, 16, DE_NULL, GL_DYNAMIC_COPY);
393*35238bceSAndroid Build Coastguard Worker         glMapBufferRange(m_bufferTarget, 0, 16, GL_MAP_WRITE_BIT);
394*35238bceSAndroid Build Coastguard Worker         expectError(GL_NO_ERROR);
395*35238bceSAndroid Build Coastguard Worker 
396*35238bceSAndroid Build Coastguard Worker         m_verifier->verifyInteger(m_testCtx, m_bufferTarget, GL_BUFFER_MAPPED, GL_TRUE);
397*35238bceSAndroid Build Coastguard Worker         expectError(GL_NO_ERROR);
398*35238bceSAndroid Build Coastguard Worker 
399*35238bceSAndroid Build Coastguard Worker         glUnmapBuffer(m_bufferTarget);
400*35238bceSAndroid Build Coastguard Worker         expectError(GL_NO_ERROR);
401*35238bceSAndroid Build Coastguard Worker     }
402*35238bceSAndroid Build Coastguard Worker };
403*35238bceSAndroid Build Coastguard Worker 
404*35238bceSAndroid Build Coastguard Worker class BufferOffsetLengthCase : public BufferCase
405*35238bceSAndroid Build Coastguard Worker {
406*35238bceSAndroid Build Coastguard Worker public:
BufferOffsetLengthCase(Context & context,BufferParamVerifier * verifier,const char * name,const char * description)407*35238bceSAndroid Build Coastguard Worker     BufferOffsetLengthCase(Context &context, BufferParamVerifier *verifier, const char *name, const char *description)
408*35238bceSAndroid Build Coastguard Worker         : BufferCase(context, verifier, name, description)
409*35238bceSAndroid Build Coastguard Worker     {
410*35238bceSAndroid Build Coastguard Worker     }
411*35238bceSAndroid Build Coastguard Worker 
testBuffer(void)412*35238bceSAndroid Build Coastguard Worker     void testBuffer(void)
413*35238bceSAndroid Build Coastguard Worker     {
414*35238bceSAndroid Build Coastguard Worker         m_verifier->verifyInteger(m_testCtx, m_bufferTarget, GL_BUFFER_MAP_OFFSET, 0);
415*35238bceSAndroid Build Coastguard Worker         m_verifier->verifyInteger(m_testCtx, m_bufferTarget, GL_BUFFER_MAP_LENGTH, 0);
416*35238bceSAndroid Build Coastguard Worker 
417*35238bceSAndroid Build Coastguard Worker         glBufferData(m_bufferTarget, 16, DE_NULL, GL_DYNAMIC_COPY);
418*35238bceSAndroid Build Coastguard Worker 
419*35238bceSAndroid Build Coastguard Worker         const struct BufferRange
420*35238bceSAndroid Build Coastguard Worker         {
421*35238bceSAndroid Build Coastguard Worker             int offset;
422*35238bceSAndroid Build Coastguard Worker             int length;
423*35238bceSAndroid Build Coastguard Worker         } ranges[] = {
424*35238bceSAndroid Build Coastguard Worker             {0, 16},
425*35238bceSAndroid Build Coastguard Worker             {4, 12},
426*35238bceSAndroid Build Coastguard Worker             {0, 12},
427*35238bceSAndroid Build Coastguard Worker             {8, 8},
428*35238bceSAndroid Build Coastguard Worker         };
429*35238bceSAndroid Build Coastguard Worker 
430*35238bceSAndroid Build Coastguard Worker         for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(ranges); ++ndx)
431*35238bceSAndroid Build Coastguard Worker         {
432*35238bceSAndroid Build Coastguard Worker             glMapBufferRange(m_bufferTarget, ranges[ndx].offset, ranges[ndx].length, GL_MAP_WRITE_BIT);
433*35238bceSAndroid Build Coastguard Worker             expectError(GL_NO_ERROR);
434*35238bceSAndroid Build Coastguard Worker 
435*35238bceSAndroid Build Coastguard Worker             m_verifier->verifyInteger(m_testCtx, m_bufferTarget, GL_BUFFER_MAP_OFFSET, ranges[ndx].offset);
436*35238bceSAndroid Build Coastguard Worker             m_verifier->verifyInteger(m_testCtx, m_bufferTarget, GL_BUFFER_MAP_LENGTH, ranges[ndx].length);
437*35238bceSAndroid Build Coastguard Worker             expectError(GL_NO_ERROR);
438*35238bceSAndroid Build Coastguard Worker 
439*35238bceSAndroid Build Coastguard Worker             glUnmapBuffer(m_bufferTarget);
440*35238bceSAndroid Build Coastguard Worker             expectError(GL_NO_ERROR);
441*35238bceSAndroid Build Coastguard Worker         }
442*35238bceSAndroid Build Coastguard Worker     }
443*35238bceSAndroid Build Coastguard Worker };
444*35238bceSAndroid Build Coastguard Worker 
445*35238bceSAndroid Build Coastguard Worker class BufferPointerCase : public ApiCase
446*35238bceSAndroid Build Coastguard Worker {
447*35238bceSAndroid Build Coastguard Worker public:
BufferPointerCase(Context & context,const char * name,const char * description)448*35238bceSAndroid Build Coastguard Worker     BufferPointerCase(Context &context, const char *name, const char *description) : ApiCase(context, name, description)
449*35238bceSAndroid Build Coastguard Worker     {
450*35238bceSAndroid Build Coastguard Worker     }
451*35238bceSAndroid Build Coastguard Worker 
test(void)452*35238bceSAndroid Build Coastguard Worker     void test(void)
453*35238bceSAndroid Build Coastguard Worker     {
454*35238bceSAndroid Build Coastguard Worker         GLuint bufferId = 0;
455*35238bceSAndroid Build Coastguard Worker         glGenBuffers(1, &bufferId);
456*35238bceSAndroid Build Coastguard Worker         glBindBuffer(GL_ARRAY_BUFFER, bufferId);
457*35238bceSAndroid Build Coastguard Worker         expectError(GL_NO_ERROR);
458*35238bceSAndroid Build Coastguard Worker 
459*35238bceSAndroid Build Coastguard Worker         StateQueryMemoryWriteGuard<GLvoid *> initialState;
460*35238bceSAndroid Build Coastguard Worker         glGetBufferPointerv(GL_ARRAY_BUFFER, GL_BUFFER_MAP_POINTER, &initialState);
461*35238bceSAndroid Build Coastguard Worker         initialState.verifyValidity(m_testCtx);
462*35238bceSAndroid Build Coastguard Worker         checkPointerEquals(m_testCtx, initialState, 0);
463*35238bceSAndroid Build Coastguard Worker 
464*35238bceSAndroid Build Coastguard Worker         glBufferData(GL_ARRAY_BUFFER, 8, DE_NULL, GL_DYNAMIC_COPY);
465*35238bceSAndroid Build Coastguard Worker         GLvoid *mapPointer = glMapBufferRange(GL_ARRAY_BUFFER, 0, 8, GL_MAP_READ_BIT);
466*35238bceSAndroid Build Coastguard Worker         expectError(GL_NO_ERROR);
467*35238bceSAndroid Build Coastguard Worker 
468*35238bceSAndroid Build Coastguard Worker         StateQueryMemoryWriteGuard<GLvoid *> mapPointerState;
469*35238bceSAndroid Build Coastguard Worker         glGetBufferPointerv(GL_ARRAY_BUFFER, GL_BUFFER_MAP_POINTER, &mapPointerState);
470*35238bceSAndroid Build Coastguard Worker         mapPointerState.verifyValidity(m_testCtx);
471*35238bceSAndroid Build Coastguard Worker         checkPointerEquals(m_testCtx, mapPointerState, mapPointer);
472*35238bceSAndroid Build Coastguard Worker 
473*35238bceSAndroid Build Coastguard Worker         glDeleteBuffers(1, &bufferId);
474*35238bceSAndroid Build Coastguard Worker         expectError(GL_NO_ERROR);
475*35238bceSAndroid Build Coastguard Worker     }
476*35238bceSAndroid Build Coastguard Worker };
477*35238bceSAndroid Build Coastguard Worker 
478*35238bceSAndroid Build Coastguard Worker } // namespace
479*35238bceSAndroid Build Coastguard Worker 
480*35238bceSAndroid Build Coastguard Worker #define FOR_EACH_VERIFIER(VERIFIERS, CODE_BLOCK)                                                 \
481*35238bceSAndroid Build Coastguard Worker     do                                                                                           \
482*35238bceSAndroid Build Coastguard Worker     {                                                                                            \
483*35238bceSAndroid Build Coastguard Worker         for (int _verifierNdx = 0; _verifierNdx < DE_LENGTH_OF_ARRAY(VERIFIERS); _verifierNdx++) \
484*35238bceSAndroid Build Coastguard Worker         {                                                                                        \
485*35238bceSAndroid Build Coastguard Worker             BufferParamVerifier *verifier = (VERIFIERS)[_verifierNdx];                           \
486*35238bceSAndroid Build Coastguard Worker             CODE_BLOCK;                                                                          \
487*35238bceSAndroid Build Coastguard Worker         }                                                                                        \
488*35238bceSAndroid Build Coastguard Worker     } while (0)
489*35238bceSAndroid Build Coastguard Worker 
BufferObjectQueryTests(Context & context)490*35238bceSAndroid Build Coastguard Worker BufferObjectQueryTests::BufferObjectQueryTests(Context &context)
491*35238bceSAndroid Build Coastguard Worker     : TestCaseGroup(context, "buffer_object", "Buffer Object Query tests")
492*35238bceSAndroid Build Coastguard Worker     , m_verifierInt(DE_NULL)
493*35238bceSAndroid Build Coastguard Worker     , m_verifierInt64(DE_NULL)
494*35238bceSAndroid Build Coastguard Worker {
495*35238bceSAndroid Build Coastguard Worker }
496*35238bceSAndroid Build Coastguard Worker 
~BufferObjectQueryTests(void)497*35238bceSAndroid Build Coastguard Worker BufferObjectQueryTests::~BufferObjectQueryTests(void)
498*35238bceSAndroid Build Coastguard Worker {
499*35238bceSAndroid Build Coastguard Worker     deinit();
500*35238bceSAndroid Build Coastguard Worker }
501*35238bceSAndroid Build Coastguard Worker 
init(void)502*35238bceSAndroid Build Coastguard Worker void BufferObjectQueryTests::init(void)
503*35238bceSAndroid Build Coastguard Worker {
504*35238bceSAndroid Build Coastguard Worker     using namespace BufferParamVerifiers;
505*35238bceSAndroid Build Coastguard Worker 
506*35238bceSAndroid Build Coastguard Worker     DE_ASSERT(m_verifierInt == DE_NULL);
507*35238bceSAndroid Build Coastguard Worker     DE_ASSERT(m_verifierInt64 == DE_NULL);
508*35238bceSAndroid Build Coastguard Worker 
509*35238bceSAndroid Build Coastguard Worker     m_verifierInt                    = new GetBufferParameterIVerifier(m_context.getRenderContext().getFunctions(),
510*35238bceSAndroid Build Coastguard Worker                                                                        m_context.getTestContext().getLog());
511*35238bceSAndroid Build Coastguard Worker     m_verifierInt64                  = new GetBufferParameterI64Verifier(m_context.getRenderContext().getFunctions(),
512*35238bceSAndroid Build Coastguard Worker                                                                          m_context.getTestContext().getLog());
513*35238bceSAndroid Build Coastguard Worker     BufferParamVerifier *verifiers[] = {m_verifierInt, m_verifierInt64};
514*35238bceSAndroid Build Coastguard Worker 
515*35238bceSAndroid Build Coastguard Worker     FOR_EACH_VERIFIER(verifiers,
516*35238bceSAndroid Build Coastguard Worker                       addChild(new BufferSizeCase(m_context, verifier,
517*35238bceSAndroid Build Coastguard Worker                                                   (std::string("buffer_size") + verifier->getTestNamePostfix()).c_str(),
518*35238bceSAndroid Build Coastguard Worker                                                   "BUFFER_SIZE")));
519*35238bceSAndroid Build Coastguard Worker     FOR_EACH_VERIFIER(
520*35238bceSAndroid Build Coastguard Worker         verifiers, addChild(new BufferUsageCase(m_context, verifier,
521*35238bceSAndroid Build Coastguard Worker                                                 (std::string("buffer_usage") + verifier->getTestNamePostfix()).c_str(),
522*35238bceSAndroid Build Coastguard Worker                                                 "BUFFER_USAGE")));
523*35238bceSAndroid Build Coastguard Worker     FOR_EACH_VERIFIER(verifiers, addChild(new BufferAccessFlagsCase(
524*35238bceSAndroid Build Coastguard Worker                                      m_context, verifier,
525*35238bceSAndroid Build Coastguard Worker                                      (std::string("buffer_access_flags") + verifier->getTestNamePostfix()).c_str(),
526*35238bceSAndroid Build Coastguard Worker                                      "BUFFER_ACCESS_FLAGS")));
527*35238bceSAndroid Build Coastguard Worker     FOR_EACH_VERIFIER(verifiers,
528*35238bceSAndroid Build Coastguard Worker                       addChild(new BufferMappedCase(
529*35238bceSAndroid Build Coastguard Worker                           m_context, verifier, (std::string("buffer_mapped") + verifier->getTestNamePostfix()).c_str(),
530*35238bceSAndroid Build Coastguard Worker                           "BUFFER_MAPPED")));
531*35238bceSAndroid Build Coastguard Worker     FOR_EACH_VERIFIER(verifiers, addChild(new BufferOffsetLengthCase(
532*35238bceSAndroid Build Coastguard Worker                                      m_context, verifier,
533*35238bceSAndroid Build Coastguard Worker                                      (std::string("buffer_map_offset_length") + verifier->getTestNamePostfix()).c_str(),
534*35238bceSAndroid Build Coastguard Worker                                      "BUFFER_MAP_OFFSET and BUFFER_MAP_LENGTH")));
535*35238bceSAndroid Build Coastguard Worker 
536*35238bceSAndroid Build Coastguard Worker     addChild(new BufferPointerCase(m_context, "buffer_pointer", "GetBufferPointerv"));
537*35238bceSAndroid Build Coastguard Worker }
538*35238bceSAndroid Build Coastguard Worker 
deinit(void)539*35238bceSAndroid Build Coastguard Worker void BufferObjectQueryTests::deinit(void)
540*35238bceSAndroid Build Coastguard Worker {
541*35238bceSAndroid Build Coastguard Worker     if (m_verifierInt)
542*35238bceSAndroid Build Coastguard Worker     {
543*35238bceSAndroid Build Coastguard Worker         delete m_verifierInt;
544*35238bceSAndroid Build Coastguard Worker         m_verifierInt = NULL;
545*35238bceSAndroid Build Coastguard Worker     }
546*35238bceSAndroid Build Coastguard Worker     if (m_verifierInt64)
547*35238bceSAndroid Build Coastguard Worker     {
548*35238bceSAndroid Build Coastguard Worker         delete m_verifierInt64;
549*35238bceSAndroid Build Coastguard Worker         m_verifierInt64 = NULL;
550*35238bceSAndroid Build Coastguard Worker     }
551*35238bceSAndroid Build Coastguard Worker }
552*35238bceSAndroid Build Coastguard Worker 
553*35238bceSAndroid Build Coastguard Worker } // namespace Functional
554*35238bceSAndroid Build Coastguard Worker } // namespace gles3
555*35238bceSAndroid Build Coastguard Worker } // namespace deqp
556