1 //
2 // Copyright 2019 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6
7 // validationES32.cpp: Validation functions for OpenGL ES 3.2 entry point parameters
8
9 #include "libANGLE/validationES32_autogen.h"
10
11 #include "libANGLE/Context.h"
12 #include "libANGLE/ErrorStrings.h"
13 #include "libANGLE/Framebuffer.h"
14 #include "libANGLE/VertexArray.h"
15 #include "libANGLE/validationES.h"
16 #include "libANGLE/validationES2.h"
17 #include "libANGLE/validationES3.h"
18 #include "libANGLE/validationES31.h"
19 #include "libANGLE/validationES31_autogen.h"
20 #include "libANGLE/validationES3_autogen.h"
21
22 #include "common/utilities.h"
23
24 using namespace angle;
25
26 namespace gl
27 {
28 using namespace err;
29
30 namespace
31 {
32 // ANGLE_shader_pixel_local_storage: INVALID_OPERATION is generated by Enablei*(), Disablei*() if
33 // <cap> is not one of: BLEND, SCISSOR_TEST, SCISSOR_TEST_EXCLUSIVE_NV.
IsIndexedCapBannedWithActivePLS(GLenum cap)34 static bool IsIndexedCapBannedWithActivePLS(GLenum cap)
35 {
36 switch (cap)
37 {
38 case GL_BLEND:
39 case GL_SCISSOR_TEST:
40 case GL_SCISSOR_TEST_EXCLUSIVE_NV:
41 return false;
42 default:
43 return true;
44 }
45 }
46 } // anonymous namespace
47
ValidateBlendBarrier(const Context * context,angle::EntryPoint entryPoint)48 bool ValidateBlendBarrier(const Context *context, angle::EntryPoint entryPoint)
49 {
50 if (context->getClientVersion() < ES_3_2)
51 {
52 ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES32Required);
53 return false;
54 }
55
56 return true;
57 }
58
ValidateBlendEquationSeparatei(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLuint buf,GLenum modeRGB,GLenum modeAlpha)59 bool ValidateBlendEquationSeparatei(const PrivateState &state,
60 ErrorSet *errors,
61 angle::EntryPoint entryPoint,
62 GLuint buf,
63 GLenum modeRGB,
64 GLenum modeAlpha)
65 {
66 if (buf >= static_cast<GLuint>(state.getCaps().maxDrawBuffers))
67 {
68 errors->validationError(entryPoint, GL_INVALID_VALUE, kExceedsMaxDrawBuffers);
69 return false;
70 }
71
72 if (!ValidateBlendEquationSeparate(state, errors, entryPoint, modeRGB, modeAlpha))
73 {
74 // error already generated
75 return false;
76 }
77
78 return true;
79 }
80
ValidateBlendEquationi(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLuint buf,GLenum mode)81 bool ValidateBlendEquationi(const PrivateState &state,
82 ErrorSet *errors,
83 angle::EntryPoint entryPoint,
84 GLuint buf,
85 GLenum mode)
86 {
87 if (buf >= static_cast<GLuint>(state.getCaps().maxDrawBuffers))
88 {
89 errors->validationError(entryPoint, GL_INVALID_VALUE, kExceedsMaxDrawBuffers);
90 return false;
91 }
92
93 if (!ValidateBlendEquation(state, errors, entryPoint, mode))
94 {
95 // error already generated
96 return false;
97 }
98
99 return true;
100 }
101
ValidateBlendFuncSeparatei(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLuint buf,GLenum srcRGB,GLenum dstRGB,GLenum srcAlpha,GLenum dstAlpha)102 bool ValidateBlendFuncSeparatei(const PrivateState &state,
103 ErrorSet *errors,
104 angle::EntryPoint entryPoint,
105 GLuint buf,
106 GLenum srcRGB,
107 GLenum dstRGB,
108 GLenum srcAlpha,
109 GLenum dstAlpha)
110 {
111 if (buf >= static_cast<GLuint>(state.getCaps().maxDrawBuffers))
112 {
113 errors->validationError(entryPoint, GL_INVALID_VALUE, kExceedsMaxDrawBuffers);
114 return false;
115 }
116
117 if (!ValidateBlendFuncSeparate(state, errors, entryPoint, srcRGB, dstRGB, srcAlpha, dstAlpha))
118 {
119 // error already generated
120 return false;
121 }
122
123 return true;
124 }
125
ValidateBlendFunci(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLuint buf,GLenum src,GLenum dst)126 bool ValidateBlendFunci(const PrivateState &state,
127 ErrorSet *errors,
128 angle::EntryPoint entryPoint,
129 GLuint buf,
130 GLenum src,
131 GLenum dst)
132 {
133 if (buf >= static_cast<GLuint>(state.getCaps().maxDrawBuffers))
134 {
135 errors->validationError(entryPoint, GL_INVALID_VALUE, kExceedsMaxDrawBuffers);
136 return false;
137 }
138
139 if (!ValidateBlendFunc(state, errors, entryPoint, src, dst))
140 {
141 // error already generated
142 return false;
143 }
144
145 return true;
146 }
147
ValidateColorMaski(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLuint buf,GLboolean r,GLboolean g,GLboolean b,GLboolean a)148 bool ValidateColorMaski(const PrivateState &state,
149 ErrorSet *errors,
150 angle::EntryPoint entryPoint,
151 GLuint buf,
152 GLboolean r,
153 GLboolean g,
154 GLboolean b,
155 GLboolean a)
156 {
157 if (buf >= static_cast<GLuint>(state.getCaps().maxDrawBuffers))
158 {
159 errors->validationError(entryPoint, GL_INVALID_VALUE, kIndexExceedsMaxDrawBuffer);
160 return false;
161 }
162
163 return true;
164 }
165
ValidateCopyImageSubData(const Context * context,angle::EntryPoint entryPoint,GLuint srcName,GLenum srcTarget,GLint srcLevel,GLint srcX,GLint srcY,GLint srcZ,GLuint dstName,GLenum dstTarget,GLint dstLevel,GLint dstX,GLint dstY,GLint dstZ,GLsizei srcWidth,GLsizei srcHeight,GLsizei srcDepth)166 bool ValidateCopyImageSubData(const Context *context,
167 angle::EntryPoint entryPoint,
168 GLuint srcName,
169 GLenum srcTarget,
170 GLint srcLevel,
171 GLint srcX,
172 GLint srcY,
173 GLint srcZ,
174 GLuint dstName,
175 GLenum dstTarget,
176 GLint dstLevel,
177 GLint dstX,
178 GLint dstY,
179 GLint dstZ,
180 GLsizei srcWidth,
181 GLsizei srcHeight,
182 GLsizei srcDepth)
183 {
184 if (context->getClientVersion() < ES_3_2)
185 {
186 ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES32Required);
187 return false;
188 }
189
190 return ValidateCopyImageSubDataBase(context, entryPoint, srcName, srcTarget, srcLevel, srcX,
191 srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ,
192 srcWidth, srcHeight, srcDepth);
193 }
194
ValidateDebugMessageCallback(const Context * context,angle::EntryPoint entryPoint,GLDEBUGPROC callback,const void * userParam)195 bool ValidateDebugMessageCallback(const Context *context,
196 angle::EntryPoint entryPoint,
197 GLDEBUGPROC callback,
198 const void *userParam)
199 {
200 if (context->getClientVersion() < ES_3_2)
201 {
202 ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES32Required);
203 return false;
204 }
205
206 return true;
207 }
208
ValidateDebugMessageControl(const Context * context,angle::EntryPoint entryPoint,GLenum source,GLenum type,GLenum severity,GLsizei count,const GLuint * ids,GLboolean enabled)209 bool ValidateDebugMessageControl(const Context *context,
210 angle::EntryPoint entryPoint,
211 GLenum source,
212 GLenum type,
213 GLenum severity,
214 GLsizei count,
215 const GLuint *ids,
216 GLboolean enabled)
217 {
218 if (context->getClientVersion() < ES_3_2)
219 {
220 ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES32Required);
221 return false;
222 }
223
224 return ValidateDebugMessageControlBase(context, entryPoint, source, type, severity, count, ids);
225 }
226
ValidateDebugMessageInsert(const Context * context,angle::EntryPoint entryPoint,GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar * buf)227 bool ValidateDebugMessageInsert(const Context *context,
228 angle::EntryPoint entryPoint,
229 GLenum source,
230 GLenum type,
231 GLuint id,
232 GLenum severity,
233 GLsizei length,
234 const GLchar *buf)
235 {
236 if (context->getClientVersion() < ES_3_2)
237 {
238 ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES32Required);
239 return false;
240 }
241
242 return ValidateDebugMessageInsertBase(context, entryPoint, source, type, id, severity, length,
243 buf);
244 }
245
ValidateDisablei(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum target,GLuint index)246 bool ValidateDisablei(const PrivateState &state,
247 ErrorSet *errors,
248 angle::EntryPoint entryPoint,
249 GLenum target,
250 GLuint index)
251 {
252 int numPLSPlanes = state.getPixelLocalStorageActivePlanes();
253 if (numPLSPlanes != 0)
254 {
255 if (IsIndexedCapBannedWithActivePLS(target))
256 {
257 errors->validationErrorF(entryPoint, GL_INVALID_OPERATION, kPLSCapNotAllowed, target);
258 return false;
259 }
260 }
261
262 switch (target)
263 {
264 case GL_BLEND:
265 if (index >= static_cast<GLuint>(state.getCaps().maxDrawBuffers))
266 {
267 errors->validationError(entryPoint, GL_INVALID_VALUE, kIndexExceedsMaxDrawBuffer);
268 return false;
269 }
270 break;
271 default:
272 errors->validationErrorF(entryPoint, GL_INVALID_ENUM, kEnumNotSupported, target);
273 return false;
274 }
275 return true;
276 }
277
ValidateDrawElementsBaseVertex(const Context * context,angle::EntryPoint entryPoint,PrimitiveMode mode,GLsizei count,DrawElementsType type,const void * indices,GLint basevertex)278 bool ValidateDrawElementsBaseVertex(const Context *context,
279 angle::EntryPoint entryPoint,
280 PrimitiveMode mode,
281 GLsizei count,
282 DrawElementsType type,
283 const void *indices,
284 GLint basevertex)
285 {
286 return ValidateDrawElementsCommon(context, entryPoint, mode, count, type, indices, 1);
287 }
288
ValidateDrawElementsInstancedBaseVertex(const Context * context,angle::EntryPoint entryPoint,PrimitiveMode mode,GLsizei count,DrawElementsType type,const void * indices,GLsizei instancecount,GLint basevertex)289 bool ValidateDrawElementsInstancedBaseVertex(const Context *context,
290 angle::EntryPoint entryPoint,
291 PrimitiveMode mode,
292 GLsizei count,
293 DrawElementsType type,
294 const void *indices,
295 GLsizei instancecount,
296 GLint basevertex)
297 {
298 return ValidateDrawElementsInstancedBase(context, entryPoint, mode, count, type, indices,
299 instancecount, 0);
300 }
301
ValidateDrawRangeElementsBaseVertex(const Context * context,angle::EntryPoint entryPoint,PrimitiveMode mode,GLuint start,GLuint end,GLsizei count,DrawElementsType type,const void * indices,GLint basevertex)302 bool ValidateDrawRangeElementsBaseVertex(const Context *context,
303 angle::EntryPoint entryPoint,
304 PrimitiveMode mode,
305 GLuint start,
306 GLuint end,
307 GLsizei count,
308 DrawElementsType type,
309 const void *indices,
310 GLint basevertex)
311 {
312 if (end < start)
313 {
314 ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidElementRange);
315 return false;
316 }
317
318 if (!ValidateDrawElementsCommon(context, entryPoint, mode, count, type, indices, 1))
319 {
320 return false;
321 }
322
323 // Skip range checks for no-op calls.
324 if (count <= 0)
325 {
326 return true;
327 }
328
329 return true;
330 }
331
ValidateEnablei(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum target,GLuint index)332 bool ValidateEnablei(const PrivateState &state,
333 ErrorSet *errors,
334 angle::EntryPoint entryPoint,
335 GLenum target,
336 GLuint index)
337 {
338 int numPLSPlanes = state.getPixelLocalStorageActivePlanes();
339 if (numPLSPlanes != 0)
340 {
341 if (IsIndexedCapBannedWithActivePLS(target))
342 {
343 errors->validationErrorF(entryPoint, GL_INVALID_OPERATION, kPLSCapNotAllowed, target);
344 return false;
345 }
346 }
347
348 switch (target)
349 {
350 case GL_BLEND:
351 if (index >= static_cast<GLuint>(state.getCaps().maxDrawBuffers))
352 {
353 errors->validationError(entryPoint, GL_INVALID_VALUE, kIndexExceedsMaxDrawBuffer);
354 return false;
355 }
356 break;
357 default:
358 errors->validationErrorF(entryPoint, GL_INVALID_ENUM, kEnumNotSupported, target);
359 return false;
360 }
361 return true;
362 }
363
ValidateFramebufferTexture(const Context * context,angle::EntryPoint entryPoint,GLenum target,GLenum attachment,TextureID texture,GLint level)364 bool ValidateFramebufferTexture(const Context *context,
365 angle::EntryPoint entryPoint,
366 GLenum target,
367 GLenum attachment,
368 TextureID texture,
369 GLint level)
370 {
371 if (context->getClientVersion() < ES_3_2)
372 {
373 ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES32Required);
374 return false;
375 }
376
377 return ValidateFramebufferTextureCommon(context, entryPoint, target, attachment, texture,
378 level);
379 }
380
ValidateGetDebugMessageLog(const Context * context,angle::EntryPoint entryPoint,GLuint count,GLsizei bufSize,const GLenum * sources,const GLenum * types,const GLuint * ids,const GLenum * severities,const GLsizei * lengths,const GLchar * messageLog)381 bool ValidateGetDebugMessageLog(const Context *context,
382 angle::EntryPoint entryPoint,
383 GLuint count,
384 GLsizei bufSize,
385 const GLenum *sources,
386 const GLenum *types,
387 const GLuint *ids,
388 const GLenum *severities,
389 const GLsizei *lengths,
390 const GLchar *messageLog)
391 {
392 return true;
393 }
394
ValidateGetGraphicsResetStatus(const Context * context,angle::EntryPoint entryPoint)395 bool ValidateGetGraphicsResetStatus(const Context *context, angle::EntryPoint entryPoint)
396 {
397 if (context->getClientVersion() < ES_3_2)
398 {
399 ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES32Required);
400 return false;
401 }
402
403 return true;
404 }
405
ValidateGetObjectLabel(const Context * context,angle::EntryPoint entryPoint,GLenum identifier,GLuint name,GLsizei bufSize,const GLsizei * length,const GLchar * label)406 bool ValidateGetObjectLabel(const Context *context,
407 angle::EntryPoint entryPoint,
408 GLenum identifier,
409 GLuint name,
410 GLsizei bufSize,
411 const GLsizei *length,
412 const GLchar *label)
413 {
414 if (context->getClientVersion() < ES_3_2)
415 {
416 ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES32Required);
417 return false;
418 }
419
420 if (!ValidateGetObjectLabelBase(context, entryPoint, identifier, name, bufSize, length, label))
421 {
422 return false;
423 }
424
425 return true;
426 }
427
ValidateGetObjectPtrLabel(const Context * context,angle::EntryPoint entryPoint,const void * ptr,GLsizei bufSize,const GLsizei * length,const GLchar * label)428 bool ValidateGetObjectPtrLabel(const Context *context,
429 angle::EntryPoint entryPoint,
430 const void *ptr,
431 GLsizei bufSize,
432 const GLsizei *length,
433 const GLchar *label)
434 {
435 if (context->getClientVersion() < ES_3_2)
436 {
437 ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES32Required);
438 return false;
439 }
440
441 if (!ValidateGetObjectPtrLabelBase(context, entryPoint, ptr, bufSize, length, label))
442 {
443 return false;
444 }
445
446 return true;
447 }
448
ValidateGetPointerv(const Context * context,angle::EntryPoint entryPoint,GLenum pname,void * const * params)449 bool ValidateGetPointerv(const Context *context,
450 angle::EntryPoint entryPoint,
451 GLenum pname,
452 void *const *params)
453 {
454 switch (pname)
455 {
456 case GL_VERTEX_ARRAY_POINTER:
457 case GL_NORMAL_ARRAY_POINTER:
458 case GL_COLOR_ARRAY_POINTER:
459 case GL_TEXTURE_COORD_ARRAY_POINTER:
460 case GL_POINT_SIZE_ARRAY_POINTER_OES:
461 if (context->getClientMajorVersion() != 1)
462 {
463 ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidPointerQuery);
464 return false;
465 }
466 break;
467
468 case GL_DEBUG_CALLBACK_FUNCTION:
469 case GL_DEBUG_CALLBACK_USER_PARAM:
470 if (!context->getExtensions().debugKHR)
471 {
472 ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
473 return false;
474 }
475 break;
476
477 case GL_BLOB_CACHE_GET_FUNCTION_ANGLE:
478 case GL_BLOB_CACHE_SET_FUNCTION_ANGLE:
479 case GL_BLOB_CACHE_USER_PARAM_ANGLE:
480 if (!context->getExtensions().blobCacheANGLE)
481 {
482 ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
483 return false;
484 }
485 break;
486
487 default:
488 ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidPointerQuery);
489 return false;
490 }
491
492 return true;
493 }
494
ValidateGetSamplerParameterIiv(const Context * context,angle::EntryPoint entryPoint,SamplerID sampler,GLenum pname,const GLint * params)495 bool ValidateGetSamplerParameterIiv(const Context *context,
496 angle::EntryPoint entryPoint,
497 SamplerID sampler,
498 GLenum pname,
499 const GLint *params)
500 {
501 if (context->getClientVersion() < ES_3_2)
502 {
503 ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES32Required);
504 return false;
505 }
506 return ValidateGetSamplerParameterBase(context, entryPoint, sampler, pname, nullptr, params);
507 }
508
ValidateGetSamplerParameterIuiv(const Context * context,angle::EntryPoint entryPoint,SamplerID sampler,GLenum pname,const GLuint * params)509 bool ValidateGetSamplerParameterIuiv(const Context *context,
510 angle::EntryPoint entryPoint,
511 SamplerID sampler,
512 GLenum pname,
513 const GLuint *params)
514 {
515 if (context->getClientVersion() < ES_3_2)
516 {
517 ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES32Required);
518 return false;
519 }
520 return ValidateGetSamplerParameterBase(context, entryPoint, sampler, pname, nullptr, params);
521 }
522
ValidateGetTexParameterIiv(const Context * context,angle::EntryPoint entryPoint,TextureType targetPacked,GLenum pname,const GLint * params)523 bool ValidateGetTexParameterIiv(const Context *context,
524 angle::EntryPoint entryPoint,
525 TextureType targetPacked,
526 GLenum pname,
527 const GLint *params)
528 {
529 if (context->getClientVersion() < ES_3_2)
530 {
531 ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES32Required);
532 return false;
533 }
534 return ValidateGetTexParameterBase(context, entryPoint, targetPacked, pname, nullptr);
535 }
536
ValidateGetTexParameterIuiv(const Context * context,angle::EntryPoint entryPoint,TextureType targetPacked,GLenum pname,const GLuint * params)537 bool ValidateGetTexParameterIuiv(const Context *context,
538 angle::EntryPoint entryPoint,
539 TextureType targetPacked,
540 GLenum pname,
541 const GLuint *params)
542 {
543 if (context->getClientVersion() < ES_3_2)
544 {
545 ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES32Required);
546 return false;
547 }
548 return ValidateGetTexParameterBase(context, entryPoint, targetPacked, pname, nullptr);
549 }
550
ValidateGetnUniformfv(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLsizei bufSize,const GLfloat * params)551 bool ValidateGetnUniformfv(const Context *context,
552 angle::EntryPoint entryPoint,
553 ShaderProgramID program,
554 UniformLocation location,
555 GLsizei bufSize,
556 const GLfloat *params)
557 {
558 if (context->getClientVersion() < ES_3_2)
559 {
560 ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES32Required);
561 return false;
562 }
563
564 return ValidateSizedGetUniform(context, entryPoint, program, location, bufSize, nullptr);
565 }
566
ValidateGetnUniformiv(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLsizei bufSize,const GLint * params)567 bool ValidateGetnUniformiv(const Context *context,
568 angle::EntryPoint entryPoint,
569 ShaderProgramID program,
570 UniformLocation location,
571 GLsizei bufSize,
572 const GLint *params)
573 {
574 if (context->getClientVersion() < ES_3_2)
575 {
576 ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES32Required);
577 return false;
578 }
579
580 return ValidateSizedGetUniform(context, entryPoint, program, location, bufSize, nullptr);
581 }
582
ValidateGetnUniformuiv(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID program,UniformLocation location,GLsizei bufSize,const GLuint * params)583 bool ValidateGetnUniformuiv(const Context *context,
584 angle::EntryPoint entryPoint,
585 ShaderProgramID program,
586 UniformLocation location,
587 GLsizei bufSize,
588 const GLuint *params)
589 {
590 if (context->getClientVersion() < ES_3_2)
591 {
592 ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES32Required);
593 return false;
594 }
595
596 return ValidateSizedGetUniform(context, entryPoint, program, location, bufSize, nullptr);
597 }
598
ValidateIsEnabledi(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum target,GLuint index)599 bool ValidateIsEnabledi(const PrivateState &state,
600 ErrorSet *errors,
601 angle::EntryPoint entryPoint,
602 GLenum target,
603 GLuint index)
604 {
605 switch (target)
606 {
607 case GL_BLEND:
608 if (index >= static_cast<GLuint>(state.getCaps().maxDrawBuffers))
609 {
610 errors->validationError(entryPoint, GL_INVALID_VALUE, kIndexExceedsMaxDrawBuffer);
611 return false;
612 }
613 break;
614 default:
615 errors->validationErrorF(entryPoint, GL_INVALID_ENUM, kEnumNotSupported, target);
616 return false;
617 }
618 return true;
619 }
620
ValidateMinSampleShading(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfloat value)621 bool ValidateMinSampleShading(const PrivateState &state,
622 ErrorSet *errors,
623 angle::EntryPoint entryPoint,
624 GLfloat value)
625 {
626 return true;
627 }
628
ValidateObjectLabel(const Context * context,angle::EntryPoint entryPoint,GLenum identifier,GLuint name,GLsizei length,const GLchar * label)629 bool ValidateObjectLabel(const Context *context,
630 angle::EntryPoint entryPoint,
631 GLenum identifier,
632 GLuint name,
633 GLsizei length,
634 const GLchar *label)
635 {
636 if (context->getClientVersion() < ES_3_2)
637 {
638 ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES32Required);
639 return false;
640 }
641
642 if (!ValidateObjectLabelBase(context, entryPoint, identifier, name, length, label))
643 {
644 return false;
645 }
646
647 return true;
648 }
649
ValidateObjectPtrLabel(const Context * context,angle::EntryPoint entryPoint,const void * ptr,GLsizei length,const GLchar * label)650 bool ValidateObjectPtrLabel(const Context *context,
651 angle::EntryPoint entryPoint,
652 const void *ptr,
653 GLsizei length,
654 const GLchar *label)
655 {
656 if (context->getClientVersion() < ES_3_2)
657 {
658 ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES32Required);
659 return false;
660 }
661
662 if (!ValidateObjectPtrLabelBase(context, entryPoint, ptr, length, label))
663 {
664 return false;
665 }
666
667 return true;
668 }
669
ValidatePatchParameteri(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum pname,GLint value)670 bool ValidatePatchParameteri(const PrivateState &state,
671 ErrorSet *errors,
672 angle::EntryPoint entryPoint,
673 GLenum pname,
674 GLint value)
675 {
676 if (state.getClientVersion() < ES_3_2)
677 {
678 errors->validationError(entryPoint, GL_INVALID_OPERATION, kES32Required);
679 return false;
680 }
681
682 return ValidatePatchParameteriBase(state, errors, entryPoint, pname, value);
683 }
684
ValidatePopDebugGroup(const Context * context,angle::EntryPoint entryPoint)685 bool ValidatePopDebugGroup(const Context *context, angle::EntryPoint entryPoint)
686 {
687 return ValidatePopDebugGroupBase(context, entryPoint);
688 }
689
ValidatePrimitiveBoundingBox(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfloat minX,GLfloat minY,GLfloat minZ,GLfloat minW,GLfloat maxX,GLfloat maxY,GLfloat maxZ,GLfloat maxW)690 bool ValidatePrimitiveBoundingBox(const PrivateState &state,
691 ErrorSet *errors,
692 angle::EntryPoint entryPoint,
693 GLfloat minX,
694 GLfloat minY,
695 GLfloat minZ,
696 GLfloat minW,
697 GLfloat maxX,
698 GLfloat maxY,
699 GLfloat maxZ,
700 GLfloat maxW)
701 {
702 return true;
703 }
704
ValidatePushDebugGroup(const Context * context,angle::EntryPoint entryPoint,GLenum source,GLuint id,GLsizei length,const GLchar * message)705 bool ValidatePushDebugGroup(const Context *context,
706 angle::EntryPoint entryPoint,
707 GLenum source,
708 GLuint id,
709 GLsizei length,
710 const GLchar *message)
711 {
712 return ValidatePushDebugGroupBase(context, entryPoint, source, id, length, message);
713 }
714
ValidateReadnPixels(const Context * context,angle::EntryPoint entryPoint,GLint x,GLint y,GLsizei width,GLsizei height,GLenum format,GLenum type,GLsizei bufSize,const void * data)715 bool ValidateReadnPixels(const Context *context,
716 angle::EntryPoint entryPoint,
717 GLint x,
718 GLint y,
719 GLsizei width,
720 GLsizei height,
721 GLenum format,
722 GLenum type,
723 GLsizei bufSize,
724 const void *data)
725 {
726 if (context->getClientVersion() < ES_3_2)
727 {
728 ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES32Required);
729 return false;
730 }
731
732 if (bufSize < 0)
733 {
734 ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kNegativeBufSize);
735 return false;
736 }
737
738 return ValidateReadPixelsBase(context, entryPoint, x, y, width, height, format, type, bufSize,
739 nullptr, nullptr, nullptr, data);
740 }
741
ValidateSamplerParameterIiv(const Context * context,angle::EntryPoint entryPoint,SamplerID sampler,GLenum pname,const GLint * param)742 bool ValidateSamplerParameterIiv(const Context *context,
743 angle::EntryPoint entryPoint,
744 SamplerID sampler,
745 GLenum pname,
746 const GLint *param)
747 {
748 if (context->getClientVersion() < ES_3_2)
749 {
750 ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES32Required);
751 return false;
752 }
753 return ValidateSamplerParameterBase(context, entryPoint, sampler, pname, -1, true, param);
754 }
755
ValidateSamplerParameterIuiv(const Context * context,angle::EntryPoint entryPoint,SamplerID sampler,GLenum pname,const GLuint * param)756 bool ValidateSamplerParameterIuiv(const Context *context,
757 angle::EntryPoint entryPoint,
758 SamplerID sampler,
759 GLenum pname,
760 const GLuint *param)
761 {
762 if (context->getClientVersion() < ES_3_2)
763 {
764 ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES32Required);
765 return false;
766 }
767 return ValidateSamplerParameterBase(context, entryPoint, sampler, pname, -1, true, param);
768 }
769
ValidateTexBuffer(const Context * context,angle::EntryPoint entryPoint,TextureType target,GLenum internalformat,BufferID buffer)770 bool ValidateTexBuffer(const Context *context,
771 angle::EntryPoint entryPoint,
772 TextureType target,
773 GLenum internalformat,
774 BufferID buffer)
775 {
776 if (context->getClientVersion() < ES_3_2)
777 {
778 ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES32Required);
779 return false;
780 }
781
782 return ValidateTexBufferBase(context, entryPoint, target, internalformat, buffer);
783 }
784
ValidateTexBufferRange(const Context * context,angle::EntryPoint entryPoint,TextureType target,GLenum internalformat,BufferID buffer,GLintptr offset,GLsizeiptr size)785 bool ValidateTexBufferRange(const Context *context,
786 angle::EntryPoint entryPoint,
787 TextureType target,
788 GLenum internalformat,
789 BufferID buffer,
790 GLintptr offset,
791 GLsizeiptr size)
792 {
793 if (context->getClientVersion() < ES_3_2)
794 {
795 ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES32Required);
796 return false;
797 }
798
799 return ValidateTexBufferRangeBase(context, entryPoint, target, internalformat, buffer, offset,
800 size);
801 }
802
ValidateTexParameterIiv(const Context * context,angle::EntryPoint entryPoint,TextureType targetPacked,GLenum pname,const GLint * params)803 bool ValidateTexParameterIiv(const Context *context,
804 angle::EntryPoint entryPoint,
805 TextureType targetPacked,
806 GLenum pname,
807 const GLint *params)
808 {
809 if (context->getClientVersion() < ES_3_2)
810 {
811 ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES32Required);
812 return false;
813 }
814 return ValidateTexParameterBase(context, entryPoint, targetPacked, pname, -1, true, params);
815 }
816
ValidateTexParameterIuiv(const Context * context,angle::EntryPoint entryPoint,TextureType targetPacked,GLenum pname,const GLuint * params)817 bool ValidateTexParameterIuiv(const Context *context,
818 angle::EntryPoint entryPoint,
819 TextureType targetPacked,
820 GLenum pname,
821 const GLuint *params)
822 {
823 if (context->getClientVersion() < ES_3_2)
824 {
825 ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES32Required);
826 return false;
827 }
828 return ValidateTexParameterBase(context, entryPoint, targetPacked, pname, -1, true, params);
829 }
830
ValidateTexStorage3DMultisample(const Context * context,angle::EntryPoint entryPoint,TextureType targetPacked,GLsizei samples,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth,GLboolean fixedsamplelocations)831 bool ValidateTexStorage3DMultisample(const Context *context,
832 angle::EntryPoint entryPoint,
833 TextureType targetPacked,
834 GLsizei samples,
835 GLenum internalformat,
836 GLsizei width,
837 GLsizei height,
838 GLsizei depth,
839 GLboolean fixedsamplelocations)
840 {
841 if (context->getClientVersion() < ES_3_2)
842 {
843 ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kES32Required);
844 return false;
845 }
846 return ValidateTexStorage3DMultisampleBase(context, entryPoint, targetPacked, samples,
847 internalformat, width, height, depth);
848 }
849
850 } // namespace gl
851