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
33 namespace deqp
34 {
35 namespace gles31
36 {
37 namespace Functional
38 {
39 namespace NegativeTestShared
40 {
41
42 using tcu::TestLog;
43 using glu::CallLogWrapper;
44 using namespace glw;
45
46 using tcu::TestLog;
47
scissor(NegativeTestContext & ctx)48 void 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
depth_func(NegativeTestContext & ctx)60 void 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
viewport(NegativeTestContext & ctx)68 void 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
stencil_func(NegativeTestContext & ctx)81 void 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
stencil_func_separate(NegativeTestContext & ctx)89 void 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
stencil_op(NegativeTestContext & ctx)102 void 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
stencil_op_separate(NegativeTestContext & ctx)114 void 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
stencil_mask_separate(NegativeTestContext & ctx)131 void 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
blend_equation(NegativeTestContext & ctx)140 void 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
blend_equation_separate(NegativeTestContext & ctx)148 void 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
checkSupport(NegativeTestContext & ctx)160 static 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
blend_equationi(NegativeTestContext & ctx)167 void 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
blend_equation_separatei(NegativeTestContext & ctx)187 void 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
blend_func(NegativeTestContext & ctx)211 void 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
blend_func_separate(NegativeTestContext & ctx)221 void 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
blend_funci(NegativeTestContext & ctx)235 void 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
blend_func_separatei(NegativeTestContext & ctx)257 void 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
cull_face(NegativeTestContext & ctx)284 void 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
front_face(NegativeTestContext & ctx)292 void 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
line_width(NegativeTestContext & ctx)300 void 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
gen_queries(NegativeTestContext & ctx)311 void 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
begin_query(NegativeTestContext & ctx)320 void 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
end_query(NegativeTestContext & ctx)379 void 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
delete_queries(NegativeTestContext & ctx)404 void 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
fence_sync(NegativeTestContext & ctx)418 void 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
wait_sync(NegativeTestContext & ctx)431 void 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
client_wait_sync(NegativeTestContext & ctx)453 void 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
delete_sync(NegativeTestContext & ctx)470 void 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
getNegativeFragmentApiTestFunctions()480 std::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