1*35238bceSAndroid Build Coastguard Worker /*-------------------------------------------------------------------------
2*35238bceSAndroid Build Coastguard Worker * drawElements Quality Program OpenGL ES 3.1 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 Debug output (KHR_debug) tests
22*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
23*35238bceSAndroid Build Coastguard Worker
24*35238bceSAndroid Build Coastguard Worker #include "es31fDebugTests.hpp"
25*35238bceSAndroid Build Coastguard Worker
26*35238bceSAndroid Build Coastguard Worker #include "es31fNegativeTestShared.hpp"
27*35238bceSAndroid Build Coastguard Worker #include "es31fNegativeBufferApiTests.hpp"
28*35238bceSAndroid Build Coastguard Worker #include "es31fNegativeTextureApiTests.hpp"
29*35238bceSAndroid Build Coastguard Worker #include "es31fNegativeShaderApiTests.hpp"
30*35238bceSAndroid Build Coastguard Worker #include "es31fNegativeFragmentApiTests.hpp"
31*35238bceSAndroid Build Coastguard Worker #include "es31fNegativeVertexArrayApiTests.hpp"
32*35238bceSAndroid Build Coastguard Worker #include "es31fNegativeStateApiTests.hpp"
33*35238bceSAndroid Build Coastguard Worker #include "es31fNegativeAtomicCounterTests.hpp"
34*35238bceSAndroid Build Coastguard Worker #include "es31fNegativeShaderImageLoadStoreTests.hpp"
35*35238bceSAndroid Build Coastguard Worker #include "es31fNegativeShaderFunctionTests.hpp"
36*35238bceSAndroid Build Coastguard Worker #include "es31fNegativeShaderDirectiveTests.hpp"
37*35238bceSAndroid Build Coastguard Worker #include "es31fNegativeSSBOBlockTests.hpp"
38*35238bceSAndroid Build Coastguard Worker #include "es31fNegativePreciseTests.hpp"
39*35238bceSAndroid Build Coastguard Worker #include "es31fNegativeAdvancedBlendEquationTests.hpp"
40*35238bceSAndroid Build Coastguard Worker #include "es31fNegativeShaderStorageTests.hpp"
41*35238bceSAndroid Build Coastguard Worker #include "es31fNegativeTessellationTests.hpp"
42*35238bceSAndroid Build Coastguard Worker #include "es31fNegativeComputeTests.hpp"
43*35238bceSAndroid Build Coastguard Worker #include "es31fNegativeSampleVariablesTests.hpp"
44*35238bceSAndroid Build Coastguard Worker #include "es31fNegativeShaderFramebufferFetchTests.hpp"
45*35238bceSAndroid Build Coastguard Worker
46*35238bceSAndroid Build Coastguard Worker #include "deUniquePtr.hpp"
47*35238bceSAndroid Build Coastguard Worker #include "deRandom.hpp"
48*35238bceSAndroid Build Coastguard Worker #include "deStringUtil.hpp"
49*35238bceSAndroid Build Coastguard Worker #include "deSTLUtil.hpp"
50*35238bceSAndroid Build Coastguard Worker #include "deMutex.hpp"
51*35238bceSAndroid Build Coastguard Worker #include "deThread.h"
52*35238bceSAndroid Build Coastguard Worker
53*35238bceSAndroid Build Coastguard Worker #include "gluRenderContext.hpp"
54*35238bceSAndroid Build Coastguard Worker #include "gluContextInfo.hpp"
55*35238bceSAndroid Build Coastguard Worker #include "gluCallLogWrapper.hpp"
56*35238bceSAndroid Build Coastguard Worker #include "gluStrUtil.hpp"
57*35238bceSAndroid Build Coastguard Worker
58*35238bceSAndroid Build Coastguard Worker #include "glwDefs.hpp"
59*35238bceSAndroid Build Coastguard Worker #include "glwEnums.hpp"
60*35238bceSAndroid Build Coastguard Worker #include "glwFunctions.hpp"
61*35238bceSAndroid Build Coastguard Worker
62*35238bceSAndroid Build Coastguard Worker #include "tes31Context.hpp"
63*35238bceSAndroid Build Coastguard Worker #include "tcuTestContext.hpp"
64*35238bceSAndroid Build Coastguard Worker #include "tcuCommandLine.hpp"
65*35238bceSAndroid Build Coastguard Worker #include "tcuResultCollector.hpp"
66*35238bceSAndroid Build Coastguard Worker
67*35238bceSAndroid Build Coastguard Worker #include "glsStateQueryUtil.hpp"
68*35238bceSAndroid Build Coastguard Worker
69*35238bceSAndroid Build Coastguard Worker namespace deqp
70*35238bceSAndroid Build Coastguard Worker {
71*35238bceSAndroid Build Coastguard Worker namespace gles31
72*35238bceSAndroid Build Coastguard Worker {
73*35238bceSAndroid Build Coastguard Worker namespace Functional
74*35238bceSAndroid Build Coastguard Worker {
75*35238bceSAndroid Build Coastguard Worker namespace
76*35238bceSAndroid Build Coastguard Worker {
77*35238bceSAndroid Build Coastguard Worker using namespace glw;
78*35238bceSAndroid Build Coastguard Worker
79*35238bceSAndroid Build Coastguard Worker using de::MovePtr;
80*35238bceSAndroid Build Coastguard Worker using std::map;
81*35238bceSAndroid Build Coastguard Worker using std::set;
82*35238bceSAndroid Build Coastguard Worker using std::string;
83*35238bceSAndroid Build Coastguard Worker using std::vector;
84*35238bceSAndroid Build Coastguard Worker
85*35238bceSAndroid Build Coastguard Worker using glu::CallLogWrapper;
86*35238bceSAndroid Build Coastguard Worker using tcu::ResultCollector;
87*35238bceSAndroid Build Coastguard Worker using tcu::TestLog;
88*35238bceSAndroid Build Coastguard Worker
89*35238bceSAndroid Build Coastguard Worker using NegativeTestShared::NegativeTestContext;
90*35238bceSAndroid Build Coastguard Worker
91*35238bceSAndroid Build Coastguard Worker static const GLenum s_debugTypes[] = {
92*35238bceSAndroid Build Coastguard Worker GL_DEBUG_TYPE_ERROR, GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR, GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR,
93*35238bceSAndroid Build Coastguard Worker GL_DEBUG_TYPE_PORTABILITY, GL_DEBUG_TYPE_PERFORMANCE, GL_DEBUG_TYPE_OTHER,
94*35238bceSAndroid Build Coastguard Worker GL_DEBUG_TYPE_MARKER, GL_DEBUG_TYPE_PUSH_GROUP, GL_DEBUG_TYPE_POP_GROUP,
95*35238bceSAndroid Build Coastguard Worker };
96*35238bceSAndroid Build Coastguard Worker
97*35238bceSAndroid Build Coastguard Worker static const GLenum s_debugSeverities[] = {
98*35238bceSAndroid Build Coastguard Worker GL_DEBUG_SEVERITY_HIGH,
99*35238bceSAndroid Build Coastguard Worker GL_DEBUG_SEVERITY_MEDIUM,
100*35238bceSAndroid Build Coastguard Worker GL_DEBUG_SEVERITY_LOW,
101*35238bceSAndroid Build Coastguard Worker GL_DEBUG_SEVERITY_NOTIFICATION,
102*35238bceSAndroid Build Coastguard Worker };
103*35238bceSAndroid Build Coastguard Worker
isKHRDebugSupported(Context & ctx)104*35238bceSAndroid Build Coastguard Worker static bool isKHRDebugSupported(Context &ctx)
105*35238bceSAndroid Build Coastguard Worker {
106*35238bceSAndroid Build Coastguard Worker const bool supportsES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
107*35238bceSAndroid Build Coastguard Worker return supportsES32 || ctx.getContextInfo().isExtensionSupported("GL_KHR_debug");
108*35238bceSAndroid Build Coastguard Worker }
109*35238bceSAndroid Build Coastguard Worker
110*35238bceSAndroid Build Coastguard Worker class BaseCase;
111*35238bceSAndroid Build Coastguard Worker
112*35238bceSAndroid Build Coastguard Worker class DebugMessageTestContext : public NegativeTestContext
113*35238bceSAndroid Build Coastguard Worker {
114*35238bceSAndroid Build Coastguard Worker public:
115*35238bceSAndroid Build Coastguard Worker DebugMessageTestContext(BaseCase &host, glu::RenderContext &renderCtx, const glu::ContextInfo &ctxInfo,
116*35238bceSAndroid Build Coastguard Worker tcu::TestLog &log, tcu::ResultCollector &results, bool enableLog);
117*35238bceSAndroid Build Coastguard Worker ~DebugMessageTestContext(void);
118*35238bceSAndroid Build Coastguard Worker
119*35238bceSAndroid Build Coastguard Worker void expectMessage(GLenum source, GLenum type);
120*35238bceSAndroid Build Coastguard Worker
121*35238bceSAndroid Build Coastguard Worker private:
122*35238bceSAndroid Build Coastguard Worker BaseCase &m_debugHost;
123*35238bceSAndroid Build Coastguard Worker };
124*35238bceSAndroid Build Coastguard Worker
125*35238bceSAndroid Build Coastguard Worker class TestFunctionWrapper
126*35238bceSAndroid Build Coastguard Worker {
127*35238bceSAndroid Build Coastguard Worker public:
128*35238bceSAndroid Build Coastguard Worker typedef void (*CoreTestFunc)(NegativeTestContext &ctx);
129*35238bceSAndroid Build Coastguard Worker typedef void (*DebugTestFunc)(DebugMessageTestContext &ctx);
130*35238bceSAndroid Build Coastguard Worker
131*35238bceSAndroid Build Coastguard Worker TestFunctionWrapper(void);
132*35238bceSAndroid Build Coastguard Worker explicit TestFunctionWrapper(CoreTestFunc func);
133*35238bceSAndroid Build Coastguard Worker explicit TestFunctionWrapper(DebugTestFunc func);
134*35238bceSAndroid Build Coastguard Worker
135*35238bceSAndroid Build Coastguard Worker void call(DebugMessageTestContext &ctx) const;
136*35238bceSAndroid Build Coastguard Worker
137*35238bceSAndroid Build Coastguard Worker private:
138*35238bceSAndroid Build Coastguard Worker enum FuncType
139*35238bceSAndroid Build Coastguard Worker {
140*35238bceSAndroid Build Coastguard Worker TYPE_NULL = 0,
141*35238bceSAndroid Build Coastguard Worker TYPE_CORE,
142*35238bceSAndroid Build Coastguard Worker TYPE_DEBUG,
143*35238bceSAndroid Build Coastguard Worker };
144*35238bceSAndroid Build Coastguard Worker FuncType m_type;
145*35238bceSAndroid Build Coastguard Worker
146*35238bceSAndroid Build Coastguard Worker union
147*35238bceSAndroid Build Coastguard Worker {
148*35238bceSAndroid Build Coastguard Worker CoreTestFunc coreFn;
149*35238bceSAndroid Build Coastguard Worker DebugTestFunc debugFn;
150*35238bceSAndroid Build Coastguard Worker } m_func;
151*35238bceSAndroid Build Coastguard Worker };
152*35238bceSAndroid Build Coastguard Worker
TestFunctionWrapper(void)153*35238bceSAndroid Build Coastguard Worker TestFunctionWrapper::TestFunctionWrapper(void) : m_type(TYPE_NULL)
154*35238bceSAndroid Build Coastguard Worker {
155*35238bceSAndroid Build Coastguard Worker m_func.coreFn = 0;
156*35238bceSAndroid Build Coastguard Worker }
157*35238bceSAndroid Build Coastguard Worker
TestFunctionWrapper(CoreTestFunc func)158*35238bceSAndroid Build Coastguard Worker TestFunctionWrapper::TestFunctionWrapper(CoreTestFunc func) : m_type(TYPE_CORE)
159*35238bceSAndroid Build Coastguard Worker {
160*35238bceSAndroid Build Coastguard Worker m_func.coreFn = func;
161*35238bceSAndroid Build Coastguard Worker }
162*35238bceSAndroid Build Coastguard Worker
TestFunctionWrapper(DebugTestFunc func)163*35238bceSAndroid Build Coastguard Worker TestFunctionWrapper::TestFunctionWrapper(DebugTestFunc func) : m_type(TYPE_DEBUG)
164*35238bceSAndroid Build Coastguard Worker {
165*35238bceSAndroid Build Coastguard Worker m_func.debugFn = func;
166*35238bceSAndroid Build Coastguard Worker }
167*35238bceSAndroid Build Coastguard Worker
call(DebugMessageTestContext & ctx) const168*35238bceSAndroid Build Coastguard Worker void TestFunctionWrapper::call(DebugMessageTestContext &ctx) const
169*35238bceSAndroid Build Coastguard Worker {
170*35238bceSAndroid Build Coastguard Worker if (m_type == TYPE_CORE)
171*35238bceSAndroid Build Coastguard Worker m_func.coreFn(static_cast<NegativeTestContext &>(ctx));
172*35238bceSAndroid Build Coastguard Worker else if (m_type == TYPE_DEBUG)
173*35238bceSAndroid Build Coastguard Worker m_func.debugFn(ctx);
174*35238bceSAndroid Build Coastguard Worker else
175*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
176*35238bceSAndroid Build Coastguard Worker }
177*35238bceSAndroid Build Coastguard Worker
emitMessages(DebugMessageTestContext & ctx,GLenum source)178*35238bceSAndroid Build Coastguard Worker void emitMessages(DebugMessageTestContext &ctx, GLenum source)
179*35238bceSAndroid Build Coastguard Worker {
180*35238bceSAndroid Build Coastguard Worker for (int typeNdx = 0; typeNdx < DE_LENGTH_OF_ARRAY(s_debugTypes); typeNdx++)
181*35238bceSAndroid Build Coastguard Worker {
182*35238bceSAndroid Build Coastguard Worker for (int severityNdx = 0; severityNdx < DE_LENGTH_OF_ARRAY(s_debugSeverities); severityNdx++)
183*35238bceSAndroid Build Coastguard Worker {
184*35238bceSAndroid Build Coastguard Worker const GLenum type = s_debugTypes[typeNdx];
185*35238bceSAndroid Build Coastguard Worker const GLenum severity = s_debugSeverities[severityNdx];
186*35238bceSAndroid Build Coastguard Worker const string msg = string("Application generated message with type ") + glu::getDebugMessageTypeName(type) +
187*35238bceSAndroid Build Coastguard Worker " and severity " + glu::getDebugMessageSeverityName(severity);
188*35238bceSAndroid Build Coastguard Worker
189*35238bceSAndroid Build Coastguard Worker // Use severity as ID, guaranteed unique
190*35238bceSAndroid Build Coastguard Worker ctx.glDebugMessageInsert(source, type, severity, severity, -1, msg.c_str());
191*35238bceSAndroid Build Coastguard Worker ctx.expectMessage(source, type);
192*35238bceSAndroid Build Coastguard Worker }
193*35238bceSAndroid Build Coastguard Worker }
194*35238bceSAndroid Build Coastguard Worker }
195*35238bceSAndroid Build Coastguard Worker
application_messages(DebugMessageTestContext & ctx)196*35238bceSAndroid Build Coastguard Worker void application_messages(DebugMessageTestContext &ctx)
197*35238bceSAndroid Build Coastguard Worker {
198*35238bceSAndroid Build Coastguard Worker ctx.beginSection("Messages with source of GL_DEBUG_SOURCE_APPLICATION");
199*35238bceSAndroid Build Coastguard Worker emitMessages(ctx, GL_DEBUG_SOURCE_APPLICATION);
200*35238bceSAndroid Build Coastguard Worker ctx.endSection();
201*35238bceSAndroid Build Coastguard Worker }
202*35238bceSAndroid Build Coastguard Worker
thirdparty_messages(DebugMessageTestContext & ctx)203*35238bceSAndroid Build Coastguard Worker void thirdparty_messages(DebugMessageTestContext &ctx)
204*35238bceSAndroid Build Coastguard Worker {
205*35238bceSAndroid Build Coastguard Worker ctx.beginSection("Messages with source of GL_DEBUG_SOURCE_THIRD_PARTY");
206*35238bceSAndroid Build Coastguard Worker emitMessages(ctx, GL_DEBUG_SOURCE_THIRD_PARTY);
207*35238bceSAndroid Build Coastguard Worker ctx.endSection();
208*35238bceSAndroid Build Coastguard Worker }
209*35238bceSAndroid Build Coastguard Worker
push_pop_messages(DebugMessageTestContext & ctx)210*35238bceSAndroid Build Coastguard Worker void push_pop_messages(DebugMessageTestContext &ctx)
211*35238bceSAndroid Build Coastguard Worker {
212*35238bceSAndroid Build Coastguard Worker ctx.beginSection("Push/Pop Debug Group");
213*35238bceSAndroid Build Coastguard Worker
214*35238bceSAndroid Build Coastguard Worker ctx.glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 1, -1, "Application group 1");
215*35238bceSAndroid Build Coastguard Worker ctx.expectMessage(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PUSH_GROUP);
216*35238bceSAndroid Build Coastguard Worker ctx.glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 2, -1, "Application group 1-1");
217*35238bceSAndroid Build Coastguard Worker ctx.expectMessage(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PUSH_GROUP);
218*35238bceSAndroid Build Coastguard Worker ctx.glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 3, -1, "Application group 1-1-1");
219*35238bceSAndroid Build Coastguard Worker ctx.expectMessage(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PUSH_GROUP);
220*35238bceSAndroid Build Coastguard Worker ctx.glPopDebugGroup();
221*35238bceSAndroid Build Coastguard Worker ctx.expectMessage(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_POP_GROUP);
222*35238bceSAndroid Build Coastguard Worker ctx.glPopDebugGroup();
223*35238bceSAndroid Build Coastguard Worker ctx.expectMessage(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_POP_GROUP);
224*35238bceSAndroid Build Coastguard Worker
225*35238bceSAndroid Build Coastguard Worker ctx.glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 4, -1, "Application group 1-2");
226*35238bceSAndroid Build Coastguard Worker ctx.expectMessage(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PUSH_GROUP);
227*35238bceSAndroid Build Coastguard Worker ctx.glPopDebugGroup();
228*35238bceSAndroid Build Coastguard Worker ctx.expectMessage(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_POP_GROUP);
229*35238bceSAndroid Build Coastguard Worker
230*35238bceSAndroid Build Coastguard Worker ctx.glPushDebugGroup(GL_DEBUG_SOURCE_THIRD_PARTY, 4, -1, "3rd Party group 1-3");
231*35238bceSAndroid Build Coastguard Worker ctx.expectMessage(GL_DEBUG_SOURCE_THIRD_PARTY, GL_DEBUG_TYPE_PUSH_GROUP);
232*35238bceSAndroid Build Coastguard Worker ctx.glPopDebugGroup();
233*35238bceSAndroid Build Coastguard Worker ctx.expectMessage(GL_DEBUG_SOURCE_THIRD_PARTY, GL_DEBUG_TYPE_POP_GROUP);
234*35238bceSAndroid Build Coastguard Worker ctx.glPopDebugGroup();
235*35238bceSAndroid Build Coastguard Worker ctx.expectMessage(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_POP_GROUP);
236*35238bceSAndroid Build Coastguard Worker
237*35238bceSAndroid Build Coastguard Worker ctx.glPushDebugGroup(GL_DEBUG_SOURCE_THIRD_PARTY, 4, -1, "3rd Party group 2");
238*35238bceSAndroid Build Coastguard Worker ctx.expectMessage(GL_DEBUG_SOURCE_THIRD_PARTY, GL_DEBUG_TYPE_PUSH_GROUP);
239*35238bceSAndroid Build Coastguard Worker ctx.glPopDebugGroup();
240*35238bceSAndroid Build Coastguard Worker ctx.expectMessage(GL_DEBUG_SOURCE_THIRD_PARTY, GL_DEBUG_TYPE_POP_GROUP);
241*35238bceSAndroid Build Coastguard Worker
242*35238bceSAndroid Build Coastguard Worker ctx.endSection();
243*35238bceSAndroid Build Coastguard Worker }
244*35238bceSAndroid Build Coastguard Worker
245*35238bceSAndroid Build Coastguard Worker struct FunctionContainer
246*35238bceSAndroid Build Coastguard Worker {
247*35238bceSAndroid Build Coastguard Worker TestFunctionWrapper function;
248*35238bceSAndroid Build Coastguard Worker const char *name;
249*35238bceSAndroid Build Coastguard Worker const char *desc;
250*35238bceSAndroid Build Coastguard Worker };
251*35238bceSAndroid Build Coastguard Worker
getUserMessageFuncs(void)252*35238bceSAndroid Build Coastguard Worker vector<FunctionContainer> getUserMessageFuncs(void)
253*35238bceSAndroid Build Coastguard Worker {
254*35238bceSAndroid Build Coastguard Worker FunctionContainer funcs[] = {
255*35238bceSAndroid Build Coastguard Worker {TestFunctionWrapper(application_messages), "application_messages",
256*35238bceSAndroid Build Coastguard Worker "Externally generated messages from the application"},
257*35238bceSAndroid Build Coastguard Worker {TestFunctionWrapper(thirdparty_messages), "third_party_messages",
258*35238bceSAndroid Build Coastguard Worker "Externally generated messages from a third party"},
259*35238bceSAndroid Build Coastguard Worker {TestFunctionWrapper(push_pop_messages), "push_pop_stack", "Messages from pushing/popping debug groups"},
260*35238bceSAndroid Build Coastguard Worker };
261*35238bceSAndroid Build Coastguard Worker
262*35238bceSAndroid Build Coastguard Worker return std::vector<FunctionContainer>(DE_ARRAY_BEGIN(funcs), DE_ARRAY_END(funcs));
263*35238bceSAndroid Build Coastguard Worker }
264*35238bceSAndroid Build Coastguard Worker
265*35238bceSAndroid Build Coastguard Worker // Data required to uniquely identify a debug message
266*35238bceSAndroid Build Coastguard Worker struct MessageID
267*35238bceSAndroid Build Coastguard Worker {
268*35238bceSAndroid Build Coastguard Worker GLenum source;
269*35238bceSAndroid Build Coastguard Worker GLenum type;
270*35238bceSAndroid Build Coastguard Worker GLuint id;
271*35238bceSAndroid Build Coastguard Worker
MessageIDdeqp::gles31::Functional::__anon5e098b950111::MessageID272*35238bceSAndroid Build Coastguard Worker MessageID(void) : source(GL_NONE), type(GL_NONE), id(0)
273*35238bceSAndroid Build Coastguard Worker {
274*35238bceSAndroid Build Coastguard Worker }
MessageIDdeqp::gles31::Functional::__anon5e098b950111::MessageID275*35238bceSAndroid Build Coastguard Worker MessageID(GLenum source_, GLenum type_, GLuint id_) : source(source_), type(type_), id(id_)
276*35238bceSAndroid Build Coastguard Worker {
277*35238bceSAndroid Build Coastguard Worker }
278*35238bceSAndroid Build Coastguard Worker
operator ==deqp::gles31::Functional::__anon5e098b950111::MessageID279*35238bceSAndroid Build Coastguard Worker bool operator==(const MessageID &rhs) const
280*35238bceSAndroid Build Coastguard Worker {
281*35238bceSAndroid Build Coastguard Worker return source == rhs.source && type == rhs.type && id == rhs.id;
282*35238bceSAndroid Build Coastguard Worker }
operator !=deqp::gles31::Functional::__anon5e098b950111::MessageID283*35238bceSAndroid Build Coastguard Worker bool operator!=(const MessageID &rhs) const
284*35238bceSAndroid Build Coastguard Worker {
285*35238bceSAndroid Build Coastguard Worker return source != rhs.source || type != rhs.type || id != rhs.id;
286*35238bceSAndroid Build Coastguard Worker }
operator <deqp::gles31::Functional::__anon5e098b950111::MessageID287*35238bceSAndroid Build Coastguard Worker bool operator<(const MessageID &rhs) const
288*35238bceSAndroid Build Coastguard Worker {
289*35238bceSAndroid Build Coastguard Worker return source < rhs.source || (source == rhs.source && (type < rhs.type || (type == rhs.type && id < rhs.id)));
290*35238bceSAndroid Build Coastguard Worker }
291*35238bceSAndroid Build Coastguard Worker };
292*35238bceSAndroid Build Coastguard Worker
operator <<(std::ostream & str,const MessageID & id)293*35238bceSAndroid Build Coastguard Worker std::ostream &operator<<(std::ostream &str, const MessageID &id)
294*35238bceSAndroid Build Coastguard Worker {
295*35238bceSAndroid Build Coastguard Worker return str << glu::getDebugMessageSourceStr(id.source) << ", " << glu::getDebugMessageTypeStr(id.type) << ", "
296*35238bceSAndroid Build Coastguard Worker << id.id;
297*35238bceSAndroid Build Coastguard Worker }
298*35238bceSAndroid Build Coastguard Worker
299*35238bceSAndroid Build Coastguard Worker // All info from a single debug message
300*35238bceSAndroid Build Coastguard Worker struct MessageData
301*35238bceSAndroid Build Coastguard Worker {
302*35238bceSAndroid Build Coastguard Worker MessageID id;
303*35238bceSAndroid Build Coastguard Worker GLenum severity;
304*35238bceSAndroid Build Coastguard Worker string message;
305*35238bceSAndroid Build Coastguard Worker
MessageDatadeqp::gles31::Functional::__anon5e098b950111::MessageData306*35238bceSAndroid Build Coastguard Worker MessageData(void) : id(MessageID()), severity(GL_NONE)
307*35238bceSAndroid Build Coastguard Worker {
308*35238bceSAndroid Build Coastguard Worker }
MessageDatadeqp::gles31::Functional::__anon5e098b950111::MessageData309*35238bceSAndroid Build Coastguard Worker MessageData(const MessageID &id_, GLenum severity_, const string &message_)
310*35238bceSAndroid Build Coastguard Worker : id(id_)
311*35238bceSAndroid Build Coastguard Worker , severity(severity_)
312*35238bceSAndroid Build Coastguard Worker , message(message_)
313*35238bceSAndroid Build Coastguard Worker {
314*35238bceSAndroid Build Coastguard Worker }
315*35238bceSAndroid Build Coastguard Worker };
316*35238bceSAndroid Build Coastguard Worker
317*35238bceSAndroid Build Coastguard Worker extern "C" typedef void GLW_APIENTRY DebugCallbackFunc(GLenum, GLenum, GLuint, GLenum, GLsizei, const char *,
318*35238bceSAndroid Build Coastguard Worker const void *);
319*35238bceSAndroid Build Coastguard Worker
320*35238bceSAndroid Build Coastguard Worker // Base class
321*35238bceSAndroid Build Coastguard Worker class BaseCase : public NegativeTestShared::ErrorCase
322*35238bceSAndroid Build Coastguard Worker {
323*35238bceSAndroid Build Coastguard Worker public:
324*35238bceSAndroid Build Coastguard Worker BaseCase(Context &ctx, const char *name, const char *desc);
~BaseCase(void)325*35238bceSAndroid Build Coastguard Worker virtual ~BaseCase(void)
326*35238bceSAndroid Build Coastguard Worker {
327*35238bceSAndroid Build Coastguard Worker }
328*35238bceSAndroid Build Coastguard Worker
329*35238bceSAndroid Build Coastguard Worker virtual IterateResult iterate(void) = 0;
330*35238bceSAndroid Build Coastguard Worker
331*35238bceSAndroid Build Coastguard Worker virtual void expectMessage(GLenum source, GLenum type);
332*35238bceSAndroid Build Coastguard Worker virtual void expectError(GLenum error0, GLenum error1);
333*35238bceSAndroid Build Coastguard Worker
334*35238bceSAndroid Build Coastguard Worker protected:
335*35238bceSAndroid Build Coastguard Worker struct VerificationResult
336*35238bceSAndroid Build Coastguard Worker {
337*35238bceSAndroid Build Coastguard Worker const qpTestResult result;
338*35238bceSAndroid Build Coastguard Worker const string resultMessage;
339*35238bceSAndroid Build Coastguard Worker const string logMessage;
340*35238bceSAndroid Build Coastguard Worker
VerificationResultdeqp::gles31::Functional::__anon5e098b950111::BaseCase::VerificationResult341*35238bceSAndroid Build Coastguard Worker VerificationResult(qpTestResult result_, const string &resultMessage_, const string &logMessage_)
342*35238bceSAndroid Build Coastguard Worker : result(result_)
343*35238bceSAndroid Build Coastguard Worker , resultMessage(resultMessage_)
344*35238bceSAndroid Build Coastguard Worker , logMessage(logMessage_)
345*35238bceSAndroid Build Coastguard Worker {
346*35238bceSAndroid Build Coastguard Worker }
347*35238bceSAndroid Build Coastguard Worker };
348*35238bceSAndroid Build Coastguard Worker
349*35238bceSAndroid Build Coastguard Worker static DebugCallbackFunc callbackHandle;
350*35238bceSAndroid Build Coastguard Worker virtual void callback(GLenum source, GLenum type, GLuint id, GLenum severity, const std::string &message);
351*35238bceSAndroid Build Coastguard Worker
352*35238bceSAndroid Build Coastguard Worker VerificationResult verifyMessageCount(const MessageID &id, GLenum severity, int refCount, int resCount,
353*35238bceSAndroid Build Coastguard Worker bool messageEnabled) const;
354*35238bceSAndroid Build Coastguard Worker
355*35238bceSAndroid Build Coastguard Worker // Verify a single message instance against expected attributes
356*35238bceSAndroid Build Coastguard Worker void verifyMessage(const MessageData &message, GLenum source, GLenum type, GLuint id, GLenum severity);
357*35238bceSAndroid Build Coastguard Worker void verifyMessage(const MessageData &message, GLenum source, GLenum type);
358*35238bceSAndroid Build Coastguard Worker
359*35238bceSAndroid Build Coastguard Worker bool verifyMessageExists(const MessageData &message, GLenum source, GLenum type);
360*35238bceSAndroid Build Coastguard Worker void verifyMessageGroup(const MessageData &message, GLenum source, GLenum type);
361*35238bceSAndroid Build Coastguard Worker void verifyMessageString(const MessageData &message);
362*35238bceSAndroid Build Coastguard Worker
363*35238bceSAndroid Build Coastguard Worker bool isDebugContext(void) const;
364*35238bceSAndroid Build Coastguard Worker
365*35238bceSAndroid Build Coastguard Worker tcu::ResultCollector m_results;
366*35238bceSAndroid Build Coastguard Worker };
367*35238bceSAndroid Build Coastguard Worker
callbackHandle(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const char * message,const void * userParam)368*35238bceSAndroid Build Coastguard Worker void BaseCase::callbackHandle(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length,
369*35238bceSAndroid Build Coastguard Worker const char *message, const void *userParam)
370*35238bceSAndroid Build Coastguard Worker {
371*35238bceSAndroid Build Coastguard Worker static_cast<BaseCase *>(const_cast<void *>(userParam))
372*35238bceSAndroid Build Coastguard Worker ->callback(source, type, id, severity, string(message, &message[length]));
373*35238bceSAndroid Build Coastguard Worker }
374*35238bceSAndroid Build Coastguard Worker
BaseCase(Context & ctx,const char * name,const char * desc)375*35238bceSAndroid Build Coastguard Worker BaseCase::BaseCase(Context &ctx, const char *name, const char *desc) : ErrorCase(ctx, name, desc)
376*35238bceSAndroid Build Coastguard Worker {
377*35238bceSAndroid Build Coastguard Worker }
378*35238bceSAndroid Build Coastguard Worker
expectMessage(GLenum source,GLenum type)379*35238bceSAndroid Build Coastguard Worker void BaseCase::expectMessage(GLenum source, GLenum type)
380*35238bceSAndroid Build Coastguard Worker {
381*35238bceSAndroid Build Coastguard Worker DE_UNREF(source);
382*35238bceSAndroid Build Coastguard Worker DE_UNREF(type);
383*35238bceSAndroid Build Coastguard Worker }
384*35238bceSAndroid Build Coastguard Worker
expectError(GLenum error0,GLenum error1)385*35238bceSAndroid Build Coastguard Worker void BaseCase::expectError(GLenum error0, GLenum error1)
386*35238bceSAndroid Build Coastguard Worker {
387*35238bceSAndroid Build Coastguard Worker if (error0 != GL_NO_ERROR || error1 != GL_NO_ERROR)
388*35238bceSAndroid Build Coastguard Worker expectMessage(GL_DEBUG_SOURCE_API, GL_DEBUG_TYPE_ERROR);
389*35238bceSAndroid Build Coastguard Worker else
390*35238bceSAndroid Build Coastguard Worker expectMessage(GL_DONT_CARE, GL_DONT_CARE);
391*35238bceSAndroid Build Coastguard Worker }
392*35238bceSAndroid Build Coastguard Worker
callback(GLenum source,GLenum type,GLuint id,GLenum severity,const string & message)393*35238bceSAndroid Build Coastguard Worker void BaseCase::callback(GLenum source, GLenum type, GLuint id, GLenum severity, const string &message)
394*35238bceSAndroid Build Coastguard Worker {
395*35238bceSAndroid Build Coastguard Worker DE_UNREF(source);
396*35238bceSAndroid Build Coastguard Worker DE_UNREF(type);
397*35238bceSAndroid Build Coastguard Worker DE_UNREF(id);
398*35238bceSAndroid Build Coastguard Worker DE_UNREF(severity);
399*35238bceSAndroid Build Coastguard Worker DE_UNREF(message);
400*35238bceSAndroid Build Coastguard Worker }
401*35238bceSAndroid Build Coastguard Worker
verifyMessageCount(const MessageID & id,GLenum severity,int refCount,int resCount,bool messageEnabled) const402*35238bceSAndroid Build Coastguard Worker BaseCase::VerificationResult BaseCase::verifyMessageCount(const MessageID &id, GLenum severity, int refCount,
403*35238bceSAndroid Build Coastguard Worker int resCount, bool messageEnabled) const
404*35238bceSAndroid Build Coastguard Worker {
405*35238bceSAndroid Build Coastguard Worker std::stringstream log;
406*35238bceSAndroid Build Coastguard Worker
407*35238bceSAndroid Build Coastguard Worker // This message should not be filtered out
408*35238bceSAndroid Build Coastguard Worker if (messageEnabled)
409*35238bceSAndroid Build Coastguard Worker {
410*35238bceSAndroid Build Coastguard Worker if (resCount != refCount)
411*35238bceSAndroid Build Coastguard Worker {
412*35238bceSAndroid Build Coastguard Worker /*
413*35238bceSAndroid Build Coastguard Worker * Technically nothing requires the implementation to be consistent in terms
414*35238bceSAndroid Build Coastguard Worker * of the messages it produces in most situations, allowing the set of messages
415*35238bceSAndroid Build Coastguard Worker * produced to vary between executions. This function splits messages
416*35238bceSAndroid Build Coastguard Worker * into deterministic and non-deterministic to facilitate handling of such messages.
417*35238bceSAndroid Build Coastguard Worker *
418*35238bceSAndroid Build Coastguard Worker * Non-deterministic messages that are present in differing quantities in filtered and
419*35238bceSAndroid Build Coastguard Worker * unfiltered runs will not fail the test case unless in direct violation of a filter:
420*35238bceSAndroid Build Coastguard Worker * the implementation may produce an arbitrary number of such messages when they are
421*35238bceSAndroid Build Coastguard Worker * not filtered out and none when they are filtered.
422*35238bceSAndroid Build Coastguard Worker *
423*35238bceSAndroid Build Coastguard Worker * A list of error source/type combinations with their assumed behaviour and
424*35238bceSAndroid Build Coastguard Worker * the rationale for expecting such behaviour follows
425*35238bceSAndroid Build Coastguard Worker *
426*35238bceSAndroid Build Coastguard Worker * For API/shader messages we assume that the following types are deterministic:
427*35238bceSAndroid Build Coastguard Worker * DEBUG_TYPE_ERROR Errors specified by spec and should always be produced
428*35238bceSAndroid Build Coastguard Worker *
429*35238bceSAndroid Build Coastguard Worker * For API messages the following types are assumed to be non-deterministic
430*35238bceSAndroid Build Coastguard Worker * and treated as quality warnings since the underlying reported issue does not change between calls:
431*35238bceSAndroid Build Coastguard Worker * DEBUG_TYPE_DEPRECATED_BEHAVIOR Reasonable to only report first instance
432*35238bceSAndroid Build Coastguard Worker * DEBUG_TYPE_UNDEFINED_BEHAVIOR Reasonable to only report first instance
433*35238bceSAndroid Build Coastguard Worker * DEBUG_TYPE_PORTABILITY Reasonable to only report first instance
434*35238bceSAndroid Build Coastguard Worker *
435*35238bceSAndroid Build Coastguard Worker * For API messages the following types are assumed to be non-deterministic
436*35238bceSAndroid Build Coastguard Worker * and do not affect test results.
437*35238bceSAndroid Build Coastguard Worker * DEBUG_TYPE_PERFORMANCE May be tied to arbitrary factors, reasonable to report only first instance
438*35238bceSAndroid Build Coastguard Worker * DEBUG_TYPE_OTHER Definition allows arbitrary contents
439*35238bceSAndroid Build Coastguard Worker *
440*35238bceSAndroid Build Coastguard Worker * For 3rd party and application messages the following types are deterministic:
441*35238bceSAndroid Build Coastguard Worker * DEBUG_TYPE_MARKER Only generated by test
442*35238bceSAndroid Build Coastguard Worker * DEBUG_TYPE_PUSH_GROUP Only generated by test
443*35238bceSAndroid Build Coastguard Worker * DEBUG_TYPE_POP_GROUP Only generated by test
444*35238bceSAndroid Build Coastguard Worker * All others Only generated by test
445*35238bceSAndroid Build Coastguard Worker *
446*35238bceSAndroid Build Coastguard Worker * All messages with category of window system or other are treated as non-deterministic
447*35238bceSAndroid Build Coastguard Worker * and do not effect test results since they can be assumed to be outside control of
448*35238bceSAndroid Build Coastguard Worker * both the implementation and test case
449*35238bceSAndroid Build Coastguard Worker *
450*35238bceSAndroid Build Coastguard Worker */
451*35238bceSAndroid Build Coastguard Worker
452*35238bceSAndroid Build Coastguard Worker const bool isDeterministic =
453*35238bceSAndroid Build Coastguard Worker id.source == GL_DEBUG_SOURCE_APPLICATION || id.source == GL_DEBUG_SOURCE_THIRD_PARTY ||
454*35238bceSAndroid Build Coastguard Worker ((id.source == GL_DEBUG_SOURCE_API || id.source == GL_DEBUG_SOURCE_SHADER_COMPILER) &&
455*35238bceSAndroid Build Coastguard Worker id.type == GL_DEBUG_TYPE_ERROR);
456*35238bceSAndroid Build Coastguard Worker
457*35238bceSAndroid Build Coastguard Worker const bool canIgnore = id.source == GL_DEBUG_SOURCE_WINDOW_SYSTEM || id.source == GL_DEBUG_SOURCE_OTHER;
458*35238bceSAndroid Build Coastguard Worker
459*35238bceSAndroid Build Coastguard Worker if (isDeterministic)
460*35238bceSAndroid Build Coastguard Worker {
461*35238bceSAndroid Build Coastguard Worker if (resCount > refCount)
462*35238bceSAndroid Build Coastguard Worker {
463*35238bceSAndroid Build Coastguard Worker log << "Extra instances of message were found: (" << id << ") with "
464*35238bceSAndroid Build Coastguard Worker << glu::getDebugMessageSeverityStr(severity) << " (got " << resCount << ", expected "
465*35238bceSAndroid Build Coastguard Worker << refCount << ")";
466*35238bceSAndroid Build Coastguard Worker return VerificationResult(QP_TEST_RESULT_FAIL,
467*35238bceSAndroid Build Coastguard Worker "Extra instances of a deterministic message were present", log.str());
468*35238bceSAndroid Build Coastguard Worker }
469*35238bceSAndroid Build Coastguard Worker else
470*35238bceSAndroid Build Coastguard Worker {
471*35238bceSAndroid Build Coastguard Worker log << "Instances of message were missing: (" << id << ") with "
472*35238bceSAndroid Build Coastguard Worker << glu::getDebugMessageSeverityStr(severity) << " (got " << resCount << ", expected "
473*35238bceSAndroid Build Coastguard Worker << refCount << ")";
474*35238bceSAndroid Build Coastguard Worker return VerificationResult(QP_TEST_RESULT_FAIL, "Message missing", log.str());
475*35238bceSAndroid Build Coastguard Worker }
476*35238bceSAndroid Build Coastguard Worker }
477*35238bceSAndroid Build Coastguard Worker else if (!canIgnore)
478*35238bceSAndroid Build Coastguard Worker {
479*35238bceSAndroid Build Coastguard Worker if (resCount > refCount)
480*35238bceSAndroid Build Coastguard Worker {
481*35238bceSAndroid Build Coastguard Worker log << "Extra instances of message were found but the message is non-deterministic(warning): ("
482*35238bceSAndroid Build Coastguard Worker << id << ") with " << glu::getDebugMessageSeverityStr(severity) << " (got " << resCount
483*35238bceSAndroid Build Coastguard Worker << ", expected " << refCount << ")";
484*35238bceSAndroid Build Coastguard Worker return VerificationResult(QP_TEST_RESULT_QUALITY_WARNING,
485*35238bceSAndroid Build Coastguard Worker "Extra instances of a message were present", log.str());
486*35238bceSAndroid Build Coastguard Worker }
487*35238bceSAndroid Build Coastguard Worker else
488*35238bceSAndroid Build Coastguard Worker {
489*35238bceSAndroid Build Coastguard Worker log << "Instances of message were missing but the message is non-deterministic(warning): (" << id
490*35238bceSAndroid Build Coastguard Worker << ") with " << glu::getDebugMessageSeverityStr(severity) << " (got " << resCount
491*35238bceSAndroid Build Coastguard Worker << ", expected " << refCount << ")";
492*35238bceSAndroid Build Coastguard Worker return VerificationResult(QP_TEST_RESULT_QUALITY_WARNING, "Message missing", log.str());
493*35238bceSAndroid Build Coastguard Worker }
494*35238bceSAndroid Build Coastguard Worker }
495*35238bceSAndroid Build Coastguard Worker else
496*35238bceSAndroid Build Coastguard Worker {
497*35238bceSAndroid Build Coastguard Worker if (resCount > refCount)
498*35238bceSAndroid Build Coastguard Worker {
499*35238bceSAndroid Build Coastguard Worker log << "Extra instances of message were found but the message is non-deterministic(ignored): ("
500*35238bceSAndroid Build Coastguard Worker << id << ") with " << glu::getDebugMessageSeverityStr(severity) << " (got " << resCount
501*35238bceSAndroid Build Coastguard Worker << ", expected " << refCount << ")";
502*35238bceSAndroid Build Coastguard Worker return VerificationResult(QP_TEST_RESULT_PASS, "", log.str());
503*35238bceSAndroid Build Coastguard Worker }
504*35238bceSAndroid Build Coastguard Worker else
505*35238bceSAndroid Build Coastguard Worker {
506*35238bceSAndroid Build Coastguard Worker log << "Instances of message were missing but the message is non-deterministic(ignored): (" << id
507*35238bceSAndroid Build Coastguard Worker << ") with " << glu::getDebugMessageSeverityStr(severity) << " (got " << resCount
508*35238bceSAndroid Build Coastguard Worker << ", expected " << refCount << ")";
509*35238bceSAndroid Build Coastguard Worker return VerificationResult(QP_TEST_RESULT_PASS, "", log.str());
510*35238bceSAndroid Build Coastguard Worker }
511*35238bceSAndroid Build Coastguard Worker }
512*35238bceSAndroid Build Coastguard Worker }
513*35238bceSAndroid Build Coastguard Worker else // Passed as appropriate
514*35238bceSAndroid Build Coastguard Worker {
515*35238bceSAndroid Build Coastguard Worker log << "Message was found when expected: (" << id << ") with " << glu::getDebugMessageSeverityStr(severity);
516*35238bceSAndroid Build Coastguard Worker return VerificationResult(QP_TEST_RESULT_PASS, "", log.str());
517*35238bceSAndroid Build Coastguard Worker }
518*35238bceSAndroid Build Coastguard Worker }
519*35238bceSAndroid Build Coastguard Worker // Message should be filtered out
520*35238bceSAndroid Build Coastguard Worker else
521*35238bceSAndroid Build Coastguard Worker {
522*35238bceSAndroid Build Coastguard Worker // Filtered out
523*35238bceSAndroid Build Coastguard Worker if (resCount == 0)
524*35238bceSAndroid Build Coastguard Worker {
525*35238bceSAndroid Build Coastguard Worker log << "Message was excluded correctly: (" << id << ") with " << glu::getDebugMessageSeverityStr(severity);
526*35238bceSAndroid Build Coastguard Worker return VerificationResult(QP_TEST_RESULT_PASS, "", log.str());
527*35238bceSAndroid Build Coastguard Worker }
528*35238bceSAndroid Build Coastguard Worker // Only present in filtered run (ERROR)
529*35238bceSAndroid Build Coastguard Worker else if (resCount > 0 && refCount == 0)
530*35238bceSAndroid Build Coastguard Worker {
531*35238bceSAndroid Build Coastguard Worker log << "A message was not excluded as it should have been: (" << id << ") with "
532*35238bceSAndroid Build Coastguard Worker << glu::getDebugMessageSeverityStr(severity) << ". This message was not present in the reference run";
533*35238bceSAndroid Build Coastguard Worker return VerificationResult(QP_TEST_RESULT_FAIL, "A message was not filtered out", log.str());
534*35238bceSAndroid Build Coastguard Worker }
535*35238bceSAndroid Build Coastguard Worker // Present in both runs (ERROR)
536*35238bceSAndroid Build Coastguard Worker else
537*35238bceSAndroid Build Coastguard Worker {
538*35238bceSAndroid Build Coastguard Worker log << "A message was not excluded as it should have been: (" << id << ") with "
539*35238bceSAndroid Build Coastguard Worker << glu::getDebugMessageSeverityStr(severity);
540*35238bceSAndroid Build Coastguard Worker return VerificationResult(QP_TEST_RESULT_FAIL, "A message was not filtered out", log.str());
541*35238bceSAndroid Build Coastguard Worker }
542*35238bceSAndroid Build Coastguard Worker }
543*35238bceSAndroid Build Coastguard Worker }
544*35238bceSAndroid Build Coastguard Worker
545*35238bceSAndroid Build Coastguard Worker // Return true if message needs further verification
verifyMessageExists(const MessageData & message,GLenum source,GLenum type)546*35238bceSAndroid Build Coastguard Worker bool BaseCase::verifyMessageExists(const MessageData &message, GLenum source, GLenum type)
547*35238bceSAndroid Build Coastguard Worker {
548*35238bceSAndroid Build Coastguard Worker TestLog &log = m_testCtx.getLog();
549*35238bceSAndroid Build Coastguard Worker
550*35238bceSAndroid Build Coastguard Worker if (source == GL_DONT_CARE || type == GL_DONT_CARE)
551*35238bceSAndroid Build Coastguard Worker return false;
552*35238bceSAndroid Build Coastguard Worker else if (message.id.source == GL_NONE || message.id.type == GL_NONE)
553*35238bceSAndroid Build Coastguard Worker {
554*35238bceSAndroid Build Coastguard Worker if (isDebugContext())
555*35238bceSAndroid Build Coastguard Worker {
556*35238bceSAndroid Build Coastguard Worker m_results.addResult(QP_TEST_RESULT_FAIL, "Message was not reported as expected");
557*35238bceSAndroid Build Coastguard Worker log << TestLog::Message << "A message was expected but none was reported" << TestLog::EndMessage;
558*35238bceSAndroid Build Coastguard Worker }
559*35238bceSAndroid Build Coastguard Worker else
560*35238bceSAndroid Build Coastguard Worker {
561*35238bceSAndroid Build Coastguard Worker m_results.addResult(QP_TEST_RESULT_QUALITY_WARNING,
562*35238bceSAndroid Build Coastguard Worker "Verification accuracy is lacking without a debug context");
563*35238bceSAndroid Build Coastguard Worker log << TestLog::Message << "A message was expected but none was reported. Running without a debug context"
564*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
565*35238bceSAndroid Build Coastguard Worker }
566*35238bceSAndroid Build Coastguard Worker return false;
567*35238bceSAndroid Build Coastguard Worker }
568*35238bceSAndroid Build Coastguard Worker else
569*35238bceSAndroid Build Coastguard Worker return true;
570*35238bceSAndroid Build Coastguard Worker }
571*35238bceSAndroid Build Coastguard Worker
verifyMessageGroup(const MessageData & message,GLenum source,GLenum type)572*35238bceSAndroid Build Coastguard Worker void BaseCase::verifyMessageGroup(const MessageData &message, GLenum source, GLenum type)
573*35238bceSAndroid Build Coastguard Worker {
574*35238bceSAndroid Build Coastguard Worker TestLog &log = m_testCtx.getLog();
575*35238bceSAndroid Build Coastguard Worker
576*35238bceSAndroid Build Coastguard Worker if (message.id.source != source)
577*35238bceSAndroid Build Coastguard Worker {
578*35238bceSAndroid Build Coastguard Worker m_results.addResult(QP_TEST_RESULT_FAIL, "Incorrect message source");
579*35238bceSAndroid Build Coastguard Worker log << TestLog::Message << "Message source was " << glu::getDebugMessageSourceStr(message.id.source)
580*35238bceSAndroid Build Coastguard Worker << " when it should have been " << glu::getDebugMessageSourceStr(source) << TestLog::EndMessage;
581*35238bceSAndroid Build Coastguard Worker }
582*35238bceSAndroid Build Coastguard Worker
583*35238bceSAndroid Build Coastguard Worker if (message.id.type != type)
584*35238bceSAndroid Build Coastguard Worker {
585*35238bceSAndroid Build Coastguard Worker m_results.addResult(QP_TEST_RESULT_FAIL, "Incorrect message type");
586*35238bceSAndroid Build Coastguard Worker log << TestLog::Message << "Message type was " << glu::getDebugMessageTypeStr(message.id.type)
587*35238bceSAndroid Build Coastguard Worker << " when it should have been " << glu::getDebugMessageTypeStr(type) << TestLog::EndMessage;
588*35238bceSAndroid Build Coastguard Worker }
589*35238bceSAndroid Build Coastguard Worker }
590*35238bceSAndroid Build Coastguard Worker
verifyMessageString(const MessageData & message)591*35238bceSAndroid Build Coastguard Worker void BaseCase::verifyMessageString(const MessageData &message)
592*35238bceSAndroid Build Coastguard Worker {
593*35238bceSAndroid Build Coastguard Worker TestLog &log = m_testCtx.getLog();
594*35238bceSAndroid Build Coastguard Worker
595*35238bceSAndroid Build Coastguard Worker log << TestLog::Message << "Driver says: \"" << message.message << "\"" << TestLog::EndMessage;
596*35238bceSAndroid Build Coastguard Worker
597*35238bceSAndroid Build Coastguard Worker if (message.message.empty())
598*35238bceSAndroid Build Coastguard Worker {
599*35238bceSAndroid Build Coastguard Worker m_results.addResult(QP_TEST_RESULT_QUALITY_WARNING, "Empty message");
600*35238bceSAndroid Build Coastguard Worker log << TestLog::Message << "Message message was empty" << TestLog::EndMessage;
601*35238bceSAndroid Build Coastguard Worker }
602*35238bceSAndroid Build Coastguard Worker }
603*35238bceSAndroid Build Coastguard Worker
verifyMessage(const MessageData & message,GLenum source,GLenum type)604*35238bceSAndroid Build Coastguard Worker void BaseCase::verifyMessage(const MessageData &message, GLenum source, GLenum type)
605*35238bceSAndroid Build Coastguard Worker {
606*35238bceSAndroid Build Coastguard Worker if (verifyMessageExists(message, source, type))
607*35238bceSAndroid Build Coastguard Worker {
608*35238bceSAndroid Build Coastguard Worker verifyMessageString(message);
609*35238bceSAndroid Build Coastguard Worker verifyMessageGroup(message, source, type);
610*35238bceSAndroid Build Coastguard Worker }
611*35238bceSAndroid Build Coastguard Worker }
612*35238bceSAndroid Build Coastguard Worker
verifyMessage(const MessageData & message,GLenum source,GLenum type,GLuint id,GLenum severity)613*35238bceSAndroid Build Coastguard Worker void BaseCase::verifyMessage(const MessageData &message, GLenum source, GLenum type, GLuint id, GLenum severity)
614*35238bceSAndroid Build Coastguard Worker {
615*35238bceSAndroid Build Coastguard Worker TestLog &log = m_testCtx.getLog();
616*35238bceSAndroid Build Coastguard Worker
617*35238bceSAndroid Build Coastguard Worker if (verifyMessageExists(message, source, type))
618*35238bceSAndroid Build Coastguard Worker {
619*35238bceSAndroid Build Coastguard Worker verifyMessageString(message);
620*35238bceSAndroid Build Coastguard Worker verifyMessageGroup(message, source, type);
621*35238bceSAndroid Build Coastguard Worker
622*35238bceSAndroid Build Coastguard Worker if (message.id.id != id)
623*35238bceSAndroid Build Coastguard Worker {
624*35238bceSAndroid Build Coastguard Worker m_results.addResult(QP_TEST_RESULT_FAIL, "Incorrect message id");
625*35238bceSAndroid Build Coastguard Worker log << TestLog::Message << "Message id was " << message.id.id << " when it should have been " << id
626*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
627*35238bceSAndroid Build Coastguard Worker }
628*35238bceSAndroid Build Coastguard Worker
629*35238bceSAndroid Build Coastguard Worker if (message.severity != severity)
630*35238bceSAndroid Build Coastguard Worker {
631*35238bceSAndroid Build Coastguard Worker m_results.addResult(QP_TEST_RESULT_FAIL, "Incorrect message severity");
632*35238bceSAndroid Build Coastguard Worker log << TestLog::Message << "Message severity was " << glu::getDebugMessageSeverityStr(message.severity)
633*35238bceSAndroid Build Coastguard Worker << " when it should have been " << glu::getDebugMessageSeverityStr(severity) << TestLog::EndMessage;
634*35238bceSAndroid Build Coastguard Worker }
635*35238bceSAndroid Build Coastguard Worker }
636*35238bceSAndroid Build Coastguard Worker }
637*35238bceSAndroid Build Coastguard Worker
isDebugContext(void) const638*35238bceSAndroid Build Coastguard Worker bool BaseCase::isDebugContext(void) const
639*35238bceSAndroid Build Coastguard Worker {
640*35238bceSAndroid Build Coastguard Worker return (m_context.getRenderContext().getType().getFlags() & glu::CONTEXT_DEBUG) != 0;
641*35238bceSAndroid Build Coastguard Worker }
642*35238bceSAndroid Build Coastguard Worker
643*35238bceSAndroid Build Coastguard Worker // Generate errors, verify that each error results in a callback call
644*35238bceSAndroid Build Coastguard Worker class CallbackErrorCase : public BaseCase
645*35238bceSAndroid Build Coastguard Worker {
646*35238bceSAndroid Build Coastguard Worker public:
647*35238bceSAndroid Build Coastguard Worker CallbackErrorCase(Context &ctx, const char *name, const char *desc, TestFunctionWrapper errorFunc);
~CallbackErrorCase(void)648*35238bceSAndroid Build Coastguard Worker virtual ~CallbackErrorCase(void)
649*35238bceSAndroid Build Coastguard Worker {
650*35238bceSAndroid Build Coastguard Worker }
651*35238bceSAndroid Build Coastguard Worker
652*35238bceSAndroid Build Coastguard Worker virtual IterateResult iterate(void);
653*35238bceSAndroid Build Coastguard Worker
654*35238bceSAndroid Build Coastguard Worker virtual void expectMessage(GLenum source, GLenum type);
655*35238bceSAndroid Build Coastguard Worker
656*35238bceSAndroid Build Coastguard Worker private:
657*35238bceSAndroid Build Coastguard Worker virtual void callback(GLenum source, GLenum type, GLuint id, GLenum severity, const string &message);
658*35238bceSAndroid Build Coastguard Worker
659*35238bceSAndroid Build Coastguard Worker const TestFunctionWrapper m_errorFunc;
660*35238bceSAndroid Build Coastguard Worker MessageData m_lastMessage;
661*35238bceSAndroid Build Coastguard Worker };
662*35238bceSAndroid Build Coastguard Worker
CallbackErrorCase(Context & ctx,const char * name,const char * desc,TestFunctionWrapper errorFunc)663*35238bceSAndroid Build Coastguard Worker CallbackErrorCase::CallbackErrorCase(Context &ctx, const char *name, const char *desc, TestFunctionWrapper errorFunc)
664*35238bceSAndroid Build Coastguard Worker : BaseCase(ctx, name, desc)
665*35238bceSAndroid Build Coastguard Worker , m_errorFunc(errorFunc)
666*35238bceSAndroid Build Coastguard Worker {
667*35238bceSAndroid Build Coastguard Worker }
668*35238bceSAndroid Build Coastguard Worker
iterate(void)669*35238bceSAndroid Build Coastguard Worker CallbackErrorCase::IterateResult CallbackErrorCase::iterate(void)
670*35238bceSAndroid Build Coastguard Worker {
671*35238bceSAndroid Build Coastguard Worker TCU_CHECK_AND_THROW(NotSupportedError, isKHRDebugSupported(m_context), "GL_KHR_debug is not supported");
672*35238bceSAndroid Build Coastguard Worker
673*35238bceSAndroid Build Coastguard Worker const glw::Functions &gl = m_context.getRenderContext().getFunctions();
674*35238bceSAndroid Build Coastguard Worker tcu::TestLog &log = m_testCtx.getLog();
675*35238bceSAndroid Build Coastguard Worker DebugMessageTestContext context =
676*35238bceSAndroid Build Coastguard Worker DebugMessageTestContext(*this, m_context.getRenderContext(), m_context.getContextInfo(), log, m_results, true);
677*35238bceSAndroid Build Coastguard Worker
678*35238bceSAndroid Build Coastguard Worker gl.enable(GL_DEBUG_OUTPUT);
679*35238bceSAndroid Build Coastguard Worker gl.enable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
680*35238bceSAndroid Build Coastguard Worker gl.debugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, DE_NULL, false); // disable all
681*35238bceSAndroid Build Coastguard Worker gl.debugMessageControl(GL_DEBUG_SOURCE_API, GL_DEBUG_TYPE_ERROR, GL_DONT_CARE, 0, DE_NULL,
682*35238bceSAndroid Build Coastguard Worker true); // enable API errors
683*35238bceSAndroid Build Coastguard Worker gl.debugMessageControl(GL_DEBUG_SOURCE_APPLICATION, GL_DONT_CARE, GL_DONT_CARE, 0, DE_NULL,
684*35238bceSAndroid Build Coastguard Worker true); // enable application messages
685*35238bceSAndroid Build Coastguard Worker gl.debugMessageControl(GL_DEBUG_SOURCE_THIRD_PARTY, GL_DONT_CARE, GL_DONT_CARE, 0, DE_NULL,
686*35238bceSAndroid Build Coastguard Worker true); // enable third party messages
687*35238bceSAndroid Build Coastguard Worker gl.debugMessageCallback(callbackHandle, this);
688*35238bceSAndroid Build Coastguard Worker
689*35238bceSAndroid Build Coastguard Worker m_errorFunc.call(context);
690*35238bceSAndroid Build Coastguard Worker
691*35238bceSAndroid Build Coastguard Worker gl.debugMessageCallback(DE_NULL, DE_NULL);
692*35238bceSAndroid Build Coastguard Worker gl.disable(GL_DEBUG_OUTPUT);
693*35238bceSAndroid Build Coastguard Worker
694*35238bceSAndroid Build Coastguard Worker m_results.setTestContextResult(m_testCtx);
695*35238bceSAndroid Build Coastguard Worker
696*35238bceSAndroid Build Coastguard Worker return STOP;
697*35238bceSAndroid Build Coastguard Worker }
698*35238bceSAndroid Build Coastguard Worker
expectMessage(GLenum source,GLenum type)699*35238bceSAndroid Build Coastguard Worker void CallbackErrorCase::expectMessage(GLenum source, GLenum type)
700*35238bceSAndroid Build Coastguard Worker {
701*35238bceSAndroid Build Coastguard Worker verifyMessage(m_lastMessage, source, type);
702*35238bceSAndroid Build Coastguard Worker m_lastMessage = MessageData();
703*35238bceSAndroid Build Coastguard Worker
704*35238bceSAndroid Build Coastguard Worker // Reset error so that code afterwards (such as glu::ShaderProgram) doesn't break because of
705*35238bceSAndroid Build Coastguard Worker // lingering error state.
706*35238bceSAndroid Build Coastguard Worker m_context.getRenderContext().getFunctions().getError();
707*35238bceSAndroid Build Coastguard Worker }
708*35238bceSAndroid Build Coastguard Worker
callback(GLenum source,GLenum type,GLuint id,GLenum severity,const string & message)709*35238bceSAndroid Build Coastguard Worker void CallbackErrorCase::callback(GLenum source, GLenum type, GLuint id, GLenum severity, const string &message)
710*35238bceSAndroid Build Coastguard Worker {
711*35238bceSAndroid Build Coastguard Worker m_lastMessage = MessageData(MessageID(source, type, id), severity, message);
712*35238bceSAndroid Build Coastguard Worker }
713*35238bceSAndroid Build Coastguard Worker
714*35238bceSAndroid Build Coastguard Worker // Generate errors, verify that each error results in a log entry
715*35238bceSAndroid Build Coastguard Worker class LogErrorCase : public BaseCase
716*35238bceSAndroid Build Coastguard Worker {
717*35238bceSAndroid Build Coastguard Worker public:
718*35238bceSAndroid Build Coastguard Worker LogErrorCase(Context &context, const char *name, const char *desc, TestFunctionWrapper errorFunc);
~LogErrorCase(void)719*35238bceSAndroid Build Coastguard Worker virtual ~LogErrorCase(void)
720*35238bceSAndroid Build Coastguard Worker {
721*35238bceSAndroid Build Coastguard Worker }
722*35238bceSAndroid Build Coastguard Worker
723*35238bceSAndroid Build Coastguard Worker virtual IterateResult iterate(void);
724*35238bceSAndroid Build Coastguard Worker
725*35238bceSAndroid Build Coastguard Worker virtual void expectMessage(GLenum source, GLenum type);
726*35238bceSAndroid Build Coastguard Worker
727*35238bceSAndroid Build Coastguard Worker private:
728*35238bceSAndroid Build Coastguard Worker const TestFunctionWrapper m_errorFunc;
729*35238bceSAndroid Build Coastguard Worker MessageData m_lastMessage;
730*35238bceSAndroid Build Coastguard Worker };
731*35238bceSAndroid Build Coastguard Worker
LogErrorCase(Context & ctx,const char * name,const char * desc,TestFunctionWrapper errorFunc)732*35238bceSAndroid Build Coastguard Worker LogErrorCase::LogErrorCase(Context &ctx, const char *name, const char *desc, TestFunctionWrapper errorFunc)
733*35238bceSAndroid Build Coastguard Worker : BaseCase(ctx, name, desc)
734*35238bceSAndroid Build Coastguard Worker , m_errorFunc(errorFunc)
735*35238bceSAndroid Build Coastguard Worker {
736*35238bceSAndroid Build Coastguard Worker }
737*35238bceSAndroid Build Coastguard Worker
iterate(void)738*35238bceSAndroid Build Coastguard Worker LogErrorCase::IterateResult LogErrorCase::iterate(void)
739*35238bceSAndroid Build Coastguard Worker {
740*35238bceSAndroid Build Coastguard Worker TCU_CHECK_AND_THROW(NotSupportedError, isKHRDebugSupported(m_context), "GL_KHR_debug is not supported");
741*35238bceSAndroid Build Coastguard Worker
742*35238bceSAndroid Build Coastguard Worker const glw::Functions &gl = m_context.getRenderContext().getFunctions();
743*35238bceSAndroid Build Coastguard Worker tcu::TestLog &log = m_testCtx.getLog();
744*35238bceSAndroid Build Coastguard Worker DebugMessageTestContext context =
745*35238bceSAndroid Build Coastguard Worker DebugMessageTestContext(*this, m_context.getRenderContext(), m_context.getContextInfo(), log, m_results, true);
746*35238bceSAndroid Build Coastguard Worker GLint numMsg = 0;
747*35238bceSAndroid Build Coastguard Worker
748*35238bceSAndroid Build Coastguard Worker gl.enable(GL_DEBUG_OUTPUT);
749*35238bceSAndroid Build Coastguard Worker gl.enable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
750*35238bceSAndroid Build Coastguard Worker gl.debugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, DE_NULL, false); // disable all
751*35238bceSAndroid Build Coastguard Worker gl.debugMessageControl(GL_DEBUG_SOURCE_API, GL_DEBUG_TYPE_ERROR, GL_DONT_CARE, 0, DE_NULL,
752*35238bceSAndroid Build Coastguard Worker true); // enable API errors
753*35238bceSAndroid Build Coastguard Worker gl.debugMessageCallback(DE_NULL, DE_NULL); // enable logging
754*35238bceSAndroid Build Coastguard Worker gl.getIntegerv(GL_DEBUG_LOGGED_MESSAGES, &numMsg);
755*35238bceSAndroid Build Coastguard Worker gl.getDebugMessageLog(numMsg, 0, DE_NULL, DE_NULL, DE_NULL, DE_NULL, DE_NULL, DE_NULL); // clear log
756*35238bceSAndroid Build Coastguard Worker
757*35238bceSAndroid Build Coastguard Worker m_errorFunc.call(context);
758*35238bceSAndroid Build Coastguard Worker
759*35238bceSAndroid Build Coastguard Worker gl.disable(GL_DEBUG_OUTPUT);
760*35238bceSAndroid Build Coastguard Worker m_results.setTestContextResult(m_testCtx);
761*35238bceSAndroid Build Coastguard Worker
762*35238bceSAndroid Build Coastguard Worker return STOP;
763*35238bceSAndroid Build Coastguard Worker }
764*35238bceSAndroid Build Coastguard Worker
expectMessage(GLenum source,GLenum type)765*35238bceSAndroid Build Coastguard Worker void LogErrorCase::expectMessage(GLenum source, GLenum type)
766*35238bceSAndroid Build Coastguard Worker {
767*35238bceSAndroid Build Coastguard Worker const glw::Functions &gl = m_context.getRenderContext().getFunctions();
768*35238bceSAndroid Build Coastguard Worker int numMsg = 0;
769*35238bceSAndroid Build Coastguard Worker TestLog &log = m_testCtx.getLog();
770*35238bceSAndroid Build Coastguard Worker MessageData lastMsg;
771*35238bceSAndroid Build Coastguard Worker
772*35238bceSAndroid Build Coastguard Worker if (source == GL_DONT_CARE || type == GL_DONT_CARE)
773*35238bceSAndroid Build Coastguard Worker return;
774*35238bceSAndroid Build Coastguard Worker
775*35238bceSAndroid Build Coastguard Worker gl.getIntegerv(GL_DEBUG_LOGGED_MESSAGES, &numMsg);
776*35238bceSAndroid Build Coastguard Worker
777*35238bceSAndroid Build Coastguard Worker if (numMsg == 0)
778*35238bceSAndroid Build Coastguard Worker {
779*35238bceSAndroid Build Coastguard Worker if (isDebugContext())
780*35238bceSAndroid Build Coastguard Worker {
781*35238bceSAndroid Build Coastguard Worker m_results.addResult(QP_TEST_RESULT_FAIL, "Error was not reported as expected");
782*35238bceSAndroid Build Coastguard Worker log << TestLog::Message << "A message was expected but none was reported (empty message log)"
783*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
784*35238bceSAndroid Build Coastguard Worker }
785*35238bceSAndroid Build Coastguard Worker else
786*35238bceSAndroid Build Coastguard Worker {
787*35238bceSAndroid Build Coastguard Worker m_results.addResult(QP_TEST_RESULT_QUALITY_WARNING,
788*35238bceSAndroid Build Coastguard Worker "Verification accuracy is lacking without a debug context");
789*35238bceSAndroid Build Coastguard Worker log << TestLog::Message
790*35238bceSAndroid Build Coastguard Worker << "A message was expected but none was reported (empty message log). Running without a debug context"
791*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
792*35238bceSAndroid Build Coastguard Worker }
793*35238bceSAndroid Build Coastguard Worker return;
794*35238bceSAndroid Build Coastguard Worker }
795*35238bceSAndroid Build Coastguard Worker
796*35238bceSAndroid Build Coastguard Worker // There may be messages other than the error we are looking for in the log.
797*35238bceSAndroid Build Coastguard Worker // Strictly nothing prevents the implementation from producing more than the
798*35238bceSAndroid Build Coastguard Worker // required error from an API call with a defined error. however we assume that
799*35238bceSAndroid Build Coastguard Worker // since calls that produce an error should not change GL state the implementation
800*35238bceSAndroid Build Coastguard Worker // should have nothing else to report.
801*35238bceSAndroid Build Coastguard Worker if (numMsg > 1)
802*35238bceSAndroid Build Coastguard Worker gl.getDebugMessageLog(numMsg - 1, 0, DE_NULL, DE_NULL, DE_NULL, DE_NULL, DE_NULL,
803*35238bceSAndroid Build Coastguard Worker DE_NULL); // Clear all but last
804*35238bceSAndroid Build Coastguard Worker
805*35238bceSAndroid Build Coastguard Worker {
806*35238bceSAndroid Build Coastguard Worker int msgLen = 0;
807*35238bceSAndroid Build Coastguard Worker gl.getIntegerv(GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH, &msgLen);
808*35238bceSAndroid Build Coastguard Worker
809*35238bceSAndroid Build Coastguard Worker TCU_CHECK_MSG(msgLen >= 0, "Negative message length");
810*35238bceSAndroid Build Coastguard Worker TCU_CHECK_MSG(msgLen < 100000, "Excessively long message");
811*35238bceSAndroid Build Coastguard Worker
812*35238bceSAndroid Build Coastguard Worker lastMsg.message.resize(msgLen);
813*35238bceSAndroid Build Coastguard Worker gl.getDebugMessageLog(1, msgLen, &lastMsg.id.source, &lastMsg.id.type, &lastMsg.id.id, &lastMsg.severity,
814*35238bceSAndroid Build Coastguard Worker &msgLen, &lastMsg.message[0]);
815*35238bceSAndroid Build Coastguard Worker }
816*35238bceSAndroid Build Coastguard Worker
817*35238bceSAndroid Build Coastguard Worker log << TestLog::Message << "Driver says: \"" << lastMsg.message << "\"" << TestLog::EndMessage;
818*35238bceSAndroid Build Coastguard Worker
819*35238bceSAndroid Build Coastguard Worker verifyMessage(lastMsg, source, type);
820*35238bceSAndroid Build Coastguard Worker
821*35238bceSAndroid Build Coastguard Worker // Reset error so that code afterwards (such as glu::ShaderProgram) doesn't break because of
822*35238bceSAndroid Build Coastguard Worker // lingering error state.
823*35238bceSAndroid Build Coastguard Worker m_context.getRenderContext().getFunctions().getError();
824*35238bceSAndroid Build Coastguard Worker }
825*35238bceSAndroid Build Coastguard Worker
826*35238bceSAndroid Build Coastguard Worker // Generate errors, verify that calling glGetError afterwards produces desired result
827*35238bceSAndroid Build Coastguard Worker class GetErrorCase : public BaseCase
828*35238bceSAndroid Build Coastguard Worker {
829*35238bceSAndroid Build Coastguard Worker public:
830*35238bceSAndroid Build Coastguard Worker GetErrorCase(Context &ctx, const char *name, const char *desc, TestFunctionWrapper errorFunc);
~GetErrorCase(void)831*35238bceSAndroid Build Coastguard Worker virtual ~GetErrorCase(void)
832*35238bceSAndroid Build Coastguard Worker {
833*35238bceSAndroid Build Coastguard Worker }
834*35238bceSAndroid Build Coastguard Worker
835*35238bceSAndroid Build Coastguard Worker virtual IterateResult iterate(void);
836*35238bceSAndroid Build Coastguard Worker
837*35238bceSAndroid Build Coastguard Worker virtual void expectMessage(GLenum source, GLenum type);
838*35238bceSAndroid Build Coastguard Worker virtual void expectError(glw::GLenum error0, glw::GLenum error1);
839*35238bceSAndroid Build Coastguard Worker
840*35238bceSAndroid Build Coastguard Worker private:
841*35238bceSAndroid Build Coastguard Worker const TestFunctionWrapper m_errorFunc;
842*35238bceSAndroid Build Coastguard Worker };
843*35238bceSAndroid Build Coastguard Worker
GetErrorCase(Context & ctx,const char * name,const char * desc,TestFunctionWrapper errorFunc)844*35238bceSAndroid Build Coastguard Worker GetErrorCase::GetErrorCase(Context &ctx, const char *name, const char *desc, TestFunctionWrapper errorFunc)
845*35238bceSAndroid Build Coastguard Worker : BaseCase(ctx, name, desc)
846*35238bceSAndroid Build Coastguard Worker , m_errorFunc(errorFunc)
847*35238bceSAndroid Build Coastguard Worker {
848*35238bceSAndroid Build Coastguard Worker }
849*35238bceSAndroid Build Coastguard Worker
iterate(void)850*35238bceSAndroid Build Coastguard Worker GetErrorCase::IterateResult GetErrorCase::iterate(void)
851*35238bceSAndroid Build Coastguard Worker {
852*35238bceSAndroid Build Coastguard Worker tcu::TestLog &log = m_testCtx.getLog();
853*35238bceSAndroid Build Coastguard Worker DebugMessageTestContext context =
854*35238bceSAndroid Build Coastguard Worker DebugMessageTestContext(*this, m_context.getRenderContext(), m_context.getContextInfo(), log, m_results, true);
855*35238bceSAndroid Build Coastguard Worker
856*35238bceSAndroid Build Coastguard Worker m_errorFunc.call(context);
857*35238bceSAndroid Build Coastguard Worker
858*35238bceSAndroid Build Coastguard Worker m_results.setTestContextResult(m_testCtx);
859*35238bceSAndroid Build Coastguard Worker
860*35238bceSAndroid Build Coastguard Worker return STOP;
861*35238bceSAndroid Build Coastguard Worker }
862*35238bceSAndroid Build Coastguard Worker
expectMessage(GLenum source,GLenum type)863*35238bceSAndroid Build Coastguard Worker void GetErrorCase::expectMessage(GLenum source, GLenum type)
864*35238bceSAndroid Build Coastguard Worker {
865*35238bceSAndroid Build Coastguard Worker DE_UNREF(source);
866*35238bceSAndroid Build Coastguard Worker DE_UNREF(type);
867*35238bceSAndroid Build Coastguard Worker DE_FATAL("GetErrorCase cannot handle anything other than error codes");
868*35238bceSAndroid Build Coastguard Worker }
869*35238bceSAndroid Build Coastguard Worker
expectError(glw::GLenum error0,glw::GLenum error1)870*35238bceSAndroid Build Coastguard Worker void GetErrorCase::expectError(glw::GLenum error0, glw::GLenum error1)
871*35238bceSAndroid Build Coastguard Worker {
872*35238bceSAndroid Build Coastguard Worker const glw::Functions &gl = m_context.getRenderContext().getFunctions();
873*35238bceSAndroid Build Coastguard Worker TestLog &log = m_testCtx.getLog();
874*35238bceSAndroid Build Coastguard Worker
875*35238bceSAndroid Build Coastguard Worker const GLenum result = gl.getError();
876*35238bceSAndroid Build Coastguard Worker
877*35238bceSAndroid Build Coastguard Worker if (result != error0 && result != error1)
878*35238bceSAndroid Build Coastguard Worker {
879*35238bceSAndroid Build Coastguard Worker m_results.addResult(QP_TEST_RESULT_FAIL, "Incorrect error was reported");
880*35238bceSAndroid Build Coastguard Worker if (error0 == error1)
881*35238bceSAndroid Build Coastguard Worker log << TestLog::Message << glu::getErrorStr(error0) << " was expected but got " << glu::getErrorStr(result)
882*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
883*35238bceSAndroid Build Coastguard Worker else
884*35238bceSAndroid Build Coastguard Worker log << TestLog::Message << glu::getErrorStr(error0) << " or " << glu::getErrorStr(error1)
885*35238bceSAndroid Build Coastguard Worker << " was expected but got " << glu::getErrorStr(result) << TestLog::EndMessage;
886*35238bceSAndroid Build Coastguard Worker return;
887*35238bceSAndroid Build Coastguard Worker }
888*35238bceSAndroid Build Coastguard Worker }
889*35238bceSAndroid Build Coastguard Worker
890*35238bceSAndroid Build Coastguard Worker // Generate errors, log the types, disable some, regenerate errors, verify correct errors (not)reported
891*35238bceSAndroid Build Coastguard Worker class FilterCase : public BaseCase
892*35238bceSAndroid Build Coastguard Worker {
893*35238bceSAndroid Build Coastguard Worker public:
894*35238bceSAndroid Build Coastguard Worker FilterCase(Context &ctx, const char *name, const char *desc, const vector<TestFunctionWrapper> &errorFuncs);
~FilterCase(void)895*35238bceSAndroid Build Coastguard Worker virtual ~FilterCase(void)
896*35238bceSAndroid Build Coastguard Worker {
897*35238bceSAndroid Build Coastguard Worker }
898*35238bceSAndroid Build Coastguard Worker
899*35238bceSAndroid Build Coastguard Worker virtual IterateResult iterate(void);
900*35238bceSAndroid Build Coastguard Worker
901*35238bceSAndroid Build Coastguard Worker virtual void expectMessage(GLenum source, GLenum type);
902*35238bceSAndroid Build Coastguard Worker
903*35238bceSAndroid Build Coastguard Worker protected:
904*35238bceSAndroid Build Coastguard Worker struct MessageFilter
905*35238bceSAndroid Build Coastguard Worker {
MessageFilterdeqp::gles31::Functional::__anon5e098b950111::FilterCase::MessageFilter906*35238bceSAndroid Build Coastguard Worker MessageFilter() : source(GL_DONT_CARE), type(GL_DONT_CARE), severity(GL_DONT_CARE), enabled(true)
907*35238bceSAndroid Build Coastguard Worker {
908*35238bceSAndroid Build Coastguard Worker } // Default to enable all
MessageFilterdeqp::gles31::Functional::__anon5e098b950111::FilterCase::MessageFilter909*35238bceSAndroid Build Coastguard Worker MessageFilter(GLenum source_, GLenum type_, GLenum severity_, const vector<GLuint> &ids_, bool enabled_)
910*35238bceSAndroid Build Coastguard Worker : source(source_)
911*35238bceSAndroid Build Coastguard Worker , type(type_)
912*35238bceSAndroid Build Coastguard Worker , severity(severity_)
913*35238bceSAndroid Build Coastguard Worker , ids(ids_)
914*35238bceSAndroid Build Coastguard Worker , enabled(enabled_)
915*35238bceSAndroid Build Coastguard Worker {
916*35238bceSAndroid Build Coastguard Worker }
917*35238bceSAndroid Build Coastguard Worker
918*35238bceSAndroid Build Coastguard Worker GLenum source;
919*35238bceSAndroid Build Coastguard Worker GLenum type;
920*35238bceSAndroid Build Coastguard Worker GLenum severity;
921*35238bceSAndroid Build Coastguard Worker vector<GLuint> ids;
922*35238bceSAndroid Build Coastguard Worker bool enabled;
923*35238bceSAndroid Build Coastguard Worker };
924*35238bceSAndroid Build Coastguard Worker
925*35238bceSAndroid Build Coastguard Worker virtual void callback(GLenum source, GLenum type, GLuint id, GLenum severity, const string &message);
926*35238bceSAndroid Build Coastguard Worker
927*35238bceSAndroid Build Coastguard Worker vector<MessageData> genMessages(bool uselog, const string &desc);
928*35238bceSAndroid Build Coastguard Worker
929*35238bceSAndroid Build Coastguard Worker vector<MessageFilter> genFilters(const vector<MessageData> &messages, const vector<MessageFilter> &initial,
930*35238bceSAndroid Build Coastguard Worker uint32_t seed, int iterations) const;
931*35238bceSAndroid Build Coastguard Worker void applyFilters(const vector<MessageFilter> &filters) const;
932*35238bceSAndroid Build Coastguard Worker bool isEnabled(const vector<MessageFilter> &filters, const MessageData &message) const;
933*35238bceSAndroid Build Coastguard Worker
934*35238bceSAndroid Build Coastguard Worker void verify(const vector<MessageData> &refMessages, const vector<MessageData> &filteredMessages,
935*35238bceSAndroid Build Coastguard Worker const vector<MessageFilter> &filters);
936*35238bceSAndroid Build Coastguard Worker
937*35238bceSAndroid Build Coastguard Worker const vector<TestFunctionWrapper> m_errorFuncs;
938*35238bceSAndroid Build Coastguard Worker
939*35238bceSAndroid Build Coastguard Worker vector<MessageData> *m_currentErrors;
940*35238bceSAndroid Build Coastguard Worker };
941*35238bceSAndroid Build Coastguard Worker
FilterCase(Context & ctx,const char * name,const char * desc,const vector<TestFunctionWrapper> & errorFuncs)942*35238bceSAndroid Build Coastguard Worker FilterCase::FilterCase(Context &ctx, const char *name, const char *desc, const vector<TestFunctionWrapper> &errorFuncs)
943*35238bceSAndroid Build Coastguard Worker : BaseCase(ctx, name, desc)
944*35238bceSAndroid Build Coastguard Worker , m_errorFuncs(errorFuncs)
945*35238bceSAndroid Build Coastguard Worker , m_currentErrors(DE_NULL)
946*35238bceSAndroid Build Coastguard Worker {
947*35238bceSAndroid Build Coastguard Worker }
948*35238bceSAndroid Build Coastguard Worker
iterate(void)949*35238bceSAndroid Build Coastguard Worker FilterCase::IterateResult FilterCase::iterate(void)
950*35238bceSAndroid Build Coastguard Worker {
951*35238bceSAndroid Build Coastguard Worker TCU_CHECK_AND_THROW(NotSupportedError, isKHRDebugSupported(m_context), "GL_KHR_debug is not supported");
952*35238bceSAndroid Build Coastguard Worker
953*35238bceSAndroid Build Coastguard Worker const glw::Functions &gl = m_context.getRenderContext().getFunctions();
954*35238bceSAndroid Build Coastguard Worker
955*35238bceSAndroid Build Coastguard Worker gl.enable(GL_DEBUG_OUTPUT);
956*35238bceSAndroid Build Coastguard Worker gl.enable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
957*35238bceSAndroid Build Coastguard Worker gl.debugMessageCallback(callbackHandle, this);
958*35238bceSAndroid Build Coastguard Worker
959*35238bceSAndroid Build Coastguard Worker try
960*35238bceSAndroid Build Coastguard Worker {
961*35238bceSAndroid Build Coastguard Worker gl.debugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, DE_NULL, true);
962*35238bceSAndroid Build Coastguard Worker
963*35238bceSAndroid Build Coastguard Worker {
964*35238bceSAndroid Build Coastguard Worker const vector<MessageData> refMessages = genMessages(true, "Reference run");
965*35238bceSAndroid Build Coastguard Worker const MessageFilter baseFilter(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, vector<GLuint>(), true);
966*35238bceSAndroid Build Coastguard Worker const uint32_t baseSeed = deStringHash(getName()) ^ m_testCtx.getCommandLine().getBaseSeed();
967*35238bceSAndroid Build Coastguard Worker const vector<MessageFilter> filters =
968*35238bceSAndroid Build Coastguard Worker genFilters(refMessages, vector<MessageFilter>(1, baseFilter), baseSeed, 4);
969*35238bceSAndroid Build Coastguard Worker vector<MessageData> filteredMessages;
970*35238bceSAndroid Build Coastguard Worker
971*35238bceSAndroid Build Coastguard Worker applyFilters(filters);
972*35238bceSAndroid Build Coastguard Worker
973*35238bceSAndroid Build Coastguard Worker // Generate errors
974*35238bceSAndroid Build Coastguard Worker filteredMessages = genMessages(false, "Filtered run");
975*35238bceSAndroid Build Coastguard Worker
976*35238bceSAndroid Build Coastguard Worker // Verify
977*35238bceSAndroid Build Coastguard Worker verify(refMessages, filteredMessages, filters);
978*35238bceSAndroid Build Coastguard Worker
979*35238bceSAndroid Build Coastguard Worker if (!isDebugContext() && refMessages.empty())
980*35238bceSAndroid Build Coastguard Worker m_results.addResult(QP_TEST_RESULT_QUALITY_WARNING,
981*35238bceSAndroid Build Coastguard Worker "Verification accuracy is lacking without a debug context");
982*35238bceSAndroid Build Coastguard Worker }
983*35238bceSAndroid Build Coastguard Worker }
984*35238bceSAndroid Build Coastguard Worker catch (...)
985*35238bceSAndroid Build Coastguard Worker {
986*35238bceSAndroid Build Coastguard Worker gl.disable(GL_DEBUG_OUTPUT);
987*35238bceSAndroid Build Coastguard Worker gl.debugMessageCallback(DE_NULL, DE_NULL);
988*35238bceSAndroid Build Coastguard Worker throw;
989*35238bceSAndroid Build Coastguard Worker }
990*35238bceSAndroid Build Coastguard Worker
991*35238bceSAndroid Build Coastguard Worker gl.disable(GL_DEBUG_OUTPUT);
992*35238bceSAndroid Build Coastguard Worker gl.debugMessageCallback(DE_NULL, DE_NULL);
993*35238bceSAndroid Build Coastguard Worker m_results.setTestContextResult(m_testCtx);
994*35238bceSAndroid Build Coastguard Worker
995*35238bceSAndroid Build Coastguard Worker return STOP;
996*35238bceSAndroid Build Coastguard Worker }
997*35238bceSAndroid Build Coastguard Worker
expectMessage(GLenum source,GLenum type)998*35238bceSAndroid Build Coastguard Worker void FilterCase::expectMessage(GLenum source, GLenum type)
999*35238bceSAndroid Build Coastguard Worker {
1000*35238bceSAndroid Build Coastguard Worker DE_UNREF(source);
1001*35238bceSAndroid Build Coastguard Worker DE_UNREF(type);
1002*35238bceSAndroid Build Coastguard Worker }
1003*35238bceSAndroid Build Coastguard Worker
callback(GLenum source,GLenum type,GLuint id,GLenum severity,const string & message)1004*35238bceSAndroid Build Coastguard Worker void FilterCase::callback(GLenum source, GLenum type, GLuint id, GLenum severity, const string &message)
1005*35238bceSAndroid Build Coastguard Worker {
1006*35238bceSAndroid Build Coastguard Worker if (m_currentErrors)
1007*35238bceSAndroid Build Coastguard Worker m_currentErrors->push_back(MessageData(MessageID(source, type, id), severity, message));
1008*35238bceSAndroid Build Coastguard Worker }
1009*35238bceSAndroid Build Coastguard Worker
genMessages(bool uselog,const string & desc)1010*35238bceSAndroid Build Coastguard Worker vector<MessageData> FilterCase::genMessages(bool uselog, const string &desc)
1011*35238bceSAndroid Build Coastguard Worker {
1012*35238bceSAndroid Build Coastguard Worker tcu::TestLog &log = m_testCtx.getLog();
1013*35238bceSAndroid Build Coastguard Worker DebugMessageTestContext context = DebugMessageTestContext(*this, m_context.getRenderContext(),
1014*35238bceSAndroid Build Coastguard Worker m_context.getContextInfo(), log, m_results, uselog);
1015*35238bceSAndroid Build Coastguard Worker tcu::ScopedLogSection section(log, "message gen", desc);
1016*35238bceSAndroid Build Coastguard Worker vector<MessageData> messages;
1017*35238bceSAndroid Build Coastguard Worker
1018*35238bceSAndroid Build Coastguard Worker m_currentErrors = &messages;
1019*35238bceSAndroid Build Coastguard Worker
1020*35238bceSAndroid Build Coastguard Worker for (int ndx = 0; ndx < int(m_errorFuncs.size()); ndx++)
1021*35238bceSAndroid Build Coastguard Worker m_errorFuncs[ndx].call(context);
1022*35238bceSAndroid Build Coastguard Worker
1023*35238bceSAndroid Build Coastguard Worker m_currentErrors = DE_NULL;
1024*35238bceSAndroid Build Coastguard Worker
1025*35238bceSAndroid Build Coastguard Worker return messages;
1026*35238bceSAndroid Build Coastguard Worker }
1027*35238bceSAndroid Build Coastguard Worker
genFilters(const vector<MessageData> & messages,const vector<MessageFilter> & initial,uint32_t seed,int iterations) const1028*35238bceSAndroid Build Coastguard Worker vector<FilterCase::MessageFilter> FilterCase::genFilters(const vector<MessageData> &messages,
1029*35238bceSAndroid Build Coastguard Worker const vector<MessageFilter> &initial, uint32_t seed,
1030*35238bceSAndroid Build Coastguard Worker int iterations) const
1031*35238bceSAndroid Build Coastguard Worker {
1032*35238bceSAndroid Build Coastguard Worker de::Random rng(seed ^ deInt32Hash(deStringHash(getName())));
1033*35238bceSAndroid Build Coastguard Worker
1034*35238bceSAndroid Build Coastguard Worker set<MessageID> tempMessageIds;
1035*35238bceSAndroid Build Coastguard Worker set<GLenum> tempSources;
1036*35238bceSAndroid Build Coastguard Worker set<GLenum> tempTypes;
1037*35238bceSAndroid Build Coastguard Worker set<GLenum> tempSeverities;
1038*35238bceSAndroid Build Coastguard Worker
1039*35238bceSAndroid Build Coastguard Worker if (messages.empty())
1040*35238bceSAndroid Build Coastguard Worker return initial;
1041*35238bceSAndroid Build Coastguard Worker
1042*35238bceSAndroid Build Coastguard Worker for (int ndx = 0; ndx < int(messages.size()); ndx++)
1043*35238bceSAndroid Build Coastguard Worker {
1044*35238bceSAndroid Build Coastguard Worker const MessageData &msg = messages[ndx];
1045*35238bceSAndroid Build Coastguard Worker
1046*35238bceSAndroid Build Coastguard Worker tempMessageIds.insert(msg.id);
1047*35238bceSAndroid Build Coastguard Worker tempSources.insert(msg.id.source);
1048*35238bceSAndroid Build Coastguard Worker tempTypes.insert(msg.id.type);
1049*35238bceSAndroid Build Coastguard Worker tempSeverities.insert(msg.severity);
1050*35238bceSAndroid Build Coastguard Worker }
1051*35238bceSAndroid Build Coastguard Worker
1052*35238bceSAndroid Build Coastguard Worker {
1053*35238bceSAndroid Build Coastguard Worker // Fetchable by index
1054*35238bceSAndroid Build Coastguard Worker const vector<MessageID> messageIds(tempMessageIds.begin(), tempMessageIds.end());
1055*35238bceSAndroid Build Coastguard Worker const vector<GLenum> sources(tempSources.begin(), tempSources.end());
1056*35238bceSAndroid Build Coastguard Worker const vector<GLenum> types(tempTypes.begin(), tempTypes.end());
1057*35238bceSAndroid Build Coastguard Worker const vector<GLenum> severities(tempSeverities.begin(), tempSeverities.end());
1058*35238bceSAndroid Build Coastguard Worker
1059*35238bceSAndroid Build Coastguard Worker vector<MessageFilter> filters = initial;
1060*35238bceSAndroid Build Coastguard Worker
1061*35238bceSAndroid Build Coastguard Worker for (int iteration = 0; iteration < iterations; iteration++)
1062*35238bceSAndroid Build Coastguard Worker {
1063*35238bceSAndroid Build Coastguard Worker switch (rng.getInt(0, 8)) // Distribute so that per-message randomization (the default branch) is prevalent
1064*35238bceSAndroid Build Coastguard Worker {
1065*35238bceSAndroid Build Coastguard Worker case 0:
1066*35238bceSAndroid Build Coastguard Worker {
1067*35238bceSAndroid Build Coastguard Worker const GLenum source = sources[rng.getInt(0, int(sources.size() - 1))];
1068*35238bceSAndroid Build Coastguard Worker const bool enabled = rng.getBool();
1069*35238bceSAndroid Build Coastguard Worker
1070*35238bceSAndroid Build Coastguard Worker filters.push_back(MessageFilter(source, GL_DONT_CARE, GL_DONT_CARE, vector<GLuint>(), enabled));
1071*35238bceSAndroid Build Coastguard Worker break;
1072*35238bceSAndroid Build Coastguard Worker }
1073*35238bceSAndroid Build Coastguard Worker
1074*35238bceSAndroid Build Coastguard Worker case 1:
1075*35238bceSAndroid Build Coastguard Worker {
1076*35238bceSAndroid Build Coastguard Worker const GLenum type = types[rng.getUint32() % types.size()];
1077*35238bceSAndroid Build Coastguard Worker const bool enabled = rng.getBool();
1078*35238bceSAndroid Build Coastguard Worker
1079*35238bceSAndroid Build Coastguard Worker filters.push_back(MessageFilter(GL_DONT_CARE, type, GL_DONT_CARE, vector<GLuint>(), enabled));
1080*35238bceSAndroid Build Coastguard Worker break;
1081*35238bceSAndroid Build Coastguard Worker }
1082*35238bceSAndroid Build Coastguard Worker
1083*35238bceSAndroid Build Coastguard Worker case 2:
1084*35238bceSAndroid Build Coastguard Worker {
1085*35238bceSAndroid Build Coastguard Worker const GLenum severity = severities[rng.getUint32() % severities.size()];
1086*35238bceSAndroid Build Coastguard Worker const bool enabled = rng.getBool();
1087*35238bceSAndroid Build Coastguard Worker
1088*35238bceSAndroid Build Coastguard Worker filters.push_back(MessageFilter(GL_DONT_CARE, GL_DONT_CARE, severity, vector<GLuint>(), enabled));
1089*35238bceSAndroid Build Coastguard Worker break;
1090*35238bceSAndroid Build Coastguard Worker }
1091*35238bceSAndroid Build Coastguard Worker
1092*35238bceSAndroid Build Coastguard Worker default:
1093*35238bceSAndroid Build Coastguard Worker {
1094*35238bceSAndroid Build Coastguard Worker const int start = rng.getInt(0, int(messageIds.size()));
1095*35238bceSAndroid Build Coastguard Worker
1096*35238bceSAndroid Build Coastguard Worker for (int itr = 0; itr < 4; itr++)
1097*35238bceSAndroid Build Coastguard Worker {
1098*35238bceSAndroid Build Coastguard Worker const MessageID &id = messageIds[(start + itr) % messageIds.size()];
1099*35238bceSAndroid Build Coastguard Worker const bool enabled = rng.getBool();
1100*35238bceSAndroid Build Coastguard Worker
1101*35238bceSAndroid Build Coastguard Worker filters.push_back(
1102*35238bceSAndroid Build Coastguard Worker MessageFilter(id.source, id.type, GL_DONT_CARE, vector<GLuint>(1, id.id), enabled));
1103*35238bceSAndroid Build Coastguard Worker }
1104*35238bceSAndroid Build Coastguard Worker }
1105*35238bceSAndroid Build Coastguard Worker }
1106*35238bceSAndroid Build Coastguard Worker }
1107*35238bceSAndroid Build Coastguard Worker
1108*35238bceSAndroid Build Coastguard Worker return filters;
1109*35238bceSAndroid Build Coastguard Worker }
1110*35238bceSAndroid Build Coastguard Worker }
1111*35238bceSAndroid Build Coastguard Worker
applyFilters(const vector<MessageFilter> & filters) const1112*35238bceSAndroid Build Coastguard Worker void FilterCase::applyFilters(const vector<MessageFilter> &filters) const
1113*35238bceSAndroid Build Coastguard Worker {
1114*35238bceSAndroid Build Coastguard Worker TestLog &log = m_testCtx.getLog();
1115*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection section(log, "", "Setting message filters");
1116*35238bceSAndroid Build Coastguard Worker const glw::Functions &gl = m_context.getRenderContext().getFunctions();
1117*35238bceSAndroid Build Coastguard Worker
1118*35238bceSAndroid Build Coastguard Worker for (size_t filterNdx = 0; filterNdx < filters.size(); filterNdx++)
1119*35238bceSAndroid Build Coastguard Worker {
1120*35238bceSAndroid Build Coastguard Worker const MessageFilter &filter = filters[filterNdx];
1121*35238bceSAndroid Build Coastguard Worker
1122*35238bceSAndroid Build Coastguard Worker if (filter.ids.empty())
1123*35238bceSAndroid Build Coastguard Worker log << TestLog::Message << "Setting messages with"
1124*35238bceSAndroid Build Coastguard Worker << " source " << glu::getDebugMessageSourceStr(filter.source) << ", type "
1125*35238bceSAndroid Build Coastguard Worker << glu::getDebugMessageTypeStr(filter.type) << " and severity "
1126*35238bceSAndroid Build Coastguard Worker << glu::getDebugMessageSeverityStr(filter.severity) << (filter.enabled ? " to enabled" : " to disabled")
1127*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
1128*35238bceSAndroid Build Coastguard Worker else
1129*35238bceSAndroid Build Coastguard Worker {
1130*35238bceSAndroid Build Coastguard Worker for (size_t ndx = 0; ndx < filter.ids.size(); ndx++)
1131*35238bceSAndroid Build Coastguard Worker log << TestLog::Message << "Setting message (" << MessageID(filter.source, filter.type, filter.ids[ndx])
1132*35238bceSAndroid Build Coastguard Worker << ") to " << (filter.enabled ? "enabled" : "disabled") << TestLog::EndMessage;
1133*35238bceSAndroid Build Coastguard Worker }
1134*35238bceSAndroid Build Coastguard Worker
1135*35238bceSAndroid Build Coastguard Worker gl.debugMessageControl(filter.source, filter.type, filter.severity, GLsizei(filter.ids.size()),
1136*35238bceSAndroid Build Coastguard Worker filter.ids.empty() ? DE_NULL : &filter.ids[0], filter.enabled);
1137*35238bceSAndroid Build Coastguard Worker }
1138*35238bceSAndroid Build Coastguard Worker }
1139*35238bceSAndroid Build Coastguard Worker
isEnabled(const vector<MessageFilter> & filters,const MessageData & message) const1140*35238bceSAndroid Build Coastguard Worker bool FilterCase::isEnabled(const vector<MessageFilter> &filters, const MessageData &message) const
1141*35238bceSAndroid Build Coastguard Worker {
1142*35238bceSAndroid Build Coastguard Worker bool retval = true;
1143*35238bceSAndroid Build Coastguard Worker
1144*35238bceSAndroid Build Coastguard Worker for (size_t filterNdx = 0; filterNdx < filters.size(); filterNdx++)
1145*35238bceSAndroid Build Coastguard Worker {
1146*35238bceSAndroid Build Coastguard Worker const MessageFilter &filter = filters[filterNdx];
1147*35238bceSAndroid Build Coastguard Worker
1148*35238bceSAndroid Build Coastguard Worker if (filter.ids.empty())
1149*35238bceSAndroid Build Coastguard Worker {
1150*35238bceSAndroid Build Coastguard Worker if (filter.source != GL_DONT_CARE && filter.source != message.id.source)
1151*35238bceSAndroid Build Coastguard Worker continue;
1152*35238bceSAndroid Build Coastguard Worker
1153*35238bceSAndroid Build Coastguard Worker if (filter.type != GL_DONT_CARE && filter.type != message.id.type)
1154*35238bceSAndroid Build Coastguard Worker continue;
1155*35238bceSAndroid Build Coastguard Worker
1156*35238bceSAndroid Build Coastguard Worker if (filter.severity != GL_DONT_CARE && filter.severity != message.severity)
1157*35238bceSAndroid Build Coastguard Worker continue;
1158*35238bceSAndroid Build Coastguard Worker }
1159*35238bceSAndroid Build Coastguard Worker else
1160*35238bceSAndroid Build Coastguard Worker {
1161*35238bceSAndroid Build Coastguard Worker DE_ASSERT(filter.source != GL_DONT_CARE);
1162*35238bceSAndroid Build Coastguard Worker DE_ASSERT(filter.type != GL_DONT_CARE);
1163*35238bceSAndroid Build Coastguard Worker DE_ASSERT(filter.severity == GL_DONT_CARE);
1164*35238bceSAndroid Build Coastguard Worker
1165*35238bceSAndroid Build Coastguard Worker if (filter.source != message.id.source || filter.type != message.id.type)
1166*35238bceSAndroid Build Coastguard Worker continue;
1167*35238bceSAndroid Build Coastguard Worker
1168*35238bceSAndroid Build Coastguard Worker if (!de::contains(filter.ids.begin(), filter.ids.end(), message.id.id))
1169*35238bceSAndroid Build Coastguard Worker continue;
1170*35238bceSAndroid Build Coastguard Worker }
1171*35238bceSAndroid Build Coastguard Worker
1172*35238bceSAndroid Build Coastguard Worker retval = filter.enabled;
1173*35238bceSAndroid Build Coastguard Worker }
1174*35238bceSAndroid Build Coastguard Worker
1175*35238bceSAndroid Build Coastguard Worker return retval;
1176*35238bceSAndroid Build Coastguard Worker }
1177*35238bceSAndroid Build Coastguard Worker
1178*35238bceSAndroid Build Coastguard Worker struct MessageMeta
1179*35238bceSAndroid Build Coastguard Worker {
1180*35238bceSAndroid Build Coastguard Worker int refCount;
1181*35238bceSAndroid Build Coastguard Worker int resCount;
1182*35238bceSAndroid Build Coastguard Worker GLenum severity;
1183*35238bceSAndroid Build Coastguard Worker
MessageMetadeqp::gles31::Functional::__anon5e098b950111::MessageMeta1184*35238bceSAndroid Build Coastguard Worker MessageMeta(void) : refCount(0), resCount(0), severity(GL_NONE)
1185*35238bceSAndroid Build Coastguard Worker {
1186*35238bceSAndroid Build Coastguard Worker }
1187*35238bceSAndroid Build Coastguard Worker };
1188*35238bceSAndroid Build Coastguard Worker
verify(const vector<MessageData> & refMessages,const vector<MessageData> & resMessages,const vector<MessageFilter> & filters)1189*35238bceSAndroid Build Coastguard Worker void FilterCase::verify(const vector<MessageData> &refMessages, const vector<MessageData> &resMessages,
1190*35238bceSAndroid Build Coastguard Worker const vector<MessageFilter> &filters)
1191*35238bceSAndroid Build Coastguard Worker {
1192*35238bceSAndroid Build Coastguard Worker TestLog &log = m_testCtx.getLog();
1193*35238bceSAndroid Build Coastguard Worker map<MessageID, MessageMeta> counts;
1194*35238bceSAndroid Build Coastguard Worker
1195*35238bceSAndroid Build Coastguard Worker log << TestLog::Section("verification", "Verifying");
1196*35238bceSAndroid Build Coastguard Worker
1197*35238bceSAndroid Build Coastguard Worker // Gather message counts & severities, report severity mismatches if found
1198*35238bceSAndroid Build Coastguard Worker for (size_t refNdx = 0; refNdx < refMessages.size(); refNdx++)
1199*35238bceSAndroid Build Coastguard Worker {
1200*35238bceSAndroid Build Coastguard Worker const MessageData &msg = refMessages[refNdx];
1201*35238bceSAndroid Build Coastguard Worker MessageMeta &meta = counts[msg.id];
1202*35238bceSAndroid Build Coastguard Worker
1203*35238bceSAndroid Build Coastguard Worker if (meta.severity != GL_NONE && meta.severity != msg.severity)
1204*35238bceSAndroid Build Coastguard Worker {
1205*35238bceSAndroid Build Coastguard Worker log << TestLog::Message << "A message has variable severity between instances: (" << msg.id
1206*35238bceSAndroid Build Coastguard Worker << ") with severity " << glu::getDebugMessageSeverityStr(meta.severity) << " and "
1207*35238bceSAndroid Build Coastguard Worker << glu::getDebugMessageSeverityStr(msg.severity) << TestLog::EndMessage;
1208*35238bceSAndroid Build Coastguard Worker m_results.addResult(QP_TEST_RESULT_FAIL, "Message severity changed between instances of the same message");
1209*35238bceSAndroid Build Coastguard Worker }
1210*35238bceSAndroid Build Coastguard Worker
1211*35238bceSAndroid Build Coastguard Worker meta.refCount++;
1212*35238bceSAndroid Build Coastguard Worker meta.severity = msg.severity;
1213*35238bceSAndroid Build Coastguard Worker }
1214*35238bceSAndroid Build Coastguard Worker
1215*35238bceSAndroid Build Coastguard Worker for (size_t resNdx = 0; resNdx < resMessages.size(); resNdx++)
1216*35238bceSAndroid Build Coastguard Worker {
1217*35238bceSAndroid Build Coastguard Worker const MessageData &msg = resMessages[resNdx];
1218*35238bceSAndroid Build Coastguard Worker MessageMeta &meta = counts[msg.id];
1219*35238bceSAndroid Build Coastguard Worker
1220*35238bceSAndroid Build Coastguard Worker if (meta.severity != GL_NONE && meta.severity != msg.severity)
1221*35238bceSAndroid Build Coastguard Worker {
1222*35238bceSAndroid Build Coastguard Worker log << TestLog::Message << "A message has variable severity between instances: (" << msg.id
1223*35238bceSAndroid Build Coastguard Worker << ") with severity " << glu::getDebugMessageSeverityStr(meta.severity) << " and "
1224*35238bceSAndroid Build Coastguard Worker << glu::getDebugMessageSeverityStr(msg.severity) << TestLog::EndMessage;
1225*35238bceSAndroid Build Coastguard Worker m_results.addResult(QP_TEST_RESULT_FAIL, "Message severity changed between instances of the same message");
1226*35238bceSAndroid Build Coastguard Worker }
1227*35238bceSAndroid Build Coastguard Worker
1228*35238bceSAndroid Build Coastguard Worker meta.resCount++;
1229*35238bceSAndroid Build Coastguard Worker meta.severity = msg.severity;
1230*35238bceSAndroid Build Coastguard Worker }
1231*35238bceSAndroid Build Coastguard Worker
1232*35238bceSAndroid Build Coastguard Worker for (map<MessageID, MessageMeta>::const_iterator itr = counts.begin(); itr != counts.end(); itr++)
1233*35238bceSAndroid Build Coastguard Worker {
1234*35238bceSAndroid Build Coastguard Worker const MessageID &id = itr->first;
1235*35238bceSAndroid Build Coastguard Worker const GLenum severity = itr->second.severity;
1236*35238bceSAndroid Build Coastguard Worker
1237*35238bceSAndroid Build Coastguard Worker const int refCount = itr->second.refCount;
1238*35238bceSAndroid Build Coastguard Worker const int resCount = itr->second.resCount;
1239*35238bceSAndroid Build Coastguard Worker const bool enabled = isEnabled(filters, MessageData(id, severity, ""));
1240*35238bceSAndroid Build Coastguard Worker
1241*35238bceSAndroid Build Coastguard Worker VerificationResult result = verifyMessageCount(id, severity, refCount, resCount, enabled);
1242*35238bceSAndroid Build Coastguard Worker
1243*35238bceSAndroid Build Coastguard Worker log << TestLog::Message << result.logMessage << TestLog::EndMessage;
1244*35238bceSAndroid Build Coastguard Worker
1245*35238bceSAndroid Build Coastguard Worker if (result.result != QP_TEST_RESULT_PASS)
1246*35238bceSAndroid Build Coastguard Worker m_results.addResult(result.result, result.resultMessage);
1247*35238bceSAndroid Build Coastguard Worker }
1248*35238bceSAndroid Build Coastguard Worker
1249*35238bceSAndroid Build Coastguard Worker log << TestLog::EndSection;
1250*35238bceSAndroid Build Coastguard Worker }
1251*35238bceSAndroid Build Coastguard Worker
1252*35238bceSAndroid Build Coastguard Worker // Filter case that uses debug groups
1253*35238bceSAndroid Build Coastguard Worker class GroupFilterCase : public FilterCase
1254*35238bceSAndroid Build Coastguard Worker {
1255*35238bceSAndroid Build Coastguard Worker public:
1256*35238bceSAndroid Build Coastguard Worker GroupFilterCase(Context &ctx, const char *name, const char *desc, const vector<TestFunctionWrapper> &errorFuncs);
~GroupFilterCase(void)1257*35238bceSAndroid Build Coastguard Worker virtual ~GroupFilterCase(void)
1258*35238bceSAndroid Build Coastguard Worker {
1259*35238bceSAndroid Build Coastguard Worker }
1260*35238bceSAndroid Build Coastguard Worker
1261*35238bceSAndroid Build Coastguard Worker virtual IterateResult iterate(void);
1262*35238bceSAndroid Build Coastguard Worker };
1263*35238bceSAndroid Build Coastguard Worker
GroupFilterCase(Context & ctx,const char * name,const char * desc,const vector<TestFunctionWrapper> & errorFuncs)1264*35238bceSAndroid Build Coastguard Worker GroupFilterCase::GroupFilterCase(Context &ctx, const char *name, const char *desc,
1265*35238bceSAndroid Build Coastguard Worker const vector<TestFunctionWrapper> &errorFuncs)
1266*35238bceSAndroid Build Coastguard Worker : FilterCase(ctx, name, desc, errorFuncs)
1267*35238bceSAndroid Build Coastguard Worker {
1268*35238bceSAndroid Build Coastguard Worker }
1269*35238bceSAndroid Build Coastguard Worker
1270*35238bceSAndroid Build Coastguard Worker template <typename T>
join(const vector<T> & a,const vector<T> & b)1271*35238bceSAndroid Build Coastguard Worker vector<T> join(const vector<T> &a, const vector<T> &b)
1272*35238bceSAndroid Build Coastguard Worker {
1273*35238bceSAndroid Build Coastguard Worker vector<T> retval;
1274*35238bceSAndroid Build Coastguard Worker
1275*35238bceSAndroid Build Coastguard Worker retval.reserve(a.size() + b.size());
1276*35238bceSAndroid Build Coastguard Worker retval.insert(retval.end(), a.begin(), a.end());
1277*35238bceSAndroid Build Coastguard Worker retval.insert(retval.end(), b.begin(), b.end());
1278*35238bceSAndroid Build Coastguard Worker return retval;
1279*35238bceSAndroid Build Coastguard Worker }
1280*35238bceSAndroid Build Coastguard Worker
iterate(void)1281*35238bceSAndroid Build Coastguard Worker GroupFilterCase::IterateResult GroupFilterCase::iterate(void)
1282*35238bceSAndroid Build Coastguard Worker {
1283*35238bceSAndroid Build Coastguard Worker TCU_CHECK_AND_THROW(NotSupportedError, isKHRDebugSupported(m_context), "GL_KHR_debug is not supported");
1284*35238bceSAndroid Build Coastguard Worker
1285*35238bceSAndroid Build Coastguard Worker const glw::Functions &gl = m_context.getRenderContext().getFunctions();
1286*35238bceSAndroid Build Coastguard Worker tcu::TestLog &log = m_testCtx.getLog();
1287*35238bceSAndroid Build Coastguard Worker
1288*35238bceSAndroid Build Coastguard Worker gl.enable(GL_DEBUG_OUTPUT);
1289*35238bceSAndroid Build Coastguard Worker gl.enable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
1290*35238bceSAndroid Build Coastguard Worker gl.debugMessageCallback(callbackHandle, this);
1291*35238bceSAndroid Build Coastguard Worker
1292*35238bceSAndroid Build Coastguard Worker try
1293*35238bceSAndroid Build Coastguard Worker {
1294*35238bceSAndroid Build Coastguard Worker gl.debugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, DE_NULL, true);
1295*35238bceSAndroid Build Coastguard Worker
1296*35238bceSAndroid Build Coastguard Worker {
1297*35238bceSAndroid Build Coastguard Worker
1298*35238bceSAndroid Build Coastguard Worker // Generate reference (all errors)
1299*35238bceSAndroid Build Coastguard Worker const vector<MessageData> refMessages = genMessages(true, "Reference run");
1300*35238bceSAndroid Build Coastguard Worker const uint32_t baseSeed = deStringHash(getName()) ^ m_testCtx.getCommandLine().getBaseSeed();
1301*35238bceSAndroid Build Coastguard Worker const MessageFilter baseFilter(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, vector<GLuint>(), true);
1302*35238bceSAndroid Build Coastguard Worker const vector<MessageFilter> filter0 =
1303*35238bceSAndroid Build Coastguard Worker genFilters(refMessages, vector<MessageFilter>(1, baseFilter), baseSeed, 4);
1304*35238bceSAndroid Build Coastguard Worker vector<MessageData> resMessages0;
1305*35238bceSAndroid Build Coastguard Worker
1306*35238bceSAndroid Build Coastguard Worker applyFilters(filter0);
1307*35238bceSAndroid Build Coastguard Worker
1308*35238bceSAndroid Build Coastguard Worker resMessages0 = genMessages(false, "Filtered run, default debug group");
1309*35238bceSAndroid Build Coastguard Worker
1310*35238bceSAndroid Build Coastguard Worker // Initial verification
1311*35238bceSAndroid Build Coastguard Worker verify(refMessages, resMessages0, filter0);
1312*35238bceSAndroid Build Coastguard Worker
1313*35238bceSAndroid Build Coastguard Worker {
1314*35238bceSAndroid Build Coastguard Worker // Generate reference (filters inherited from parent)
1315*35238bceSAndroid Build Coastguard Worker const vector<MessageFilter> filter1base =
1316*35238bceSAndroid Build Coastguard Worker genFilters(refMessages, vector<MessageFilter>(), baseSeed ^ 0xDEADBEEF, 4);
1317*35238bceSAndroid Build Coastguard Worker const vector<MessageFilter> filter1full = join(filter0, filter1base);
1318*35238bceSAndroid Build Coastguard Worker tcu::ScopedLogSection section1(log, "", "Pushing Debug Group");
1319*35238bceSAndroid Build Coastguard Worker vector<MessageData> resMessages1;
1320*35238bceSAndroid Build Coastguard Worker
1321*35238bceSAndroid Build Coastguard Worker gl.pushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 1, -1, "Test Group");
1322*35238bceSAndroid Build Coastguard Worker applyFilters(filter1base);
1323*35238bceSAndroid Build Coastguard Worker
1324*35238bceSAndroid Build Coastguard Worker // First nested verification
1325*35238bceSAndroid Build Coastguard Worker resMessages1 = genMessages(false, "Filtered run, pushed one debug group");
1326*35238bceSAndroid Build Coastguard Worker verify(refMessages, resMessages1, filter1full);
1327*35238bceSAndroid Build Coastguard Worker
1328*35238bceSAndroid Build Coastguard Worker {
1329*35238bceSAndroid Build Coastguard Worker // Generate reference (filters iherited again)
1330*35238bceSAndroid Build Coastguard Worker const vector<MessageFilter> filter2base =
1331*35238bceSAndroid Build Coastguard Worker genFilters(refMessages, vector<MessageFilter>(), baseSeed ^ 0x43211234, 4);
1332*35238bceSAndroid Build Coastguard Worker const vector<MessageFilter> filter2full = join(filter1full, filter2base);
1333*35238bceSAndroid Build Coastguard Worker tcu::ScopedLogSection section2(log, "", "Pushing Debug Group");
1334*35238bceSAndroid Build Coastguard Worker vector<MessageData> resMessages2;
1335*35238bceSAndroid Build Coastguard Worker
1336*35238bceSAndroid Build Coastguard Worker gl.pushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 1, -1, "Nested Test Group");
1337*35238bceSAndroid Build Coastguard Worker applyFilters(filter2base);
1338*35238bceSAndroid Build Coastguard Worker
1339*35238bceSAndroid Build Coastguard Worker // Second nested verification
1340*35238bceSAndroid Build Coastguard Worker resMessages2 = genMessages(false, "Filtered run, pushed two debug groups");
1341*35238bceSAndroid Build Coastguard Worker verify(refMessages, resMessages2, filter2full);
1342*35238bceSAndroid Build Coastguard Worker
1343*35238bceSAndroid Build Coastguard Worker gl.popDebugGroup();
1344*35238bceSAndroid Build Coastguard Worker }
1345*35238bceSAndroid Build Coastguard Worker
1346*35238bceSAndroid Build Coastguard Worker // First restore verification
1347*35238bceSAndroid Build Coastguard Worker resMessages1 = genMessages(false, "Filtered run, popped second debug group");
1348*35238bceSAndroid Build Coastguard Worker verify(refMessages, resMessages1, filter1full);
1349*35238bceSAndroid Build Coastguard Worker
1350*35238bceSAndroid Build Coastguard Worker gl.popDebugGroup();
1351*35238bceSAndroid Build Coastguard Worker }
1352*35238bceSAndroid Build Coastguard Worker
1353*35238bceSAndroid Build Coastguard Worker // restore verification
1354*35238bceSAndroid Build Coastguard Worker resMessages0 = genMessages(false, "Filtered run, popped first debug group");
1355*35238bceSAndroid Build Coastguard Worker verify(refMessages, resMessages0, filter0);
1356*35238bceSAndroid Build Coastguard Worker
1357*35238bceSAndroid Build Coastguard Worker if (!isDebugContext() && refMessages.empty())
1358*35238bceSAndroid Build Coastguard Worker m_results.addResult(QP_TEST_RESULT_QUALITY_WARNING,
1359*35238bceSAndroid Build Coastguard Worker "Verification accuracy is lacking without a debug context");
1360*35238bceSAndroid Build Coastguard Worker }
1361*35238bceSAndroid Build Coastguard Worker }
1362*35238bceSAndroid Build Coastguard Worker catch (...)
1363*35238bceSAndroid Build Coastguard Worker {
1364*35238bceSAndroid Build Coastguard Worker gl.disable(GL_DEBUG_OUTPUT);
1365*35238bceSAndroid Build Coastguard Worker gl.debugMessageCallback(DE_NULL, DE_NULL);
1366*35238bceSAndroid Build Coastguard Worker throw;
1367*35238bceSAndroid Build Coastguard Worker }
1368*35238bceSAndroid Build Coastguard Worker
1369*35238bceSAndroid Build Coastguard Worker gl.disable(GL_DEBUG_OUTPUT);
1370*35238bceSAndroid Build Coastguard Worker gl.debugMessageCallback(DE_NULL, DE_NULL);
1371*35238bceSAndroid Build Coastguard Worker m_results.setTestContextResult(m_testCtx);
1372*35238bceSAndroid Build Coastguard Worker return STOP;
1373*35238bceSAndroid Build Coastguard Worker }
1374*35238bceSAndroid Build Coastguard Worker
1375*35238bceSAndroid Build Coastguard Worker // Basic grouping functionality
1376*35238bceSAndroid Build Coastguard Worker class GroupCase : public BaseCase
1377*35238bceSAndroid Build Coastguard Worker {
1378*35238bceSAndroid Build Coastguard Worker public:
1379*35238bceSAndroid Build Coastguard Worker GroupCase(Context &ctx, const char *name, const char *desc);
~GroupCase()1380*35238bceSAndroid Build Coastguard Worker virtual ~GroupCase()
1381*35238bceSAndroid Build Coastguard Worker {
1382*35238bceSAndroid Build Coastguard Worker }
1383*35238bceSAndroid Build Coastguard Worker
1384*35238bceSAndroid Build Coastguard Worker virtual IterateResult iterate(void);
1385*35238bceSAndroid Build Coastguard Worker
1386*35238bceSAndroid Build Coastguard Worker private:
1387*35238bceSAndroid Build Coastguard Worker virtual void callback(GLenum source, GLenum type, GLuint id, GLenum severity, const string &message);
1388*35238bceSAndroid Build Coastguard Worker
1389*35238bceSAndroid Build Coastguard Worker MessageData m_lastMessage;
1390*35238bceSAndroid Build Coastguard Worker };
1391*35238bceSAndroid Build Coastguard Worker
GroupCase(Context & ctx,const char * name,const char * desc)1392*35238bceSAndroid Build Coastguard Worker GroupCase::GroupCase(Context &ctx, const char *name, const char *desc) : BaseCase(ctx, name, desc)
1393*35238bceSAndroid Build Coastguard Worker {
1394*35238bceSAndroid Build Coastguard Worker }
1395*35238bceSAndroid Build Coastguard Worker
iterate(void)1396*35238bceSAndroid Build Coastguard Worker GroupCase::IterateResult GroupCase::iterate(void)
1397*35238bceSAndroid Build Coastguard Worker {
1398*35238bceSAndroid Build Coastguard Worker TCU_CHECK_AND_THROW(NotSupportedError, isKHRDebugSupported(m_context), "GL_KHR_debug is not supported");
1399*35238bceSAndroid Build Coastguard Worker
1400*35238bceSAndroid Build Coastguard Worker const glw::Functions &gl = m_context.getRenderContext().getFunctions();
1401*35238bceSAndroid Build Coastguard Worker tcu::TestLog &log = m_testCtx.getLog();
1402*35238bceSAndroid Build Coastguard Worker glu::CallLogWrapper wrapper(gl, log);
1403*35238bceSAndroid Build Coastguard Worker
1404*35238bceSAndroid Build Coastguard Worker gl.enable(GL_DEBUG_OUTPUT);
1405*35238bceSAndroid Build Coastguard Worker gl.enable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
1406*35238bceSAndroid Build Coastguard Worker gl.debugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, DE_NULL, false); // disable all
1407*35238bceSAndroid Build Coastguard Worker gl.debugMessageControl(GL_DEBUG_SOURCE_API, GL_DEBUG_TYPE_ERROR, GL_DONT_CARE, 0, DE_NULL,
1408*35238bceSAndroid Build Coastguard Worker true); // enable API errors
1409*35238bceSAndroid Build Coastguard Worker gl.debugMessageControl(GL_DEBUG_SOURCE_APPLICATION, GL_DONT_CARE, GL_DONT_CARE, 0, DE_NULL,
1410*35238bceSAndroid Build Coastguard Worker true); // enable application messages
1411*35238bceSAndroid Build Coastguard Worker gl.debugMessageControl(GL_DEBUG_SOURCE_THIRD_PARTY, GL_DONT_CARE, GL_DONT_CARE, 0, DE_NULL,
1412*35238bceSAndroid Build Coastguard Worker true); // enable third party messages
1413*35238bceSAndroid Build Coastguard Worker gl.debugMessageCallback(callbackHandle, this);
1414*35238bceSAndroid Build Coastguard Worker
1415*35238bceSAndroid Build Coastguard Worker wrapper.enableLogging(true);
1416*35238bceSAndroid Build Coastguard Worker wrapper.glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 1234, -1, "Pushed debug stack");
1417*35238bceSAndroid Build Coastguard Worker verifyMessage(m_lastMessage, GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PUSH_GROUP, 1234,
1418*35238bceSAndroid Build Coastguard Worker GL_DEBUG_SEVERITY_NOTIFICATION);
1419*35238bceSAndroid Build Coastguard Worker wrapper.glPopDebugGroup();
1420*35238bceSAndroid Build Coastguard Worker verifyMessage(m_lastMessage, GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_POP_GROUP, 1234,
1421*35238bceSAndroid Build Coastguard Worker GL_DEBUG_SEVERITY_NOTIFICATION);
1422*35238bceSAndroid Build Coastguard Worker
1423*35238bceSAndroid Build Coastguard Worker wrapper.glPushDebugGroup(GL_DEBUG_SOURCE_THIRD_PARTY, 4231, -1, "Pushed debug stack");
1424*35238bceSAndroid Build Coastguard Worker verifyMessage(m_lastMessage, GL_DEBUG_SOURCE_THIRD_PARTY, GL_DEBUG_TYPE_PUSH_GROUP, 4231,
1425*35238bceSAndroid Build Coastguard Worker GL_DEBUG_SEVERITY_NOTIFICATION);
1426*35238bceSAndroid Build Coastguard Worker wrapper.glPopDebugGroup();
1427*35238bceSAndroid Build Coastguard Worker verifyMessage(m_lastMessage, GL_DEBUG_SOURCE_THIRD_PARTY, GL_DEBUG_TYPE_POP_GROUP, 4231,
1428*35238bceSAndroid Build Coastguard Worker GL_DEBUG_SEVERITY_NOTIFICATION);
1429*35238bceSAndroid Build Coastguard Worker
1430*35238bceSAndroid Build Coastguard Worker gl.debugMessageCallback(DE_NULL, DE_NULL);
1431*35238bceSAndroid Build Coastguard Worker gl.disable(GL_DEBUG_OUTPUT);
1432*35238bceSAndroid Build Coastguard Worker
1433*35238bceSAndroid Build Coastguard Worker m_results.setTestContextResult(m_testCtx);
1434*35238bceSAndroid Build Coastguard Worker
1435*35238bceSAndroid Build Coastguard Worker return STOP;
1436*35238bceSAndroid Build Coastguard Worker }
1437*35238bceSAndroid Build Coastguard Worker
callback(GLenum source,GLenum type,GLuint id,GLenum severity,const string & message)1438*35238bceSAndroid Build Coastguard Worker void GroupCase::callback(GLenum source, GLenum type, GLuint id, GLenum severity, const string &message)
1439*35238bceSAndroid Build Coastguard Worker {
1440*35238bceSAndroid Build Coastguard Worker m_lastMessage = MessageData(MessageID(source, type, id), severity, message);
1441*35238bceSAndroid Build Coastguard Worker }
1442*35238bceSAndroid Build Coastguard Worker
1443*35238bceSAndroid Build Coastguard Worker // Asynchronous debug output
1444*35238bceSAndroid Build Coastguard Worker class AsyncCase : public BaseCase
1445*35238bceSAndroid Build Coastguard Worker {
1446*35238bceSAndroid Build Coastguard Worker public:
1447*35238bceSAndroid Build Coastguard Worker AsyncCase(Context &ctx, const char *name, const char *desc, const vector<TestFunctionWrapper> &errorFuncs,
1448*35238bceSAndroid Build Coastguard Worker bool useCallbacks);
~AsyncCase(void)1449*35238bceSAndroid Build Coastguard Worker virtual ~AsyncCase(void)
1450*35238bceSAndroid Build Coastguard Worker {
1451*35238bceSAndroid Build Coastguard Worker }
1452*35238bceSAndroid Build Coastguard Worker
1453*35238bceSAndroid Build Coastguard Worker virtual IterateResult iterate(void);
1454*35238bceSAndroid Build Coastguard Worker
1455*35238bceSAndroid Build Coastguard Worker virtual void expectMessage(glw::GLenum source, glw::GLenum type);
1456*35238bceSAndroid Build Coastguard Worker
1457*35238bceSAndroid Build Coastguard Worker private:
1458*35238bceSAndroid Build Coastguard Worker struct MessageCount
1459*35238bceSAndroid Build Coastguard Worker {
1460*35238bceSAndroid Build Coastguard Worker int received;
1461*35238bceSAndroid Build Coastguard Worker int expected;
1462*35238bceSAndroid Build Coastguard Worker
MessageCountdeqp::gles31::Functional::__anon5e098b950111::AsyncCase::MessageCount1463*35238bceSAndroid Build Coastguard Worker MessageCount(void) : received(0), expected(0)
1464*35238bceSAndroid Build Coastguard Worker {
1465*35238bceSAndroid Build Coastguard Worker }
1466*35238bceSAndroid Build Coastguard Worker };
1467*35238bceSAndroid Build Coastguard Worker typedef map<MessageID, MessageCount> MessageCounter;
1468*35238bceSAndroid Build Coastguard Worker
1469*35238bceSAndroid Build Coastguard Worker enum VerifyState
1470*35238bceSAndroid Build Coastguard Worker {
1471*35238bceSAndroid Build Coastguard Worker VERIFY_PASS = 0,
1472*35238bceSAndroid Build Coastguard Worker VERIFY_MINIMUM,
1473*35238bceSAndroid Build Coastguard Worker VERIFY_FAIL,
1474*35238bceSAndroid Build Coastguard Worker
1475*35238bceSAndroid Build Coastguard Worker VERIFY_LAST
1476*35238bceSAndroid Build Coastguard Worker };
1477*35238bceSAndroid Build Coastguard Worker
1478*35238bceSAndroid Build Coastguard Worker virtual void callback(glw::GLenum source, glw::GLenum type, glw::GLuint id, glw::GLenum severity,
1479*35238bceSAndroid Build Coastguard Worker const std::string &message);
1480*35238bceSAndroid Build Coastguard Worker VerifyState verify(bool uselog);
1481*35238bceSAndroid Build Coastguard Worker void fetchLogMessages(void);
1482*35238bceSAndroid Build Coastguard Worker
1483*35238bceSAndroid Build Coastguard Worker const vector<TestFunctionWrapper> m_errorFuncs;
1484*35238bceSAndroid Build Coastguard Worker const bool m_useCallbacks;
1485*35238bceSAndroid Build Coastguard Worker
1486*35238bceSAndroid Build Coastguard Worker MessageCounter m_counts;
1487*35238bceSAndroid Build Coastguard Worker
1488*35238bceSAndroid Build Coastguard Worker de::Mutex m_mutex;
1489*35238bceSAndroid Build Coastguard Worker };
1490*35238bceSAndroid Build Coastguard Worker
AsyncCase(Context & ctx,const char * name,const char * desc,const vector<TestFunctionWrapper> & errorFuncs,bool useCallbacks)1491*35238bceSAndroid Build Coastguard Worker AsyncCase::AsyncCase(Context &ctx, const char *name, const char *desc, const vector<TestFunctionWrapper> &errorFuncs,
1492*35238bceSAndroid Build Coastguard Worker bool useCallbacks)
1493*35238bceSAndroid Build Coastguard Worker : BaseCase(ctx, name, desc)
1494*35238bceSAndroid Build Coastguard Worker , m_errorFuncs(errorFuncs)
1495*35238bceSAndroid Build Coastguard Worker , m_useCallbacks(useCallbacks)
1496*35238bceSAndroid Build Coastguard Worker {
1497*35238bceSAndroid Build Coastguard Worker }
1498*35238bceSAndroid Build Coastguard Worker
iterate(void)1499*35238bceSAndroid Build Coastguard Worker AsyncCase::IterateResult AsyncCase::iterate(void)
1500*35238bceSAndroid Build Coastguard Worker {
1501*35238bceSAndroid Build Coastguard Worker TCU_CHECK_AND_THROW(NotSupportedError, isKHRDebugSupported(m_context), "GL_KHR_debug is not supported");
1502*35238bceSAndroid Build Coastguard Worker
1503*35238bceSAndroid Build Coastguard Worker const glw::Functions &gl = m_context.getRenderContext().getFunctions();
1504*35238bceSAndroid Build Coastguard Worker tcu::TestLog &log = m_testCtx.getLog();
1505*35238bceSAndroid Build Coastguard Worker DebugMessageTestContext context =
1506*35238bceSAndroid Build Coastguard Worker DebugMessageTestContext(*this, m_context.getRenderContext(), m_context.getContextInfo(), log, m_results, true);
1507*35238bceSAndroid Build Coastguard Worker const int maxWait = 10000; // ms
1508*35238bceSAndroid Build Coastguard Worker const int warnWait = 100;
1509*35238bceSAndroid Build Coastguard Worker
1510*35238bceSAndroid Build Coastguard Worker // Clear log from earlier messages
1511*35238bceSAndroid Build Coastguard Worker {
1512*35238bceSAndroid Build Coastguard Worker GLint numMessages = 0;
1513*35238bceSAndroid Build Coastguard Worker gl.getIntegerv(GL_DEBUG_LOGGED_MESSAGES, &numMessages);
1514*35238bceSAndroid Build Coastguard Worker gl.getDebugMessageLog(numMessages, 0, DE_NULL, DE_NULL, DE_NULL, DE_NULL, DE_NULL, DE_NULL);
1515*35238bceSAndroid Build Coastguard Worker }
1516*35238bceSAndroid Build Coastguard Worker
1517*35238bceSAndroid Build Coastguard Worker gl.enable(GL_DEBUG_OUTPUT);
1518*35238bceSAndroid Build Coastguard Worker gl.enable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
1519*35238bceSAndroid Build Coastguard Worker gl.debugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, DE_NULL, false);
1520*35238bceSAndroid Build Coastguard Worker
1521*35238bceSAndroid Build Coastguard Worker // Some messages could be dependent on the value of DEBUG_OUTPUT_SYNCHRONOUS so only use API errors which should be generated in all cases
1522*35238bceSAndroid Build Coastguard Worker gl.debugMessageControl(GL_DEBUG_SOURCE_API, GL_DEBUG_TYPE_ERROR, GL_DONT_CARE, 0, DE_NULL, true);
1523*35238bceSAndroid Build Coastguard Worker
1524*35238bceSAndroid Build Coastguard Worker if (m_useCallbacks) // will use log otherwise
1525*35238bceSAndroid Build Coastguard Worker gl.debugMessageCallback(callbackHandle, this);
1526*35238bceSAndroid Build Coastguard Worker else
1527*35238bceSAndroid Build Coastguard Worker gl.debugMessageCallback(DE_NULL, DE_NULL);
1528*35238bceSAndroid Build Coastguard Worker
1529*35238bceSAndroid Build Coastguard Worker // Reference run (synchoronous)
1530*35238bceSAndroid Build Coastguard Worker {
1531*35238bceSAndroid Build Coastguard Worker tcu::ScopedLogSection section(log, "reference run", "Reference run (synchronous)");
1532*35238bceSAndroid Build Coastguard Worker
1533*35238bceSAndroid Build Coastguard Worker for (int ndx = 0; ndx < int(m_errorFuncs.size()); ndx++)
1534*35238bceSAndroid Build Coastguard Worker m_errorFuncs[ndx].call(context);
1535*35238bceSAndroid Build Coastguard Worker }
1536*35238bceSAndroid Build Coastguard Worker
1537*35238bceSAndroid Build Coastguard Worker if (m_counts.empty())
1538*35238bceSAndroid Build Coastguard Worker {
1539*35238bceSAndroid Build Coastguard Worker if (!isDebugContext())
1540*35238bceSAndroid Build Coastguard Worker m_results.addResult(QP_TEST_RESULT_QUALITY_WARNING,
1541*35238bceSAndroid Build Coastguard Worker "Need debug context to guarantee implementation behaviour (see command line options)");
1542*35238bceSAndroid Build Coastguard Worker
1543*35238bceSAndroid Build Coastguard Worker log << TestLog::Message << "Reference run produced no messages, nothing to verify" << TestLog::EndMessage;
1544*35238bceSAndroid Build Coastguard Worker
1545*35238bceSAndroid Build Coastguard Worker gl.debugMessageCallback(DE_NULL, DE_NULL);
1546*35238bceSAndroid Build Coastguard Worker gl.disable(GL_DEBUG_OUTPUT);
1547*35238bceSAndroid Build Coastguard Worker
1548*35238bceSAndroid Build Coastguard Worker m_results.setTestContextResult(m_testCtx);
1549*35238bceSAndroid Build Coastguard Worker return STOP;
1550*35238bceSAndroid Build Coastguard Worker }
1551*35238bceSAndroid Build Coastguard Worker
1552*35238bceSAndroid Build Coastguard Worker for (MessageCounter::iterator itr = m_counts.begin(); itr != m_counts.end(); itr++)
1553*35238bceSAndroid Build Coastguard Worker {
1554*35238bceSAndroid Build Coastguard Worker itr->second.expected = itr->second.received;
1555*35238bceSAndroid Build Coastguard Worker itr->second.received = 0;
1556*35238bceSAndroid Build Coastguard Worker }
1557*35238bceSAndroid Build Coastguard Worker
1558*35238bceSAndroid Build Coastguard Worker gl.disable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
1559*35238bceSAndroid Build Coastguard Worker
1560*35238bceSAndroid Build Coastguard Worker // Result run (async)
1561*35238bceSAndroid Build Coastguard Worker for (int ndx = 0; ndx < int(m_errorFuncs.size()); ndx++)
1562*35238bceSAndroid Build Coastguard Worker m_errorFuncs[ndx].call(context);
1563*35238bceSAndroid Build Coastguard Worker
1564*35238bceSAndroid Build Coastguard Worker // Repatedly try verification, new results may be added to m_receivedMessages at any time
1565*35238bceSAndroid Build Coastguard Worker {
1566*35238bceSAndroid Build Coastguard Worker tcu::ScopedLogSection section(log, "result run", "Result run (asynchronous)");
1567*35238bceSAndroid Build Coastguard Worker VerifyState lastTimelyState = VERIFY_FAIL;
1568*35238bceSAndroid Build Coastguard Worker
1569*35238bceSAndroid Build Coastguard Worker for (int waited = 0;;)
1570*35238bceSAndroid Build Coastguard Worker {
1571*35238bceSAndroid Build Coastguard Worker const VerifyState pass = verify(false);
1572*35238bceSAndroid Build Coastguard Worker const int wait = de::max(50, waited >> 2);
1573*35238bceSAndroid Build Coastguard Worker
1574*35238bceSAndroid Build Coastguard Worker // Pass (possibly due to time limit)
1575*35238bceSAndroid Build Coastguard Worker if (pass == VERIFY_PASS || (pass == VERIFY_MINIMUM && waited >= maxWait))
1576*35238bceSAndroid Build Coastguard Worker {
1577*35238bceSAndroid Build Coastguard Worker verify(true); // log
1578*35238bceSAndroid Build Coastguard Worker
1579*35238bceSAndroid Build Coastguard Worker // State changed late
1580*35238bceSAndroid Build Coastguard Worker if (waited >= warnWait && lastTimelyState != pass)
1581*35238bceSAndroid Build Coastguard Worker m_results.addResult(QP_TEST_RESULT_QUALITY_WARNING,
1582*35238bceSAndroid Build Coastguard Worker "Async messages were returned to application somewhat slowly");
1583*35238bceSAndroid Build Coastguard Worker
1584*35238bceSAndroid Build Coastguard Worker log << TestLog::Message << "Passed after ~" << waited << "ms of waiting" << TestLog::EndMessage;
1585*35238bceSAndroid Build Coastguard Worker break;
1586*35238bceSAndroid Build Coastguard Worker }
1587*35238bceSAndroid Build Coastguard Worker // fail
1588*35238bceSAndroid Build Coastguard Worker else if (waited >= maxWait)
1589*35238bceSAndroid Build Coastguard Worker {
1590*35238bceSAndroid Build Coastguard Worker verify(true); // log
1591*35238bceSAndroid Build Coastguard Worker
1592*35238bceSAndroid Build Coastguard Worker log << TestLog::Message << "Waited for ~" << waited << "ms without getting all expected messages"
1593*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
1594*35238bceSAndroid Build Coastguard Worker m_results.addResult(QP_TEST_RESULT_FAIL,
1595*35238bceSAndroid Build Coastguard Worker "Async messages were not returned to application within a reasonable timeframe");
1596*35238bceSAndroid Build Coastguard Worker break;
1597*35238bceSAndroid Build Coastguard Worker }
1598*35238bceSAndroid Build Coastguard Worker
1599*35238bceSAndroid Build Coastguard Worker if (waited < warnWait)
1600*35238bceSAndroid Build Coastguard Worker lastTimelyState = pass;
1601*35238bceSAndroid Build Coastguard Worker
1602*35238bceSAndroid Build Coastguard Worker deSleep(wait);
1603*35238bceSAndroid Build Coastguard Worker waited += wait;
1604*35238bceSAndroid Build Coastguard Worker
1605*35238bceSAndroid Build Coastguard Worker if (!m_useCallbacks)
1606*35238bceSAndroid Build Coastguard Worker fetchLogMessages();
1607*35238bceSAndroid Build Coastguard Worker }
1608*35238bceSAndroid Build Coastguard Worker }
1609*35238bceSAndroid Build Coastguard Worker
1610*35238bceSAndroid Build Coastguard Worker gl.debugMessageCallback(DE_NULL, DE_NULL);
1611*35238bceSAndroid Build Coastguard Worker
1612*35238bceSAndroid Build Coastguard Worker gl.disable(GL_DEBUG_OUTPUT);
1613*35238bceSAndroid Build Coastguard Worker m_results.setTestContextResult(m_testCtx);
1614*35238bceSAndroid Build Coastguard Worker
1615*35238bceSAndroid Build Coastguard Worker return STOP;
1616*35238bceSAndroid Build Coastguard Worker }
1617*35238bceSAndroid Build Coastguard Worker
expectMessage(GLenum source,GLenum type)1618*35238bceSAndroid Build Coastguard Worker void AsyncCase::expectMessage(GLenum source, GLenum type)
1619*35238bceSAndroid Build Coastguard Worker {
1620*35238bceSAndroid Build Coastguard Worker // Good time to clean up the queue as this should be called after most messages are generated
1621*35238bceSAndroid Build Coastguard Worker if (!m_useCallbacks)
1622*35238bceSAndroid Build Coastguard Worker fetchLogMessages();
1623*35238bceSAndroid Build Coastguard Worker
1624*35238bceSAndroid Build Coastguard Worker DE_UNREF(source);
1625*35238bceSAndroid Build Coastguard Worker DE_UNREF(type);
1626*35238bceSAndroid Build Coastguard Worker }
1627*35238bceSAndroid Build Coastguard Worker
callback(GLenum source,GLenum type,GLuint id,GLenum severity,const string & message)1628*35238bceSAndroid Build Coastguard Worker void AsyncCase::callback(GLenum source, GLenum type, GLuint id, GLenum severity, const string &message)
1629*35238bceSAndroid Build Coastguard Worker {
1630*35238bceSAndroid Build Coastguard Worker DE_ASSERT(m_useCallbacks);
1631*35238bceSAndroid Build Coastguard Worker DE_UNREF(severity);
1632*35238bceSAndroid Build Coastguard Worker DE_UNREF(message);
1633*35238bceSAndroid Build Coastguard Worker
1634*35238bceSAndroid Build Coastguard Worker de::ScopedLock lock(m_mutex);
1635*35238bceSAndroid Build Coastguard Worker
1636*35238bceSAndroid Build Coastguard Worker m_counts[MessageID(source, type, id)].received++;
1637*35238bceSAndroid Build Coastguard Worker }
1638*35238bceSAndroid Build Coastguard Worker
1639*35238bceSAndroid Build Coastguard Worker // Note that we can never guarantee getting all messages back when using logs/fetching as the GL may create more than its log size limit during an arbitrary period of time
fetchLogMessages(void)1640*35238bceSAndroid Build Coastguard Worker void AsyncCase::fetchLogMessages(void)
1641*35238bceSAndroid Build Coastguard Worker {
1642*35238bceSAndroid Build Coastguard Worker const glw::Functions &gl = m_context.getRenderContext().getFunctions();
1643*35238bceSAndroid Build Coastguard Worker GLint numMsg = 0;
1644*35238bceSAndroid Build Coastguard Worker
1645*35238bceSAndroid Build Coastguard Worker gl.getIntegerv(GL_DEBUG_LOGGED_MESSAGES, &numMsg);
1646*35238bceSAndroid Build Coastguard Worker
1647*35238bceSAndroid Build Coastguard Worker for (int msgNdx = 0; msgNdx < numMsg; msgNdx++)
1648*35238bceSAndroid Build Coastguard Worker {
1649*35238bceSAndroid Build Coastguard Worker int msgLen = 0;
1650*35238bceSAndroid Build Coastguard Worker MessageData msg;
1651*35238bceSAndroid Build Coastguard Worker
1652*35238bceSAndroid Build Coastguard Worker gl.getIntegerv(GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH, &msgLen);
1653*35238bceSAndroid Build Coastguard Worker
1654*35238bceSAndroid Build Coastguard Worker TCU_CHECK_MSG(msgLen >= 0, "Negative message length");
1655*35238bceSAndroid Build Coastguard Worker TCU_CHECK_MSG(msgLen < 100000, "Excessively long message");
1656*35238bceSAndroid Build Coastguard Worker
1657*35238bceSAndroid Build Coastguard Worker msg.message.resize(msgLen);
1658*35238bceSAndroid Build Coastguard Worker gl.getDebugMessageLog(1, msgLen, &msg.id.source, &msg.id.type, &msg.id.id, &msg.severity, &msgLen,
1659*35238bceSAndroid Build Coastguard Worker &msg.message[0]);
1660*35238bceSAndroid Build Coastguard Worker
1661*35238bceSAndroid Build Coastguard Worker {
1662*35238bceSAndroid Build Coastguard Worker const de::ScopedLock lock(m_mutex); // Don't block during API call
1663*35238bceSAndroid Build Coastguard Worker
1664*35238bceSAndroid Build Coastguard Worker m_counts[MessageID(msg.id)].received++;
1665*35238bceSAndroid Build Coastguard Worker }
1666*35238bceSAndroid Build Coastguard Worker }
1667*35238bceSAndroid Build Coastguard Worker }
1668*35238bceSAndroid Build Coastguard Worker
verify(bool uselog)1669*35238bceSAndroid Build Coastguard Worker AsyncCase::VerifyState AsyncCase::verify(bool uselog)
1670*35238bceSAndroid Build Coastguard Worker {
1671*35238bceSAndroid Build Coastguard Worker using std::map;
1672*35238bceSAndroid Build Coastguard Worker
1673*35238bceSAndroid Build Coastguard Worker VerifyState retval = VERIFY_PASS;
1674*35238bceSAndroid Build Coastguard Worker TestLog &log = m_testCtx.getLog();
1675*35238bceSAndroid Build Coastguard Worker
1676*35238bceSAndroid Build Coastguard Worker const de::ScopedLock lock(m_mutex);
1677*35238bceSAndroid Build Coastguard Worker
1678*35238bceSAndroid Build Coastguard Worker for (map<MessageID, MessageCount>::const_iterator itr = m_counts.begin(); itr != m_counts.end(); itr++)
1679*35238bceSAndroid Build Coastguard Worker {
1680*35238bceSAndroid Build Coastguard Worker const MessageID &id = itr->first;
1681*35238bceSAndroid Build Coastguard Worker
1682*35238bceSAndroid Build Coastguard Worker const int refCount = itr->second.expected;
1683*35238bceSAndroid Build Coastguard Worker const int resCount = itr->second.received;
1684*35238bceSAndroid Build Coastguard Worker const bool enabled = true;
1685*35238bceSAndroid Build Coastguard Worker
1686*35238bceSAndroid Build Coastguard Worker VerificationResult result = verifyMessageCount(id, GL_DONT_CARE, refCount, resCount, enabled);
1687*35238bceSAndroid Build Coastguard Worker
1688*35238bceSAndroid Build Coastguard Worker if (uselog)
1689*35238bceSAndroid Build Coastguard Worker log << TestLog::Message << result.logMessage << TestLog::EndMessage;
1690*35238bceSAndroid Build Coastguard Worker
1691*35238bceSAndroid Build Coastguard Worker if (result.result == QP_TEST_RESULT_FAIL)
1692*35238bceSAndroid Build Coastguard Worker retval = VERIFY_FAIL;
1693*35238bceSAndroid Build Coastguard Worker else if (result.result != QP_TEST_RESULT_PASS && retval == VERIFY_PASS)
1694*35238bceSAndroid Build Coastguard Worker retval = VERIFY_MINIMUM;
1695*35238bceSAndroid Build Coastguard Worker }
1696*35238bceSAndroid Build Coastguard Worker
1697*35238bceSAndroid Build Coastguard Worker return retval;
1698*35238bceSAndroid Build Coastguard Worker }
1699*35238bceSAndroid Build Coastguard Worker
1700*35238bceSAndroid Build Coastguard Worker // Tests debug labels
1701*35238bceSAndroid Build Coastguard Worker class LabelCase : public TestCase
1702*35238bceSAndroid Build Coastguard Worker {
1703*35238bceSAndroid Build Coastguard Worker public:
1704*35238bceSAndroid Build Coastguard Worker LabelCase(Context &ctx, const char *name, const char *desc, GLenum identifier);
~LabelCase(void)1705*35238bceSAndroid Build Coastguard Worker virtual ~LabelCase(void)
1706*35238bceSAndroid Build Coastguard Worker {
1707*35238bceSAndroid Build Coastguard Worker }
1708*35238bceSAndroid Build Coastguard Worker
1709*35238bceSAndroid Build Coastguard Worker virtual IterateResult iterate(void);
1710*35238bceSAndroid Build Coastguard Worker
1711*35238bceSAndroid Build Coastguard Worker private:
1712*35238bceSAndroid Build Coastguard Worker GLenum m_identifier;
1713*35238bceSAndroid Build Coastguard Worker };
1714*35238bceSAndroid Build Coastguard Worker
LabelCase(Context & ctx,const char * name,const char * desc,GLenum identifier)1715*35238bceSAndroid Build Coastguard Worker LabelCase::LabelCase(Context &ctx, const char *name, const char *desc, GLenum identifier)
1716*35238bceSAndroid Build Coastguard Worker : TestCase(ctx, name, desc)
1717*35238bceSAndroid Build Coastguard Worker , m_identifier(identifier)
1718*35238bceSAndroid Build Coastguard Worker {
1719*35238bceSAndroid Build Coastguard Worker }
1720*35238bceSAndroid Build Coastguard Worker
iterate(void)1721*35238bceSAndroid Build Coastguard Worker LabelCase::IterateResult LabelCase::iterate(void)
1722*35238bceSAndroid Build Coastguard Worker {
1723*35238bceSAndroid Build Coastguard Worker TCU_CHECK_AND_THROW(NotSupportedError, isKHRDebugSupported(m_context), "GL_KHR_debug is not supported");
1724*35238bceSAndroid Build Coastguard Worker
1725*35238bceSAndroid Build Coastguard Worker const glw::Functions &gl = m_context.getRenderContext().getFunctions();
1726*35238bceSAndroid Build Coastguard Worker const char *const msg = "This is a debug label";
1727*35238bceSAndroid Build Coastguard Worker GLuint object = 0;
1728*35238bceSAndroid Build Coastguard Worker int outlen = -1;
1729*35238bceSAndroid Build Coastguard Worker char buffer[64];
1730*35238bceSAndroid Build Coastguard Worker
1731*35238bceSAndroid Build Coastguard Worker switch (m_identifier)
1732*35238bceSAndroid Build Coastguard Worker {
1733*35238bceSAndroid Build Coastguard Worker case GL_BUFFER:
1734*35238bceSAndroid Build Coastguard Worker gl.genBuffers(1, &object);
1735*35238bceSAndroid Build Coastguard Worker gl.bindBuffer(GL_ARRAY_BUFFER, object);
1736*35238bceSAndroid Build Coastguard Worker gl.bindBuffer(GL_ARRAY_BUFFER, 0);
1737*35238bceSAndroid Build Coastguard Worker break;
1738*35238bceSAndroid Build Coastguard Worker
1739*35238bceSAndroid Build Coastguard Worker case GL_SHADER:
1740*35238bceSAndroid Build Coastguard Worker object = gl.createShader(GL_FRAGMENT_SHADER);
1741*35238bceSAndroid Build Coastguard Worker break;
1742*35238bceSAndroid Build Coastguard Worker
1743*35238bceSAndroid Build Coastguard Worker case GL_PROGRAM:
1744*35238bceSAndroid Build Coastguard Worker object = gl.createProgram();
1745*35238bceSAndroid Build Coastguard Worker break;
1746*35238bceSAndroid Build Coastguard Worker
1747*35238bceSAndroid Build Coastguard Worker case GL_QUERY:
1748*35238bceSAndroid Build Coastguard Worker gl.genQueries(1, &object);
1749*35238bceSAndroid Build Coastguard Worker gl.beginQuery(GL_ANY_SAMPLES_PASSED, object); // Create
1750*35238bceSAndroid Build Coastguard Worker gl.endQuery(GL_ANY_SAMPLES_PASSED); // Cleanup
1751*35238bceSAndroid Build Coastguard Worker break;
1752*35238bceSAndroid Build Coastguard Worker
1753*35238bceSAndroid Build Coastguard Worker case GL_PROGRAM_PIPELINE:
1754*35238bceSAndroid Build Coastguard Worker gl.genProgramPipelines(1, &object);
1755*35238bceSAndroid Build Coastguard Worker gl.bindProgramPipeline(object); // Create
1756*35238bceSAndroid Build Coastguard Worker gl.bindProgramPipeline(0); // Cleanup
1757*35238bceSAndroid Build Coastguard Worker break;
1758*35238bceSAndroid Build Coastguard Worker
1759*35238bceSAndroid Build Coastguard Worker case GL_TRANSFORM_FEEDBACK:
1760*35238bceSAndroid Build Coastguard Worker gl.genTransformFeedbacks(1, &object);
1761*35238bceSAndroid Build Coastguard Worker gl.bindTransformFeedback(GL_TRANSFORM_FEEDBACK, object);
1762*35238bceSAndroid Build Coastguard Worker gl.bindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);
1763*35238bceSAndroid Build Coastguard Worker break;
1764*35238bceSAndroid Build Coastguard Worker
1765*35238bceSAndroid Build Coastguard Worker case GL_SAMPLER:
1766*35238bceSAndroid Build Coastguard Worker gl.genSamplers(1, &object);
1767*35238bceSAndroid Build Coastguard Worker gl.bindSampler(0, object);
1768*35238bceSAndroid Build Coastguard Worker gl.bindSampler(0, 0);
1769*35238bceSAndroid Build Coastguard Worker break;
1770*35238bceSAndroid Build Coastguard Worker
1771*35238bceSAndroid Build Coastguard Worker case GL_TEXTURE:
1772*35238bceSAndroid Build Coastguard Worker gl.genTextures(1, &object);
1773*35238bceSAndroid Build Coastguard Worker gl.bindTexture(GL_TEXTURE_2D, object);
1774*35238bceSAndroid Build Coastguard Worker gl.bindTexture(GL_TEXTURE_2D, 0);
1775*35238bceSAndroid Build Coastguard Worker break;
1776*35238bceSAndroid Build Coastguard Worker
1777*35238bceSAndroid Build Coastguard Worker case GL_RENDERBUFFER:
1778*35238bceSAndroid Build Coastguard Worker gl.genRenderbuffers(1, &object);
1779*35238bceSAndroid Build Coastguard Worker gl.bindRenderbuffer(GL_RENDERBUFFER, object);
1780*35238bceSAndroid Build Coastguard Worker gl.bindRenderbuffer(GL_RENDERBUFFER, 0);
1781*35238bceSAndroid Build Coastguard Worker break;
1782*35238bceSAndroid Build Coastguard Worker
1783*35238bceSAndroid Build Coastguard Worker case GL_FRAMEBUFFER:
1784*35238bceSAndroid Build Coastguard Worker gl.genFramebuffers(1, &object);
1785*35238bceSAndroid Build Coastguard Worker gl.bindFramebuffer(GL_DRAW_FRAMEBUFFER, object);
1786*35238bceSAndroid Build Coastguard Worker gl.bindFramebuffer(GL_DRAW_FRAMEBUFFER, m_context.getRenderContext().getDefaultFramebuffer());
1787*35238bceSAndroid Build Coastguard Worker break;
1788*35238bceSAndroid Build Coastguard Worker
1789*35238bceSAndroid Build Coastguard Worker default:
1790*35238bceSAndroid Build Coastguard Worker DE_FATAL("Invalid identifier");
1791*35238bceSAndroid Build Coastguard Worker }
1792*35238bceSAndroid Build Coastguard Worker
1793*35238bceSAndroid Build Coastguard Worker gl.objectLabel(m_identifier, object, -1, msg);
1794*35238bceSAndroid Build Coastguard Worker
1795*35238bceSAndroid Build Coastguard Worker deMemset(buffer, 'X', sizeof(buffer));
1796*35238bceSAndroid Build Coastguard Worker gl.getObjectLabel(m_identifier, object, sizeof(buffer), &outlen, buffer);
1797*35238bceSAndroid Build Coastguard Worker
1798*35238bceSAndroid Build Coastguard Worker if (outlen == 0)
1799*35238bceSAndroid Build Coastguard Worker m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Failed to query debug label from object");
1800*35238bceSAndroid Build Coastguard Worker else if (deStringEqual(msg, buffer))
1801*35238bceSAndroid Build Coastguard Worker {
1802*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Query returned string: \"" << buffer << "\"" << TestLog::EndMessage;
1803*35238bceSAndroid Build Coastguard Worker m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1804*35238bceSAndroid Build Coastguard Worker }
1805*35238bceSAndroid Build Coastguard Worker else
1806*35238bceSAndroid Build Coastguard Worker {
1807*35238bceSAndroid Build Coastguard Worker buffer[63] = '\0'; // make sure buffer is null terminated before printing
1808*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Query returned wrong string: expected \"" << msg << "\" but got \""
1809*35238bceSAndroid Build Coastguard Worker << buffer << "\"" << TestLog::EndMessage;
1810*35238bceSAndroid Build Coastguard Worker m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Query returned wrong label");
1811*35238bceSAndroid Build Coastguard Worker }
1812*35238bceSAndroid Build Coastguard Worker
1813*35238bceSAndroid Build Coastguard Worker switch (m_identifier)
1814*35238bceSAndroid Build Coastguard Worker {
1815*35238bceSAndroid Build Coastguard Worker case GL_BUFFER:
1816*35238bceSAndroid Build Coastguard Worker gl.deleteBuffers(1, &object);
1817*35238bceSAndroid Build Coastguard Worker break;
1818*35238bceSAndroid Build Coastguard Worker case GL_SHADER:
1819*35238bceSAndroid Build Coastguard Worker gl.deleteShader(object);
1820*35238bceSAndroid Build Coastguard Worker break;
1821*35238bceSAndroid Build Coastguard Worker case GL_PROGRAM:
1822*35238bceSAndroid Build Coastguard Worker gl.deleteProgram(object);
1823*35238bceSAndroid Build Coastguard Worker break;
1824*35238bceSAndroid Build Coastguard Worker case GL_QUERY:
1825*35238bceSAndroid Build Coastguard Worker gl.deleteQueries(1, &object);
1826*35238bceSAndroid Build Coastguard Worker break;
1827*35238bceSAndroid Build Coastguard Worker case GL_PROGRAM_PIPELINE:
1828*35238bceSAndroid Build Coastguard Worker gl.deleteProgramPipelines(1, &object);
1829*35238bceSAndroid Build Coastguard Worker break;
1830*35238bceSAndroid Build Coastguard Worker case GL_TRANSFORM_FEEDBACK:
1831*35238bceSAndroid Build Coastguard Worker gl.deleteTransformFeedbacks(1, &object);
1832*35238bceSAndroid Build Coastguard Worker break;
1833*35238bceSAndroid Build Coastguard Worker case GL_SAMPLER:
1834*35238bceSAndroid Build Coastguard Worker gl.deleteSamplers(1, &object);
1835*35238bceSAndroid Build Coastguard Worker break;
1836*35238bceSAndroid Build Coastguard Worker case GL_TEXTURE:
1837*35238bceSAndroid Build Coastguard Worker gl.deleteTextures(1, &object);
1838*35238bceSAndroid Build Coastguard Worker break;
1839*35238bceSAndroid Build Coastguard Worker case GL_RENDERBUFFER:
1840*35238bceSAndroid Build Coastguard Worker gl.deleteRenderbuffers(1, &object);
1841*35238bceSAndroid Build Coastguard Worker break;
1842*35238bceSAndroid Build Coastguard Worker case GL_FRAMEBUFFER:
1843*35238bceSAndroid Build Coastguard Worker gl.deleteFramebuffers(1, &object);
1844*35238bceSAndroid Build Coastguard Worker break;
1845*35238bceSAndroid Build Coastguard Worker
1846*35238bceSAndroid Build Coastguard Worker default:
1847*35238bceSAndroid Build Coastguard Worker DE_FATAL("Invalid identifier");
1848*35238bceSAndroid Build Coastguard Worker }
1849*35238bceSAndroid Build Coastguard Worker
1850*35238bceSAndroid Build Coastguard Worker return STOP;
1851*35238bceSAndroid Build Coastguard Worker }
1852*35238bceSAndroid Build Coastguard Worker
DebugMessageTestContext(BaseCase & host,glu::RenderContext & renderCtx,const glu::ContextInfo & ctxInfo,tcu::TestLog & log,tcu::ResultCollector & results,bool enableLog)1853*35238bceSAndroid Build Coastguard Worker DebugMessageTestContext::DebugMessageTestContext(BaseCase &host, glu::RenderContext &renderCtx,
1854*35238bceSAndroid Build Coastguard Worker const glu::ContextInfo &ctxInfo, tcu::TestLog &log,
1855*35238bceSAndroid Build Coastguard Worker tcu::ResultCollector &results, bool enableLog)
1856*35238bceSAndroid Build Coastguard Worker : NegativeTestContext(host, renderCtx, ctxInfo, log, results, enableLog)
1857*35238bceSAndroid Build Coastguard Worker , m_debugHost(host)
1858*35238bceSAndroid Build Coastguard Worker {
1859*35238bceSAndroid Build Coastguard Worker }
1860*35238bceSAndroid Build Coastguard Worker
~DebugMessageTestContext(void)1861*35238bceSAndroid Build Coastguard Worker DebugMessageTestContext::~DebugMessageTestContext(void)
1862*35238bceSAndroid Build Coastguard Worker {
1863*35238bceSAndroid Build Coastguard Worker }
1864*35238bceSAndroid Build Coastguard Worker
expectMessage(GLenum source,GLenum type)1865*35238bceSAndroid Build Coastguard Worker void DebugMessageTestContext::expectMessage(GLenum source, GLenum type)
1866*35238bceSAndroid Build Coastguard Worker {
1867*35238bceSAndroid Build Coastguard Worker m_debugHost.expectMessage(source, type);
1868*35238bceSAndroid Build Coastguard Worker }
1869*35238bceSAndroid Build Coastguard Worker
1870*35238bceSAndroid Build Coastguard Worker class SyncLabelCase : public TestCase
1871*35238bceSAndroid Build Coastguard Worker {
1872*35238bceSAndroid Build Coastguard Worker public:
1873*35238bceSAndroid Build Coastguard Worker SyncLabelCase(Context &ctx, const char *name, const char *desc);
1874*35238bceSAndroid Build Coastguard Worker virtual IterateResult iterate(void);
1875*35238bceSAndroid Build Coastguard Worker };
1876*35238bceSAndroid Build Coastguard Worker
SyncLabelCase(Context & ctx,const char * name,const char * desc)1877*35238bceSAndroid Build Coastguard Worker SyncLabelCase::SyncLabelCase(Context &ctx, const char *name, const char *desc) : TestCase(ctx, name, desc)
1878*35238bceSAndroid Build Coastguard Worker {
1879*35238bceSAndroid Build Coastguard Worker }
1880*35238bceSAndroid Build Coastguard Worker
iterate(void)1881*35238bceSAndroid Build Coastguard Worker SyncLabelCase::IterateResult SyncLabelCase::iterate(void)
1882*35238bceSAndroid Build Coastguard Worker {
1883*35238bceSAndroid Build Coastguard Worker TCU_CHECK_AND_THROW(NotSupportedError, isKHRDebugSupported(m_context), "GL_KHR_debug is not supported");
1884*35238bceSAndroid Build Coastguard Worker
1885*35238bceSAndroid Build Coastguard Worker const glw::Functions &gl = m_context.getRenderContext().getFunctions();
1886*35238bceSAndroid Build Coastguard Worker const char *const msg = "This is a debug label";
1887*35238bceSAndroid Build Coastguard Worker int outlen = -1;
1888*35238bceSAndroid Build Coastguard Worker char buffer[64];
1889*35238bceSAndroid Build Coastguard Worker
1890*35238bceSAndroid Build Coastguard Worker glw::GLsync sync = gl.fenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
1891*35238bceSAndroid Build Coastguard Worker GLU_EXPECT_NO_ERROR(gl.getError(), "fenceSync");
1892*35238bceSAndroid Build Coastguard Worker
1893*35238bceSAndroid Build Coastguard Worker gl.objectPtrLabel(sync, -1, msg);
1894*35238bceSAndroid Build Coastguard Worker
1895*35238bceSAndroid Build Coastguard Worker deMemset(buffer, 'X', sizeof(buffer));
1896*35238bceSAndroid Build Coastguard Worker gl.getObjectPtrLabel(sync, sizeof(buffer), &outlen, buffer);
1897*35238bceSAndroid Build Coastguard Worker
1898*35238bceSAndroid Build Coastguard Worker if (outlen == 0)
1899*35238bceSAndroid Build Coastguard Worker m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Failed to query debug label from object");
1900*35238bceSAndroid Build Coastguard Worker else if (deStringEqual(msg, buffer))
1901*35238bceSAndroid Build Coastguard Worker {
1902*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Query returned string: \"" << buffer << "\"" << TestLog::EndMessage;
1903*35238bceSAndroid Build Coastguard Worker m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1904*35238bceSAndroid Build Coastguard Worker }
1905*35238bceSAndroid Build Coastguard Worker else
1906*35238bceSAndroid Build Coastguard Worker {
1907*35238bceSAndroid Build Coastguard Worker buffer[63] = '\0'; // make sure buffer is null terminated before printing
1908*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Query returned wrong string: expected \"" << msg << "\" but got \""
1909*35238bceSAndroid Build Coastguard Worker << buffer << "\"" << TestLog::EndMessage;
1910*35238bceSAndroid Build Coastguard Worker m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Query returned wrong label");
1911*35238bceSAndroid Build Coastguard Worker }
1912*35238bceSAndroid Build Coastguard Worker
1913*35238bceSAndroid Build Coastguard Worker gl.deleteSync(sync);
1914*35238bceSAndroid Build Coastguard Worker
1915*35238bceSAndroid Build Coastguard Worker return STOP;
1916*35238bceSAndroid Build Coastguard Worker }
1917*35238bceSAndroid Build Coastguard Worker
1918*35238bceSAndroid Build Coastguard Worker class InitialLabelCase : public TestCase
1919*35238bceSAndroid Build Coastguard Worker {
1920*35238bceSAndroid Build Coastguard Worker public:
1921*35238bceSAndroid Build Coastguard Worker InitialLabelCase(Context &ctx, const char *name, const char *desc);
1922*35238bceSAndroid Build Coastguard Worker virtual IterateResult iterate(void);
1923*35238bceSAndroid Build Coastguard Worker };
1924*35238bceSAndroid Build Coastguard Worker
InitialLabelCase(Context & ctx,const char * name,const char * desc)1925*35238bceSAndroid Build Coastguard Worker InitialLabelCase::InitialLabelCase(Context &ctx, const char *name, const char *desc) : TestCase(ctx, name, desc)
1926*35238bceSAndroid Build Coastguard Worker {
1927*35238bceSAndroid Build Coastguard Worker }
1928*35238bceSAndroid Build Coastguard Worker
iterate(void)1929*35238bceSAndroid Build Coastguard Worker InitialLabelCase::IterateResult InitialLabelCase::iterate(void)
1930*35238bceSAndroid Build Coastguard Worker {
1931*35238bceSAndroid Build Coastguard Worker TCU_CHECK_AND_THROW(NotSupportedError, isKHRDebugSupported(m_context), "GL_KHR_debug is not supported");
1932*35238bceSAndroid Build Coastguard Worker
1933*35238bceSAndroid Build Coastguard Worker const glw::Functions &gl = m_context.getRenderContext().getFunctions();
1934*35238bceSAndroid Build Coastguard Worker tcu::ResultCollector result(m_testCtx.getLog(), " // ERROR: ");
1935*35238bceSAndroid Build Coastguard Worker int outlen = -1;
1936*35238bceSAndroid Build Coastguard Worker GLuint shader;
1937*35238bceSAndroid Build Coastguard Worker glw::GLsync sync;
1938*35238bceSAndroid Build Coastguard Worker char buffer[64];
1939*35238bceSAndroid Build Coastguard Worker
1940*35238bceSAndroid Build Coastguard Worker sync = gl.fenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
1941*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "fenceSync");
1942*35238bceSAndroid Build Coastguard Worker
1943*35238bceSAndroid Build Coastguard Worker shader = gl.createShader(GL_FRAGMENT_SHADER);
1944*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "createShader");
1945*35238bceSAndroid Build Coastguard Worker
1946*35238bceSAndroid Build Coastguard Worker {
1947*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection section(m_testCtx.getLog(), "Shader", "Shader object");
1948*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Querying initial value" << TestLog::EndMessage;
1949*35238bceSAndroid Build Coastguard Worker
1950*35238bceSAndroid Build Coastguard Worker buffer[0] = 'X';
1951*35238bceSAndroid Build Coastguard Worker outlen = -1;
1952*35238bceSAndroid Build Coastguard Worker gl.getObjectLabel(GL_SHADER, shader, sizeof(buffer), &outlen, buffer);
1953*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "getObjectLabel");
1954*35238bceSAndroid Build Coastguard Worker
1955*35238bceSAndroid Build Coastguard Worker if (outlen != 0)
1956*35238bceSAndroid Build Coastguard Worker result.fail("'length' was not zero, got " + de::toString(outlen));
1957*35238bceSAndroid Build Coastguard Worker else if (buffer[0] != '\0')
1958*35238bceSAndroid Build Coastguard Worker result.fail("label was not null terminated");
1959*35238bceSAndroid Build Coastguard Worker else
1960*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Got 0-sized null-terminated string." << TestLog::EndMessage;
1961*35238bceSAndroid Build Coastguard Worker }
1962*35238bceSAndroid Build Coastguard Worker
1963*35238bceSAndroid Build Coastguard Worker {
1964*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection section(m_testCtx.getLog(), "Sync", "Sync object");
1965*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Querying initial value" << TestLog::EndMessage;
1966*35238bceSAndroid Build Coastguard Worker
1967*35238bceSAndroid Build Coastguard Worker buffer[0] = 'X';
1968*35238bceSAndroid Build Coastguard Worker outlen = -1;
1969*35238bceSAndroid Build Coastguard Worker gl.getObjectPtrLabel(sync, sizeof(buffer), &outlen, buffer);
1970*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "getObjectPtrLabel");
1971*35238bceSAndroid Build Coastguard Worker
1972*35238bceSAndroid Build Coastguard Worker if (outlen != 0)
1973*35238bceSAndroid Build Coastguard Worker result.fail("'length' was not zero, got " + de::toString(outlen));
1974*35238bceSAndroid Build Coastguard Worker else if (buffer[0] != '\0')
1975*35238bceSAndroid Build Coastguard Worker result.fail("label was not null terminated");
1976*35238bceSAndroid Build Coastguard Worker else
1977*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Got 0-sized null-terminated string." << TestLog::EndMessage;
1978*35238bceSAndroid Build Coastguard Worker }
1979*35238bceSAndroid Build Coastguard Worker
1980*35238bceSAndroid Build Coastguard Worker gl.deleteShader(shader);
1981*35238bceSAndroid Build Coastguard Worker gl.deleteSync(sync);
1982*35238bceSAndroid Build Coastguard Worker
1983*35238bceSAndroid Build Coastguard Worker result.setTestContextResult(m_testCtx);
1984*35238bceSAndroid Build Coastguard Worker return STOP;
1985*35238bceSAndroid Build Coastguard Worker }
1986*35238bceSAndroid Build Coastguard Worker
1987*35238bceSAndroid Build Coastguard Worker class ClearLabelCase : public TestCase
1988*35238bceSAndroid Build Coastguard Worker {
1989*35238bceSAndroid Build Coastguard Worker public:
1990*35238bceSAndroid Build Coastguard Worker ClearLabelCase(Context &ctx, const char *name, const char *desc);
1991*35238bceSAndroid Build Coastguard Worker virtual IterateResult iterate(void);
1992*35238bceSAndroid Build Coastguard Worker };
1993*35238bceSAndroid Build Coastguard Worker
ClearLabelCase(Context & ctx,const char * name,const char * desc)1994*35238bceSAndroid Build Coastguard Worker ClearLabelCase::ClearLabelCase(Context &ctx, const char *name, const char *desc) : TestCase(ctx, name, desc)
1995*35238bceSAndroid Build Coastguard Worker {
1996*35238bceSAndroid Build Coastguard Worker }
1997*35238bceSAndroid Build Coastguard Worker
iterate(void)1998*35238bceSAndroid Build Coastguard Worker ClearLabelCase::IterateResult ClearLabelCase::iterate(void)
1999*35238bceSAndroid Build Coastguard Worker {
2000*35238bceSAndroid Build Coastguard Worker TCU_CHECK_AND_THROW(NotSupportedError, isKHRDebugSupported(m_context), "GL_KHR_debug is not supported");
2001*35238bceSAndroid Build Coastguard Worker
2002*35238bceSAndroid Build Coastguard Worker static const struct
2003*35238bceSAndroid Build Coastguard Worker {
2004*35238bceSAndroid Build Coastguard Worker const char *description;
2005*35238bceSAndroid Build Coastguard Worker int length;
2006*35238bceSAndroid Build Coastguard Worker } s_clearMethods[] = {
2007*35238bceSAndroid Build Coastguard Worker {" with NULL label and 0 length", 0},
2008*35238bceSAndroid Build Coastguard Worker {" with NULL label and 1 length", 1},
2009*35238bceSAndroid Build Coastguard Worker {" with NULL label and negative length", -1},
2010*35238bceSAndroid Build Coastguard Worker };
2011*35238bceSAndroid Build Coastguard Worker
2012*35238bceSAndroid Build Coastguard Worker const glw::Functions &gl = m_context.getRenderContext().getFunctions();
2013*35238bceSAndroid Build Coastguard Worker tcu::ResultCollector result(m_testCtx.getLog(), " // ERROR: ");
2014*35238bceSAndroid Build Coastguard Worker const char *const msg = "This is a debug label";
2015*35238bceSAndroid Build Coastguard Worker int outlen = -1;
2016*35238bceSAndroid Build Coastguard Worker GLuint shader;
2017*35238bceSAndroid Build Coastguard Worker glw::GLsync sync;
2018*35238bceSAndroid Build Coastguard Worker char buffer[64];
2019*35238bceSAndroid Build Coastguard Worker
2020*35238bceSAndroid Build Coastguard Worker sync = gl.fenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
2021*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "fenceSync");
2022*35238bceSAndroid Build Coastguard Worker
2023*35238bceSAndroid Build Coastguard Worker shader = gl.createShader(GL_FRAGMENT_SHADER);
2024*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "createShader");
2025*35238bceSAndroid Build Coastguard Worker
2026*35238bceSAndroid Build Coastguard Worker {
2027*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection section(m_testCtx.getLog(), "Shader", "Shader object");
2028*35238bceSAndroid Build Coastguard Worker
2029*35238bceSAndroid Build Coastguard Worker for (int methodNdx = 0; methodNdx < DE_LENGTH_OF_ARRAY(s_clearMethods); ++methodNdx)
2030*35238bceSAndroid Build Coastguard Worker {
2031*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Setting label to string: \"" << msg << "\""
2032*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
2033*35238bceSAndroid Build Coastguard Worker gl.objectLabel(GL_SHADER, shader, -2, msg);
2034*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "objectLabel");
2035*35238bceSAndroid Build Coastguard Worker
2036*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Clearing label " << s_clearMethods[methodNdx].description
2037*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
2038*35238bceSAndroid Build Coastguard Worker gl.objectLabel(GL_SHADER, shader, s_clearMethods[methodNdx].length, DE_NULL);
2039*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "objectLabel");
2040*35238bceSAndroid Build Coastguard Worker
2041*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Querying label" << TestLog::EndMessage;
2042*35238bceSAndroid Build Coastguard Worker buffer[0] = 'X';
2043*35238bceSAndroid Build Coastguard Worker outlen = -1;
2044*35238bceSAndroid Build Coastguard Worker gl.getObjectLabel(GL_SHADER, shader, sizeof(buffer), &outlen, buffer);
2045*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "getObjectLabel");
2046*35238bceSAndroid Build Coastguard Worker
2047*35238bceSAndroid Build Coastguard Worker if (outlen != 0)
2048*35238bceSAndroid Build Coastguard Worker result.fail("'length' was not zero, got " + de::toString(outlen));
2049*35238bceSAndroid Build Coastguard Worker else if (buffer[0] != '\0')
2050*35238bceSAndroid Build Coastguard Worker result.fail("label was not null terminated");
2051*35238bceSAndroid Build Coastguard Worker else
2052*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Got 0-sized null-terminated string." << TestLog::EndMessage;
2053*35238bceSAndroid Build Coastguard Worker }
2054*35238bceSAndroid Build Coastguard Worker }
2055*35238bceSAndroid Build Coastguard Worker
2056*35238bceSAndroid Build Coastguard Worker {
2057*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection section(m_testCtx.getLog(), "Sync", "Sync object");
2058*35238bceSAndroid Build Coastguard Worker
2059*35238bceSAndroid Build Coastguard Worker for (int methodNdx = 0; methodNdx < DE_LENGTH_OF_ARRAY(s_clearMethods); ++methodNdx)
2060*35238bceSAndroid Build Coastguard Worker {
2061*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Setting label to string: \"" << msg << "\""
2062*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
2063*35238bceSAndroid Build Coastguard Worker gl.objectPtrLabel(sync, -2, msg);
2064*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "objectPtrLabel");
2065*35238bceSAndroid Build Coastguard Worker
2066*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Clearing label " << s_clearMethods[methodNdx].description
2067*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
2068*35238bceSAndroid Build Coastguard Worker gl.objectPtrLabel(sync, s_clearMethods[methodNdx].length, DE_NULL);
2069*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "objectPtrLabel");
2070*35238bceSAndroid Build Coastguard Worker
2071*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Querying label" << TestLog::EndMessage;
2072*35238bceSAndroid Build Coastguard Worker buffer[0] = 'X';
2073*35238bceSAndroid Build Coastguard Worker outlen = -1;
2074*35238bceSAndroid Build Coastguard Worker gl.getObjectPtrLabel(sync, sizeof(buffer), &outlen, buffer);
2075*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "getObjectPtrLabel");
2076*35238bceSAndroid Build Coastguard Worker
2077*35238bceSAndroid Build Coastguard Worker if (outlen != 0)
2078*35238bceSAndroid Build Coastguard Worker result.fail("'length' was not zero, got " + de::toString(outlen));
2079*35238bceSAndroid Build Coastguard Worker else if (buffer[0] != '\0')
2080*35238bceSAndroid Build Coastguard Worker result.fail("label was not null terminated");
2081*35238bceSAndroid Build Coastguard Worker else
2082*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Got 0-sized null-terminated string." << TestLog::EndMessage;
2083*35238bceSAndroid Build Coastguard Worker }
2084*35238bceSAndroid Build Coastguard Worker }
2085*35238bceSAndroid Build Coastguard Worker
2086*35238bceSAndroid Build Coastguard Worker gl.deleteShader(shader);
2087*35238bceSAndroid Build Coastguard Worker gl.deleteSync(sync);
2088*35238bceSAndroid Build Coastguard Worker
2089*35238bceSAndroid Build Coastguard Worker result.setTestContextResult(m_testCtx);
2090*35238bceSAndroid Build Coastguard Worker return STOP;
2091*35238bceSAndroid Build Coastguard Worker }
2092*35238bceSAndroid Build Coastguard Worker
2093*35238bceSAndroid Build Coastguard Worker class SpecifyWithLengthCase : public TestCase
2094*35238bceSAndroid Build Coastguard Worker {
2095*35238bceSAndroid Build Coastguard Worker public:
2096*35238bceSAndroid Build Coastguard Worker SpecifyWithLengthCase(Context &ctx, const char *name, const char *desc);
2097*35238bceSAndroid Build Coastguard Worker virtual IterateResult iterate(void);
2098*35238bceSAndroid Build Coastguard Worker };
2099*35238bceSAndroid Build Coastguard Worker
SpecifyWithLengthCase(Context & ctx,const char * name,const char * desc)2100*35238bceSAndroid Build Coastguard Worker SpecifyWithLengthCase::SpecifyWithLengthCase(Context &ctx, const char *name, const char *desc)
2101*35238bceSAndroid Build Coastguard Worker : TestCase(ctx, name, desc)
2102*35238bceSAndroid Build Coastguard Worker {
2103*35238bceSAndroid Build Coastguard Worker }
2104*35238bceSAndroid Build Coastguard Worker
iterate(void)2105*35238bceSAndroid Build Coastguard Worker SpecifyWithLengthCase::IterateResult SpecifyWithLengthCase::iterate(void)
2106*35238bceSAndroid Build Coastguard Worker {
2107*35238bceSAndroid Build Coastguard Worker TCU_CHECK_AND_THROW(NotSupportedError, isKHRDebugSupported(m_context), "GL_KHR_debug is not supported");
2108*35238bceSAndroid Build Coastguard Worker
2109*35238bceSAndroid Build Coastguard Worker const glw::Functions &gl = m_context.getRenderContext().getFunctions();
2110*35238bceSAndroid Build Coastguard Worker tcu::ResultCollector result(m_testCtx.getLog(), " // ERROR: ");
2111*35238bceSAndroid Build Coastguard Worker const char *const msg = "This is a debug label";
2112*35238bceSAndroid Build Coastguard Worker const char *const clipMsg = "This is a de";
2113*35238bceSAndroid Build Coastguard Worker int outlen = -1;
2114*35238bceSAndroid Build Coastguard Worker GLuint shader;
2115*35238bceSAndroid Build Coastguard Worker glw::GLsync sync;
2116*35238bceSAndroid Build Coastguard Worker char buffer[64];
2117*35238bceSAndroid Build Coastguard Worker
2118*35238bceSAndroid Build Coastguard Worker sync = gl.fenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
2119*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "fenceSync");
2120*35238bceSAndroid Build Coastguard Worker
2121*35238bceSAndroid Build Coastguard Worker shader = gl.createShader(GL_FRAGMENT_SHADER);
2122*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "createShader");
2123*35238bceSAndroid Build Coastguard Worker
2124*35238bceSAndroid Build Coastguard Worker {
2125*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection section(m_testCtx.getLog(), "Shader", "Shader object");
2126*35238bceSAndroid Build Coastguard Worker
2127*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Setting label to string: \"" << msg << "\" with length 12"
2128*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
2129*35238bceSAndroid Build Coastguard Worker gl.objectLabel(GL_SHADER, shader, 12, msg);
2130*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "objectLabel");
2131*35238bceSAndroid Build Coastguard Worker
2132*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Querying label" << TestLog::EndMessage;
2133*35238bceSAndroid Build Coastguard Worker deMemset(buffer, 'X', sizeof(buffer));
2134*35238bceSAndroid Build Coastguard Worker gl.getObjectLabel(GL_SHADER, shader, sizeof(buffer), &outlen, buffer);
2135*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "getObjectLabel");
2136*35238bceSAndroid Build Coastguard Worker
2137*35238bceSAndroid Build Coastguard Worker if (outlen != 12)
2138*35238bceSAndroid Build Coastguard Worker result.fail("'length' was not 12, got " + de::toString(outlen));
2139*35238bceSAndroid Build Coastguard Worker else if (deStringEqual(clipMsg, buffer))
2140*35238bceSAndroid Build Coastguard Worker {
2141*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Query returned string: \"" << buffer << "\""
2142*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
2143*35238bceSAndroid Build Coastguard Worker }
2144*35238bceSAndroid Build Coastguard Worker else
2145*35238bceSAndroid Build Coastguard Worker {
2146*35238bceSAndroid Build Coastguard Worker buffer[63] = '\0'; // make sure buffer is null terminated before printing
2147*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Query returned wrong string: expected \"" << clipMsg
2148*35238bceSAndroid Build Coastguard Worker << "\" but got \"" << buffer << "\"" << TestLog::EndMessage;
2149*35238bceSAndroid Build Coastguard Worker result.fail("Query returned wrong label");
2150*35238bceSAndroid Build Coastguard Worker }
2151*35238bceSAndroid Build Coastguard Worker }
2152*35238bceSAndroid Build Coastguard Worker
2153*35238bceSAndroid Build Coastguard Worker {
2154*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection section(m_testCtx.getLog(), "Sync", "Sync object");
2155*35238bceSAndroid Build Coastguard Worker
2156*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Setting label to string: \"" << msg << "\" with length 12"
2157*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
2158*35238bceSAndroid Build Coastguard Worker gl.objectPtrLabel(sync, 12, msg);
2159*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "objectPtrLabel");
2160*35238bceSAndroid Build Coastguard Worker
2161*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Querying label" << TestLog::EndMessage;
2162*35238bceSAndroid Build Coastguard Worker deMemset(buffer, 'X', sizeof(buffer));
2163*35238bceSAndroid Build Coastguard Worker gl.getObjectPtrLabel(sync, sizeof(buffer), &outlen, buffer);
2164*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "getObjectPtrLabel");
2165*35238bceSAndroid Build Coastguard Worker
2166*35238bceSAndroid Build Coastguard Worker if (outlen != 12)
2167*35238bceSAndroid Build Coastguard Worker result.fail("'length' was not 12, got " + de::toString(outlen));
2168*35238bceSAndroid Build Coastguard Worker else if (deStringEqual(clipMsg, buffer))
2169*35238bceSAndroid Build Coastguard Worker {
2170*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Query returned string: \"" << buffer << "\""
2171*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
2172*35238bceSAndroid Build Coastguard Worker }
2173*35238bceSAndroid Build Coastguard Worker else
2174*35238bceSAndroid Build Coastguard Worker {
2175*35238bceSAndroid Build Coastguard Worker buffer[63] = '\0'; // make sure buffer is null terminated before printing
2176*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Query returned wrong string: expected \"" << clipMsg
2177*35238bceSAndroid Build Coastguard Worker << "\" but got \"" << buffer << "\"" << TestLog::EndMessage;
2178*35238bceSAndroid Build Coastguard Worker result.fail("Query returned wrong label");
2179*35238bceSAndroid Build Coastguard Worker }
2180*35238bceSAndroid Build Coastguard Worker }
2181*35238bceSAndroid Build Coastguard Worker
2182*35238bceSAndroid Build Coastguard Worker {
2183*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection section(m_testCtx.getLog(), "ZeroSized", "ZeroSized");
2184*35238bceSAndroid Build Coastguard Worker
2185*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Setting label to string: \"" << msg << "\" with length 0"
2186*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
2187*35238bceSAndroid Build Coastguard Worker gl.objectLabel(GL_SHADER, shader, 0, msg);
2188*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "objectLabel");
2189*35238bceSAndroid Build Coastguard Worker
2190*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Querying label" << TestLog::EndMessage;
2191*35238bceSAndroid Build Coastguard Worker deMemset(buffer, 'X', sizeof(buffer));
2192*35238bceSAndroid Build Coastguard Worker gl.getObjectLabel(GL_SHADER, shader, sizeof(buffer), &outlen, buffer);
2193*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "getObjectLabel");
2194*35238bceSAndroid Build Coastguard Worker
2195*35238bceSAndroid Build Coastguard Worker if (outlen != 0)
2196*35238bceSAndroid Build Coastguard Worker result.fail("'length' was not zero, got " + de::toString(outlen));
2197*35238bceSAndroid Build Coastguard Worker else if (buffer[0] != '\0')
2198*35238bceSAndroid Build Coastguard Worker result.fail("label was not null terminated");
2199*35238bceSAndroid Build Coastguard Worker else
2200*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Got 0-sized null-terminated string." << TestLog::EndMessage;
2201*35238bceSAndroid Build Coastguard Worker }
2202*35238bceSAndroid Build Coastguard Worker
2203*35238bceSAndroid Build Coastguard Worker gl.deleteShader(shader);
2204*35238bceSAndroid Build Coastguard Worker gl.deleteSync(sync);
2205*35238bceSAndroid Build Coastguard Worker
2206*35238bceSAndroid Build Coastguard Worker result.setTestContextResult(m_testCtx);
2207*35238bceSAndroid Build Coastguard Worker return STOP;
2208*35238bceSAndroid Build Coastguard Worker }
2209*35238bceSAndroid Build Coastguard Worker
2210*35238bceSAndroid Build Coastguard Worker class BufferLimitedLabelCase : public TestCase
2211*35238bceSAndroid Build Coastguard Worker {
2212*35238bceSAndroid Build Coastguard Worker public:
2213*35238bceSAndroid Build Coastguard Worker BufferLimitedLabelCase(Context &ctx, const char *name, const char *desc);
2214*35238bceSAndroid Build Coastguard Worker virtual IterateResult iterate(void);
2215*35238bceSAndroid Build Coastguard Worker };
2216*35238bceSAndroid Build Coastguard Worker
BufferLimitedLabelCase(Context & ctx,const char * name,const char * desc)2217*35238bceSAndroid Build Coastguard Worker BufferLimitedLabelCase::BufferLimitedLabelCase(Context &ctx, const char *name, const char *desc)
2218*35238bceSAndroid Build Coastguard Worker : TestCase(ctx, name, desc)
2219*35238bceSAndroid Build Coastguard Worker {
2220*35238bceSAndroid Build Coastguard Worker }
2221*35238bceSAndroid Build Coastguard Worker
iterate(void)2222*35238bceSAndroid Build Coastguard Worker BufferLimitedLabelCase::IterateResult BufferLimitedLabelCase::iterate(void)
2223*35238bceSAndroid Build Coastguard Worker {
2224*35238bceSAndroid Build Coastguard Worker TCU_CHECK_AND_THROW(NotSupportedError, isKHRDebugSupported(m_context), "GL_KHR_debug is not supported");
2225*35238bceSAndroid Build Coastguard Worker
2226*35238bceSAndroid Build Coastguard Worker const glw::Functions &gl = m_context.getRenderContext().getFunctions();
2227*35238bceSAndroid Build Coastguard Worker tcu::ResultCollector result(m_testCtx.getLog(), " // ERROR: ");
2228*35238bceSAndroid Build Coastguard Worker const char *const msg = "This is a debug label";
2229*35238bceSAndroid Build Coastguard Worker int outlen = -1;
2230*35238bceSAndroid Build Coastguard Worker GLuint shader;
2231*35238bceSAndroid Build Coastguard Worker glw::GLsync sync;
2232*35238bceSAndroid Build Coastguard Worker char buffer[64];
2233*35238bceSAndroid Build Coastguard Worker
2234*35238bceSAndroid Build Coastguard Worker sync = gl.fenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
2235*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "fenceSync");
2236*35238bceSAndroid Build Coastguard Worker
2237*35238bceSAndroid Build Coastguard Worker shader = gl.createShader(GL_FRAGMENT_SHADER);
2238*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "createShader");
2239*35238bceSAndroid Build Coastguard Worker
2240*35238bceSAndroid Build Coastguard Worker {
2241*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection superSection(m_testCtx.getLog(), "Shader", "Shader object");
2242*35238bceSAndroid Build Coastguard Worker
2243*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Setting label to string: \"" << msg << "\"" << TestLog::EndMessage;
2244*35238bceSAndroid Build Coastguard Worker gl.objectLabel(GL_SHADER, shader, -1, msg);
2245*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "objectLabel");
2246*35238bceSAndroid Build Coastguard Worker
2247*35238bceSAndroid Build Coastguard Worker {
2248*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection section(m_testCtx.getLog(), "QueryAll", "Query All");
2249*35238bceSAndroid Build Coastguard Worker
2250*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Querying whole label, buffer size = 22" << TestLog::EndMessage;
2251*35238bceSAndroid Build Coastguard Worker deMemset(buffer, 'X', sizeof(buffer));
2252*35238bceSAndroid Build Coastguard Worker gl.getObjectLabel(GL_SHADER, shader, 22, &outlen, buffer);
2253*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "getObjectLabel");
2254*35238bceSAndroid Build Coastguard Worker
2255*35238bceSAndroid Build Coastguard Worker if (outlen != 21)
2256*35238bceSAndroid Build Coastguard Worker result.fail("'length' was not 21, got " + de::toString(outlen));
2257*35238bceSAndroid Build Coastguard Worker else if (buffer[outlen] != '\0')
2258*35238bceSAndroid Build Coastguard Worker result.fail("Buffer was not null-terminated");
2259*35238bceSAndroid Build Coastguard Worker else if (buffer[outlen + 1] != 'X')
2260*35238bceSAndroid Build Coastguard Worker result.fail("Query wrote over buffer bound");
2261*35238bceSAndroid Build Coastguard Worker else if (!deStringEqual(msg, buffer))
2262*35238bceSAndroid Build Coastguard Worker {
2263*35238bceSAndroid Build Coastguard Worker buffer[63] = '\0'; // make sure buffer is null terminated before printing
2264*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Query returned string: \"" << buffer << "\""
2265*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
2266*35238bceSAndroid Build Coastguard Worker result.fail("Query returned wrong label");
2267*35238bceSAndroid Build Coastguard Worker }
2268*35238bceSAndroid Build Coastguard Worker else
2269*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Query returned string: \"" << buffer << "\""
2270*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
2271*35238bceSAndroid Build Coastguard Worker }
2272*35238bceSAndroid Build Coastguard Worker {
2273*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection section(m_testCtx.getLog(), "QueryAllNoSize", "Query all without size");
2274*35238bceSAndroid Build Coastguard Worker
2275*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Querying whole label, buffer size = 22" << TestLog::EndMessage;
2276*35238bceSAndroid Build Coastguard Worker deMemset(buffer, 'X', sizeof(buffer));
2277*35238bceSAndroid Build Coastguard Worker gl.getObjectLabel(GL_SHADER, shader, 22, DE_NULL, buffer);
2278*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "getObjectLabel");
2279*35238bceSAndroid Build Coastguard Worker
2280*35238bceSAndroid Build Coastguard Worker buffer[63] = '\0'; // make sure buffer is null terminated before strlen
2281*35238bceSAndroid Build Coastguard Worker
2282*35238bceSAndroid Build Coastguard Worker if (strlen(buffer) != 21)
2283*35238bceSAndroid Build Coastguard Worker result.fail("Buffer length was not 21");
2284*35238bceSAndroid Build Coastguard Worker else if (buffer[21] != '\0')
2285*35238bceSAndroid Build Coastguard Worker result.fail("Buffer was not null-terminated");
2286*35238bceSAndroid Build Coastguard Worker else if (buffer[22] != 'X')
2287*35238bceSAndroid Build Coastguard Worker result.fail("Query wrote over buffer bound");
2288*35238bceSAndroid Build Coastguard Worker else if (!deStringEqual(msg, buffer))
2289*35238bceSAndroid Build Coastguard Worker {
2290*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Query returned string: \"" << buffer << "\""
2291*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
2292*35238bceSAndroid Build Coastguard Worker result.fail("Query returned wrong label");
2293*35238bceSAndroid Build Coastguard Worker }
2294*35238bceSAndroid Build Coastguard Worker else
2295*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Query returned string: \"" << buffer << "\""
2296*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
2297*35238bceSAndroid Build Coastguard Worker }
2298*35238bceSAndroid Build Coastguard Worker {
2299*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection section(m_testCtx.getLog(), "QueryLess", "Query substring");
2300*35238bceSAndroid Build Coastguard Worker
2301*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Querying whole label, buffer size = 2" << TestLog::EndMessage;
2302*35238bceSAndroid Build Coastguard Worker deMemset(buffer, 'X', sizeof(buffer));
2303*35238bceSAndroid Build Coastguard Worker gl.getObjectLabel(GL_SHADER, shader, 2, &outlen, buffer);
2304*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "getObjectLabel");
2305*35238bceSAndroid Build Coastguard Worker
2306*35238bceSAndroid Build Coastguard Worker if (outlen != 1)
2307*35238bceSAndroid Build Coastguard Worker result.fail("'length' was not 1, got " + de::toString(outlen));
2308*35238bceSAndroid Build Coastguard Worker else if (buffer[outlen] != '\0')
2309*35238bceSAndroid Build Coastguard Worker result.fail("Buffer was not null-terminated");
2310*35238bceSAndroid Build Coastguard Worker else if (buffer[outlen + 1] != 'X')
2311*35238bceSAndroid Build Coastguard Worker result.fail("Query wrote over buffer bound");
2312*35238bceSAndroid Build Coastguard Worker else if (!deStringBeginsWith(msg, buffer))
2313*35238bceSAndroid Build Coastguard Worker {
2314*35238bceSAndroid Build Coastguard Worker buffer[63] = '\0'; // make sure buffer is null terminated before printing
2315*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Query returned string: \"" << buffer << "\""
2316*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
2317*35238bceSAndroid Build Coastguard Worker result.fail("Query returned wrong label");
2318*35238bceSAndroid Build Coastguard Worker }
2319*35238bceSAndroid Build Coastguard Worker else
2320*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Query returned string: \"" << buffer << "\""
2321*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
2322*35238bceSAndroid Build Coastguard Worker }
2323*35238bceSAndroid Build Coastguard Worker {
2324*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection section(m_testCtx.getLog(), "QueryNone", "Query one character");
2325*35238bceSAndroid Build Coastguard Worker
2326*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Querying whole label, buffer size = 1" << TestLog::EndMessage;
2327*35238bceSAndroid Build Coastguard Worker deMemset(buffer, 'X', sizeof(buffer));
2328*35238bceSAndroid Build Coastguard Worker gl.getObjectLabel(GL_SHADER, shader, 1, &outlen, buffer);
2329*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "getObjectLabel");
2330*35238bceSAndroid Build Coastguard Worker
2331*35238bceSAndroid Build Coastguard Worker if (outlen != 0)
2332*35238bceSAndroid Build Coastguard Worker result.fail("'length' was not 0, got " + de::toString(outlen));
2333*35238bceSAndroid Build Coastguard Worker else if (buffer[outlen] != '\0')
2334*35238bceSAndroid Build Coastguard Worker result.fail("Buffer was not null-terminated");
2335*35238bceSAndroid Build Coastguard Worker else if (buffer[outlen + 1] != 'X')
2336*35238bceSAndroid Build Coastguard Worker result.fail("Query wrote over buffer bound");
2337*35238bceSAndroid Build Coastguard Worker else
2338*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Query returned zero-sized null-terminated string"
2339*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
2340*35238bceSAndroid Build Coastguard Worker }
2341*35238bceSAndroid Build Coastguard Worker }
2342*35238bceSAndroid Build Coastguard Worker
2343*35238bceSAndroid Build Coastguard Worker {
2344*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection superSection(m_testCtx.getLog(), "Sync", "Sync object");
2345*35238bceSAndroid Build Coastguard Worker
2346*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Setting label to string: \"" << msg << "\"" << TestLog::EndMessage;
2347*35238bceSAndroid Build Coastguard Worker gl.objectPtrLabel(sync, -1, msg);
2348*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "objectPtrLabel");
2349*35238bceSAndroid Build Coastguard Worker
2350*35238bceSAndroid Build Coastguard Worker {
2351*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection section(m_testCtx.getLog(), "QueryAll", "Query All");
2352*35238bceSAndroid Build Coastguard Worker
2353*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Querying whole label, buffer size = 22" << TestLog::EndMessage;
2354*35238bceSAndroid Build Coastguard Worker deMemset(buffer, 'X', sizeof(buffer));
2355*35238bceSAndroid Build Coastguard Worker gl.getObjectPtrLabel(sync, 22, &outlen, buffer);
2356*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "getObjectPtrLabel");
2357*35238bceSAndroid Build Coastguard Worker
2358*35238bceSAndroid Build Coastguard Worker if (outlen != 21)
2359*35238bceSAndroid Build Coastguard Worker result.fail("'length' was not 21, got " + de::toString(outlen));
2360*35238bceSAndroid Build Coastguard Worker else if (buffer[outlen] != '\0')
2361*35238bceSAndroid Build Coastguard Worker result.fail("Buffer was not null-terminated");
2362*35238bceSAndroid Build Coastguard Worker else if (buffer[outlen + 1] != 'X')
2363*35238bceSAndroid Build Coastguard Worker result.fail("Query wrote over buffer bound");
2364*35238bceSAndroid Build Coastguard Worker else if (!deStringEqual(msg, buffer))
2365*35238bceSAndroid Build Coastguard Worker {
2366*35238bceSAndroid Build Coastguard Worker buffer[63] = '\0'; // make sure buffer is null terminated before printing
2367*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Query returned string: \"" << buffer << "\""
2368*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
2369*35238bceSAndroid Build Coastguard Worker result.fail("Query returned wrong label");
2370*35238bceSAndroid Build Coastguard Worker }
2371*35238bceSAndroid Build Coastguard Worker else
2372*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Query returned string: \"" << buffer << "\""
2373*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
2374*35238bceSAndroid Build Coastguard Worker }
2375*35238bceSAndroid Build Coastguard Worker {
2376*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection section(m_testCtx.getLog(), "QueryAllNoSize", "Query all without size");
2377*35238bceSAndroid Build Coastguard Worker
2378*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Querying whole label, buffer size = 22" << TestLog::EndMessage;
2379*35238bceSAndroid Build Coastguard Worker deMemset(buffer, 'X', sizeof(buffer));
2380*35238bceSAndroid Build Coastguard Worker gl.getObjectPtrLabel(sync, 22, DE_NULL, buffer);
2381*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "getObjectPtrLabel");
2382*35238bceSAndroid Build Coastguard Worker
2383*35238bceSAndroid Build Coastguard Worker buffer[63] = '\0'; // make sure buffer is null terminated before strlen
2384*35238bceSAndroid Build Coastguard Worker
2385*35238bceSAndroid Build Coastguard Worker if (strlen(buffer) != 21)
2386*35238bceSAndroid Build Coastguard Worker result.fail("Buffer length was not 21");
2387*35238bceSAndroid Build Coastguard Worker else if (buffer[21] != '\0')
2388*35238bceSAndroid Build Coastguard Worker result.fail("Buffer was not null-terminated");
2389*35238bceSAndroid Build Coastguard Worker else if (buffer[22] != 'X')
2390*35238bceSAndroid Build Coastguard Worker result.fail("Query wrote over buffer bound");
2391*35238bceSAndroid Build Coastguard Worker else if (!deStringEqual(msg, buffer))
2392*35238bceSAndroid Build Coastguard Worker {
2393*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Query returned string: \"" << buffer << "\""
2394*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
2395*35238bceSAndroid Build Coastguard Worker result.fail("Query returned wrong label");
2396*35238bceSAndroid Build Coastguard Worker }
2397*35238bceSAndroid Build Coastguard Worker else
2398*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Query returned string: \"" << buffer << "\""
2399*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
2400*35238bceSAndroid Build Coastguard Worker }
2401*35238bceSAndroid Build Coastguard Worker {
2402*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection section(m_testCtx.getLog(), "QueryLess", "Query substring");
2403*35238bceSAndroid Build Coastguard Worker
2404*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Querying whole label, buffer size = 2" << TestLog::EndMessage;
2405*35238bceSAndroid Build Coastguard Worker deMemset(buffer, 'X', sizeof(buffer));
2406*35238bceSAndroid Build Coastguard Worker gl.getObjectPtrLabel(sync, 2, &outlen, buffer);
2407*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "getObjectPtrLabel");
2408*35238bceSAndroid Build Coastguard Worker
2409*35238bceSAndroid Build Coastguard Worker if (outlen != 1)
2410*35238bceSAndroid Build Coastguard Worker result.fail("'length' was not 1, got " + de::toString(outlen));
2411*35238bceSAndroid Build Coastguard Worker else if (buffer[outlen] != '\0')
2412*35238bceSAndroid Build Coastguard Worker result.fail("Buffer was not null-terminated");
2413*35238bceSAndroid Build Coastguard Worker else if (buffer[outlen + 1] != 'X')
2414*35238bceSAndroid Build Coastguard Worker result.fail("Query wrote over buffer bound");
2415*35238bceSAndroid Build Coastguard Worker else if (!deStringBeginsWith(msg, buffer))
2416*35238bceSAndroid Build Coastguard Worker {
2417*35238bceSAndroid Build Coastguard Worker buffer[63] = '\0'; // make sure buffer is null terminated before printing
2418*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Query returned string: \"" << buffer << "\""
2419*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
2420*35238bceSAndroid Build Coastguard Worker result.fail("Query returned wrong label");
2421*35238bceSAndroid Build Coastguard Worker }
2422*35238bceSAndroid Build Coastguard Worker else
2423*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Query returned string: \"" << buffer << "\""
2424*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
2425*35238bceSAndroid Build Coastguard Worker }
2426*35238bceSAndroid Build Coastguard Worker {
2427*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection section(m_testCtx.getLog(), "QueryNone", "Query one character");
2428*35238bceSAndroid Build Coastguard Worker
2429*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Querying whole label, buffer size = 1" << TestLog::EndMessage;
2430*35238bceSAndroid Build Coastguard Worker deMemset(buffer, 'X', sizeof(buffer));
2431*35238bceSAndroid Build Coastguard Worker gl.getObjectPtrLabel(sync, 1, &outlen, buffer);
2432*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "getObjectPtrLabel");
2433*35238bceSAndroid Build Coastguard Worker
2434*35238bceSAndroid Build Coastguard Worker if (outlen != 0)
2435*35238bceSAndroid Build Coastguard Worker result.fail("'length' was not 0, got " + de::toString(outlen));
2436*35238bceSAndroid Build Coastguard Worker else if (buffer[outlen] != '\0')
2437*35238bceSAndroid Build Coastguard Worker result.fail("Buffer was not null-terminated");
2438*35238bceSAndroid Build Coastguard Worker else if (buffer[outlen + 1] != 'X')
2439*35238bceSAndroid Build Coastguard Worker result.fail("Query wrote over buffer bound");
2440*35238bceSAndroid Build Coastguard Worker else
2441*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Query returned zero-sized null-terminated string"
2442*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
2443*35238bceSAndroid Build Coastguard Worker }
2444*35238bceSAndroid Build Coastguard Worker }
2445*35238bceSAndroid Build Coastguard Worker
2446*35238bceSAndroid Build Coastguard Worker gl.deleteShader(shader);
2447*35238bceSAndroid Build Coastguard Worker gl.deleteSync(sync);
2448*35238bceSAndroid Build Coastguard Worker
2449*35238bceSAndroid Build Coastguard Worker result.setTestContextResult(m_testCtx);
2450*35238bceSAndroid Build Coastguard Worker return STOP;
2451*35238bceSAndroid Build Coastguard Worker }
2452*35238bceSAndroid Build Coastguard Worker
2453*35238bceSAndroid Build Coastguard Worker class LabelMaxSizeCase : public TestCase
2454*35238bceSAndroid Build Coastguard Worker {
2455*35238bceSAndroid Build Coastguard Worker public:
2456*35238bceSAndroid Build Coastguard Worker LabelMaxSizeCase(Context &ctx, const char *name, const char *desc);
2457*35238bceSAndroid Build Coastguard Worker virtual IterateResult iterate(void);
2458*35238bceSAndroid Build Coastguard Worker };
2459*35238bceSAndroid Build Coastguard Worker
LabelMaxSizeCase(Context & ctx,const char * name,const char * desc)2460*35238bceSAndroid Build Coastguard Worker LabelMaxSizeCase::LabelMaxSizeCase(Context &ctx, const char *name, const char *desc) : TestCase(ctx, name, desc)
2461*35238bceSAndroid Build Coastguard Worker {
2462*35238bceSAndroid Build Coastguard Worker }
2463*35238bceSAndroid Build Coastguard Worker
iterate(void)2464*35238bceSAndroid Build Coastguard Worker LabelMaxSizeCase::IterateResult LabelMaxSizeCase::iterate(void)
2465*35238bceSAndroid Build Coastguard Worker {
2466*35238bceSAndroid Build Coastguard Worker TCU_CHECK_AND_THROW(NotSupportedError, isKHRDebugSupported(m_context), "GL_KHR_debug is not supported");
2467*35238bceSAndroid Build Coastguard Worker
2468*35238bceSAndroid Build Coastguard Worker const glw::Functions &gl = m_context.getRenderContext().getFunctions();
2469*35238bceSAndroid Build Coastguard Worker tcu::ResultCollector result(m_testCtx.getLog(), " // ERROR: ");
2470*35238bceSAndroid Build Coastguard Worker int maxLabelLen = -1;
2471*35238bceSAndroid Build Coastguard Worker int outlen = -1;
2472*35238bceSAndroid Build Coastguard Worker GLuint shader;
2473*35238bceSAndroid Build Coastguard Worker glw::GLsync sync;
2474*35238bceSAndroid Build Coastguard Worker
2475*35238bceSAndroid Build Coastguard Worker gl.getIntegerv(GL_MAX_LABEL_LENGTH, &maxLabelLen);
2476*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "GL_MAX_LABEL_LENGTH");
2477*35238bceSAndroid Build Coastguard Worker
2478*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "GL_MAX_LABEL_LENGTH = " << maxLabelLen << TestLog::EndMessage;
2479*35238bceSAndroid Build Coastguard Worker
2480*35238bceSAndroid Build Coastguard Worker if (maxLabelLen < 256)
2481*35238bceSAndroid Build Coastguard Worker throw tcu::TestError("maxLabelLen was less than required (256)");
2482*35238bceSAndroid Build Coastguard Worker if (maxLabelLen > 8192)
2483*35238bceSAndroid Build Coastguard Worker {
2484*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog()
2485*35238bceSAndroid Build Coastguard Worker << TestLog::Message
2486*35238bceSAndroid Build Coastguard Worker << "GL_MAX_LABEL_LENGTH is very large. Application having larger labels is unlikely, skipping test."
2487*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
2488*35238bceSAndroid Build Coastguard Worker m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
2489*35238bceSAndroid Build Coastguard Worker return STOP;
2490*35238bceSAndroid Build Coastguard Worker }
2491*35238bceSAndroid Build Coastguard Worker
2492*35238bceSAndroid Build Coastguard Worker sync = gl.fenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
2493*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "fenceSync");
2494*35238bceSAndroid Build Coastguard Worker
2495*35238bceSAndroid Build Coastguard Worker shader = gl.createShader(GL_FRAGMENT_SHADER);
2496*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "createShader");
2497*35238bceSAndroid Build Coastguard Worker
2498*35238bceSAndroid Build Coastguard Worker {
2499*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection section(m_testCtx.getLog(), "Shader", "Shader object");
2500*35238bceSAndroid Build Coastguard Worker std::vector<char> buffer(maxLabelLen, 'X');
2501*35238bceSAndroid Build Coastguard Worker std::vector<char> readBuffer(maxLabelLen, 'X');
2502*35238bceSAndroid Build Coastguard Worker
2503*35238bceSAndroid Build Coastguard Worker buffer[maxLabelLen - 1] = '\0';
2504*35238bceSAndroid Build Coastguard Worker
2505*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Setting max length label, with implicit size. (length = -1)"
2506*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
2507*35238bceSAndroid Build Coastguard Worker gl.objectLabel(GL_SHADER, shader, -1, &buffer[0]);
2508*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "objectLabel");
2509*35238bceSAndroid Build Coastguard Worker
2510*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Querying label back" << TestLog::EndMessage;
2511*35238bceSAndroid Build Coastguard Worker outlen = -1;
2512*35238bceSAndroid Build Coastguard Worker gl.getObjectLabel(GL_SHADER, shader, maxLabelLen, &outlen, &readBuffer[0]);
2513*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "getObjectLabel");
2514*35238bceSAndroid Build Coastguard Worker
2515*35238bceSAndroid Build Coastguard Worker if (outlen != maxLabelLen - 1)
2516*35238bceSAndroid Build Coastguard Worker result.fail("'length' was not " + de::toString(maxLabelLen - 1) + ", got " + de::toString(outlen));
2517*35238bceSAndroid Build Coastguard Worker else if (readBuffer[outlen] != '\0')
2518*35238bceSAndroid Build Coastguard Worker result.fail("Buffer was not null-terminated");
2519*35238bceSAndroid Build Coastguard Worker
2520*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message
2521*35238bceSAndroid Build Coastguard Worker << "Setting max length label, with explicit size. (length = " << (maxLabelLen - 1) << ")"
2522*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
2523*35238bceSAndroid Build Coastguard Worker gl.objectLabel(GL_SHADER, shader, maxLabelLen - 1, &buffer[0]);
2524*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "objectLabel");
2525*35238bceSAndroid Build Coastguard Worker
2526*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Querying label back" << TestLog::EndMessage;
2527*35238bceSAndroid Build Coastguard Worker outlen = -1;
2528*35238bceSAndroid Build Coastguard Worker readBuffer[maxLabelLen - 1] = 'X';
2529*35238bceSAndroid Build Coastguard Worker gl.getObjectLabel(GL_SHADER, shader, maxLabelLen, &outlen, &readBuffer[0]);
2530*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "getObjectLabel");
2531*35238bceSAndroid Build Coastguard Worker
2532*35238bceSAndroid Build Coastguard Worker if (outlen != maxLabelLen - 1)
2533*35238bceSAndroid Build Coastguard Worker result.fail("'length' was not " + de::toString(maxLabelLen - 1) + ", got " + de::toString(outlen));
2534*35238bceSAndroid Build Coastguard Worker else if (readBuffer[outlen] != '\0')
2535*35238bceSAndroid Build Coastguard Worker result.fail("Buffer was not null-terminated");
2536*35238bceSAndroid Build Coastguard Worker }
2537*35238bceSAndroid Build Coastguard Worker
2538*35238bceSAndroid Build Coastguard Worker {
2539*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection section(m_testCtx.getLog(), "Sync", "Sync object");
2540*35238bceSAndroid Build Coastguard Worker std::vector<char> buffer(maxLabelLen, 'X');
2541*35238bceSAndroid Build Coastguard Worker std::vector<char> readBuffer(maxLabelLen, 'X');
2542*35238bceSAndroid Build Coastguard Worker
2543*35238bceSAndroid Build Coastguard Worker buffer[maxLabelLen - 1] = '\0';
2544*35238bceSAndroid Build Coastguard Worker
2545*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Setting max length label, with implicit size. (length = -1)"
2546*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
2547*35238bceSAndroid Build Coastguard Worker gl.objectPtrLabel(sync, -1, &buffer[0]);
2548*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "objectPtrLabel");
2549*35238bceSAndroid Build Coastguard Worker
2550*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Querying label back" << TestLog::EndMessage;
2551*35238bceSAndroid Build Coastguard Worker outlen = -1;
2552*35238bceSAndroid Build Coastguard Worker gl.getObjectPtrLabel(sync, maxLabelLen, &outlen, &readBuffer[0]);
2553*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "getObjectPtrLabel");
2554*35238bceSAndroid Build Coastguard Worker
2555*35238bceSAndroid Build Coastguard Worker if (outlen != maxLabelLen - 1)
2556*35238bceSAndroid Build Coastguard Worker result.fail("'length' was not " + de::toString(maxLabelLen - 1) + ", got " + de::toString(outlen));
2557*35238bceSAndroid Build Coastguard Worker else if (readBuffer[outlen] != '\0')
2558*35238bceSAndroid Build Coastguard Worker result.fail("Buffer was not null-terminated");
2559*35238bceSAndroid Build Coastguard Worker
2560*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message
2561*35238bceSAndroid Build Coastguard Worker << "Setting max length label, with explicit size. (length = " << (maxLabelLen - 1) << ")"
2562*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
2563*35238bceSAndroid Build Coastguard Worker gl.objectPtrLabel(sync, maxLabelLen - 1, &buffer[0]);
2564*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "objectPtrLabel");
2565*35238bceSAndroid Build Coastguard Worker
2566*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Querying label back" << TestLog::EndMessage;
2567*35238bceSAndroid Build Coastguard Worker outlen = -1;
2568*35238bceSAndroid Build Coastguard Worker readBuffer[maxLabelLen - 1] = 'X';
2569*35238bceSAndroid Build Coastguard Worker gl.getObjectPtrLabel(sync, maxLabelLen, &outlen, &readBuffer[0]);
2570*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "getObjectPtrLabel");
2571*35238bceSAndroid Build Coastguard Worker
2572*35238bceSAndroid Build Coastguard Worker if (outlen != maxLabelLen - 1)
2573*35238bceSAndroid Build Coastguard Worker result.fail("'length' was not " + de::toString(maxLabelLen - 1) + ", got " + de::toString(outlen));
2574*35238bceSAndroid Build Coastguard Worker else if (readBuffer[outlen] != '\0')
2575*35238bceSAndroid Build Coastguard Worker result.fail("Buffer was not null-terminated");
2576*35238bceSAndroid Build Coastguard Worker }
2577*35238bceSAndroid Build Coastguard Worker
2578*35238bceSAndroid Build Coastguard Worker gl.deleteShader(shader);
2579*35238bceSAndroid Build Coastguard Worker gl.deleteSync(sync);
2580*35238bceSAndroid Build Coastguard Worker
2581*35238bceSAndroid Build Coastguard Worker result.setTestContextResult(m_testCtx);
2582*35238bceSAndroid Build Coastguard Worker return STOP;
2583*35238bceSAndroid Build Coastguard Worker }
2584*35238bceSAndroid Build Coastguard Worker
2585*35238bceSAndroid Build Coastguard Worker class LabelLengthCase : public TestCase
2586*35238bceSAndroid Build Coastguard Worker {
2587*35238bceSAndroid Build Coastguard Worker public:
2588*35238bceSAndroid Build Coastguard Worker LabelLengthCase(Context &ctx, const char *name, const char *desc);
2589*35238bceSAndroid Build Coastguard Worker virtual IterateResult iterate(void);
2590*35238bceSAndroid Build Coastguard Worker };
2591*35238bceSAndroid Build Coastguard Worker
LabelLengthCase(Context & ctx,const char * name,const char * desc)2592*35238bceSAndroid Build Coastguard Worker LabelLengthCase::LabelLengthCase(Context &ctx, const char *name, const char *desc) : TestCase(ctx, name, desc)
2593*35238bceSAndroid Build Coastguard Worker {
2594*35238bceSAndroid Build Coastguard Worker }
2595*35238bceSAndroid Build Coastguard Worker
iterate(void)2596*35238bceSAndroid Build Coastguard Worker LabelLengthCase::IterateResult LabelLengthCase::iterate(void)
2597*35238bceSAndroid Build Coastguard Worker {
2598*35238bceSAndroid Build Coastguard Worker TCU_CHECK_AND_THROW(NotSupportedError, isKHRDebugSupported(m_context), "GL_KHR_debug is not supported");
2599*35238bceSAndroid Build Coastguard Worker
2600*35238bceSAndroid Build Coastguard Worker const glw::Functions &gl = m_context.getRenderContext().getFunctions();
2601*35238bceSAndroid Build Coastguard Worker tcu::ResultCollector result(m_testCtx.getLog(), " // ERROR: ");
2602*35238bceSAndroid Build Coastguard Worker const char *const msg = "This is a debug label";
2603*35238bceSAndroid Build Coastguard Worker int outlen = -1;
2604*35238bceSAndroid Build Coastguard Worker GLuint shader;
2605*35238bceSAndroid Build Coastguard Worker glw::GLsync sync;
2606*35238bceSAndroid Build Coastguard Worker
2607*35238bceSAndroid Build Coastguard Worker sync = gl.fenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
2608*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "fenceSync");
2609*35238bceSAndroid Build Coastguard Worker
2610*35238bceSAndroid Build Coastguard Worker shader = gl.createShader(GL_FRAGMENT_SHADER);
2611*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "createShader");
2612*35238bceSAndroid Build Coastguard Worker
2613*35238bceSAndroid Build Coastguard Worker {
2614*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection section(m_testCtx.getLog(), "Shader", "Shader object");
2615*35238bceSAndroid Build Coastguard Worker
2616*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Querying label length" << TestLog::EndMessage;
2617*35238bceSAndroid Build Coastguard Worker outlen = -1;
2618*35238bceSAndroid Build Coastguard Worker gl.getObjectLabel(GL_SHADER, shader, 0, &outlen, DE_NULL);
2619*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "getObjectLabel");
2620*35238bceSAndroid Build Coastguard Worker
2621*35238bceSAndroid Build Coastguard Worker if (outlen != 0)
2622*35238bceSAndroid Build Coastguard Worker result.fail("'length' was not 0, got " + de::toString(outlen));
2623*35238bceSAndroid Build Coastguard Worker else
2624*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Query returned length: " << outlen << TestLog::EndMessage;
2625*35238bceSAndroid Build Coastguard Worker
2626*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Setting label to string: \"" << msg << "\"" << TestLog::EndMessage;
2627*35238bceSAndroid Build Coastguard Worker gl.objectLabel(GL_SHADER, shader, -1, msg);
2628*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "objectLabel");
2629*35238bceSAndroid Build Coastguard Worker
2630*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Querying label length" << TestLog::EndMessage;
2631*35238bceSAndroid Build Coastguard Worker outlen = -1;
2632*35238bceSAndroid Build Coastguard Worker gl.getObjectLabel(GL_SHADER, shader, 0, &outlen, DE_NULL);
2633*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "getObjectLabel");
2634*35238bceSAndroid Build Coastguard Worker
2635*35238bceSAndroid Build Coastguard Worker if (outlen != 21)
2636*35238bceSAndroid Build Coastguard Worker result.fail("'length' was not 21, got " + de::toString(outlen));
2637*35238bceSAndroid Build Coastguard Worker else
2638*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Query returned length: " << outlen << TestLog::EndMessage;
2639*35238bceSAndroid Build Coastguard Worker }
2640*35238bceSAndroid Build Coastguard Worker
2641*35238bceSAndroid Build Coastguard Worker {
2642*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection section(m_testCtx.getLog(), "Sync", "Sync object");
2643*35238bceSAndroid Build Coastguard Worker
2644*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Querying label length" << TestLog::EndMessage;
2645*35238bceSAndroid Build Coastguard Worker outlen = -1;
2646*35238bceSAndroid Build Coastguard Worker gl.getObjectPtrLabel(sync, 0, &outlen, DE_NULL);
2647*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "getObjectPtrLabel");
2648*35238bceSAndroid Build Coastguard Worker
2649*35238bceSAndroid Build Coastguard Worker if (outlen != 0)
2650*35238bceSAndroid Build Coastguard Worker result.fail("'length' was not 0, got " + de::toString(outlen));
2651*35238bceSAndroid Build Coastguard Worker else
2652*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Query returned length: " << outlen << TestLog::EndMessage;
2653*35238bceSAndroid Build Coastguard Worker
2654*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Setting label to string: \"" << msg << "\"" << TestLog::EndMessage;
2655*35238bceSAndroid Build Coastguard Worker gl.objectPtrLabel(sync, -1, msg);
2656*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "objectPtrLabel");
2657*35238bceSAndroid Build Coastguard Worker
2658*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Querying label length" << TestLog::EndMessage;
2659*35238bceSAndroid Build Coastguard Worker outlen = -1;
2660*35238bceSAndroid Build Coastguard Worker gl.getObjectPtrLabel(sync, 0, &outlen, DE_NULL);
2661*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.getError(), "getObjectPtrLabel");
2662*35238bceSAndroid Build Coastguard Worker
2663*35238bceSAndroid Build Coastguard Worker if (outlen != 21)
2664*35238bceSAndroid Build Coastguard Worker result.fail("'length' was not 21, got " + de::toString(outlen));
2665*35238bceSAndroid Build Coastguard Worker else
2666*35238bceSAndroid Build Coastguard Worker m_testCtx.getLog() << TestLog::Message << "Query returned length: " << outlen << TestLog::EndMessage;
2667*35238bceSAndroid Build Coastguard Worker }
2668*35238bceSAndroid Build Coastguard Worker
2669*35238bceSAndroid Build Coastguard Worker gl.deleteShader(shader);
2670*35238bceSAndroid Build Coastguard Worker gl.deleteSync(sync);
2671*35238bceSAndroid Build Coastguard Worker
2672*35238bceSAndroid Build Coastguard Worker result.setTestContextResult(m_testCtx);
2673*35238bceSAndroid Build Coastguard Worker return STOP;
2674*35238bceSAndroid Build Coastguard Worker }
2675*35238bceSAndroid Build Coastguard Worker
2676*35238bceSAndroid Build Coastguard Worker class LimitQueryCase : public TestCase
2677*35238bceSAndroid Build Coastguard Worker {
2678*35238bceSAndroid Build Coastguard Worker public:
2679*35238bceSAndroid Build Coastguard Worker LimitQueryCase(Context &context, const char *name, const char *description, glw::GLenum target, int limit,
2680*35238bceSAndroid Build Coastguard Worker gls::StateQueryUtil::QueryType type);
2681*35238bceSAndroid Build Coastguard Worker
2682*35238bceSAndroid Build Coastguard Worker IterateResult iterate(void);
2683*35238bceSAndroid Build Coastguard Worker
2684*35238bceSAndroid Build Coastguard Worker private:
2685*35238bceSAndroid Build Coastguard Worker const gls::StateQueryUtil::QueryType m_type;
2686*35238bceSAndroid Build Coastguard Worker const int m_limit;
2687*35238bceSAndroid Build Coastguard Worker const glw::GLenum m_target;
2688*35238bceSAndroid Build Coastguard Worker };
2689*35238bceSAndroid Build Coastguard Worker
LimitQueryCase(Context & context,const char * name,const char * description,glw::GLenum target,int limit,gls::StateQueryUtil::QueryType type)2690*35238bceSAndroid Build Coastguard Worker LimitQueryCase::LimitQueryCase(Context &context, const char *name, const char *description, glw::GLenum target,
2691*35238bceSAndroid Build Coastguard Worker int limit, gls::StateQueryUtil::QueryType type)
2692*35238bceSAndroid Build Coastguard Worker : TestCase(context, name, description)
2693*35238bceSAndroid Build Coastguard Worker , m_type(type)
2694*35238bceSAndroid Build Coastguard Worker , m_limit(limit)
2695*35238bceSAndroid Build Coastguard Worker , m_target(target)
2696*35238bceSAndroid Build Coastguard Worker {
2697*35238bceSAndroid Build Coastguard Worker }
2698*35238bceSAndroid Build Coastguard Worker
iterate(void)2699*35238bceSAndroid Build Coastguard Worker LimitQueryCase::IterateResult LimitQueryCase::iterate(void)
2700*35238bceSAndroid Build Coastguard Worker {
2701*35238bceSAndroid Build Coastguard Worker TCU_CHECK_AND_THROW(NotSupportedError, isKHRDebugSupported(m_context), "GL_KHR_debug is not supported");
2702*35238bceSAndroid Build Coastguard Worker
2703*35238bceSAndroid Build Coastguard Worker glu::CallLogWrapper gl(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
2704*35238bceSAndroid Build Coastguard Worker tcu::ResultCollector result(m_testCtx.getLog(), " // ERROR: ");
2705*35238bceSAndroid Build Coastguard Worker
2706*35238bceSAndroid Build Coastguard Worker gl.enableLogging(true);
2707*35238bceSAndroid Build Coastguard Worker gls::StateQueryUtil::verifyStateIntegerMin(result, gl, m_target, m_limit, m_type);
2708*35238bceSAndroid Build Coastguard Worker
2709*35238bceSAndroid Build Coastguard Worker result.setTestContextResult(m_testCtx);
2710*35238bceSAndroid Build Coastguard Worker return STOP;
2711*35238bceSAndroid Build Coastguard Worker }
2712*35238bceSAndroid Build Coastguard Worker
2713*35238bceSAndroid Build Coastguard Worker class IsEnabledCase : public TestCase
2714*35238bceSAndroid Build Coastguard Worker {
2715*35238bceSAndroid Build Coastguard Worker public:
2716*35238bceSAndroid Build Coastguard Worker enum InitialValue
2717*35238bceSAndroid Build Coastguard Worker {
2718*35238bceSAndroid Build Coastguard Worker INITIAL_CTX_IS_DEBUG = 0,
2719*35238bceSAndroid Build Coastguard Worker INITIAL_FALSE,
2720*35238bceSAndroid Build Coastguard Worker };
2721*35238bceSAndroid Build Coastguard Worker
2722*35238bceSAndroid Build Coastguard Worker IsEnabledCase(Context &context, const char *name, const char *description, glw::GLenum target, InitialValue initial,
2723*35238bceSAndroid Build Coastguard Worker gls::StateQueryUtil::QueryType type);
2724*35238bceSAndroid Build Coastguard Worker
2725*35238bceSAndroid Build Coastguard Worker IterateResult iterate(void);
2726*35238bceSAndroid Build Coastguard Worker
2727*35238bceSAndroid Build Coastguard Worker private:
2728*35238bceSAndroid Build Coastguard Worker const gls::StateQueryUtil::QueryType m_type;
2729*35238bceSAndroid Build Coastguard Worker const glw::GLenum m_target;
2730*35238bceSAndroid Build Coastguard Worker const InitialValue m_initial;
2731*35238bceSAndroid Build Coastguard Worker };
2732*35238bceSAndroid Build Coastguard Worker
IsEnabledCase(Context & context,const char * name,const char * description,glw::GLenum target,InitialValue initial,gls::StateQueryUtil::QueryType type)2733*35238bceSAndroid Build Coastguard Worker IsEnabledCase::IsEnabledCase(Context &context, const char *name, const char *description, glw::GLenum target,
2734*35238bceSAndroid Build Coastguard Worker InitialValue initial, gls::StateQueryUtil::QueryType type)
2735*35238bceSAndroid Build Coastguard Worker : TestCase(context, name, description)
2736*35238bceSAndroid Build Coastguard Worker , m_type(type)
2737*35238bceSAndroid Build Coastguard Worker , m_target(target)
2738*35238bceSAndroid Build Coastguard Worker , m_initial(initial)
2739*35238bceSAndroid Build Coastguard Worker {
2740*35238bceSAndroid Build Coastguard Worker }
2741*35238bceSAndroid Build Coastguard Worker
iterate(void)2742*35238bceSAndroid Build Coastguard Worker IsEnabledCase::IterateResult IsEnabledCase::iterate(void)
2743*35238bceSAndroid Build Coastguard Worker {
2744*35238bceSAndroid Build Coastguard Worker TCU_CHECK_AND_THROW(NotSupportedError, isKHRDebugSupported(m_context), "GL_KHR_debug is not supported");
2745*35238bceSAndroid Build Coastguard Worker
2746*35238bceSAndroid Build Coastguard Worker glu::CallLogWrapper gl(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
2747*35238bceSAndroid Build Coastguard Worker tcu::ResultCollector result(m_testCtx.getLog(), " // ERROR: ");
2748*35238bceSAndroid Build Coastguard Worker bool initial;
2749*35238bceSAndroid Build Coastguard Worker
2750*35238bceSAndroid Build Coastguard Worker gl.enableLogging(true);
2751*35238bceSAndroid Build Coastguard Worker
2752*35238bceSAndroid Build Coastguard Worker if (m_initial == INITIAL_FALSE)
2753*35238bceSAndroid Build Coastguard Worker initial = false;
2754*35238bceSAndroid Build Coastguard Worker else
2755*35238bceSAndroid Build Coastguard Worker {
2756*35238bceSAndroid Build Coastguard Worker DE_ASSERT(m_initial == INITIAL_CTX_IS_DEBUG);
2757*35238bceSAndroid Build Coastguard Worker initial = (m_context.getRenderContext().getType().getFlags() & glu::CONTEXT_DEBUG) != 0;
2758*35238bceSAndroid Build Coastguard Worker }
2759*35238bceSAndroid Build Coastguard Worker
2760*35238bceSAndroid Build Coastguard Worker // check inital value
2761*35238bceSAndroid Build Coastguard Worker gls::StateQueryUtil::verifyStateBoolean(result, gl, m_target, initial, m_type);
2762*35238bceSAndroid Build Coastguard Worker
2763*35238bceSAndroid Build Coastguard Worker // check toggle
2764*35238bceSAndroid Build Coastguard Worker
2765*35238bceSAndroid Build Coastguard Worker gl.glEnable(m_target);
2766*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glEnable");
2767*35238bceSAndroid Build Coastguard Worker
2768*35238bceSAndroid Build Coastguard Worker gls::StateQueryUtil::verifyStateBoolean(result, gl, m_target, true, m_type);
2769*35238bceSAndroid Build Coastguard Worker
2770*35238bceSAndroid Build Coastguard Worker gl.glDisable(m_target);
2771*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glDisable");
2772*35238bceSAndroid Build Coastguard Worker
2773*35238bceSAndroid Build Coastguard Worker gls::StateQueryUtil::verifyStateBoolean(result, gl, m_target, false, m_type);
2774*35238bceSAndroid Build Coastguard Worker
2775*35238bceSAndroid Build Coastguard Worker result.setTestContextResult(m_testCtx);
2776*35238bceSAndroid Build Coastguard Worker return STOP;
2777*35238bceSAndroid Build Coastguard Worker }
2778*35238bceSAndroid Build Coastguard Worker
2779*35238bceSAndroid Build Coastguard Worker class PositiveIntegerCase : public TestCase
2780*35238bceSAndroid Build Coastguard Worker {
2781*35238bceSAndroid Build Coastguard Worker public:
2782*35238bceSAndroid Build Coastguard Worker PositiveIntegerCase(Context &context, const char *name, const char *description, glw::GLenum target,
2783*35238bceSAndroid Build Coastguard Worker gls::StateQueryUtil::QueryType type);
2784*35238bceSAndroid Build Coastguard Worker
2785*35238bceSAndroid Build Coastguard Worker IterateResult iterate(void);
2786*35238bceSAndroid Build Coastguard Worker
2787*35238bceSAndroid Build Coastguard Worker private:
2788*35238bceSAndroid Build Coastguard Worker const gls::StateQueryUtil::QueryType m_type;
2789*35238bceSAndroid Build Coastguard Worker const glw::GLenum m_target;
2790*35238bceSAndroid Build Coastguard Worker };
2791*35238bceSAndroid Build Coastguard Worker
PositiveIntegerCase(Context & context,const char * name,const char * description,glw::GLenum target,gls::StateQueryUtil::QueryType type)2792*35238bceSAndroid Build Coastguard Worker PositiveIntegerCase::PositiveIntegerCase(Context &context, const char *name, const char *description,
2793*35238bceSAndroid Build Coastguard Worker glw::GLenum target, gls::StateQueryUtil::QueryType type)
2794*35238bceSAndroid Build Coastguard Worker : TestCase(context, name, description)
2795*35238bceSAndroid Build Coastguard Worker , m_type(type)
2796*35238bceSAndroid Build Coastguard Worker , m_target(target)
2797*35238bceSAndroid Build Coastguard Worker {
2798*35238bceSAndroid Build Coastguard Worker }
2799*35238bceSAndroid Build Coastguard Worker
iterate(void)2800*35238bceSAndroid Build Coastguard Worker PositiveIntegerCase::IterateResult PositiveIntegerCase::iterate(void)
2801*35238bceSAndroid Build Coastguard Worker {
2802*35238bceSAndroid Build Coastguard Worker TCU_CHECK_AND_THROW(NotSupportedError, isKHRDebugSupported(m_context), "GL_KHR_debug is not supported");
2803*35238bceSAndroid Build Coastguard Worker
2804*35238bceSAndroid Build Coastguard Worker glu::CallLogWrapper gl(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
2805*35238bceSAndroid Build Coastguard Worker tcu::ResultCollector result(m_testCtx.getLog(), " // ERROR: ");
2806*35238bceSAndroid Build Coastguard Worker
2807*35238bceSAndroid Build Coastguard Worker gl.enableLogging(true);
2808*35238bceSAndroid Build Coastguard Worker gls::StateQueryUtil::verifyStateIntegerMin(result, gl, m_target, 0, m_type);
2809*35238bceSAndroid Build Coastguard Worker
2810*35238bceSAndroid Build Coastguard Worker result.setTestContextResult(m_testCtx);
2811*35238bceSAndroid Build Coastguard Worker return STOP;
2812*35238bceSAndroid Build Coastguard Worker }
2813*35238bceSAndroid Build Coastguard Worker
2814*35238bceSAndroid Build Coastguard Worker class GroupStackDepthQueryCase : public TestCase
2815*35238bceSAndroid Build Coastguard Worker {
2816*35238bceSAndroid Build Coastguard Worker public:
2817*35238bceSAndroid Build Coastguard Worker GroupStackDepthQueryCase(Context &context, const char *name, const char *description,
2818*35238bceSAndroid Build Coastguard Worker gls::StateQueryUtil::QueryType type);
2819*35238bceSAndroid Build Coastguard Worker
2820*35238bceSAndroid Build Coastguard Worker IterateResult iterate(void);
2821*35238bceSAndroid Build Coastguard Worker
2822*35238bceSAndroid Build Coastguard Worker private:
2823*35238bceSAndroid Build Coastguard Worker const gls::StateQueryUtil::QueryType m_type;
2824*35238bceSAndroid Build Coastguard Worker };
2825*35238bceSAndroid Build Coastguard Worker
GroupStackDepthQueryCase(Context & context,const char * name,const char * description,gls::StateQueryUtil::QueryType type)2826*35238bceSAndroid Build Coastguard Worker GroupStackDepthQueryCase::GroupStackDepthQueryCase(Context &context, const char *name, const char *description,
2827*35238bceSAndroid Build Coastguard Worker gls::StateQueryUtil::QueryType type)
2828*35238bceSAndroid Build Coastguard Worker : TestCase(context, name, description)
2829*35238bceSAndroid Build Coastguard Worker , m_type(type)
2830*35238bceSAndroid Build Coastguard Worker {
2831*35238bceSAndroid Build Coastguard Worker }
2832*35238bceSAndroid Build Coastguard Worker
iterate(void)2833*35238bceSAndroid Build Coastguard Worker GroupStackDepthQueryCase::IterateResult GroupStackDepthQueryCase::iterate(void)
2834*35238bceSAndroid Build Coastguard Worker {
2835*35238bceSAndroid Build Coastguard Worker TCU_CHECK_AND_THROW(NotSupportedError, isKHRDebugSupported(m_context), "GL_KHR_debug is not supported");
2836*35238bceSAndroid Build Coastguard Worker
2837*35238bceSAndroid Build Coastguard Worker glu::CallLogWrapper gl(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
2838*35238bceSAndroid Build Coastguard Worker tcu::ResultCollector result(m_testCtx.getLog(), " // ERROR: ");
2839*35238bceSAndroid Build Coastguard Worker
2840*35238bceSAndroid Build Coastguard Worker gl.enableLogging(true);
2841*35238bceSAndroid Build Coastguard Worker
2842*35238bceSAndroid Build Coastguard Worker {
2843*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial");
2844*35238bceSAndroid Build Coastguard Worker
2845*35238bceSAndroid Build Coastguard Worker gls::StateQueryUtil::verifyStateInteger(result, gl, GL_DEBUG_GROUP_STACK_DEPTH, 1, m_type);
2846*35238bceSAndroid Build Coastguard Worker }
2847*35238bceSAndroid Build Coastguard Worker
2848*35238bceSAndroid Build Coastguard Worker {
2849*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection section(m_testCtx.getLog(), "Scoped", "Scoped");
2850*35238bceSAndroid Build Coastguard Worker
2851*35238bceSAndroid Build Coastguard Worker gl.glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 1, -1, "Application group 1");
2852*35238bceSAndroid Build Coastguard Worker gls::StateQueryUtil::verifyStateInteger(result, gl, GL_DEBUG_GROUP_STACK_DEPTH, 2, m_type);
2853*35238bceSAndroid Build Coastguard Worker gl.glPopDebugGroup();
2854*35238bceSAndroid Build Coastguard Worker }
2855*35238bceSAndroid Build Coastguard Worker
2856*35238bceSAndroid Build Coastguard Worker result.setTestContextResult(m_testCtx);
2857*35238bceSAndroid Build Coastguard Worker return STOP;
2858*35238bceSAndroid Build Coastguard Worker }
2859*35238bceSAndroid Build Coastguard Worker
emptyCallback(GLenum,GLenum,GLuint,GLenum,GLsizei,const char *,const void *)2860*35238bceSAndroid Build Coastguard Worker extern "C" void GLW_APIENTRY emptyCallback(GLenum, GLenum, GLuint, GLenum, GLsizei, const char *, const void *)
2861*35238bceSAndroid Build Coastguard Worker {
2862*35238bceSAndroid Build Coastguard Worker // empty
2863*35238bceSAndroid Build Coastguard Worker }
2864*35238bceSAndroid Build Coastguard Worker
2865*35238bceSAndroid Build Coastguard Worker class DebugCallbackFunctionCase : public TestCase
2866*35238bceSAndroid Build Coastguard Worker {
2867*35238bceSAndroid Build Coastguard Worker public:
2868*35238bceSAndroid Build Coastguard Worker DebugCallbackFunctionCase(Context &context, const char *name, const char *description);
2869*35238bceSAndroid Build Coastguard Worker IterateResult iterate(void);
2870*35238bceSAndroid Build Coastguard Worker };
2871*35238bceSAndroid Build Coastguard Worker
DebugCallbackFunctionCase(Context & context,const char * name,const char * description)2872*35238bceSAndroid Build Coastguard Worker DebugCallbackFunctionCase::DebugCallbackFunctionCase(Context &context, const char *name, const char *description)
2873*35238bceSAndroid Build Coastguard Worker : TestCase(context, name, description)
2874*35238bceSAndroid Build Coastguard Worker {
2875*35238bceSAndroid Build Coastguard Worker }
2876*35238bceSAndroid Build Coastguard Worker
iterate(void)2877*35238bceSAndroid Build Coastguard Worker DebugCallbackFunctionCase::IterateResult DebugCallbackFunctionCase::iterate(void)
2878*35238bceSAndroid Build Coastguard Worker {
2879*35238bceSAndroid Build Coastguard Worker using namespace gls::StateQueryUtil;
2880*35238bceSAndroid Build Coastguard Worker TCU_CHECK_AND_THROW(NotSupportedError, isKHRDebugSupported(m_context), "GL_KHR_debug is not supported");
2881*35238bceSAndroid Build Coastguard Worker
2882*35238bceSAndroid Build Coastguard Worker glu::CallLogWrapper gl(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
2883*35238bceSAndroid Build Coastguard Worker tcu::ResultCollector result(m_testCtx.getLog(), " // ERROR: ");
2884*35238bceSAndroid Build Coastguard Worker
2885*35238bceSAndroid Build Coastguard Worker gl.enableLogging(true);
2886*35238bceSAndroid Build Coastguard Worker
2887*35238bceSAndroid Build Coastguard Worker {
2888*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial");
2889*35238bceSAndroid Build Coastguard Worker
2890*35238bceSAndroid Build Coastguard Worker verifyStatePointer(result, gl, GL_DEBUG_CALLBACK_FUNCTION, 0, QUERY_POINTER);
2891*35238bceSAndroid Build Coastguard Worker }
2892*35238bceSAndroid Build Coastguard Worker
2893*35238bceSAndroid Build Coastguard Worker {
2894*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection section(m_testCtx.getLog(), "Set", "Set");
2895*35238bceSAndroid Build Coastguard Worker
2896*35238bceSAndroid Build Coastguard Worker gl.glDebugMessageCallback(emptyCallback, DE_NULL);
2897*35238bceSAndroid Build Coastguard Worker verifyStatePointer(result, gl, GL_DEBUG_CALLBACK_FUNCTION, (const void *)emptyCallback, QUERY_POINTER);
2898*35238bceSAndroid Build Coastguard Worker }
2899*35238bceSAndroid Build Coastguard Worker
2900*35238bceSAndroid Build Coastguard Worker result.setTestContextResult(m_testCtx);
2901*35238bceSAndroid Build Coastguard Worker return STOP;
2902*35238bceSAndroid Build Coastguard Worker }
2903*35238bceSAndroid Build Coastguard Worker
2904*35238bceSAndroid Build Coastguard Worker class DebugCallbackUserParamCase : public TestCase
2905*35238bceSAndroid Build Coastguard Worker {
2906*35238bceSAndroid Build Coastguard Worker public:
2907*35238bceSAndroid Build Coastguard Worker DebugCallbackUserParamCase(Context &context, const char *name, const char *description);
2908*35238bceSAndroid Build Coastguard Worker IterateResult iterate(void);
2909*35238bceSAndroid Build Coastguard Worker };
2910*35238bceSAndroid Build Coastguard Worker
DebugCallbackUserParamCase(Context & context,const char * name,const char * description)2911*35238bceSAndroid Build Coastguard Worker DebugCallbackUserParamCase::DebugCallbackUserParamCase(Context &context, const char *name, const char *description)
2912*35238bceSAndroid Build Coastguard Worker : TestCase(context, name, description)
2913*35238bceSAndroid Build Coastguard Worker {
2914*35238bceSAndroid Build Coastguard Worker }
2915*35238bceSAndroid Build Coastguard Worker
iterate(void)2916*35238bceSAndroid Build Coastguard Worker DebugCallbackUserParamCase::IterateResult DebugCallbackUserParamCase::iterate(void)
2917*35238bceSAndroid Build Coastguard Worker {
2918*35238bceSAndroid Build Coastguard Worker using namespace gls::StateQueryUtil;
2919*35238bceSAndroid Build Coastguard Worker
2920*35238bceSAndroid Build Coastguard Worker TCU_CHECK_AND_THROW(NotSupportedError, isKHRDebugSupported(m_context), "GL_KHR_debug is not supported");
2921*35238bceSAndroid Build Coastguard Worker
2922*35238bceSAndroid Build Coastguard Worker glu::CallLogWrapper gl(m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
2923*35238bceSAndroid Build Coastguard Worker tcu::ResultCollector result(m_testCtx.getLog(), " // ERROR: ");
2924*35238bceSAndroid Build Coastguard Worker
2925*35238bceSAndroid Build Coastguard Worker gl.enableLogging(true);
2926*35238bceSAndroid Build Coastguard Worker
2927*35238bceSAndroid Build Coastguard Worker {
2928*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection section(m_testCtx.getLog(), "Initial", "Initial");
2929*35238bceSAndroid Build Coastguard Worker
2930*35238bceSAndroid Build Coastguard Worker verifyStatePointer(result, gl, GL_DEBUG_CALLBACK_USER_PARAM, 0, QUERY_POINTER);
2931*35238bceSAndroid Build Coastguard Worker }
2932*35238bceSAndroid Build Coastguard Worker
2933*35238bceSAndroid Build Coastguard Worker {
2934*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection section(m_testCtx.getLog(), "Set", "Set");
2935*35238bceSAndroid Build Coastguard Worker const void *param = (void *)(int *)0x123;
2936*35238bceSAndroid Build Coastguard Worker
2937*35238bceSAndroid Build Coastguard Worker gl.glDebugMessageCallback(emptyCallback, param);
2938*35238bceSAndroid Build Coastguard Worker verifyStatePointer(result, gl, GL_DEBUG_CALLBACK_USER_PARAM, param, QUERY_POINTER);
2939*35238bceSAndroid Build Coastguard Worker }
2940*35238bceSAndroid Build Coastguard Worker
2941*35238bceSAndroid Build Coastguard Worker result.setTestContextResult(m_testCtx);
2942*35238bceSAndroid Build Coastguard Worker return STOP;
2943*35238bceSAndroid Build Coastguard Worker }
2944*35238bceSAndroid Build Coastguard Worker
2945*35238bceSAndroid Build Coastguard Worker } // namespace
2946*35238bceSAndroid Build Coastguard Worker
DebugTests(Context & context)2947*35238bceSAndroid Build Coastguard Worker DebugTests::DebugTests(Context &context) : TestCaseGroup(context, "debug", "Debug tests")
2948*35238bceSAndroid Build Coastguard Worker {
2949*35238bceSAndroid Build Coastguard Worker }
2950*35238bceSAndroid Build Coastguard Worker
2951*35238bceSAndroid Build Coastguard Worker enum CaseType
2952*35238bceSAndroid Build Coastguard Worker {
2953*35238bceSAndroid Build Coastguard Worker CASETYPE_CALLBACK = 0,
2954*35238bceSAndroid Build Coastguard Worker CASETYPE_LOG,
2955*35238bceSAndroid Build Coastguard Worker CASETYPE_GETERROR,
2956*35238bceSAndroid Build Coastguard Worker
2957*35238bceSAndroid Build Coastguard Worker CASETYPE_LAST
2958*35238bceSAndroid Build Coastguard Worker };
2959*35238bceSAndroid Build Coastguard Worker
createCase(CaseType type,Context & ctx,const char * name,const char * desc,TestFunctionWrapper function)2960*35238bceSAndroid Build Coastguard Worker tcu::TestNode *createCase(CaseType type, Context &ctx, const char *name, const char *desc, TestFunctionWrapper function)
2961*35238bceSAndroid Build Coastguard Worker {
2962*35238bceSAndroid Build Coastguard Worker switch (type)
2963*35238bceSAndroid Build Coastguard Worker {
2964*35238bceSAndroid Build Coastguard Worker case CASETYPE_CALLBACK:
2965*35238bceSAndroid Build Coastguard Worker return new CallbackErrorCase(ctx, name, desc, function);
2966*35238bceSAndroid Build Coastguard Worker case CASETYPE_LOG:
2967*35238bceSAndroid Build Coastguard Worker return new LogErrorCase(ctx, name, desc, function);
2968*35238bceSAndroid Build Coastguard Worker case CASETYPE_GETERROR:
2969*35238bceSAndroid Build Coastguard Worker return new GetErrorCase(ctx, name, desc, function);
2970*35238bceSAndroid Build Coastguard Worker
2971*35238bceSAndroid Build Coastguard Worker default:
2972*35238bceSAndroid Build Coastguard Worker DE_FATAL("Invalid type");
2973*35238bceSAndroid Build Coastguard Worker }
2974*35238bceSAndroid Build Coastguard Worker
2975*35238bceSAndroid Build Coastguard Worker return DE_NULL;
2976*35238bceSAndroid Build Coastguard Worker }
2977*35238bceSAndroid Build Coastguard Worker
createChildCases(CaseType type,Context & ctx,const char * name,const char * desc,const vector<FunctionContainer> & funcs)2978*35238bceSAndroid Build Coastguard Worker tcu::TestCaseGroup *createChildCases(CaseType type, Context &ctx, const char *name, const char *desc,
2979*35238bceSAndroid Build Coastguard Worker const vector<FunctionContainer> &funcs)
2980*35238bceSAndroid Build Coastguard Worker {
2981*35238bceSAndroid Build Coastguard Worker tcu::TestCaseGroup *host = new tcu::TestCaseGroup(ctx.getTestContext(), name, desc);
2982*35238bceSAndroid Build Coastguard Worker
2983*35238bceSAndroid Build Coastguard Worker for (size_t ndx = 0; ndx < funcs.size(); ndx++)
2984*35238bceSAndroid Build Coastguard Worker host->addChild(createCase(type, ctx, funcs[ndx].name, funcs[ndx].desc, funcs[ndx].function));
2985*35238bceSAndroid Build Coastguard Worker
2986*35238bceSAndroid Build Coastguard Worker return host;
2987*35238bceSAndroid Build Coastguard Worker }
2988*35238bceSAndroid Build Coastguard Worker
wrapCoreFunctions(const vector<NegativeTestShared::FunctionContainer> & fns)2989*35238bceSAndroid Build Coastguard Worker vector<FunctionContainer> wrapCoreFunctions(const vector<NegativeTestShared::FunctionContainer> &fns)
2990*35238bceSAndroid Build Coastguard Worker {
2991*35238bceSAndroid Build Coastguard Worker vector<FunctionContainer> retVal;
2992*35238bceSAndroid Build Coastguard Worker
2993*35238bceSAndroid Build Coastguard Worker retVal.resize(fns.size());
2994*35238bceSAndroid Build Coastguard Worker for (int ndx = 0; ndx < (int)fns.size(); ++ndx)
2995*35238bceSAndroid Build Coastguard Worker {
2996*35238bceSAndroid Build Coastguard Worker retVal[ndx].function = TestFunctionWrapper(fns[ndx].function);
2997*35238bceSAndroid Build Coastguard Worker retVal[ndx].name = fns[ndx].name;
2998*35238bceSAndroid Build Coastguard Worker retVal[ndx].desc = fns[ndx].desc;
2999*35238bceSAndroid Build Coastguard Worker }
3000*35238bceSAndroid Build Coastguard Worker
3001*35238bceSAndroid Build Coastguard Worker return retVal;
3002*35238bceSAndroid Build Coastguard Worker }
3003*35238bceSAndroid Build Coastguard Worker
init(void)3004*35238bceSAndroid Build Coastguard Worker void DebugTests::init(void)
3005*35238bceSAndroid Build Coastguard Worker {
3006*35238bceSAndroid Build Coastguard Worker const vector<FunctionContainer> bufferFuncs =
3007*35238bceSAndroid Build Coastguard Worker wrapCoreFunctions(NegativeTestShared::getNegativeBufferApiTestFunctions());
3008*35238bceSAndroid Build Coastguard Worker const vector<FunctionContainer> textureFuncs =
3009*35238bceSAndroid Build Coastguard Worker wrapCoreFunctions(NegativeTestShared::getNegativeTextureApiTestFunctions());
3010*35238bceSAndroid Build Coastguard Worker const vector<FunctionContainer> shaderFuncs =
3011*35238bceSAndroid Build Coastguard Worker wrapCoreFunctions(NegativeTestShared::getNegativeShaderApiTestFunctions());
3012*35238bceSAndroid Build Coastguard Worker const vector<FunctionContainer> fragmentFuncs =
3013*35238bceSAndroid Build Coastguard Worker wrapCoreFunctions(NegativeTestShared::getNegativeFragmentApiTestFunctions());
3014*35238bceSAndroid Build Coastguard Worker const vector<FunctionContainer> vaFuncs =
3015*35238bceSAndroid Build Coastguard Worker wrapCoreFunctions(NegativeTestShared::getNegativeVertexArrayApiTestFunctions());
3016*35238bceSAndroid Build Coastguard Worker const vector<FunctionContainer> stateFuncs =
3017*35238bceSAndroid Build Coastguard Worker wrapCoreFunctions(NegativeTestShared::getNegativeStateApiTestFunctions());
3018*35238bceSAndroid Build Coastguard Worker const vector<FunctionContainer> tessellationFuncs =
3019*35238bceSAndroid Build Coastguard Worker wrapCoreFunctions(NegativeTestShared::getNegativeTessellationTestFunctions());
3020*35238bceSAndroid Build Coastguard Worker const vector<FunctionContainer> atomicCounterFuncs =
3021*35238bceSAndroid Build Coastguard Worker wrapCoreFunctions(NegativeTestShared::getNegativeAtomicCounterTestFunctions());
3022*35238bceSAndroid Build Coastguard Worker const vector<FunctionContainer> imageLoadFuncs =
3023*35238bceSAndroid Build Coastguard Worker wrapCoreFunctions(NegativeTestShared::getNegativeShaderImageLoadTestFunctions());
3024*35238bceSAndroid Build Coastguard Worker const vector<FunctionContainer> imageStoreFuncs =
3025*35238bceSAndroid Build Coastguard Worker wrapCoreFunctions(NegativeTestShared::getNegativeShaderImageStoreTestFunctions());
3026*35238bceSAndroid Build Coastguard Worker const vector<FunctionContainer> imageAtomicFuncs =
3027*35238bceSAndroid Build Coastguard Worker wrapCoreFunctions(NegativeTestShared::getNegativeShaderImageAtomicTestFunctions());
3028*35238bceSAndroid Build Coastguard Worker const vector<FunctionContainer> imageAtomicExchangeFuncs =
3029*35238bceSAndroid Build Coastguard Worker wrapCoreFunctions(NegativeTestShared::getNegativeShaderImageAtomicExchangeTestFunctions());
3030*35238bceSAndroid Build Coastguard Worker const vector<FunctionContainer> shaderFunctionFuncs =
3031*35238bceSAndroid Build Coastguard Worker wrapCoreFunctions(NegativeTestShared::getNegativeShaderFunctionTestFunctions());
3032*35238bceSAndroid Build Coastguard Worker const vector<FunctionContainer> shaderDirectiveFuncs =
3033*35238bceSAndroid Build Coastguard Worker wrapCoreFunctions(NegativeTestShared::getNegativeShaderDirectiveTestFunctions());
3034*35238bceSAndroid Build Coastguard Worker const vector<FunctionContainer> ssboBlockFuncs =
3035*35238bceSAndroid Build Coastguard Worker wrapCoreFunctions(NegativeTestShared::getNegativeSSBOBlockTestFunctions());
3036*35238bceSAndroid Build Coastguard Worker const vector<FunctionContainer> preciseFuncs =
3037*35238bceSAndroid Build Coastguard Worker wrapCoreFunctions(NegativeTestShared::getNegativePreciseTestFunctions());
3038*35238bceSAndroid Build Coastguard Worker const vector<FunctionContainer> advancedBlendFuncs =
3039*35238bceSAndroid Build Coastguard Worker wrapCoreFunctions(NegativeTestShared::getNegativeAdvancedBlendEquationTestFunctions());
3040*35238bceSAndroid Build Coastguard Worker const vector<FunctionContainer> shaderStorageFuncs =
3041*35238bceSAndroid Build Coastguard Worker wrapCoreFunctions(NegativeTestShared::getNegativeShaderStorageTestFunctions());
3042*35238bceSAndroid Build Coastguard Worker const vector<FunctionContainer> sampleVariablesFuncs =
3043*35238bceSAndroid Build Coastguard Worker wrapCoreFunctions(NegativeTestShared::getNegativeSampleVariablesTestFunctions());
3044*35238bceSAndroid Build Coastguard Worker const vector<FunctionContainer> computeFuncs =
3045*35238bceSAndroid Build Coastguard Worker wrapCoreFunctions(NegativeTestShared::getNegativeComputeTestFunctions());
3046*35238bceSAndroid Build Coastguard Worker const vector<FunctionContainer> framebufferFetchFuncs =
3047*35238bceSAndroid Build Coastguard Worker wrapCoreFunctions(NegativeTestShared::getNegativeShaderFramebufferFetchTestFunctions());
3048*35238bceSAndroid Build Coastguard Worker const vector<FunctionContainer> externalFuncs = getUserMessageFuncs();
3049*35238bceSAndroid Build Coastguard Worker
3050*35238bceSAndroid Build Coastguard Worker {
3051*35238bceSAndroid Build Coastguard Worker using namespace gls::StateQueryUtil;
3052*35238bceSAndroid Build Coastguard Worker
3053*35238bceSAndroid Build Coastguard Worker tcu::TestCaseGroup *const queries = new tcu::TestCaseGroup(m_testCtx, "state_query", "State query");
3054*35238bceSAndroid Build Coastguard Worker
3055*35238bceSAndroid Build Coastguard Worker static const struct
3056*35238bceSAndroid Build Coastguard Worker {
3057*35238bceSAndroid Build Coastguard Worker const char *name;
3058*35238bceSAndroid Build Coastguard Worker const char *targetName;
3059*35238bceSAndroid Build Coastguard Worker glw::GLenum target;
3060*35238bceSAndroid Build Coastguard Worker int limit;
3061*35238bceSAndroid Build Coastguard Worker } limits[] = {
3062*35238bceSAndroid Build Coastguard Worker {"max_debug_message_length", "MAX_DEBUG_MESSAGE_LENGTH", GL_MAX_DEBUG_MESSAGE_LENGTH, 1},
3063*35238bceSAndroid Build Coastguard Worker {"max_debug_logged_messages", "MAX_DEBUG_LOGGED_MESSAGES", GL_MAX_DEBUG_LOGGED_MESSAGES, 1},
3064*35238bceSAndroid Build Coastguard Worker {"max_debug_group_stack_depth", "MAX_DEBUG_GROUP_STACK_DEPTH", GL_MAX_DEBUG_GROUP_STACK_DEPTH, 64},
3065*35238bceSAndroid Build Coastguard Worker {"max_label_length", "MAX_LABEL_LENGTH", GL_MAX_LABEL_LENGTH, 256},
3066*35238bceSAndroid Build Coastguard Worker };
3067*35238bceSAndroid Build Coastguard Worker
3068*35238bceSAndroid Build Coastguard Worker addChild(queries);
3069*35238bceSAndroid Build Coastguard Worker
3070*35238bceSAndroid Build Coastguard Worker #define FOR_ALL_TYPES(X) \
3071*35238bceSAndroid Build Coastguard Worker do \
3072*35238bceSAndroid Build Coastguard Worker { \
3073*35238bceSAndroid Build Coastguard Worker { \
3074*35238bceSAndroid Build Coastguard Worker const char *const postfix = "_getboolean"; \
3075*35238bceSAndroid Build Coastguard Worker const QueryType queryType = QUERY_BOOLEAN; \
3076*35238bceSAndroid Build Coastguard Worker X; \
3077*35238bceSAndroid Build Coastguard Worker } \
3078*35238bceSAndroid Build Coastguard Worker { \
3079*35238bceSAndroid Build Coastguard Worker const char *const postfix = "_getinteger"; \
3080*35238bceSAndroid Build Coastguard Worker const QueryType queryType = QUERY_INTEGER; \
3081*35238bceSAndroid Build Coastguard Worker X; \
3082*35238bceSAndroid Build Coastguard Worker } \
3083*35238bceSAndroid Build Coastguard Worker { \
3084*35238bceSAndroid Build Coastguard Worker const char *const postfix = "_getinteger64"; \
3085*35238bceSAndroid Build Coastguard Worker const QueryType queryType = QUERY_INTEGER64; \
3086*35238bceSAndroid Build Coastguard Worker X; \
3087*35238bceSAndroid Build Coastguard Worker } \
3088*35238bceSAndroid Build Coastguard Worker { \
3089*35238bceSAndroid Build Coastguard Worker const char *const postfix = "_getfloat"; \
3090*35238bceSAndroid Build Coastguard Worker const QueryType queryType = QUERY_FLOAT; \
3091*35238bceSAndroid Build Coastguard Worker X; \
3092*35238bceSAndroid Build Coastguard Worker } \
3093*35238bceSAndroid Build Coastguard Worker } while (false)
3094*35238bceSAndroid Build Coastguard Worker #define FOR_ALL_ENABLE_TYPES(X) \
3095*35238bceSAndroid Build Coastguard Worker do \
3096*35238bceSAndroid Build Coastguard Worker { \
3097*35238bceSAndroid Build Coastguard Worker { \
3098*35238bceSAndroid Build Coastguard Worker const char *const postfix = "_isenabled"; \
3099*35238bceSAndroid Build Coastguard Worker const QueryType queryType = QUERY_ISENABLED; \
3100*35238bceSAndroid Build Coastguard Worker X; \
3101*35238bceSAndroid Build Coastguard Worker } \
3102*35238bceSAndroid Build Coastguard Worker FOR_ALL_TYPES(X); \
3103*35238bceSAndroid Build Coastguard Worker } while (false)
3104*35238bceSAndroid Build Coastguard Worker
3105*35238bceSAndroid Build Coastguard Worker for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(limits); ++ndx)
3106*35238bceSAndroid Build Coastguard Worker {
3107*35238bceSAndroid Build Coastguard Worker FOR_ALL_TYPES(
3108*35238bceSAndroid Build Coastguard Worker queries->addChild(new LimitQueryCase(m_context, (std::string(limits[ndx].name) + postfix).c_str(),
3109*35238bceSAndroid Build Coastguard Worker (std::string("Test ") + limits[ndx].targetName).c_str(),
3110*35238bceSAndroid Build Coastguard Worker limits[ndx].target, limits[ndx].limit, queryType)));
3111*35238bceSAndroid Build Coastguard Worker }
3112*35238bceSAndroid Build Coastguard Worker
3113*35238bceSAndroid Build Coastguard Worker FOR_ALL_ENABLE_TYPES(queries->addChild(
3114*35238bceSAndroid Build Coastguard Worker new IsEnabledCase(m_context, (std::string("debug_output") + postfix).c_str(), "Test DEBUG_OUTPUT",
3115*35238bceSAndroid Build Coastguard Worker GL_DEBUG_OUTPUT, IsEnabledCase::INITIAL_CTX_IS_DEBUG, queryType)));
3116*35238bceSAndroid Build Coastguard Worker FOR_ALL_ENABLE_TYPES(queries->addChild(new IsEnabledCase(
3117*35238bceSAndroid Build Coastguard Worker m_context, (std::string("debug_output_synchronous") + postfix).c_str(), "Test DEBUG_OUTPUT_SYNCHRONOUS",
3118*35238bceSAndroid Build Coastguard Worker GL_DEBUG_OUTPUT_SYNCHRONOUS, IsEnabledCase::INITIAL_FALSE, queryType)));
3119*35238bceSAndroid Build Coastguard Worker
3120*35238bceSAndroid Build Coastguard Worker FOR_ALL_TYPES(queries->addChild(
3121*35238bceSAndroid Build Coastguard Worker new PositiveIntegerCase(m_context, (std::string("debug_logged_messages") + postfix).c_str(),
3122*35238bceSAndroid Build Coastguard Worker "Test DEBUG_LOGGED_MESSAGES", GL_DEBUG_LOGGED_MESSAGES, queryType)));
3123*35238bceSAndroid Build Coastguard Worker FOR_ALL_TYPES(queries->addChild(new PositiveIntegerCase(
3124*35238bceSAndroid Build Coastguard Worker m_context, (std::string("debug_next_logged_message_length") + postfix).c_str(),
3125*35238bceSAndroid Build Coastguard Worker "Test DEBUG_NEXT_LOGGED_MESSAGE_LENGTH", GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH, queryType)));
3126*35238bceSAndroid Build Coastguard Worker FOR_ALL_TYPES(queries->addChild(
3127*35238bceSAndroid Build Coastguard Worker new GroupStackDepthQueryCase(m_context, (std::string("debug_group_stack_depth") + postfix).c_str(),
3128*35238bceSAndroid Build Coastguard Worker "Test DEBUG_GROUP_STACK_DEPTH", queryType)));
3129*35238bceSAndroid Build Coastguard Worker
3130*35238bceSAndroid Build Coastguard Worker queries->addChild(new DebugCallbackFunctionCase(m_context, "debug_callback_function_getpointer",
3131*35238bceSAndroid Build Coastguard Worker "Test DEBUG_CALLBACK_FUNCTION"));
3132*35238bceSAndroid Build Coastguard Worker queries->addChild(new DebugCallbackUserParamCase(m_context, "debug_callback_user_param_getpointer",
3133*35238bceSAndroid Build Coastguard Worker "Test DEBUG_CALLBACK_USER_PARAM"));
3134*35238bceSAndroid Build Coastguard Worker
3135*35238bceSAndroid Build Coastguard Worker #undef FOR_ALL_TYPES
3136*35238bceSAndroid Build Coastguard Worker #undef FOR_ALL_ENABLE_TYPES
3137*35238bceSAndroid Build Coastguard Worker }
3138*35238bceSAndroid Build Coastguard Worker
3139*35238bceSAndroid Build Coastguard Worker {
3140*35238bceSAndroid Build Coastguard Worker tcu::TestCaseGroup *const negative =
3141*35238bceSAndroid Build Coastguard Worker new tcu::TestCaseGroup(m_testCtx, "negative_coverage", "API error coverage with various reporting methods");
3142*35238bceSAndroid Build Coastguard Worker
3143*35238bceSAndroid Build Coastguard Worker addChild(negative);
3144*35238bceSAndroid Build Coastguard Worker {
3145*35238bceSAndroid Build Coastguard Worker tcu::TestCaseGroup *const host =
3146*35238bceSAndroid Build Coastguard Worker new tcu::TestCaseGroup(m_testCtx, "callbacks", "Reporting of standard API errors via callback");
3147*35238bceSAndroid Build Coastguard Worker
3148*35238bceSAndroid Build Coastguard Worker negative->addChild(host);
3149*35238bceSAndroid Build Coastguard Worker host->addChild(
3150*35238bceSAndroid Build Coastguard Worker createChildCases(CASETYPE_CALLBACK, m_context, "buffer", "Negative Buffer API Cases", bufferFuncs));
3151*35238bceSAndroid Build Coastguard Worker host->addChild(
3152*35238bceSAndroid Build Coastguard Worker createChildCases(CASETYPE_CALLBACK, m_context, "texture", "Negative Texture API Cases", textureFuncs));
3153*35238bceSAndroid Build Coastguard Worker host->addChild(
3154*35238bceSAndroid Build Coastguard Worker createChildCases(CASETYPE_CALLBACK, m_context, "shader", "Negative Shader API Cases", shaderFuncs));
3155*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_CALLBACK, m_context, "fragment", "Negative Fragment API Cases",
3156*35238bceSAndroid Build Coastguard Worker fragmentFuncs));
3157*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_CALLBACK, m_context, "vertex_array",
3158*35238bceSAndroid Build Coastguard Worker "Negative Vertex Array API Cases", vaFuncs));
3159*35238bceSAndroid Build Coastguard Worker host->addChild(
3160*35238bceSAndroid Build Coastguard Worker createChildCases(CASETYPE_CALLBACK, m_context, "state", "Negative GL State API Cases", stateFuncs));
3161*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_CALLBACK, m_context, "atomic_counter",
3162*35238bceSAndroid Build Coastguard Worker "Negative Atomic Counter API Cases", atomicCounterFuncs));
3163*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_CALLBACK, m_context, "shader_image_load",
3164*35238bceSAndroid Build Coastguard Worker "Negative Shader Image Load API Cases", imageLoadFuncs));
3165*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_CALLBACK, m_context, "shader_image_store",
3166*35238bceSAndroid Build Coastguard Worker "Negative Shader Image Store API Cases", imageStoreFuncs));
3167*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_CALLBACK, m_context, "shader_image_atomic",
3168*35238bceSAndroid Build Coastguard Worker "Negative Shader Image Atomic API Cases", imageAtomicFuncs));
3169*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_CALLBACK, m_context, "shader_image_exchange",
3170*35238bceSAndroid Build Coastguard Worker "Negative Shader Image Atomic Exchange API Cases",
3171*35238bceSAndroid Build Coastguard Worker imageAtomicExchangeFuncs));
3172*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_CALLBACK, m_context, "shader_function",
3173*35238bceSAndroid Build Coastguard Worker "Negative Shader Function Cases", shaderFunctionFuncs));
3174*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_CALLBACK, m_context, "shader_directive",
3175*35238bceSAndroid Build Coastguard Worker "Negative Shader Directive Cases", shaderDirectiveFuncs));
3176*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_CALLBACK, m_context, "ssbo_block", "Negative SSBO Block Cases",
3177*35238bceSAndroid Build Coastguard Worker ssboBlockFuncs));
3178*35238bceSAndroid Build Coastguard Worker host->addChild(
3179*35238bceSAndroid Build Coastguard Worker createChildCases(CASETYPE_CALLBACK, m_context, "precise", "Negative Precise Cases", preciseFuncs));
3180*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_CALLBACK, m_context, "advanced_blend",
3181*35238bceSAndroid Build Coastguard Worker "Negative Advanced Blend Equation Cases", advancedBlendFuncs));
3182*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_CALLBACK, m_context, "shader_storage",
3183*35238bceSAndroid Build Coastguard Worker "Negative Shader Storage Cases", shaderStorageFuncs));
3184*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_CALLBACK, m_context, "tessellation", "Negative Tessellation Cases",
3185*35238bceSAndroid Build Coastguard Worker tessellationFuncs));
3186*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_CALLBACK, m_context, "oes_sample_variables",
3187*35238bceSAndroid Build Coastguard Worker "Negative Sample Variables Cases", sampleVariablesFuncs));
3188*35238bceSAndroid Build Coastguard Worker host->addChild(
3189*35238bceSAndroid Build Coastguard Worker createChildCases(CASETYPE_CALLBACK, m_context, "compute", "Negative Compute Cases", computeFuncs));
3190*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_CALLBACK, m_context, "framebuffer_fetch",
3191*35238bceSAndroid Build Coastguard Worker "Negative Framebuffer Fetch Cases", framebufferFetchFuncs));
3192*35238bceSAndroid Build Coastguard Worker }
3193*35238bceSAndroid Build Coastguard Worker
3194*35238bceSAndroid Build Coastguard Worker {
3195*35238bceSAndroid Build Coastguard Worker tcu::TestCaseGroup *const host =
3196*35238bceSAndroid Build Coastguard Worker new tcu::TestCaseGroup(m_testCtx, "log", "Reporting of standard API errors via log");
3197*35238bceSAndroid Build Coastguard Worker
3198*35238bceSAndroid Build Coastguard Worker negative->addChild(host);
3199*35238bceSAndroid Build Coastguard Worker
3200*35238bceSAndroid Build Coastguard Worker host->addChild(
3201*35238bceSAndroid Build Coastguard Worker createChildCases(CASETYPE_LOG, m_context, "buffer", "Negative Buffer API Cases", bufferFuncs));
3202*35238bceSAndroid Build Coastguard Worker host->addChild(
3203*35238bceSAndroid Build Coastguard Worker createChildCases(CASETYPE_LOG, m_context, "texture", "Negative Texture API Cases", textureFuncs));
3204*35238bceSAndroid Build Coastguard Worker host->addChild(
3205*35238bceSAndroid Build Coastguard Worker createChildCases(CASETYPE_LOG, m_context, "shader", "Negative Shader API Cases", shaderFuncs));
3206*35238bceSAndroid Build Coastguard Worker host->addChild(
3207*35238bceSAndroid Build Coastguard Worker createChildCases(CASETYPE_LOG, m_context, "fragment", "Negative Fragment API Cases", fragmentFuncs));
3208*35238bceSAndroid Build Coastguard Worker host->addChild(
3209*35238bceSAndroid Build Coastguard Worker createChildCases(CASETYPE_LOG, m_context, "vertex_array", "Negative Vertex Array API Cases", vaFuncs));
3210*35238bceSAndroid Build Coastguard Worker host->addChild(
3211*35238bceSAndroid Build Coastguard Worker createChildCases(CASETYPE_LOG, m_context, "state", "Negative GL State API Cases", stateFuncs));
3212*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_LOG, m_context, "atomic_counter",
3213*35238bceSAndroid Build Coastguard Worker "Negative Atomic Counter API Cases", atomicCounterFuncs));
3214*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_LOG, m_context, "shader_image_load",
3215*35238bceSAndroid Build Coastguard Worker "Negative Shader Image Load API Cases", imageLoadFuncs));
3216*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_LOG, m_context, "shader_image_store",
3217*35238bceSAndroid Build Coastguard Worker "Negative Shader Image Store API Cases", imageStoreFuncs));
3218*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_LOG, m_context, "shader_image_atomic",
3219*35238bceSAndroid Build Coastguard Worker "Negative Shader Image Atomic API Cases", imageAtomicFuncs));
3220*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_LOG, m_context, "shader_image_exchange",
3221*35238bceSAndroid Build Coastguard Worker "Negative Shader Image Atomic Exchange API Cases",
3222*35238bceSAndroid Build Coastguard Worker imageAtomicExchangeFuncs));
3223*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_LOG, m_context, "shader_function",
3224*35238bceSAndroid Build Coastguard Worker "Negative Shader Function Cases", shaderFunctionFuncs));
3225*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_LOG, m_context, "shader_directive",
3226*35238bceSAndroid Build Coastguard Worker "Negative Shader Directive Cases", shaderDirectiveFuncs));
3227*35238bceSAndroid Build Coastguard Worker host->addChild(
3228*35238bceSAndroid Build Coastguard Worker createChildCases(CASETYPE_LOG, m_context, "ssbo_block", "Negative SSBO Block Cases", ssboBlockFuncs));
3229*35238bceSAndroid Build Coastguard Worker host->addChild(
3230*35238bceSAndroid Build Coastguard Worker createChildCases(CASETYPE_LOG, m_context, "precise", "Negative Precise Cases", preciseFuncs));
3231*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_LOG, m_context, "advanced_blend",
3232*35238bceSAndroid Build Coastguard Worker "Negative Advanced Blend Equation Cases", advancedBlendFuncs));
3233*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_LOG, m_context, "shader_storage", "Negative Shader Storage Cases",
3234*35238bceSAndroid Build Coastguard Worker shaderStorageFuncs));
3235*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_LOG, m_context, "tessellation", "Negative Tessellation Cases",
3236*35238bceSAndroid Build Coastguard Worker tessellationFuncs));
3237*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_LOG, m_context, "oes_sample_variables",
3238*35238bceSAndroid Build Coastguard Worker "Negative Sample Variables Cases", sampleVariablesFuncs));
3239*35238bceSAndroid Build Coastguard Worker host->addChild(
3240*35238bceSAndroid Build Coastguard Worker createChildCases(CASETYPE_LOG, m_context, "compute", "Negative Compute Cases", computeFuncs));
3241*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_LOG, m_context, "framebuffer_fetch",
3242*35238bceSAndroid Build Coastguard Worker "Negative Framebuffer Fetch Cases", framebufferFetchFuncs));
3243*35238bceSAndroid Build Coastguard Worker }
3244*35238bceSAndroid Build Coastguard Worker
3245*35238bceSAndroid Build Coastguard Worker {
3246*35238bceSAndroid Build Coastguard Worker tcu::TestCaseGroup *const host =
3247*35238bceSAndroid Build Coastguard Worker new tcu::TestCaseGroup(m_testCtx, "get_error", "Reporting of standard API errors via glGetError");
3248*35238bceSAndroid Build Coastguard Worker
3249*35238bceSAndroid Build Coastguard Worker negative->addChild(host);
3250*35238bceSAndroid Build Coastguard Worker
3251*35238bceSAndroid Build Coastguard Worker host->addChild(
3252*35238bceSAndroid Build Coastguard Worker createChildCases(CASETYPE_GETERROR, m_context, "buffer", "Negative Buffer API Cases", bufferFuncs));
3253*35238bceSAndroid Build Coastguard Worker host->addChild(
3254*35238bceSAndroid Build Coastguard Worker createChildCases(CASETYPE_GETERROR, m_context, "texture", "Negative Texture API Cases", textureFuncs));
3255*35238bceSAndroid Build Coastguard Worker host->addChild(
3256*35238bceSAndroid Build Coastguard Worker createChildCases(CASETYPE_GETERROR, m_context, "shader", "Negative Shader API Cases", shaderFuncs));
3257*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_GETERROR, m_context, "fragment", "Negative Fragment API Cases",
3258*35238bceSAndroid Build Coastguard Worker fragmentFuncs));
3259*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_GETERROR, m_context, "vertex_array",
3260*35238bceSAndroid Build Coastguard Worker "Negative Vertex Array API Cases", vaFuncs));
3261*35238bceSAndroid Build Coastguard Worker host->addChild(
3262*35238bceSAndroid Build Coastguard Worker createChildCases(CASETYPE_GETERROR, m_context, "state", "Negative GL State API Cases", stateFuncs));
3263*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_GETERROR, m_context, "atomic_counter",
3264*35238bceSAndroid Build Coastguard Worker "Negative Atomic Counter API Cases", atomicCounterFuncs));
3265*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_GETERROR, m_context, "shader_image_load",
3266*35238bceSAndroid Build Coastguard Worker "Negative Shader Image Load API Cases", imageLoadFuncs));
3267*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_GETERROR, m_context, "shader_image_store",
3268*35238bceSAndroid Build Coastguard Worker "Negative Shader Image Store API Cases", imageStoreFuncs));
3269*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_GETERROR, m_context, "shader_image_atomic",
3270*35238bceSAndroid Build Coastguard Worker "Negative Shader Image Atomic API Cases", imageAtomicFuncs));
3271*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_GETERROR, m_context, "shader_image_exchange",
3272*35238bceSAndroid Build Coastguard Worker "Negative Shader Image Atomic Exchange API Cases",
3273*35238bceSAndroid Build Coastguard Worker imageAtomicExchangeFuncs));
3274*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_GETERROR, m_context, "shader_function",
3275*35238bceSAndroid Build Coastguard Worker "Negative Shader Function Cases", shaderFunctionFuncs));
3276*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_GETERROR, m_context, "shader_directive",
3277*35238bceSAndroid Build Coastguard Worker "Negative Shader Directive Cases", shaderDirectiveFuncs));
3278*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_GETERROR, m_context, "ssbo_block", "Negative SSBO Block Cases",
3279*35238bceSAndroid Build Coastguard Worker ssboBlockFuncs));
3280*35238bceSAndroid Build Coastguard Worker host->addChild(
3281*35238bceSAndroid Build Coastguard Worker createChildCases(CASETYPE_GETERROR, m_context, "precise", "Negative Precise Cases", preciseFuncs));
3282*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_GETERROR, m_context, "advanced_blend",
3283*35238bceSAndroid Build Coastguard Worker "Negative Advanced Blend Equation Cases", advancedBlendFuncs));
3284*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_GETERROR, m_context, "shader_storage",
3285*35238bceSAndroid Build Coastguard Worker "Negative Shader Storage Cases", shaderStorageFuncs));
3286*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_GETERROR, m_context, "tessellation", "Negative Tessellation Cases",
3287*35238bceSAndroid Build Coastguard Worker tessellationFuncs));
3288*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_GETERROR, m_context, "oes_sample_variables",
3289*35238bceSAndroid Build Coastguard Worker "Negative Sample Variables Cases", sampleVariablesFuncs));
3290*35238bceSAndroid Build Coastguard Worker host->addChild(
3291*35238bceSAndroid Build Coastguard Worker createChildCases(CASETYPE_GETERROR, m_context, "compute", "Negative Compute Cases", computeFuncs));
3292*35238bceSAndroid Build Coastguard Worker host->addChild(createChildCases(CASETYPE_GETERROR, m_context, "framebuffer_fetch",
3293*35238bceSAndroid Build Coastguard Worker "Negative Framebuffer Fetch Cases", framebufferFetchFuncs));
3294*35238bceSAndroid Build Coastguard Worker }
3295*35238bceSAndroid Build Coastguard Worker }
3296*35238bceSAndroid Build Coastguard Worker
3297*35238bceSAndroid Build Coastguard Worker {
3298*35238bceSAndroid Build Coastguard Worker tcu::TestCaseGroup *const host = createChildCases(CASETYPE_CALLBACK, m_context, "externally_generated",
3299*35238bceSAndroid Build Coastguard Worker "Externally Generated Messages", externalFuncs);
3300*35238bceSAndroid Build Coastguard Worker
3301*35238bceSAndroid Build Coastguard Worker host->addChild(new GroupCase(m_context, "push_pop_consistency",
3302*35238bceSAndroid Build Coastguard Worker "Push/pop message generation with full message output checking"));
3303*35238bceSAndroid Build Coastguard Worker
3304*35238bceSAndroid Build Coastguard Worker addChild(host);
3305*35238bceSAndroid Build Coastguard Worker }
3306*35238bceSAndroid Build Coastguard Worker
3307*35238bceSAndroid Build Coastguard Worker {
3308*35238bceSAndroid Build Coastguard Worker vector<FunctionContainer> containers;
3309*35238bceSAndroid Build Coastguard Worker vector<TestFunctionWrapper> allFuncs;
3310*35238bceSAndroid Build Coastguard Worker
3311*35238bceSAndroid Build Coastguard Worker de::Random rng(0x53941903 ^ m_context.getTestContext().getCommandLine().getBaseSeed());
3312*35238bceSAndroid Build Coastguard Worker
3313*35238bceSAndroid Build Coastguard Worker containers.insert(containers.end(), bufferFuncs.begin(), bufferFuncs.end());
3314*35238bceSAndroid Build Coastguard Worker containers.insert(containers.end(), textureFuncs.begin(), textureFuncs.end());
3315*35238bceSAndroid Build Coastguard Worker containers.insert(containers.end(), externalFuncs.begin(), externalFuncs.end());
3316*35238bceSAndroid Build Coastguard Worker
3317*35238bceSAndroid Build Coastguard Worker for (size_t ndx = 0; ndx < containers.size(); ndx++)
3318*35238bceSAndroid Build Coastguard Worker allFuncs.push_back(containers[ndx].function);
3319*35238bceSAndroid Build Coastguard Worker
3320*35238bceSAndroid Build Coastguard Worker rng.shuffle(allFuncs.begin(), allFuncs.end());
3321*35238bceSAndroid Build Coastguard Worker
3322*35238bceSAndroid Build Coastguard Worker {
3323*35238bceSAndroid Build Coastguard Worker tcu::TestCaseGroup *const filtering =
3324*35238bceSAndroid Build Coastguard Worker new tcu::TestCaseGroup(m_testCtx, "error_filters", "Filtering of reported errors");
3325*35238bceSAndroid Build Coastguard Worker const int errorFuncsPerCase = 4;
3326*35238bceSAndroid Build Coastguard Worker const int maxFilteringCaseCount = 32;
3327*35238bceSAndroid Build Coastguard Worker const int caseCount = (int(allFuncs.size()) + errorFuncsPerCase - 1) / errorFuncsPerCase;
3328*35238bceSAndroid Build Coastguard Worker
3329*35238bceSAndroid Build Coastguard Worker addChild(filtering);
3330*35238bceSAndroid Build Coastguard Worker
3331*35238bceSAndroid Build Coastguard Worker for (int caseNdx = 0; caseNdx < de::min(caseCount, maxFilteringCaseCount); caseNdx++)
3332*35238bceSAndroid Build Coastguard Worker {
3333*35238bceSAndroid Build Coastguard Worker const int start = caseNdx * errorFuncsPerCase;
3334*35238bceSAndroid Build Coastguard Worker const int end = de::min((caseNdx + 1) * errorFuncsPerCase, int(allFuncs.size()));
3335*35238bceSAndroid Build Coastguard Worker const string name = "case_" + de::toString(caseNdx);
3336*35238bceSAndroid Build Coastguard Worker vector<TestFunctionWrapper> funcs(allFuncs.begin() + start, allFuncs.begin() + end);
3337*35238bceSAndroid Build Coastguard Worker
3338*35238bceSAndroid Build Coastguard Worker // These produce lots of different message types, thus always include at least one when testing filtering
3339*35238bceSAndroid Build Coastguard Worker funcs.insert(funcs.end(), externalFuncs[caseNdx % externalFuncs.size()].function);
3340*35238bceSAndroid Build Coastguard Worker
3341*35238bceSAndroid Build Coastguard Worker filtering->addChild(new FilterCase(m_context, name.c_str(), "DebugMessageControl usage", funcs));
3342*35238bceSAndroid Build Coastguard Worker }
3343*35238bceSAndroid Build Coastguard Worker }
3344*35238bceSAndroid Build Coastguard Worker
3345*35238bceSAndroid Build Coastguard Worker {
3346*35238bceSAndroid Build Coastguard Worker tcu::TestCaseGroup *const groups = new tcu::TestCaseGroup(
3347*35238bceSAndroid Build Coastguard Worker m_testCtx, "error_groups", "Filtering of reported errors with use of Error Groups");
3348*35238bceSAndroid Build Coastguard Worker const int errorFuncsPerCase = 4;
3349*35238bceSAndroid Build Coastguard Worker const int maxFilteringCaseCount = 16;
3350*35238bceSAndroid Build Coastguard Worker const int caseCount = (int(allFuncs.size()) + errorFuncsPerCase - 1) / errorFuncsPerCase;
3351*35238bceSAndroid Build Coastguard Worker
3352*35238bceSAndroid Build Coastguard Worker addChild(groups);
3353*35238bceSAndroid Build Coastguard Worker
3354*35238bceSAndroid Build Coastguard Worker for (int caseNdx = 0; caseNdx < caseCount && caseNdx < maxFilteringCaseCount; caseNdx++)
3355*35238bceSAndroid Build Coastguard Worker {
3356*35238bceSAndroid Build Coastguard Worker const int start = caseNdx * errorFuncsPerCase;
3357*35238bceSAndroid Build Coastguard Worker const int end = de::min((caseNdx + 1) * errorFuncsPerCase, int(allFuncs.size()));
3358*35238bceSAndroid Build Coastguard Worker const string name = ("case_" + de::toString(caseNdx)).c_str();
3359*35238bceSAndroid Build Coastguard Worker vector<TestFunctionWrapper> funcs(&allFuncs[0] + start, &allFuncs[0] + end);
3360*35238bceSAndroid Build Coastguard Worker
3361*35238bceSAndroid Build Coastguard Worker // These produce lots of different message types, thus always include at least one when testing filtering
3362*35238bceSAndroid Build Coastguard Worker funcs.insert(funcs.end(), externalFuncs[caseNdx % externalFuncs.size()].function);
3363*35238bceSAndroid Build Coastguard Worker
3364*35238bceSAndroid Build Coastguard Worker groups->addChild(new GroupFilterCase(m_context, name.c_str(), "Debug Group usage", funcs));
3365*35238bceSAndroid Build Coastguard Worker }
3366*35238bceSAndroid Build Coastguard Worker }
3367*35238bceSAndroid Build Coastguard Worker
3368*35238bceSAndroid Build Coastguard Worker {
3369*35238bceSAndroid Build Coastguard Worker tcu::TestCaseGroup *const async =
3370*35238bceSAndroid Build Coastguard Worker new tcu::TestCaseGroup(m_testCtx, "async", "Asynchronous message generation");
3371*35238bceSAndroid Build Coastguard Worker const int errorFuncsPerCase = 2;
3372*35238bceSAndroid Build Coastguard Worker const int maxAsyncCaseCount = 16;
3373*35238bceSAndroid Build Coastguard Worker const int caseCount = (int(allFuncs.size()) + errorFuncsPerCase - 1) / errorFuncsPerCase;
3374*35238bceSAndroid Build Coastguard Worker
3375*35238bceSAndroid Build Coastguard Worker addChild(async);
3376*35238bceSAndroid Build Coastguard Worker
3377*35238bceSAndroid Build Coastguard Worker for (int caseNdx = 0; caseNdx < caseCount && caseNdx < maxAsyncCaseCount; caseNdx++)
3378*35238bceSAndroid Build Coastguard Worker {
3379*35238bceSAndroid Build Coastguard Worker const int start = caseNdx * errorFuncsPerCase;
3380*35238bceSAndroid Build Coastguard Worker const int end = de::min((caseNdx + 1) * errorFuncsPerCase, int(allFuncs.size()));
3381*35238bceSAndroid Build Coastguard Worker const string name = ("case_" + de::toString(caseNdx)).c_str();
3382*35238bceSAndroid Build Coastguard Worker vector<TestFunctionWrapper> funcs(&allFuncs[0] + start, &allFuncs[0] + end);
3383*35238bceSAndroid Build Coastguard Worker
3384*35238bceSAndroid Build Coastguard Worker if (caseNdx & 0x1)
3385*35238bceSAndroid Build Coastguard Worker async->addChild(new AsyncCase(m_context, (name + "_callback").c_str(), "Async message generation",
3386*35238bceSAndroid Build Coastguard Worker funcs, true));
3387*35238bceSAndroid Build Coastguard Worker else
3388*35238bceSAndroid Build Coastguard Worker async->addChild(
3389*35238bceSAndroid Build Coastguard Worker new AsyncCase(m_context, (name + "_log").c_str(), "Async message generation", funcs, false));
3390*35238bceSAndroid Build Coastguard Worker }
3391*35238bceSAndroid Build Coastguard Worker }
3392*35238bceSAndroid Build Coastguard Worker }
3393*35238bceSAndroid Build Coastguard Worker
3394*35238bceSAndroid Build Coastguard Worker {
3395*35238bceSAndroid Build Coastguard Worker tcu::TestCaseGroup *const labels = new tcu::TestCaseGroup(m_testCtx, "object_labels", "Labeling objects");
3396*35238bceSAndroid Build Coastguard Worker
3397*35238bceSAndroid Build Coastguard Worker const struct
3398*35238bceSAndroid Build Coastguard Worker {
3399*35238bceSAndroid Build Coastguard Worker GLenum identifier;
3400*35238bceSAndroid Build Coastguard Worker const char *name;
3401*35238bceSAndroid Build Coastguard Worker const char *desc;
3402*35238bceSAndroid Build Coastguard Worker } cases[] = {
3403*35238bceSAndroid Build Coastguard Worker {GL_BUFFER, "buffer", "Debug label on a buffer object"},
3404*35238bceSAndroid Build Coastguard Worker {GL_SHADER, "shader", "Debug label on a shader object"},
3405*35238bceSAndroid Build Coastguard Worker {GL_PROGRAM, "program", "Debug label on a program object"},
3406*35238bceSAndroid Build Coastguard Worker {GL_QUERY, "query", "Debug label on a query object"},
3407*35238bceSAndroid Build Coastguard Worker {GL_PROGRAM_PIPELINE, "program_pipeline", "Debug label on a program pipeline object"},
3408*35238bceSAndroid Build Coastguard Worker {GL_TRANSFORM_FEEDBACK, "transform_feedback", "Debug label on a transform feedback object"},
3409*35238bceSAndroid Build Coastguard Worker {GL_SAMPLER, "sampler", "Debug label on a sampler object"},
3410*35238bceSAndroid Build Coastguard Worker {GL_TEXTURE, "texture", "Debug label on a texture object"},
3411*35238bceSAndroid Build Coastguard Worker {GL_RENDERBUFFER, "renderbuffer", "Debug label on a renderbuffer object"},
3412*35238bceSAndroid Build Coastguard Worker {GL_FRAMEBUFFER, "framebuffer", "Debug label on a framebuffer object"},
3413*35238bceSAndroid Build Coastguard Worker };
3414*35238bceSAndroid Build Coastguard Worker
3415*35238bceSAndroid Build Coastguard Worker addChild(labels);
3416*35238bceSAndroid Build Coastguard Worker
3417*35238bceSAndroid Build Coastguard Worker labels->addChild(new InitialLabelCase(m_context, "initial", "Debug label initial value"));
3418*35238bceSAndroid Build Coastguard Worker labels->addChild(new ClearLabelCase(m_context, "clearing", "Debug label clearing"));
3419*35238bceSAndroid Build Coastguard Worker labels->addChild(
3420*35238bceSAndroid Build Coastguard Worker new SpecifyWithLengthCase(m_context, "specify_with_length", "Debug label specified with length"));
3421*35238bceSAndroid Build Coastguard Worker labels->addChild(
3422*35238bceSAndroid Build Coastguard Worker new BufferLimitedLabelCase(m_context, "buffer_limited_query", "Debug label query to too short buffer"));
3423*35238bceSAndroid Build Coastguard Worker labels->addChild(new LabelMaxSizeCase(m_context, "max_label_length", "Max sized debug label"));
3424*35238bceSAndroid Build Coastguard Worker labels->addChild(new LabelLengthCase(m_context, "query_length_only", "Query debug label length"));
3425*35238bceSAndroid Build Coastguard Worker
3426*35238bceSAndroid Build Coastguard Worker for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(cases); ndx++)
3427*35238bceSAndroid Build Coastguard Worker labels->addChild(new LabelCase(m_context, cases[ndx].name, cases[ndx].desc, cases[ndx].identifier));
3428*35238bceSAndroid Build Coastguard Worker labels->addChild(new SyncLabelCase(m_context, "sync", "Debug label on a sync object"));
3429*35238bceSAndroid Build Coastguard Worker }
3430*35238bceSAndroid Build Coastguard Worker }
3431*35238bceSAndroid Build Coastguard Worker
3432*35238bceSAndroid Build Coastguard Worker } // namespace Functional
3433*35238bceSAndroid Build Coastguard Worker } // namespace gles31
3434*35238bceSAndroid Build Coastguard Worker } // namespace deqp
3435