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 glu::CallLogWrapper;
43 using tcu::TestLog;
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 "
105 "symbolic constant values.");
106 ctx.glStencilOp(-1, GL_ZERO, GL_REPLACE);
107 ctx.expectError(GL_INVALID_ENUM);
108 ctx.glStencilOp(GL_KEEP, -1, GL_REPLACE);
109 ctx.expectError(GL_INVALID_ENUM);
110 ctx.glStencilOp(GL_KEEP, GL_ZERO, -1);
111 ctx.expectError(GL_INVALID_ENUM);
112 ctx.endSection();
113 }
114
stencil_op_separate(NegativeTestContext & ctx)115 void stencil_op_separate(NegativeTestContext &ctx)
116 {
117 ctx.beginSection(
118 "GL_INVALID_ENUM is generated if face is any value other than GL_FRONT, GL_BACK, or GL_FRONT_AND_BACK.");
119 ctx.glStencilOpSeparate(-1, GL_KEEP, GL_ZERO, GL_REPLACE);
120 ctx.expectError(GL_INVALID_ENUM);
121 ctx.endSection();
122
123 ctx.beginSection("GL_INVALID_ENUM is generated if sfail, dpfail, or dppass is any value other than the eight "
124 "defined symbolic constant values.");
125 ctx.glStencilOpSeparate(GL_FRONT, -1, GL_ZERO, GL_REPLACE);
126 ctx.expectError(GL_INVALID_ENUM);
127 ctx.glStencilOpSeparate(GL_FRONT, GL_KEEP, -1, GL_REPLACE);
128 ctx.expectError(GL_INVALID_ENUM);
129 ctx.glStencilOpSeparate(GL_FRONT, GL_KEEP, GL_ZERO, -1);
130 ctx.expectError(GL_INVALID_ENUM);
131 ctx.endSection();
132 }
133
stencil_mask_separate(NegativeTestContext & ctx)134 void stencil_mask_separate(NegativeTestContext &ctx)
135 {
136 ctx.beginSection("GL_INVALID_ENUM is generated if face is not GL_FRONT, GL_BACK, or GL_FRONT_AND_BACK.");
137 ctx.glStencilMaskSeparate(-1, 0);
138 ctx.expectError(GL_INVALID_ENUM);
139 ctx.endSection();
140 }
141
142 // Blend functions
blend_equation(NegativeTestContext & ctx)143 void blend_equation(NegativeTestContext &ctx)
144 {
145 ctx.beginSection("GL_INVALID_ENUM is generated if mode is not GL_FUNC_ADD, GL_FUNC_SUBTRACT, "
146 "GL_FUNC_REVERSE_SUBTRACT, GL_MAX or GL_MIN.");
147 ctx.glBlendEquation(-1);
148 ctx.expectError(GL_INVALID_ENUM);
149 ctx.endSection();
150 }
151
blend_equation_separate(NegativeTestContext & ctx)152 void blend_equation_separate(NegativeTestContext &ctx)
153 {
154 ctx.beginSection("GL_INVALID_ENUM is generated if modeRGB is not GL_FUNC_ADD, GL_FUNC_SUBTRACT, "
155 "GL_FUNC_REVERSE_SUBTRACT, GL_MAX or GL_MIN.");
156 ctx.glBlendEquationSeparate(-1, GL_FUNC_ADD);
157 ctx.expectError(GL_INVALID_ENUM);
158 ctx.endSection();
159 ctx.beginSection("GL_INVALID_ENUM is generated if modeAlpha is not GL_FUNC_ADD, GL_FUNC_SUBTRACT, "
160 "GL_FUNC_REVERSE_SUBTRACT, GL_MAX or GL_MIN.");
161 ctx.glBlendEquationSeparate(GL_FUNC_ADD, -1);
162 ctx.expectError(GL_INVALID_ENUM);
163 ctx.endSection();
164 }
165
checkSupport(NegativeTestContext & ctx)166 static bool checkSupport(NegativeTestContext &ctx)
167 {
168 return contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) ||
169 contextSupports(ctx.getRenderContext().getType(), glu::ApiType::core(4, 5)) ||
170 ctx.getContextInfo().isExtensionSupported("GL_EXT_draw_buffers_indexed");
171 }
172
blend_equationi(NegativeTestContext & ctx)173 void blend_equationi(NegativeTestContext &ctx)
174 {
175 glw::GLint maxDrawBuffers = -1;
176
177 if (!checkSupport(ctx))
178 throw tcu::NotSupportedError("GL_EXT_draw_buffers_indexed is not supported", DE_NULL, __FILE__, __LINE__);
179
180 ctx.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
181 ctx.beginSection("GL_INVALID_ENUM is generated if mode is not GL_FUNC_ADD, GL_FUNC_SUBTRACT, "
182 "GL_FUNC_REVERSE_SUBTRACT, GL_MAX or GL_MIN.");
183 ctx.glBlendEquationi(0, -1);
184 ctx.expectError(GL_INVALID_ENUM);
185 ctx.endSection();
186 ctx.beginSection(
187 "GL_INVALID_VALUE is generated if buf is not in the range zero to the value of MAX_DRAW_BUFFERS minus one.");
188 ctx.glBlendEquationi(-1, GL_FUNC_ADD);
189 ctx.expectError(GL_INVALID_VALUE);
190 ctx.glBlendEquationi(maxDrawBuffers, GL_FUNC_ADD);
191 ctx.expectError(GL_INVALID_VALUE);
192 ctx.endSection();
193 }
194
blend_equation_separatei(NegativeTestContext & ctx)195 void blend_equation_separatei(NegativeTestContext &ctx)
196 {
197 glw::GLint maxDrawBuffers = -1;
198
199 if (!checkSupport(ctx))
200 throw tcu::NotSupportedError("GL_EXT_draw_buffers_indexed is not supported", DE_NULL, __FILE__, __LINE__);
201
202 ctx.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
203 ctx.beginSection("GL_INVALID_ENUM is generated if modeRGB is not GL_FUNC_ADD, GL_FUNC_SUBTRACT, "
204 "GL_FUNC_REVERSE_SUBTRACT, GL_MAX or GL_MIN.");
205 ctx.glBlendEquationSeparatei(0, -1, GL_FUNC_ADD);
206 ctx.expectError(GL_INVALID_ENUM);
207 ctx.endSection();
208 ctx.beginSection("GL_INVALID_ENUM is generated if modeAlpha is not GL_FUNC_ADD, GL_FUNC_SUBTRACT, "
209 "GL_FUNC_REVERSE_SUBTRACT, GL_MAX or GL_MIN.");
210 ctx.glBlendEquationSeparatei(0, GL_FUNC_ADD, -1);
211 ctx.expectError(GL_INVALID_ENUM);
212 ctx.endSection();
213 ctx.beginSection(
214 "GL_INVALID_VALUE is generated if buf is not in the range zero to the value of MAX_DRAW_BUFFERS minus one.");
215 ctx.glBlendEquationSeparatei(-1, GL_FUNC_ADD, GL_FUNC_ADD);
216 ctx.expectError(GL_INVALID_VALUE);
217 ctx.glBlendEquationSeparatei(maxDrawBuffers, GL_FUNC_ADD, GL_FUNC_ADD);
218 ctx.expectError(GL_INVALID_VALUE);
219 ctx.endSection();
220 }
221
blend_func(NegativeTestContext & ctx)222 void blend_func(NegativeTestContext &ctx)
223 {
224 ctx.beginSection("GL_INVALID_ENUM is generated if either sfactor or dfactor is not an accepted value.");
225 ctx.glBlendFunc(-1, GL_ONE);
226 ctx.expectError(GL_INVALID_ENUM);
227 ctx.glBlendFunc(GL_ONE, -1);
228 ctx.expectError(GL_INVALID_ENUM);
229 ctx.endSection();
230 }
231
blend_func_separate(NegativeTestContext & ctx)232 void blend_func_separate(NegativeTestContext &ctx)
233 {
234 ctx.beginSection("GL_INVALID_ENUM is generated if srcRGB, dstRGB, srcAlpha, or dstAlpha is not an accepted value.");
235 ctx.glBlendFuncSeparate(-1, GL_ONE, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR);
236 ctx.expectError(GL_INVALID_ENUM);
237 ctx.glBlendFuncSeparate(GL_ZERO, -1, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR);
238 ctx.expectError(GL_INVALID_ENUM);
239 ctx.glBlendFuncSeparate(GL_ZERO, GL_ONE, -1, GL_ONE_MINUS_SRC_COLOR);
240 ctx.expectError(GL_INVALID_ENUM);
241 ctx.glBlendFuncSeparate(GL_ZERO, GL_ONE, GL_SRC_COLOR, -1);
242 ctx.expectError(GL_INVALID_ENUM);
243 ctx.endSection();
244 }
245
blend_funci(NegativeTestContext & ctx)246 void blend_funci(NegativeTestContext &ctx)
247 {
248 glw::GLint maxDrawBuffers = -1;
249
250 if (!checkSupport(ctx))
251 throw tcu::NotSupportedError("GL_EXT_draw_buffers_indexed is not supported", DE_NULL, __FILE__, __LINE__);
252
253 ctx.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
254 ctx.beginSection("GL_INVALID_ENUM is generated if either sfactor or dfactor is not an accepted value.");
255 ctx.glBlendFunci(0, -1, GL_ONE);
256 ctx.expectError(GL_INVALID_ENUM);
257 ctx.glBlendFunci(0, GL_ONE, -1);
258 ctx.expectError(GL_INVALID_ENUM);
259 ctx.endSection();
260 ctx.beginSection(
261 "GL_INVALID_VALUE is generated if buf is not in the range zero to the value of MAX_DRAW_BUFFERS minus one.");
262 ctx.glBlendFunci(-1, GL_ONE, GL_ONE);
263 ctx.expectError(GL_INVALID_VALUE);
264 ctx.glBlendFunci(maxDrawBuffers, GL_ONE, GL_ONE);
265 ctx.expectError(GL_INVALID_VALUE);
266 ctx.endSection();
267 }
268
blend_func_separatei(NegativeTestContext & ctx)269 void blend_func_separatei(NegativeTestContext &ctx)
270 {
271 glw::GLint maxDrawBuffers = -1;
272
273 if (!checkSupport(ctx))
274 throw tcu::NotSupportedError("GL_EXT_draw_buffers_indexed is not supported", DE_NULL, __FILE__, __LINE__);
275
276 ctx.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
277 ctx.beginSection("GL_INVALID_ENUM is generated if srcRGB, dstRGB, srcAlpha, or dstAlpha is not an accepted value.");
278 ctx.glBlendFuncSeparatei(0, -1, GL_ONE, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR);
279 ctx.expectError(GL_INVALID_ENUM);
280 ctx.glBlendFuncSeparatei(0, GL_ZERO, -1, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR);
281 ctx.expectError(GL_INVALID_ENUM);
282 ctx.glBlendFuncSeparatei(0, GL_ZERO, GL_ONE, -1, GL_ONE_MINUS_SRC_COLOR);
283 ctx.expectError(GL_INVALID_ENUM);
284 ctx.glBlendFuncSeparatei(0, GL_ZERO, GL_ONE, GL_SRC_COLOR, -1);
285 ctx.expectError(GL_INVALID_ENUM);
286 ctx.endSection();
287 ctx.beginSection(
288 "GL_INVALID_VALUE is generated if buf is not in the range zero to the value of MAX_DRAW_BUFFERS minus one.");
289 ctx.glBlendFuncSeparatei(-1, GL_ONE, GL_ONE, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR);
290 ctx.expectError(GL_INVALID_VALUE);
291 ctx.glBlendFuncSeparatei(maxDrawBuffers, GL_ONE, GL_ONE, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR);
292 ctx.expectError(GL_INVALID_VALUE);
293 ctx.endSection();
294 }
295
296 // Rasterization API functions
cull_face(NegativeTestContext & ctx)297 void cull_face(NegativeTestContext &ctx)
298 {
299 ctx.beginSection("GL_INVALID_ENUM is generated if mode is not an accepted value.");
300 ctx.glCullFace(-1);
301 ctx.expectError(GL_INVALID_ENUM);
302 ctx.endSection();
303 }
304
front_face(NegativeTestContext & ctx)305 void front_face(NegativeTestContext &ctx)
306 {
307 ctx.beginSection("GL_INVALID_ENUM is generated if mode is not an accepted value.");
308 ctx.glFrontFace(-1);
309 ctx.expectError(GL_INVALID_ENUM);
310 ctx.endSection();
311 }
312
line_width(NegativeTestContext & ctx)313 void line_width(NegativeTestContext &ctx)
314 {
315 ctx.beginSection("GL_INVALID_VALUE is generated if width is less than or equal to 0.");
316 ctx.glLineWidth(0);
317 ctx.expectError(GL_INVALID_VALUE);
318 ctx.glLineWidth(-1);
319 ctx.expectError(GL_INVALID_VALUE);
320 ctx.endSection();
321 }
322
323 // Asynchronous queries
gen_queries(NegativeTestContext & ctx)324 void gen_queries(NegativeTestContext &ctx)
325 {
326 ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
327 GLuint ids = 0;
328 ctx.glGenQueries(-1, &ids);
329 ctx.expectError(GL_INVALID_VALUE);
330 ctx.endSection();
331 }
332
begin_query(NegativeTestContext & ctx)333 void begin_query(NegativeTestContext &ctx)
334 {
335 GLuint ids[3];
336 ctx.glGenQueries(3, ids);
337
338 ctx.beginSection("GL_INVALID_ENUM is generated if target is not one of the accepted tokens.");
339 ctx.glBeginQuery(-1, ids[0]);
340 ctx.expectError(GL_INVALID_ENUM);
341 ctx.endSection();
342
343 ctx.beginSection("GL_INVALID_OPERATION is generated if ctx.glBeginQuery is executed while a query object of the "
344 "same target is already active.");
345 ctx.glBeginQuery(GL_ANY_SAMPLES_PASSED, ids[0]);
346 ctx.expectError(GL_NO_ERROR);
347 ctx.glBeginQuery(GL_ANY_SAMPLES_PASSED, ids[1]);
348 ctx.expectError(GL_INVALID_OPERATION);
349 // \note GL_ANY_SAMPLES_PASSED and GL_ANY_SAMPLES_PASSED_CONSERVATIVE alias to the same target for the purposes of this error.
350 ctx.glBeginQuery(GL_ANY_SAMPLES_PASSED_CONSERVATIVE, ids[1]);
351 ctx.expectError(GL_INVALID_OPERATION);
352 ctx.glBeginQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, ids[1]);
353 ctx.expectError(GL_NO_ERROR);
354 ctx.glBeginQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, ids[2]);
355 ctx.expectError(GL_INVALID_OPERATION);
356 ctx.glEndQuery(GL_ANY_SAMPLES_PASSED);
357 ctx.glEndQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN);
358 ctx.expectError(GL_NO_ERROR);
359 ctx.endSection();
360
361 ctx.beginSection("GL_INVALID_OPERATION is generated if id is 0.");
362 ctx.glBeginQuery(GL_ANY_SAMPLES_PASSED, 0);
363 ctx.expectError(GL_INVALID_OPERATION);
364 ctx.endSection();
365
366 ctx.beginSection("GL_INVALID_OPERATION is generated if id not a name returned from a previous call to "
367 "ctx.glGenQueries, or if such a name has since been deleted with ctx.glDeleteQueries.");
368 ctx.glBeginQuery(GL_ANY_SAMPLES_PASSED, -1);
369 ctx.expectError(GL_INVALID_OPERATION);
370 ctx.glDeleteQueries(1, &ids[2]);
371 ctx.expectError(GL_NO_ERROR);
372 ctx.glBeginQuery(GL_ANY_SAMPLES_PASSED, ids[2]);
373 ctx.expectError(GL_INVALID_OPERATION);
374 ctx.endSection();
375
376 ctx.beginSection("GL_INVALID_OPERATION is generated if id is the name of an already active query object.");
377 ctx.glBeginQuery(GL_ANY_SAMPLES_PASSED, ids[0]);
378 ctx.expectError(GL_NO_ERROR);
379 ctx.glBeginQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, ids[0]);
380 ctx.expectError(GL_INVALID_OPERATION);
381 ctx.endSection();
382
383 ctx.beginSection("GL_INVALID_OPERATION is generated if id refers to an existing query object whose type does not "
384 "does not match target.");
385 ctx.glEndQuery(GL_ANY_SAMPLES_PASSED);
386 ctx.expectError(GL_NO_ERROR);
387 ctx.glBeginQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, ids[0]);
388 ctx.expectError(GL_INVALID_OPERATION);
389 ctx.endSection();
390
391 ctx.glDeleteQueries(2, &ids[0]);
392 ctx.expectError(GL_NO_ERROR);
393 }
394
end_query(NegativeTestContext & ctx)395 void end_query(NegativeTestContext &ctx)
396 {
397 GLuint id = 0;
398 ctx.glGenQueries(1, &id);
399
400 ctx.beginSection("GL_INVALID_ENUM is generated if target is not one of the accepted tokens.");
401 ctx.glEndQuery(-1);
402 ctx.expectError(GL_INVALID_ENUM);
403 ctx.endSection();
404
405 ctx.beginSection("GL_INVALID_OPERATION is generated if ctx.glEndQuery is executed when a query object of the same "
406 "target is not active.");
407 ctx.glEndQuery(GL_ANY_SAMPLES_PASSED);
408 ctx.expectError(GL_INVALID_OPERATION);
409 ctx.glBeginQuery(GL_ANY_SAMPLES_PASSED, id);
410 ctx.expectError(GL_NO_ERROR);
411 ctx.glEndQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN);
412 ctx.expectError(GL_INVALID_OPERATION);
413 ctx.glEndQuery(GL_ANY_SAMPLES_PASSED);
414 ctx.expectError(GL_NO_ERROR);
415 ctx.endSection();
416
417 ctx.glDeleteQueries(1, &id);
418 ctx.expectError(GL_NO_ERROR);
419 }
420
delete_queries(NegativeTestContext & ctx)421 void delete_queries(NegativeTestContext &ctx)
422 {
423 GLuint id = 0;
424 ctx.glGenQueries(1, &id);
425
426 ctx.beginSection("GL_INVALID_VALUE is generated if n is negative.");
427 ctx.glDeleteQueries(-1, &id);
428 ctx.expectError(GL_INVALID_VALUE);
429 ctx.endSection();
430
431 ctx.glDeleteQueries(1, &id);
432 }
433
434 // Sync objects
fence_sync(NegativeTestContext & ctx)435 void fence_sync(NegativeTestContext &ctx)
436 {
437 ctx.beginSection("GL_INVALID_ENUM is generated if condition is not GL_SYNC_GPU_COMMANDS_COMPLETE.");
438 ctx.glFenceSync(-1, 0);
439 ctx.expectError(GL_INVALID_ENUM);
440 ctx.endSection();
441
442 ctx.beginSection("GL_INVALID_VALUE is generated if flags is not zero.");
443 ctx.glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0x0010);
444 ctx.expectError(GL_INVALID_VALUE);
445 ctx.endSection();
446 }
447
wait_sync(NegativeTestContext & ctx)448 void wait_sync(NegativeTestContext &ctx)
449 {
450 GLsync sync = ctx.glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
451
452 ctx.beginSection("GL_INVALID_VALUE is generated if sync is not the name of a sync object.");
453 ctx.glWaitSync(0, 0, GL_TIMEOUT_IGNORED);
454 ctx.expectError(GL_INVALID_VALUE);
455 ctx.endSection();
456
457 ctx.beginSection("GL_INVALID_VALUE is generated if flags is not zero.");
458 ctx.glWaitSync(sync, 0x0010, GL_TIMEOUT_IGNORED);
459 ctx.expectError(GL_INVALID_VALUE);
460 ctx.endSection();
461
462 ctx.beginSection("GL_INVALID_VALUE is generated if timeout is not GL_TIMEOUT_IGNORED.");
463 ctx.glWaitSync(sync, 0, 0);
464 ctx.expectError(GL_INVALID_VALUE);
465 ctx.endSection();
466
467 ctx.glDeleteSync(sync);
468 }
469
client_wait_sync(NegativeTestContext & ctx)470 void client_wait_sync(NegativeTestContext &ctx)
471 {
472 GLsync sync = ctx.glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
473
474 ctx.beginSection("GL_INVALID_VALUE is generated if sync is not the name of an existing sync object.");
475 ctx.glClientWaitSync(0, 0, 10000);
476 ctx.expectError(GL_INVALID_VALUE);
477 ctx.endSection();
478
479 ctx.beginSection("GL_INVALID_VALUE is generated if flags contains any unsupported flag.");
480 ctx.glClientWaitSync(sync, 0x00000004, 10000);
481 ctx.expectError(GL_INVALID_VALUE);
482 ctx.endSection();
483
484 ctx.glDeleteSync(sync);
485 }
486
delete_sync(NegativeTestContext & ctx)487 void delete_sync(NegativeTestContext &ctx)
488 {
489 ctx.beginSection("GL_INVALID_VALUE is generated if sync is neither zero or the name of a sync object.");
490 ctx.glDeleteSync((GLsync)1);
491 ctx.expectError(GL_INVALID_VALUE);
492 ctx.glDeleteSync(0);
493 ctx.expectError(GL_NO_ERROR);
494 ctx.endSection();
495 }
496
getNegativeFragmentApiTestFunctions()497 std::vector<FunctionContainer> getNegativeFragmentApiTestFunctions()
498 {
499 FunctionContainer funcs[] = {
500 {scissor, "scissor", "Invalid glScissor() usage"},
501 {depth_func, "depth_func", "Invalid glDepthFunc() usage"},
502 {viewport, "viewport", "Invalid glViewport() usage"},
503 {stencil_func, "stencil_func", "Invalid glStencilFunc() usage"},
504 {stencil_func_separate, "stencil_func_separate", "Invalid glStencilFuncSeparate() usage"},
505 {stencil_op, "stencil_op", "Invalid glStencilOp() usage"},
506 {stencil_op_separate, "stencil_op_separate", "Invalid glStencilOpSeparate() usage"},
507 {stencil_mask_separate, "stencil_mask_separate", "Invalid glStencilMaskSeparate() usage"},
508 {blend_equation, "blend_equation", "Invalid glBlendEquation() usage"},
509 {blend_equationi, "blend_equationi", "Invalid glBlendEquationi() usage"},
510 {blend_equation_separate, "blend_equation_separate", "Invalid glBlendEquationSeparate() usage"},
511 {blend_equation_separatei, "blend_equation_separatei", "Invalid glBlendEquationSeparatei() usage"},
512 {blend_func, "blend_func", "Invalid glBlendFunc() usage"},
513 {blend_funci, "blend_funci", "Invalid glBlendFunci() usage"},
514 {blend_func_separate, "blend_func_separate", "Invalid glBlendFuncSeparate() usage"},
515 {blend_func_separatei, "blend_func_separatei", "Invalid glBlendFuncSeparatei() usage"},
516 {cull_face, "cull_face", "Invalid glCullFace() usage"},
517 {front_face, "front_face", "Invalid glFrontFace() usage"},
518 {line_width, "line_width", "Invalid glLineWidth() usage"},
519 {gen_queries, "gen_queries", "Invalid glGenQueries() usage"},
520 {begin_query, "begin_query", "Invalid glBeginQuery() usage"},
521 {end_query, "end_query", "Invalid glEndQuery() usage"},
522 {delete_queries, "delete_queries", "Invalid glDeleteQueries() usage"},
523 {fence_sync, "fence_sync", "Invalid glFenceSync() usage"},
524 {wait_sync, "wait_sync", "Invalid glWaitSync() usage"},
525 {client_wait_sync, "client_wait_sync", "Invalid glClientWaitSync() usage"},
526 {delete_sync, "delete_sync", "Invalid glDeleteSync() usage"},
527 };
528
529 return std::vector<FunctionContainer>(DE_ARRAY_BEGIN(funcs), DE_ARRAY_END(funcs));
530 }
531
532 } // namespace NegativeTestShared
533 } // namespace Functional
534 } // namespace gles31
535 } // namespace deqp
536