1/*-------------------------------------------------------------------------
2 * drawElements Quality Program OpenGL ES 3.1 Module
3 * -------------------------------------------------
4 *
5 * Copyright 2014 The Android Open Source Project
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 *      http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 *//*!
20 * \file
21 * \brief Negative Fragment Pipe API tests.
22 *//*--------------------------------------------------------------------*/
23
24#include "es31fNegativeFragmentApiTests.hpp"
25
26#include "gluCallLogWrapper.hpp"
27#include "gluContextInfo.hpp"
28#include "gluRenderContext.hpp"
29
30#include "glwDefs.hpp"
31#include "glwEnums.hpp"
32
33namespace deqp
34{
35namespace gles31
36{
37namespace Functional
38{
39namespace NegativeTestShared
40{
41
42using tcu::TestLog;
43using glu::CallLogWrapper;
44using namespace glw;
45
46using tcu::TestLog;
47
48void scissor (NegativeTestContext& ctx)
49{
50	ctx.beginSection("GL_INVALID_VALUE is generated if either width or height is negative.");
51	ctx.glScissor(0, 0, -1, 0);
52	ctx.expectError(GL_INVALID_VALUE);
53	ctx.glScissor(0, 0, 0, -1);
54	ctx.expectError(GL_INVALID_VALUE);
55	ctx.glScissor(0, 0, -1, -1);
56	ctx.expectError(GL_INVALID_VALUE);
57	ctx.endSection();
58}
59
60void depth_func (NegativeTestContext& ctx)
61{
62	ctx.beginSection("GL_INVALID_ENUM is generated if func is not an accepted value.");
63	ctx.glDepthFunc(-1);
64	ctx.expectError(GL_INVALID_ENUM);
65	ctx.endSection();
66}
67
68void viewport (NegativeTestContext& ctx)
69{
70	ctx.beginSection("GL_INVALID_VALUE is generated if either width or height is negative.");
71	ctx.glViewport(0, 0, -1, 1);
72	ctx.expectError(GL_INVALID_VALUE);
73	ctx.glViewport(0, 0, 1, -1);
74	ctx.expectError(GL_INVALID_VALUE);
75	ctx.glViewport(0, 0, -1, -1);
76	ctx.expectError(GL_INVALID_VALUE);
77	ctx.endSection();
78}
79
80// Stencil functions
81void stencil_func (NegativeTestContext& ctx)
82{
83	ctx.beginSection("GL_INVALID_ENUM is generated if func is not one of the eight accepted values.");
84	ctx.glStencilFunc(-1, 0, 1);
85	ctx.expectError(GL_INVALID_ENUM);
86	ctx.endSection();
87}
88
89void stencil_func_separate (NegativeTestContext& ctx)
90{
91	ctx.beginSection("GL_INVALID_ENUM is generated if face is not GL_FRONT, GL_BACK, or GL_FRONT_AND_BACK.");
92	ctx.glStencilFuncSeparate(-1, GL_NEVER, 0, 1);
93	ctx.expectError(GL_INVALID_ENUM);
94	ctx.endSection();
95
96	ctx.beginSection("GL_INVALID_ENUM is generated if func is not one of the eight accepted values.");
97	ctx.glStencilFuncSeparate(GL_FRONT, -1, 0, 1);
98	ctx.expectError(GL_INVALID_ENUM);
99	ctx.endSection();
100}
101
102void stencil_op (NegativeTestContext& ctx)
103{
104	ctx.beginSection("GL_INVALID_ENUM is generated if sfail, dpfail, or dppass is any value other than the defined symbolic constant values.");
105	ctx.glStencilOp(-1, GL_ZERO, GL_REPLACE);
106	ctx.expectError(GL_INVALID_ENUM);
107	ctx.glStencilOp(GL_KEEP, -1, GL_REPLACE);
108	ctx.expectError(GL_INVALID_ENUM);
109	ctx.glStencilOp(GL_KEEP, GL_ZERO, -1);
110	ctx.expectError(GL_INVALID_ENUM);
111	ctx.endSection();
112}
113
114void stencil_op_separate (NegativeTestContext& ctx)
115{
116	ctx.beginSection("GL_INVALID_ENUM is generated if face is any value other than GL_FRONT, GL_BACK, or GL_FRONT_AND_BACK.");
117	ctx.glStencilOpSeparate(-1, GL_KEEP, GL_ZERO, GL_REPLACE);
118	ctx.expectError(GL_INVALID_ENUM);
119	ctx.endSection();
120
121	ctx.beginSection("GL_INVALID_ENUM is generated if sfail, dpfail, or dppass is any value other than the eight defined symbolic constant values.");
122	ctx.glStencilOpSeparate(GL_FRONT, -1, GL_ZERO, GL_REPLACE);
123	ctx.expectError(GL_INVALID_ENUM);
124	ctx.glStencilOpSeparate(GL_FRONT, GL_KEEP, -1, GL_REPLACE);
125	ctx.expectError(GL_INVALID_ENUM);
126	ctx.glStencilOpSeparate(GL_FRONT, GL_KEEP, GL_ZERO, -1);
127	ctx.expectError(GL_INVALID_ENUM);
128	ctx.endSection();
129}
130
131void stencil_mask_separate (NegativeTestContext& ctx)
132{
133	ctx.beginSection("GL_INVALID_ENUM is generated if face is not GL_FRONT, GL_BACK, or GL_FRONT_AND_BACK.");
134	ctx.glStencilMaskSeparate(-1, 0);
135	ctx.expectError(GL_INVALID_ENUM);
136	ctx.endSection();
137}
138
139// Blend functions
140void blend_equation (NegativeTestContext& ctx)
141{
142	ctx.beginSection("GL_INVALID_ENUM is generated if mode is not GL_FUNC_ADD, GL_FUNC_SUBTRACT, GL_FUNC_REVERSE_SUBTRACT, GL_MAX or GL_MIN.");
143	ctx.glBlendEquation(-1);
144	ctx.expectError(GL_INVALID_ENUM);
145	ctx.endSection();
146}
147
148void blend_equation_separate (NegativeTestContext& ctx)
149{
150	ctx.beginSection("GL_INVALID_ENUM is generated if modeRGB is not GL_FUNC_ADD, GL_FUNC_SUBTRACT, GL_FUNC_REVERSE_SUBTRACT, GL_MAX or GL_MIN.");
151	ctx.glBlendEquationSeparate(-1, GL_FUNC_ADD);
152	ctx.expectError(GL_INVALID_ENUM);
153	ctx.endSection();
154	ctx.beginSection("GL_INVALID_ENUM is generated if modeAlpha is not GL_FUNC_ADD, GL_FUNC_SUBTRACT, GL_FUNC_REVERSE_SUBTRACT, GL_MAX or GL_MIN.");
155	ctx.glBlendEquationSeparate(GL_FUNC_ADD, -1);
156	ctx.expectError(GL_INVALID_ENUM);
157	ctx.endSection();
158}
159
160static bool checkSupport(NegativeTestContext& ctx)
161{
162	return contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) ||
163		   contextSupports(ctx.getRenderContext().getType(), glu::ApiType::core(4, 5)) ||
164		   ctx.getContextInfo().isExtensionSupported("GL_EXT_draw_buffers_indexed");
165}
166
167void blend_equationi (NegativeTestContext& ctx)
168{
169	glw::GLint maxDrawBuffers = -1;
170
171	if (!checkSupport(ctx))
172		throw tcu::NotSupportedError("GL_EXT_draw_buffers_indexed is not supported", DE_NULL, __FILE__, __LINE__);
173
174	ctx.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
175	ctx.beginSection("GL_INVALID_ENUM is generated if mode is not GL_FUNC_ADD, GL_FUNC_SUBTRACT, GL_FUNC_REVERSE_SUBTRACT, GL_MAX or GL_MIN.");
176	ctx.glBlendEquationi(0, -1);
177	ctx.expectError(GL_INVALID_ENUM);
178	ctx.endSection();
179	ctx.beginSection("GL_INVALID_VALUE is generated if buf is not in the range zero to the value of MAX_DRAW_BUFFERS minus one.");
180	ctx.glBlendEquationi(-1, GL_FUNC_ADD);
181	ctx.expectError(GL_INVALID_VALUE);
182	ctx.glBlendEquationi(maxDrawBuffers, GL_FUNC_ADD);
183	ctx.expectError(GL_INVALID_VALUE);
184	ctx.endSection();
185}
186
187void blend_equation_separatei (NegativeTestContext& ctx)
188{
189	glw::GLint maxDrawBuffers = -1;
190
191	if (!checkSupport(ctx))
192		throw tcu::NotSupportedError("GL_EXT_draw_buffers_indexed is not supported", DE_NULL, __FILE__, __LINE__);
193
194	ctx.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
195	ctx.beginSection("GL_INVALID_ENUM is generated if modeRGB is not GL_FUNC_ADD, GL_FUNC_SUBTRACT, GL_FUNC_REVERSE_SUBTRACT, GL_MAX or GL_MIN.");
196	ctx.glBlendEquationSeparatei(0, -1, GL_FUNC_ADD);
197	ctx.expectError(GL_INVALID_ENUM);
198	ctx.endSection();
199	ctx.beginSection("GL_INVALID_ENUM is generated if modeAlpha is not GL_FUNC_ADD, GL_FUNC_SUBTRACT, GL_FUNC_REVERSE_SUBTRACT, GL_MAX or GL_MIN.");
200	ctx.glBlendEquationSeparatei(0, GL_FUNC_ADD, -1);
201	ctx.expectError(GL_INVALID_ENUM);
202	ctx.endSection();
203	ctx.beginSection("GL_INVALID_VALUE is generated if buf is not in the range zero to the value of MAX_DRAW_BUFFERS minus one.");
204	ctx.glBlendEquationSeparatei(-1, GL_FUNC_ADD, GL_FUNC_ADD);
205	ctx.expectError(GL_INVALID_VALUE);
206	ctx.glBlendEquationSeparatei(maxDrawBuffers, GL_FUNC_ADD, GL_FUNC_ADD);
207	ctx.expectError(GL_INVALID_VALUE);
208	ctx.endSection();
209}
210
211void blend_func (NegativeTestContext& ctx)
212{
213	ctx.beginSection("GL_INVALID_ENUM is generated if either sfactor or dfactor is not an accepted value.");
214	ctx.glBlendFunc(-1, GL_ONE);
215	ctx.expectError(GL_INVALID_ENUM);
216	ctx.glBlendFunc(GL_ONE, -1);
217	ctx.expectError(GL_INVALID_ENUM);
218	ctx.endSection();
219}
220
221void blend_func_separate (NegativeTestContext& ctx)
222{
223	ctx.beginSection("GL_INVALID_ENUM is generated if srcRGB, dstRGB, srcAlpha, or dstAlpha is not an accepted value.");
224	ctx.glBlendFuncSeparate(-1, GL_ONE, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR);
225	ctx.expectError(GL_INVALID_ENUM);
226	ctx.glBlendFuncSeparate(GL_ZERO, -1, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR);
227	ctx.expectError(GL_INVALID_ENUM);
228	ctx.glBlendFuncSeparate(GL_ZERO, GL_ONE, -1, GL_ONE_MINUS_SRC_COLOR);
229	ctx.expectError(GL_INVALID_ENUM);
230	ctx.glBlendFuncSeparate(GL_ZERO, GL_ONE, GL_SRC_COLOR, -1);
231	ctx.expectError(GL_INVALID_ENUM);
232	ctx.endSection();
233}
234
235void blend_funci (NegativeTestContext& ctx)
236{
237	glw::GLint maxDrawBuffers = -1;
238
239	if (!checkSupport(ctx))
240		throw tcu::NotSupportedError("GL_EXT_draw_buffers_indexed is not supported", DE_NULL, __FILE__, __LINE__);
241
242	ctx.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
243	ctx.beginSection("GL_INVALID_ENUM is generated if either sfactor or dfactor is not an accepted value.");
244	ctx.glBlendFunci(0, -1, GL_ONE);
245	ctx.expectError(GL_INVALID_ENUM);
246	ctx.glBlendFunci(0, GL_ONE, -1);
247	ctx.expectError(GL_INVALID_ENUM);
248	ctx.endSection();
249	ctx.beginSection("GL_INVALID_VALUE is generated if buf is not in the range zero to the value of MAX_DRAW_BUFFERS minus one.");
250	ctx.glBlendFunci(-1, GL_ONE, GL_ONE);
251	ctx.expectError(GL_INVALID_VALUE);
252	ctx.glBlendFunci(maxDrawBuffers, GL_ONE, GL_ONE);
253	ctx.expectError(GL_INVALID_VALUE);
254	ctx.endSection();
255}
256
257void blend_func_separatei (NegativeTestContext& ctx)
258{
259	glw::GLint maxDrawBuffers = -1;
260
261	if (!checkSupport(ctx))
262		throw tcu::NotSupportedError("GL_EXT_draw_buffers_indexed is not supported", DE_NULL, __FILE__, __LINE__);
263
264	ctx.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
265	ctx.beginSection("GL_INVALID_ENUM is generated if srcRGB, dstRGB, srcAlpha, or dstAlpha is not an accepted value.");
266	ctx.glBlendFuncSeparatei(0, -1, GL_ONE, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR);
267	ctx.expectError(GL_INVALID_ENUM);
268	ctx.glBlendFuncSeparatei(0, GL_ZERO, -1, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR);
269	ctx.expectError(GL_INVALID_ENUM);
270	ctx.glBlendFuncSeparatei(0, GL_ZERO, GL_ONE, -1, GL_ONE_MINUS_SRC_COLOR);
271	ctx.expectError(GL_INVALID_ENUM);
272	ctx.glBlendFuncSeparatei(0, GL_ZERO, GL_ONE, GL_SRC_COLOR, -1);
273	ctx.expectError(GL_INVALID_ENUM);
274	ctx.endSection();
275	ctx.beginSection("GL_INVALID_VALUE is generated if buf is not in the range zero to the value of MAX_DRAW_BUFFERS minus one.");
276	ctx.glBlendFuncSeparatei(-1, GL_ONE, GL_ONE, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR);
277	ctx.expectError(GL_INVALID_VALUE);
278	ctx.glBlendFuncSeparatei(maxDrawBuffers, GL_ONE, GL_ONE, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR);
279	ctx.expectError(GL_INVALID_VALUE);
280	ctx.endSection();
281}
282
283// Rasterization API functions
284void cull_face (NegativeTestContext& ctx)
285{
286	ctx.beginSection("GL_INVALID_ENUM is generated if mode is not an accepted value.");
287	ctx.glCullFace(-1);
288	ctx.expectError(GL_INVALID_ENUM);
289	ctx.endSection();
290}
291
292void front_face (NegativeTestContext& ctx)
293{
294	ctx.beginSection("GL_INVALID_ENUM is generated if mode is not an accepted value.");
295	ctx.glFrontFace(-1);
296	ctx.expectError(GL_INVALID_ENUM);
297	ctx.endSection();
298}
299
300void line_width (NegativeTestContext& ctx)
301{
302	ctx.beginSection("GL_INVALID_VALUE is generated if width is less than or equal to 0.");
303	ctx.glLineWidth(0);
304	ctx.expectError(GL_INVALID_VALUE);
305	ctx.glLineWidth(-1);
306	ctx.expectError(GL_INVALID_VALUE);
307	ctx.endSection();
308}
309
310// Asynchronous queries
311void gen_queries (NegativeTestContext& ctx)
312{
313	ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
314	GLuint ids = 0;
315	ctx.glGenQueries	(-1, &ids);
316	ctx.expectError		(GL_INVALID_VALUE);
317	ctx.endSection();
318}
319
320void begin_query (NegativeTestContext& ctx)
321{
322	GLuint ids[3];
323	ctx.glGenQueries	(3, ids);
324
325	ctx.beginSection("GL_INVALID_ENUM is generated if target is not one of the accepted tokens.");
326	ctx.glBeginQuery	(-1, ids[0]);
327	ctx.expectError		(GL_INVALID_ENUM);
328	ctx.endSection();
329
330	ctx.beginSection("GL_INVALID_OPERATION is generated if ctx.glBeginQuery is executed while a query object of the same target is already active.");
331	ctx.glBeginQuery	(GL_ANY_SAMPLES_PASSED, ids[0]);
332	ctx.expectError		(GL_NO_ERROR);
333	ctx.glBeginQuery	(GL_ANY_SAMPLES_PASSED, ids[1]);
334	ctx.expectError		(GL_INVALID_OPERATION);
335	// \note GL_ANY_SAMPLES_PASSED and GL_ANY_SAMPLES_PASSED_CONSERVATIVE alias to the same target for the purposes of this error.
336	ctx.glBeginQuery	(GL_ANY_SAMPLES_PASSED_CONSERVATIVE, ids[1]);
337	ctx.expectError		(GL_INVALID_OPERATION);
338	ctx.glBeginQuery	(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, ids[1]);
339	ctx.expectError		(GL_NO_ERROR);
340	ctx.glBeginQuery	(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, ids[2]);
341	ctx.expectError		(GL_INVALID_OPERATION);
342	ctx.glEndQuery		(GL_ANY_SAMPLES_PASSED);
343	ctx.glEndQuery		(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN);
344	ctx.expectError		(GL_NO_ERROR);
345	ctx.endSection();
346
347	ctx.beginSection("GL_INVALID_OPERATION is generated if id is 0.");
348	ctx.glBeginQuery	(GL_ANY_SAMPLES_PASSED, 0);
349	ctx.expectError		(GL_INVALID_OPERATION);
350	ctx.endSection();
351
352	ctx.beginSection("GL_INVALID_OPERATION is generated if id not a name returned from a previous call to ctx.glGenQueries, or if such a name has since been deleted with ctx.glDeleteQueries.");
353	ctx.glBeginQuery	(GL_ANY_SAMPLES_PASSED, -1);
354	ctx.expectError		(GL_INVALID_OPERATION);
355	ctx.glDeleteQueries	(1, &ids[2]);
356	ctx.expectError		(GL_NO_ERROR);
357	ctx.glBeginQuery	(GL_ANY_SAMPLES_PASSED, ids[2]);
358	ctx.expectError		(GL_INVALID_OPERATION);
359	ctx.endSection();
360
361	ctx.beginSection("GL_INVALID_OPERATION is generated if id is the name of an already active query object.");
362	ctx.glBeginQuery	(GL_ANY_SAMPLES_PASSED, ids[0]);
363	ctx.expectError		(GL_NO_ERROR);
364	ctx.glBeginQuery	(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, ids[0]);
365	ctx.expectError		(GL_INVALID_OPERATION);
366	ctx.endSection();
367
368	ctx.beginSection("GL_INVALID_OPERATION is generated if id refers to an existing query object whose type does not does not match target.");
369	ctx.glEndQuery		(GL_ANY_SAMPLES_PASSED);
370	ctx.expectError		(GL_NO_ERROR);
371	ctx.glBeginQuery	(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, ids[0]);
372	ctx.expectError		(GL_INVALID_OPERATION);
373	ctx.endSection();
374
375	ctx.glDeleteQueries	(2, &ids[0]);
376	ctx.expectError		(GL_NO_ERROR);
377}
378
379void end_query (NegativeTestContext& ctx)
380{
381	GLuint id = 0;
382	ctx.glGenQueries	(1, &id);
383
384	ctx.beginSection("GL_INVALID_ENUM is generated if target is not one of the accepted tokens.");
385	ctx.glEndQuery		(-1);
386	ctx.expectError		(GL_INVALID_ENUM);
387	ctx.endSection();
388
389	ctx.beginSection("GL_INVALID_OPERATION is generated if ctx.glEndQuery is executed when a query object of the same target is not active.");
390	ctx.glEndQuery		(GL_ANY_SAMPLES_PASSED);
391	ctx.expectError		(GL_INVALID_OPERATION);
392	ctx.glBeginQuery	(GL_ANY_SAMPLES_PASSED, id);
393	ctx.expectError		(GL_NO_ERROR);
394	ctx.glEndQuery		(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN);
395	ctx.expectError		(GL_INVALID_OPERATION);
396	ctx.glEndQuery		(GL_ANY_SAMPLES_PASSED);
397	ctx.expectError		(GL_NO_ERROR);
398	ctx.endSection();
399
400	ctx.glDeleteQueries	(1, &id);
401	ctx.expectError		(GL_NO_ERROR);
402}
403
404void delete_queries (NegativeTestContext& ctx)
405{
406	GLuint id = 0;
407	ctx.glGenQueries	(1, &id);
408
409	ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
410	ctx.glDeleteQueries	(-1, &id);
411	ctx.expectError		(GL_INVALID_VALUE);
412	ctx.endSection();
413
414	ctx.glDeleteQueries	(1, &id);
415}
416
417// Sync objects
418void fence_sync (NegativeTestContext& ctx)
419{
420	ctx.beginSection("GL_INVALID_ENUM is generated if condition is not GL_SYNC_GPU_COMMANDS_COMPLETE.");
421	ctx.glFenceSync(-1, 0);
422	ctx.expectError(GL_INVALID_ENUM);
423	ctx.endSection();
424
425	ctx.beginSection("GL_INVALID_VALUE is generated if flags is not zero.");
426	ctx.glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0x0010);
427	ctx.expectError(GL_INVALID_VALUE);
428	ctx.endSection();
429}
430
431void wait_sync (NegativeTestContext& ctx)
432{
433	GLsync sync = ctx.glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
434
435	ctx.beginSection("GL_INVALID_VALUE is generated if sync is not the name of a sync object.");
436	ctx.glWaitSync(0, 0, GL_TIMEOUT_IGNORED);
437	ctx.expectError(GL_INVALID_VALUE);
438	ctx.endSection();
439
440	ctx.beginSection("GL_INVALID_VALUE is generated if flags is not zero.");
441	ctx.glWaitSync(sync, 0x0010, GL_TIMEOUT_IGNORED);
442	ctx.expectError(GL_INVALID_VALUE);
443	ctx.endSection();
444
445	ctx.beginSection("GL_INVALID_VALUE is generated if timeout is not GL_TIMEOUT_IGNORED.");
446	ctx.glWaitSync(sync, 0, 0);
447	ctx.expectError(GL_INVALID_VALUE);
448	ctx.endSection();
449
450	ctx.glDeleteSync(sync);
451}
452
453void client_wait_sync (NegativeTestContext& ctx)
454{
455	GLsync sync = ctx.glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
456
457	ctx.beginSection("GL_INVALID_VALUE is generated if sync is not the name of an existing sync object.");
458	ctx.glClientWaitSync (0, 0, 10000);
459	ctx.expectError(GL_INVALID_VALUE);
460	ctx.endSection();
461
462	ctx.beginSection("GL_INVALID_VALUE is generated if flags contains any unsupported flag.");
463	ctx.glClientWaitSync(sync, 0x00000004, 10000);
464	ctx.expectError(GL_INVALID_VALUE);
465	ctx.endSection();
466
467	ctx.glDeleteSync(sync);
468}
469
470void delete_sync (NegativeTestContext& ctx)
471{
472	ctx.beginSection("GL_INVALID_VALUE is generated if sync is neither zero or the name of a sync object.");
473	ctx.glDeleteSync((GLsync)1);
474	ctx.expectError(GL_INVALID_VALUE);
475	ctx.glDeleteSync(0);
476	ctx.expectError(GL_NO_ERROR);
477	ctx.endSection();
478}
479
480std::vector<FunctionContainer> getNegativeFragmentApiTestFunctions ()
481{
482	FunctionContainer funcs[] =
483	{
484		{scissor,					"scissor",					"Invalid glScissor() usage"					},
485		{depth_func,				"depth_func",				"Invalid glDepthFunc() usage"				},
486		{viewport,					"viewport",					"Invalid glViewport() usage"				},
487		{stencil_func,				"stencil_func",				"Invalid glStencilFunc() usage"				},
488		{stencil_func_separate,		"stencil_func_separate",	"Invalid glStencilFuncSeparate() usage"		},
489		{stencil_op,				"stencil_op",				"Invalid glStencilOp() usage"				},
490		{stencil_op_separate,		"stencil_op_separate",		"Invalid glStencilOpSeparate() usage"		},
491		{stencil_mask_separate,		"stencil_mask_separate",	"Invalid glStencilMaskSeparate() usage"		},
492		{blend_equation,			"blend_equation",			"Invalid glBlendEquation() usage"			},
493		{blend_equationi,			"blend_equationi",			"Invalid glBlendEquationi() usage"			},
494		{blend_equation_separate,	"blend_equation_separate",	"Invalid glBlendEquationSeparate() usage"	},
495		{blend_equation_separatei,	"blend_equation_separatei",	"Invalid glBlendEquationSeparatei() usage"	},
496		{blend_func,				"blend_func",				"Invalid glBlendFunc() usage"				},
497		{blend_funci,				"blend_funci",				"Invalid glBlendFunci() usage"				},
498		{blend_func_separate,		"blend_func_separate",		"Invalid glBlendFuncSeparate() usage"		},
499		{blend_func_separatei,		"blend_func_separatei",		"Invalid glBlendFuncSeparatei() usage"		},
500		{cull_face,					"cull_face",				"Invalid glCullFace() usage"				},
501		{front_face,				"front_face",				"Invalid glFrontFace() usage"				},
502		{line_width,				"line_width",				"Invalid glLineWidth() usage"				},
503		{gen_queries,				"gen_queries",				"Invalid glGenQueries() usage"				},
504		{begin_query,				"begin_query",				"Invalid glBeginQuery() usage"				},
505		{end_query,					"end_query",				"Invalid glEndQuery() usage"				},
506		{delete_queries,			"delete_queries",			"Invalid glDeleteQueries() usage"			},
507		{fence_sync,				"fence_sync",				"Invalid glFenceSync() usage"				},
508		{wait_sync,					"wait_sync",				"Invalid glWaitSync() usage"				},
509		{client_wait_sync,			"client_wait_sync",			"Invalid glClientWaitSync() usage"			},
510		{delete_sync,				"delete_sync",				"Invalid glDeleteSync() usage"				},
511	};
512
513	return std::vector<FunctionContainer>(DE_ARRAY_BEGIN(funcs), DE_ARRAY_END(funcs));
514}
515
516} // NegativeTestShared
517} // Functional
518} // gles31
519} // deqp
520