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 // validationESEXT.cpp: Validation functions for OpenGL ES extension entry points.
7
8 #include "libANGLE/validationESEXT_autogen.h"
9
10 #include "libANGLE/Context.h"
11 #include "libANGLE/ErrorStrings.h"
12 #include "libANGLE/MemoryObject.h"
13 #include "libANGLE/validationES.h"
14 #include "libANGLE/validationES2.h"
15 #include "libANGLE/validationES3.h"
16 #include "libANGLE/validationES31.h"
17 #include "libANGLE/validationES32.h"
18
19 namespace gl
20 {
21 using namespace err;
22
23 namespace
24 {
25 template <typename ObjectT>
ValidateGetImageFormatAndType(const Context * context,angle::EntryPoint entryPoint,ObjectT * obj,GLenum format,GLenum type)26 bool ValidateGetImageFormatAndType(const Context *context,
27 angle::EntryPoint entryPoint,
28 ObjectT *obj,
29 GLenum format,
30 GLenum type)
31 {
32 GLenum implFormat = obj->getImplementationColorReadFormat(context);
33 if (!ValidES3Format(format) && (format != implFormat || format == GL_NONE))
34 {
35 context->validationError(entryPoint, GL_INVALID_ENUM, kInvalidFormat);
36 return false;
37 }
38
39 GLenum implType = obj->getImplementationColorReadType(context);
40 if (!ValidES3Type(type) && (type != implType || type == GL_NONE))
41 {
42 context->validationError(entryPoint, GL_INVALID_ENUM, kInvalidType);
43 return false;
44 }
45
46 // Format/type combinations are not yet validated.
47
48 return true;
49 }
50
IsValidImageLayout(ImageLayout layout)51 bool IsValidImageLayout(ImageLayout layout)
52 {
53 switch (layout)
54 {
55 case ImageLayout::Undefined:
56 case ImageLayout::General:
57 case ImageLayout::ColorAttachment:
58 case ImageLayout::DepthStencilAttachment:
59 case ImageLayout::DepthStencilReadOnlyAttachment:
60 case ImageLayout::ShaderReadOnly:
61 case ImageLayout::TransferSrc:
62 case ImageLayout::TransferDst:
63 case ImageLayout::DepthReadOnlyStencilAttachment:
64 case ImageLayout::DepthAttachmentStencilReadOnly:
65 return true;
66
67 default:
68 return false;
69 }
70 }
71
IsValidMemoryObjectParamater(const Context * context,angle::EntryPoint entryPoint,GLenum pname)72 bool IsValidMemoryObjectParamater(const Context *context,
73 angle::EntryPoint entryPoint,
74 GLenum pname)
75 {
76 switch (pname)
77 {
78 case GL_DEDICATED_MEMORY_OBJECT_EXT:
79 return true;
80
81 case GL_PROTECTED_MEMORY_OBJECT_EXT:
82 if (!context->getExtensions().protectedTexturesEXT)
83 {
84 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
85 return false;
86 }
87 return true;
88
89 default:
90 return false;
91 }
92 }
93
ValidateObjectIdentifierAndName(const Context * context,angle::EntryPoint entryPoint,GLenum identifier,GLuint name)94 bool ValidateObjectIdentifierAndName(const Context *context,
95 angle::EntryPoint entryPoint,
96 GLenum identifier,
97 GLuint name)
98 {
99 bool isGLES11 = context->getClientVersion() == Version(1, 1);
100 bool isGLES3 = context->getClientMajorVersion() >= 3;
101 bool isGLES31 = context->getClientVersion() >= Version(3, 1);
102 switch (identifier)
103 {
104 case GL_BUFFER_OBJECT_EXT:
105 if (context->getBuffer({name}) == nullptr)
106 {
107 context->validationError(entryPoint, GL_INVALID_OPERATION, kInvalidBufferName);
108 return false;
109 }
110 return true;
111
112 case GL_SHADER_OBJECT_EXT:
113 if (isGLES11)
114 {
115 context->validationError(entryPoint, GL_INVALID_ENUM, kInvalidType);
116 return false;
117 }
118 if (context->getShader({name}) == nullptr)
119 {
120 context->validationError(entryPoint, GL_INVALID_OPERATION, kInvalidShaderName);
121 return false;
122 }
123 return true;
124
125 case GL_PROGRAM_OBJECT_EXT:
126 if (isGLES11)
127 {
128 context->validationError(entryPoint, GL_INVALID_ENUM, kInvalidType);
129 return false;
130 }
131 if (context->getProgramNoResolveLink({name}) == nullptr)
132 {
133 context->validationError(entryPoint, GL_INVALID_OPERATION, kInvalidProgramName);
134 return false;
135 }
136 return true;
137
138 case GL_VERTEX_ARRAY_OBJECT_EXT:
139 if (!isGLES3 && !context->getExtensions().vertexArrayObjectOES)
140 {
141 context->validationError(entryPoint, GL_INVALID_ENUM, kInvalidType);
142 return false;
143 }
144 if (context->getVertexArray({name}) == nullptr)
145 {
146 context->validationError(entryPoint, GL_INVALID_OPERATION, kInvalidVertexArrayName);
147 return false;
148 }
149 return true;
150
151 case GL_QUERY_OBJECT_EXT:
152 if (!isGLES3 && !context->getExtensions().occlusionQueryBooleanEXT)
153 {
154 context->validationError(entryPoint, GL_INVALID_ENUM, kInvalidType);
155 return false;
156 }
157 if (context->getQuery({name}) == nullptr)
158 {
159 context->validationError(entryPoint, GL_INVALID_OPERATION, kInvalidQueryName);
160 return false;
161 }
162 return true;
163
164 case GL_TRANSFORM_FEEDBACK:
165 if (!isGLES3)
166 {
167 context->validationError(entryPoint, GL_INVALID_ENUM, kInvalidType);
168 return false;
169 }
170 if (context->getTransformFeedback({name}) == nullptr)
171 {
172 context->validationError(entryPoint, GL_INVALID_OPERATION,
173 kInvalidTransformFeedbackName);
174 return false;
175 }
176 return true;
177
178 case GL_SAMPLER:
179 if (!isGLES3)
180 {
181 context->validationError(entryPoint, GL_INVALID_ENUM, kInvalidType);
182 return false;
183 }
184 if (context->getSampler({name}) == nullptr)
185 {
186 context->validationError(entryPoint, GL_INVALID_OPERATION, kInvalidSamplerName);
187 return false;
188 }
189 return true;
190
191 case GL_TEXTURE:
192 if (context->getTexture({name}) == nullptr)
193 {
194 context->validationError(entryPoint, GL_INVALID_OPERATION, kInvalidTextureName);
195 return false;
196 }
197 return true;
198
199 case GL_RENDERBUFFER:
200 if (!context->isRenderbuffer({name}))
201 {
202 context->validationError(entryPoint, GL_INVALID_OPERATION,
203 kInvalidRenderbufferName);
204 return false;
205 }
206 return true;
207
208 case GL_FRAMEBUFFER:
209 if (context->getFramebuffer({name}) == nullptr)
210 {
211 context->validationError(entryPoint, GL_INVALID_OPERATION, kInvalidFramebufferName);
212 return false;
213 }
214 return true;
215
216 case GL_PROGRAM_PIPELINE_OBJECT_EXT:
217 if (!isGLES31 && !context->getExtensions().separateShaderObjectsEXT)
218 {
219 context->validationError(entryPoint, GL_INVALID_ENUM, kInvalidType);
220 return false;
221 }
222 if (context->getProgramPipeline({name}) == nullptr)
223 {
224 context->validationError(entryPoint, GL_INVALID_OPERATION,
225 kInvalidProgramPipelineName);
226 return false;
227 }
228 return true;
229
230 default:
231 context->validationError(entryPoint, GL_INVALID_ENUM, kInvalidIndentifier);
232 return false;
233 }
234 }
235 } // namespace
236
ValidateGetTexImageANGLE(const Context * context,angle::EntryPoint entryPoint,TextureTarget target,GLint level,GLenum format,GLenum type,const void * pixels)237 bool ValidateGetTexImageANGLE(const Context *context,
238 angle::EntryPoint entryPoint,
239 TextureTarget target,
240 GLint level,
241 GLenum format,
242 GLenum type,
243 const void *pixels)
244 {
245 if (!context->getExtensions().getImageANGLE)
246 {
247 context->validationError(entryPoint, GL_INVALID_OPERATION, kGetImageExtensionNotEnabled);
248 return false;
249 }
250
251 if (!ValidTexture2DDestinationTarget(context, target) &&
252 !ValidTexture3DDestinationTarget(context, target))
253 {
254 context->validationError(entryPoint, GL_INVALID_ENUM, kInvalidTextureTarget);
255 return false;
256 }
257
258 if (level < 0)
259 {
260 context->validationError(entryPoint, GL_INVALID_VALUE, kNegativeLevel);
261 return false;
262 }
263
264 TextureType textureType = TextureTargetToType(target);
265 if (!ValidMipLevel(context, textureType, level))
266 {
267 context->validationError(entryPoint, GL_INVALID_VALUE, kInvalidMipLevel);
268 return false;
269 }
270
271 Texture *texture = context->getTextureByTarget(target);
272
273 if (!ValidateGetImageFormatAndType(context, entryPoint, texture, format, type))
274 {
275 return false;
276 }
277
278 GLsizei width = static_cast<GLsizei>(texture->getWidth(target, level));
279 GLsizei height = static_cast<GLsizei>(texture->getHeight(target, level));
280 if (!ValidatePixelPack(context, entryPoint, format, type, 0, 0, width, height, -1, nullptr,
281 pixels))
282 {
283 return false;
284 }
285
286 if (texture->getFormat(target, level).info->compressed)
287 {
288 context->validationError(entryPoint, GL_INVALID_OPERATION, kGetImageCompressed);
289 return false;
290 }
291
292 return true;
293 }
294
ValidateGetCompressedTexImageANGLE(const Context * context,angle::EntryPoint entryPoint,TextureTarget target,GLint level,const void * pixels)295 bool ValidateGetCompressedTexImageANGLE(const Context *context,
296 angle::EntryPoint entryPoint,
297 TextureTarget target,
298 GLint level,
299 const void *pixels)
300 {
301 if (!context->getExtensions().getImageANGLE)
302 {
303 context->validationError(entryPoint, GL_INVALID_OPERATION, kGetImageExtensionNotEnabled);
304 return false;
305 }
306
307 // TODO: Validate all the things. http://anglebug.com/6177
308 return false;
309 }
310
ValidateGetRenderbufferImageANGLE(const Context * context,angle::EntryPoint entryPoint,GLenum target,GLenum format,GLenum type,const void * pixels)311 bool ValidateGetRenderbufferImageANGLE(const Context *context,
312 angle::EntryPoint entryPoint,
313 GLenum target,
314 GLenum format,
315 GLenum type,
316 const void *pixels)
317 {
318 if (!context->getExtensions().getImageANGLE)
319 {
320 context->validationError(entryPoint, GL_INVALID_OPERATION, kGetImageExtensionNotEnabled);
321 return false;
322 }
323
324 if (target != GL_RENDERBUFFER)
325 {
326 context->validationError(entryPoint, GL_INVALID_ENUM, kInvalidRenderbufferTarget);
327 return false;
328 }
329
330 Renderbuffer *renderbuffer = context->getState().getCurrentRenderbuffer();
331
332 if (!ValidateGetImageFormatAndType(context, entryPoint, renderbuffer, format, type))
333 {
334 return false;
335 }
336
337 GLsizei width = renderbuffer->getWidth();
338 GLsizei height = renderbuffer->getHeight();
339 if (!ValidatePixelPack(context, entryPoint, format, type, 0, 0, width, height, -1, nullptr,
340 pixels))
341 {
342 return false;
343 }
344
345 return true;
346 }
347
ValidateDrawElementsBaseVertexEXT(const Context * context,angle::EntryPoint entryPoint,PrimitiveMode mode,GLsizei count,DrawElementsType type,const void * indices,GLint basevertex)348 bool ValidateDrawElementsBaseVertexEXT(const Context *context,
349 angle::EntryPoint entryPoint,
350 PrimitiveMode mode,
351 GLsizei count,
352 DrawElementsType type,
353 const void *indices,
354 GLint basevertex)
355 {
356 if (!context->getExtensions().drawElementsBaseVertexAny())
357 {
358 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
359 return false;
360 }
361
362 return ValidateDrawElementsCommon(context, entryPoint, mode, count, type, indices, 1);
363 }
364
ValidateDrawElementsInstancedBaseVertexEXT(const Context * context,angle::EntryPoint entryPoint,PrimitiveMode mode,GLsizei count,DrawElementsType type,const void * indices,GLsizei instancecount,GLint basevertex)365 bool ValidateDrawElementsInstancedBaseVertexEXT(const Context *context,
366 angle::EntryPoint entryPoint,
367 PrimitiveMode mode,
368 GLsizei count,
369 DrawElementsType type,
370 const void *indices,
371 GLsizei instancecount,
372 GLint basevertex)
373 {
374 if (!context->getExtensions().drawElementsBaseVertexAny())
375 {
376 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
377 return false;
378 }
379
380 return ValidateDrawElementsInstancedBase(context, entryPoint, mode, count, type, indices,
381 instancecount);
382 }
383
ValidateDrawRangeElementsBaseVertexEXT(const Context * context,angle::EntryPoint entryPoint,PrimitiveMode mode,GLuint start,GLuint end,GLsizei count,DrawElementsType type,const void * indices,GLint basevertex)384 bool ValidateDrawRangeElementsBaseVertexEXT(const Context *context,
385 angle::EntryPoint entryPoint,
386 PrimitiveMode mode,
387 GLuint start,
388 GLuint end,
389 GLsizei count,
390 DrawElementsType type,
391 const void *indices,
392 GLint basevertex)
393 {
394 if (!context->getExtensions().drawElementsBaseVertexAny())
395 {
396 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
397 return false;
398 }
399
400 if (end < start)
401 {
402 context->validationError(entryPoint, GL_INVALID_VALUE, kInvalidElementRange);
403 return false;
404 }
405
406 if (!ValidateDrawElementsCommon(context, entryPoint, mode, count, type, indices, 0))
407 {
408 return false;
409 }
410
411 // Skip range checks for no-op calls.
412 if (count <= 0)
413 {
414 return true;
415 }
416
417 // Note that resolving the index range is a bit slow. We should probably optimize this.
418 IndexRange indexRange;
419 ANGLE_VALIDATION_TRY(context->getState().getVertexArray()->getIndexRange(context, type, count,
420 indices, &indexRange));
421
422 if (indexRange.end > end || indexRange.start < start)
423 {
424 // GL spec says that behavior in this case is undefined - generating an error is fine.
425 context->validationError(entryPoint, GL_INVALID_OPERATION, kExceedsElementRange);
426 return false;
427 }
428 return true;
429 }
430
ValidateMultiDrawElementsBaseVertexEXT(const Context * context,angle::EntryPoint entryPoint,PrimitiveMode mode,const GLsizei * count,DrawElementsType type,const void * const * indices,GLsizei drawcount,const GLint * basevertex)431 bool ValidateMultiDrawElementsBaseVertexEXT(const Context *context,
432 angle::EntryPoint entryPoint,
433 PrimitiveMode mode,
434 const GLsizei *count,
435 DrawElementsType type,
436 const void *const *indices,
437 GLsizei drawcount,
438 const GLint *basevertex)
439 {
440 return true;
441 }
442
ValidateMultiDrawArraysIndirectEXT(const Context * context,angle::EntryPoint entryPoint,GLenum mode,const void * indirect,GLsizei drawcount,GLsizei stride)443 bool ValidateMultiDrawArraysIndirectEXT(const Context *context,
444 angle::EntryPoint entryPoint,
445 GLenum mode,
446 const void *indirect,
447 GLsizei drawcount,
448 GLsizei stride)
449 {
450 if (!ValidateMultiDrawIndirectBase(context, entryPoint, drawcount, stride))
451 {
452 return false;
453 }
454
455 PrimitiveMode primitiveMode = FromGLenum<PrimitiveMode>(mode);
456 if (!ValidateDrawArraysIndirect(context, entryPoint, primitiveMode, indirect))
457 {
458 return false;
459 }
460
461 return true;
462 }
463
ValidateMultiDrawElementsIndirectEXT(const Context * context,angle::EntryPoint entryPoint,GLenum mode,GLenum type,const void * indirect,GLsizei drawcount,GLsizei stride)464 bool ValidateMultiDrawElementsIndirectEXT(const Context *context,
465 angle::EntryPoint entryPoint,
466 GLenum mode,
467 GLenum type,
468 const void *indirect,
469 GLsizei drawcount,
470 GLsizei stride)
471 {
472 if (!ValidateMultiDrawIndirectBase(context, entryPoint, drawcount, stride))
473 {
474 return false;
475 }
476
477 PrimitiveMode primitiveMode = FromGLenum<PrimitiveMode>(mode);
478 DrawElementsType drawElementsType = FromGLenum<DrawElementsType>(type);
479 const State &state = context->getState();
480 TransformFeedback *curTransformFeedback = state.getCurrentTransformFeedback();
481 if (!ValidateDrawElementsIndirect(context, entryPoint, primitiveMode, drawElementsType,
482 indirect))
483 {
484 return false;
485 }
486
487 if (curTransformFeedback && curTransformFeedback->isActive() &&
488 !curTransformFeedback->isPaused())
489 {
490 // EXT_geometry_shader allows transform feedback to work with all draw commands.
491 // [EXT_geometry_shader] Section 12.1, "Transform Feedback"
492 if (context->getExtensions().geometryShaderAny() || context->getClientVersion() >= ES_3_2)
493 {
494 if (!ValidateTransformFeedbackPrimitiveMode(
495 context, entryPoint, curTransformFeedback->getPrimitiveMode(), primitiveMode))
496 {
497 context->validationError(entryPoint, GL_INVALID_OPERATION,
498 kInvalidDrawModeTransformFeedback);
499 return false;
500 }
501 }
502 else
503 {
504 // An INVALID_OPERATION error is generated if transform feedback is active and not
505 // paused.
506 context->validationError(entryPoint, GL_INVALID_OPERATION,
507 kUnsupportedDrawModeForTransformFeedback);
508 return false;
509 }
510 }
511
512 return true;
513 }
514
ValidateDrawElementsBaseVertexOES(const Context * context,angle::EntryPoint entryPoint,PrimitiveMode mode,GLsizei count,DrawElementsType type,const void * indices,GLint basevertex)515 bool ValidateDrawElementsBaseVertexOES(const Context *context,
516 angle::EntryPoint entryPoint,
517 PrimitiveMode mode,
518 GLsizei count,
519 DrawElementsType type,
520 const void *indices,
521 GLint basevertex)
522 {
523 if (!context->getExtensions().drawElementsBaseVertexAny())
524 {
525 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
526 return false;
527 }
528
529 return ValidateDrawElementsCommon(context, entryPoint, mode, count, type, indices, 1);
530 }
531
ValidateDrawElementsInstancedBaseVertexOES(const Context * context,angle::EntryPoint entryPoint,PrimitiveMode mode,GLsizei count,DrawElementsType type,const void * indices,GLsizei instancecount,GLint basevertex)532 bool ValidateDrawElementsInstancedBaseVertexOES(const Context *context,
533 angle::EntryPoint entryPoint,
534 PrimitiveMode mode,
535 GLsizei count,
536 DrawElementsType type,
537 const void *indices,
538 GLsizei instancecount,
539 GLint basevertex)
540 {
541 if (!context->getExtensions().drawElementsBaseVertexAny())
542 {
543 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
544 return false;
545 }
546
547 return ValidateDrawElementsInstancedBase(context, entryPoint, mode, count, type, indices,
548 instancecount);
549 }
550
ValidateDrawRangeElementsBaseVertexOES(const Context * context,angle::EntryPoint entryPoint,PrimitiveMode mode,GLuint start,GLuint end,GLsizei count,DrawElementsType type,const void * indices,GLint basevertex)551 bool ValidateDrawRangeElementsBaseVertexOES(const Context *context,
552 angle::EntryPoint entryPoint,
553 PrimitiveMode mode,
554 GLuint start,
555 GLuint end,
556 GLsizei count,
557 DrawElementsType type,
558 const void *indices,
559 GLint basevertex)
560 {
561 if (!context->getExtensions().drawElementsBaseVertexAny())
562 {
563 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
564 return false;
565 }
566
567 if (end < start)
568 {
569 context->validationError(entryPoint, GL_INVALID_VALUE, kInvalidElementRange);
570 return false;
571 }
572
573 if (!ValidateDrawElementsCommon(context, entryPoint, mode, count, type, indices, 0))
574 {
575 return false;
576 }
577
578 // Skip range checks for no-op calls.
579 if (count <= 0)
580 {
581 return true;
582 }
583
584 // Note that resolving the index range is a bit slow. We should probably optimize this.
585 IndexRange indexRange;
586 ANGLE_VALIDATION_TRY(context->getState().getVertexArray()->getIndexRange(context, type, count,
587 indices, &indexRange));
588
589 if (indexRange.end > end || indexRange.start < start)
590 {
591 // GL spec says that behavior in this case is undefined - generating an error is fine.
592 context->validationError(entryPoint, GL_INVALID_OPERATION, kExceedsElementRange);
593 return false;
594 }
595 return true;
596 }
597
598 // GL_KHR_blend_equation_advanced
ValidateBlendBarrierKHR(const Context * context,angle::EntryPoint entryPoint)599 bool ValidateBlendBarrierKHR(const Context *context, angle::EntryPoint entryPoint)
600 {
601 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
602 return false;
603 }
604
ValidateBlendEquationSeparateiEXT(const Context * context,angle::EntryPoint entryPoint,GLuint buf,GLenum modeRGB,GLenum modeAlpha)605 bool ValidateBlendEquationSeparateiEXT(const Context *context,
606 angle::EntryPoint entryPoint,
607 GLuint buf,
608 GLenum modeRGB,
609 GLenum modeAlpha)
610 {
611 if (!context->getExtensions().drawBuffersIndexedEXT)
612 {
613 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
614 return false;
615 }
616
617 return ValidateBlendEquationSeparatei(context, entryPoint, buf, modeRGB, modeAlpha);
618 }
619
ValidateBlendEquationiEXT(const Context * context,angle::EntryPoint entryPoint,GLuint buf,GLenum mode)620 bool ValidateBlendEquationiEXT(const Context *context,
621 angle::EntryPoint entryPoint,
622 GLuint buf,
623 GLenum mode)
624 {
625 if (!context->getExtensions().drawBuffersIndexedEXT)
626 {
627 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
628 return false;
629 }
630
631 return ValidateBlendEquationi(context, entryPoint, buf, mode);
632 }
633
ValidateBlendFuncSeparateiEXT(const Context * context,angle::EntryPoint entryPoint,GLuint buf,GLenum srcRGB,GLenum dstRGB,GLenum srcAlpha,GLenum dstAlpha)634 bool ValidateBlendFuncSeparateiEXT(const Context *context,
635 angle::EntryPoint entryPoint,
636 GLuint buf,
637 GLenum srcRGB,
638 GLenum dstRGB,
639 GLenum srcAlpha,
640 GLenum dstAlpha)
641 {
642 if (!context->getExtensions().drawBuffersIndexedEXT)
643 {
644 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
645 return false;
646 }
647
648 return ValidateBlendFuncSeparatei(context, entryPoint, buf, srcRGB, dstRGB, srcAlpha, dstAlpha);
649 }
650
ValidateBlendFunciEXT(const Context * context,angle::EntryPoint entryPoint,GLuint buf,GLenum src,GLenum dst)651 bool ValidateBlendFunciEXT(const Context *context,
652 angle::EntryPoint entryPoint,
653 GLuint buf,
654 GLenum src,
655 GLenum dst)
656 {
657 if (!context->getExtensions().drawBuffersIndexedEXT)
658 {
659 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
660 return false;
661 }
662
663 return ValidateBlendFunci(context, entryPoint, buf, src, dst);
664 }
665
ValidateColorMaskiEXT(const Context * context,angle::EntryPoint entryPoint,GLuint index,GLboolean r,GLboolean g,GLboolean b,GLboolean a)666 bool ValidateColorMaskiEXT(const Context *context,
667 angle::EntryPoint entryPoint,
668 GLuint index,
669 GLboolean r,
670 GLboolean g,
671 GLboolean b,
672 GLboolean a)
673 {
674 if (!context->getExtensions().drawBuffersIndexedEXT)
675 {
676 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
677 return false;
678 }
679
680 return ValidateColorMaski(context, entryPoint, index, r, g, b, a);
681 }
682
ValidateDisableiEXT(const Context * context,angle::EntryPoint entryPoint,GLenum target,GLuint index)683 bool ValidateDisableiEXT(const Context *context,
684 angle::EntryPoint entryPoint,
685 GLenum target,
686 GLuint index)
687 {
688 if (!context->getExtensions().drawBuffersIndexedEXT)
689 {
690 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
691 return false;
692 }
693
694 return ValidateDisablei(context, entryPoint, target, index);
695 }
696
ValidateEnableiEXT(const Context * context,angle::EntryPoint entryPoint,GLenum target,GLuint index)697 bool ValidateEnableiEXT(const Context *context,
698 angle::EntryPoint entryPoint,
699 GLenum target,
700 GLuint index)
701 {
702 if (!context->getExtensions().drawBuffersIndexedEXT)
703 {
704 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
705 return false;
706 }
707
708 return ValidateEnablei(context, entryPoint, target, index);
709 }
710
ValidateIsEnablediEXT(const Context * context,angle::EntryPoint entryPoint,GLenum target,GLuint index)711 bool ValidateIsEnablediEXT(const Context *context,
712 angle::EntryPoint entryPoint,
713 GLenum target,
714 GLuint index)
715 {
716 if (!context->getExtensions().drawBuffersIndexedEXT)
717 {
718 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
719 return false;
720 }
721
722 return ValidateIsEnabledi(context, entryPoint, target, index);
723 }
724
ValidateBlendEquationSeparateiOES(const Context * context,angle::EntryPoint entryPoint,GLuint buf,GLenum modeRGB,GLenum modeAlpha)725 bool ValidateBlendEquationSeparateiOES(const Context *context,
726 angle::EntryPoint entryPoint,
727 GLuint buf,
728 GLenum modeRGB,
729 GLenum modeAlpha)
730 {
731 if (!context->getExtensions().drawBuffersIndexedOES)
732 {
733 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
734 return false;
735 }
736
737 return ValidateBlendEquationSeparatei(context, entryPoint, buf, modeRGB, modeAlpha);
738 }
739
ValidateBlendEquationiOES(const Context * context,angle::EntryPoint entryPoint,GLuint buf,GLenum mode)740 bool ValidateBlendEquationiOES(const Context *context,
741 angle::EntryPoint entryPoint,
742 GLuint buf,
743 GLenum mode)
744 {
745 if (!context->getExtensions().drawBuffersIndexedOES)
746 {
747 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
748 return false;
749 }
750
751 return ValidateBlendEquationi(context, entryPoint, buf, mode);
752 }
753
ValidateBlendFuncSeparateiOES(const Context * context,angle::EntryPoint entryPoint,GLuint buf,GLenum srcRGB,GLenum dstRGB,GLenum srcAlpha,GLenum dstAlpha)754 bool ValidateBlendFuncSeparateiOES(const Context *context,
755 angle::EntryPoint entryPoint,
756 GLuint buf,
757 GLenum srcRGB,
758 GLenum dstRGB,
759 GLenum srcAlpha,
760 GLenum dstAlpha)
761 {
762 if (!context->getExtensions().drawBuffersIndexedOES)
763 {
764 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
765 return false;
766 }
767
768 return ValidateBlendFuncSeparatei(context, entryPoint, buf, srcRGB, dstRGB, srcAlpha, dstAlpha);
769 }
770
ValidateBlendFunciOES(const Context * context,angle::EntryPoint entryPoint,GLuint buf,GLenum src,GLenum dst)771 bool ValidateBlendFunciOES(const Context *context,
772 angle::EntryPoint entryPoint,
773 GLuint buf,
774 GLenum src,
775 GLenum dst)
776 {
777 if (!context->getExtensions().drawBuffersIndexedOES)
778 {
779 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
780 return false;
781 }
782
783 return ValidateBlendFunci(context, entryPoint, buf, src, dst);
784 }
785
ValidateColorMaskiOES(const Context * context,angle::EntryPoint entryPoint,GLuint index,GLboolean r,GLboolean g,GLboolean b,GLboolean a)786 bool ValidateColorMaskiOES(const Context *context,
787 angle::EntryPoint entryPoint,
788 GLuint index,
789 GLboolean r,
790 GLboolean g,
791 GLboolean b,
792 GLboolean a)
793 {
794 if (!context->getExtensions().drawBuffersIndexedOES)
795 {
796 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
797 return false;
798 }
799
800 return ValidateColorMaski(context, entryPoint, index, r, g, b, a);
801 }
802
ValidateDisableiOES(const Context * context,angle::EntryPoint entryPoint,GLenum target,GLuint index)803 bool ValidateDisableiOES(const Context *context,
804 angle::EntryPoint entryPoint,
805 GLenum target,
806 GLuint index)
807 {
808 if (!context->getExtensions().drawBuffersIndexedOES)
809 {
810 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
811 return false;
812 }
813
814 return ValidateDisablei(context, entryPoint, target, index);
815 }
816
ValidateEnableiOES(const Context * context,angle::EntryPoint entryPoint,GLenum target,GLuint index)817 bool ValidateEnableiOES(const Context *context,
818 angle::EntryPoint entryPoint,
819 GLenum target,
820 GLuint index)
821 {
822 if (!context->getExtensions().drawBuffersIndexedOES)
823 {
824 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
825 return false;
826 }
827
828 return ValidateEnablei(context, entryPoint, target, index);
829 }
830
ValidateIsEnablediOES(const Context * context,angle::EntryPoint entryPoint,GLenum target,GLuint index)831 bool ValidateIsEnablediOES(const Context *context,
832 angle::EntryPoint entryPoint,
833 GLenum target,
834 GLuint index)
835 {
836 if (!context->getExtensions().drawBuffersIndexedOES)
837 {
838 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
839 return false;
840 }
841
842 return ValidateIsEnabledi(context, entryPoint, target, index);
843 }
844
ValidateGetInteger64vEXT(const Context * context,angle::EntryPoint entryPoint,GLenum pname,const GLint64 * data)845 bool ValidateGetInteger64vEXT(const Context *context,
846 angle::EntryPoint entryPoint,
847 GLenum pname,
848 const GLint64 *data)
849 {
850 if (!context->getExtensions().disjointTimerQueryEXT)
851 {
852 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
853 return false;
854 }
855
856 GLenum nativeType = GL_NONE;
857 unsigned int numParams = 0;
858 if (!ValidateStateQuery(context, entryPoint, pname, &nativeType, &numParams))
859 {
860 return false;
861 }
862
863 return true;
864 }
865
ValidateCopyImageSubDataEXT(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)866 bool ValidateCopyImageSubDataEXT(const Context *context,
867 angle::EntryPoint entryPoint,
868 GLuint srcName,
869 GLenum srcTarget,
870 GLint srcLevel,
871 GLint srcX,
872 GLint srcY,
873 GLint srcZ,
874 GLuint dstName,
875 GLenum dstTarget,
876 GLint dstLevel,
877 GLint dstX,
878 GLint dstY,
879 GLint dstZ,
880 GLsizei srcWidth,
881 GLsizei srcHeight,
882 GLsizei srcDepth)
883 {
884 if (!context->getExtensions().copyImageEXT)
885 {
886 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
887 return false;
888 }
889
890 return ValidateCopyImageSubDataBase(context, entryPoint, srcName, srcTarget, srcLevel, srcX,
891 srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ,
892 srcWidth, srcHeight, srcDepth);
893 }
894
ValidateCopyImageSubDataOES(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)895 bool ValidateCopyImageSubDataOES(const Context *context,
896 angle::EntryPoint entryPoint,
897 GLuint srcName,
898 GLenum srcTarget,
899 GLint srcLevel,
900 GLint srcX,
901 GLint srcY,
902 GLint srcZ,
903 GLuint dstName,
904 GLenum dstTarget,
905 GLint dstLevel,
906 GLint dstX,
907 GLint dstY,
908 GLint dstZ,
909 GLsizei srcWidth,
910 GLsizei srcHeight,
911 GLsizei srcDepth)
912 {
913 if (!context->getExtensions().copyImageEXT)
914 {
915 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
916 return false;
917 }
918
919 return ValidateCopyImageSubDataBase(context, entryPoint, srcName, srcTarget, srcLevel, srcX,
920 srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ,
921 srcWidth, srcHeight, srcDepth);
922 }
923
ValidateBufferStorageMemEXT(const Context * context,angle::EntryPoint entryPoint,TextureType target,GLsizeiptr size,MemoryObjectID memory,GLuint64 offset)924 bool ValidateBufferStorageMemEXT(const Context *context,
925 angle::EntryPoint entryPoint,
926 TextureType target,
927 GLsizeiptr size,
928 MemoryObjectID memory,
929 GLuint64 offset)
930 {
931 if (!context->getExtensions().memoryObjectEXT)
932 {
933 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
934 return false;
935 }
936
937 UNIMPLEMENTED();
938 return false;
939 }
940
ValidateCreateMemoryObjectsEXT(const Context * context,angle::EntryPoint entryPoint,GLsizei n,const MemoryObjectID * memoryObjects)941 bool ValidateCreateMemoryObjectsEXT(const Context *context,
942 angle::EntryPoint entryPoint,
943 GLsizei n,
944 const MemoryObjectID *memoryObjects)
945 {
946 if (!context->getExtensions().memoryObjectEXT)
947 {
948 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
949 return false;
950 }
951
952 return ValidateGenOrDelete(context, entryPoint, n);
953 }
954
ValidateDeleteMemoryObjectsEXT(const Context * context,angle::EntryPoint entryPoint,GLsizei n,const MemoryObjectID * memoryObjects)955 bool ValidateDeleteMemoryObjectsEXT(const Context *context,
956 angle::EntryPoint entryPoint,
957 GLsizei n,
958 const MemoryObjectID *memoryObjects)
959 {
960 if (!context->getExtensions().memoryObjectEXT)
961 {
962 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
963 return false;
964 }
965
966 return ValidateGenOrDelete(context, entryPoint, n);
967 }
968
ValidateGetMemoryObjectParameterivEXT(const Context * context,angle::EntryPoint entryPoint,MemoryObjectID memoryObject,GLenum pname,const GLint * params)969 bool ValidateGetMemoryObjectParameterivEXT(const Context *context,
970 angle::EntryPoint entryPoint,
971 MemoryObjectID memoryObject,
972 GLenum pname,
973 const GLint *params)
974 {
975 if (!context->getExtensions().memoryObjectEXT)
976 {
977 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
978 return false;
979 }
980
981 const MemoryObject *memory = context->getMemoryObject(memoryObject);
982 if (memory == nullptr)
983 {
984 context->validationError(entryPoint, GL_INVALID_VALUE, kInvalidMemoryObject);
985 }
986
987 if (!IsValidMemoryObjectParamater(context, entryPoint, pname))
988 {
989 context->validationError(entryPoint, GL_INVALID_ENUM, kInvalidMemoryObjectParameter);
990 return false;
991 }
992
993 return true;
994 }
995
ValidateGetUnsignedBytevEXT(const Context * context,angle::EntryPoint entryPoint,GLenum pname,const GLubyte * data)996 bool ValidateGetUnsignedBytevEXT(const Context *context,
997 angle::EntryPoint entryPoint,
998 GLenum pname,
999 const GLubyte *data)
1000 {
1001 if (!context->getExtensions().memoryObjectEXT && !context->getExtensions().semaphoreEXT)
1002 {
1003 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
1004 return false;
1005 }
1006
1007 UNIMPLEMENTED();
1008 return false;
1009 }
1010
ValidateGetUnsignedBytei_vEXT(const Context * context,angle::EntryPoint entryPoint,GLenum target,GLuint index,const GLubyte * data)1011 bool ValidateGetUnsignedBytei_vEXT(const Context *context,
1012 angle::EntryPoint entryPoint,
1013 GLenum target,
1014 GLuint index,
1015 const GLubyte *data)
1016 {
1017 if (!context->getExtensions().memoryObjectEXT && !context->getExtensions().semaphoreEXT)
1018 {
1019 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
1020 return false;
1021 }
1022
1023 UNIMPLEMENTED();
1024 return false;
1025 }
1026
ValidateIsMemoryObjectEXT(const Context * context,angle::EntryPoint entryPoint,MemoryObjectID memoryObject)1027 bool ValidateIsMemoryObjectEXT(const Context *context,
1028 angle::EntryPoint entryPoint,
1029 MemoryObjectID memoryObject)
1030 {
1031 if (!context->getExtensions().memoryObjectEXT)
1032 {
1033 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
1034 return false;
1035 }
1036
1037 return true;
1038 }
1039
ValidateMemoryObjectParameterivEXT(const Context * context,angle::EntryPoint entryPoint,MemoryObjectID memoryObject,GLenum pname,const GLint * params)1040 bool ValidateMemoryObjectParameterivEXT(const Context *context,
1041 angle::EntryPoint entryPoint,
1042 MemoryObjectID memoryObject,
1043 GLenum pname,
1044 const GLint *params)
1045 {
1046 if (!context->getExtensions().memoryObjectEXT)
1047 {
1048 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
1049 return false;
1050 }
1051
1052 const MemoryObject *memory = context->getMemoryObject(memoryObject);
1053 if (memory == nullptr)
1054 {
1055 context->validationError(entryPoint, GL_INVALID_VALUE, kInvalidMemoryObject);
1056 return false;
1057 }
1058
1059 if (memory->isImmutable())
1060 {
1061 context->validationError(entryPoint, GL_INVALID_OPERATION, kImmutableMemoryObject);
1062 return false;
1063 }
1064
1065 if (!IsValidMemoryObjectParamater(context, entryPoint, pname))
1066 {
1067 context->validationError(entryPoint, GL_INVALID_ENUM, kInvalidMemoryObjectParameter);
1068 return false;
1069 }
1070
1071 return true;
1072 }
1073
ValidateTexStorageMem2DEXT(const Context * context,angle::EntryPoint entryPoint,TextureType target,GLsizei levels,GLenum internalFormat,GLsizei width,GLsizei height,MemoryObjectID memory,GLuint64 offset)1074 bool ValidateTexStorageMem2DEXT(const Context *context,
1075 angle::EntryPoint entryPoint,
1076 TextureType target,
1077 GLsizei levels,
1078 GLenum internalFormat,
1079 GLsizei width,
1080 GLsizei height,
1081 MemoryObjectID memory,
1082 GLuint64 offset)
1083 {
1084 if (!context->getExtensions().memoryObjectEXT)
1085 {
1086 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
1087 return false;
1088 }
1089
1090 if (context->getClientMajorVersion() < 3)
1091 {
1092 return ValidateES2TexStorageParametersBase(context, entryPoint, target, levels,
1093 internalFormat, width, height);
1094 }
1095
1096 ASSERT(context->getClientMajorVersion() >= 3);
1097 return ValidateES3TexStorage2DParameters(context, entryPoint, target, levels, internalFormat,
1098 width, height, 1);
1099 }
1100
ValidateTexStorageMem3DEXT(const Context * context,angle::EntryPoint entryPoint,TextureType target,GLsizei levels,GLenum internalFormat,GLsizei width,GLsizei height,GLsizei depth,MemoryObjectID memory,GLuint64 offset)1101 bool ValidateTexStorageMem3DEXT(const Context *context,
1102 angle::EntryPoint entryPoint,
1103 TextureType target,
1104 GLsizei levels,
1105 GLenum internalFormat,
1106 GLsizei width,
1107 GLsizei height,
1108 GLsizei depth,
1109 MemoryObjectID memory,
1110 GLuint64 offset)
1111 {
1112 if (!context->getExtensions().memoryObjectEXT)
1113 {
1114 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
1115 return false;
1116 }
1117
1118 UNIMPLEMENTED();
1119 return false;
1120 }
1121
ValidateImportMemoryFdEXT(const Context * context,angle::EntryPoint entryPoint,MemoryObjectID memory,GLuint64 size,HandleType handleType,GLint fd)1122 bool ValidateImportMemoryFdEXT(const Context *context,
1123 angle::EntryPoint entryPoint,
1124 MemoryObjectID memory,
1125 GLuint64 size,
1126 HandleType handleType,
1127 GLint fd)
1128 {
1129 if (!context->getExtensions().memoryObjectFdEXT)
1130 {
1131 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
1132 return false;
1133 }
1134
1135 switch (handleType)
1136 {
1137 case HandleType::OpaqueFd:
1138 break;
1139 default:
1140 context->validationError(entryPoint, GL_INVALID_ENUM, kInvalidHandleType);
1141 return false;
1142 }
1143
1144 return true;
1145 }
1146
ValidateImportMemoryZirconHandleANGLE(const Context * context,angle::EntryPoint entryPoint,MemoryObjectID memory,GLuint64 size,HandleType handleType,GLuint handle)1147 bool ValidateImportMemoryZirconHandleANGLE(const Context *context,
1148 angle::EntryPoint entryPoint,
1149 MemoryObjectID memory,
1150 GLuint64 size,
1151 HandleType handleType,
1152 GLuint handle)
1153 {
1154 if (!context->getExtensions().memoryObjectFuchsiaANGLE)
1155 {
1156 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
1157 return false;
1158 }
1159
1160 switch (handleType)
1161 {
1162 case HandleType::ZirconVmo:
1163 break;
1164 default:
1165 context->validationError(entryPoint, GL_INVALID_ENUM, kInvalidHandleType);
1166 return false;
1167 }
1168
1169 return true;
1170 }
1171
ValidateDeleteSemaphoresEXT(const Context * context,angle::EntryPoint entryPoint,GLsizei n,const SemaphoreID * semaphores)1172 bool ValidateDeleteSemaphoresEXT(const Context *context,
1173 angle::EntryPoint entryPoint,
1174 GLsizei n,
1175 const SemaphoreID *semaphores)
1176 {
1177 if (!context->getExtensions().semaphoreEXT)
1178 {
1179 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
1180 return false;
1181 }
1182
1183 return ValidateGenOrDelete(context, entryPoint, n);
1184 }
1185
ValidateGenSemaphoresEXT(const Context * context,angle::EntryPoint entryPoint,GLsizei n,const SemaphoreID * semaphores)1186 bool ValidateGenSemaphoresEXT(const Context *context,
1187 angle::EntryPoint entryPoint,
1188 GLsizei n,
1189 const SemaphoreID *semaphores)
1190 {
1191 if (!context->getExtensions().semaphoreEXT)
1192 {
1193 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
1194 return false;
1195 }
1196
1197 return ValidateGenOrDelete(context, entryPoint, n);
1198 }
1199
ValidateGetSemaphoreParameterui64vEXT(const Context * context,angle::EntryPoint entryPoint,SemaphoreID semaphore,GLenum pname,const GLuint64 * params)1200 bool ValidateGetSemaphoreParameterui64vEXT(const Context *context,
1201 angle::EntryPoint entryPoint,
1202 SemaphoreID semaphore,
1203 GLenum pname,
1204 const GLuint64 *params)
1205 {
1206 if (!context->getExtensions().semaphoreEXT)
1207 {
1208 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
1209 return false;
1210 }
1211
1212 UNIMPLEMENTED();
1213 return false;
1214 }
1215
ValidateIsSemaphoreEXT(const Context * context,angle::EntryPoint entryPoint,SemaphoreID semaphore)1216 bool ValidateIsSemaphoreEXT(const Context *context,
1217 angle::EntryPoint entryPoint,
1218 SemaphoreID semaphore)
1219 {
1220 if (!context->getExtensions().semaphoreEXT)
1221 {
1222 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
1223 return false;
1224 }
1225
1226 return true;
1227 }
1228
ValidateSemaphoreParameterui64vEXT(const Context * context,angle::EntryPoint entryPoint,SemaphoreID semaphore,GLenum pname,const GLuint64 * params)1229 bool ValidateSemaphoreParameterui64vEXT(const Context *context,
1230 angle::EntryPoint entryPoint,
1231 SemaphoreID semaphore,
1232 GLenum pname,
1233 const GLuint64 *params)
1234 {
1235 if (!context->getExtensions().semaphoreEXT)
1236 {
1237 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
1238 return false;
1239 }
1240
1241 UNIMPLEMENTED();
1242 return false;
1243 }
1244
ValidateSignalSemaphoreEXT(const Context * context,angle::EntryPoint entryPoint,SemaphoreID semaphore,GLuint numBufferBarriers,const BufferID * buffers,GLuint numTextureBarriers,const TextureID * textures,const GLenum * dstLayouts)1245 bool ValidateSignalSemaphoreEXT(const Context *context,
1246 angle::EntryPoint entryPoint,
1247 SemaphoreID semaphore,
1248 GLuint numBufferBarriers,
1249 const BufferID *buffers,
1250 GLuint numTextureBarriers,
1251 const TextureID *textures,
1252 const GLenum *dstLayouts)
1253 {
1254 if (!context->getExtensions().semaphoreEXT)
1255 {
1256 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
1257 return false;
1258 }
1259
1260 for (GLuint i = 0; i < numBufferBarriers; ++i)
1261 {
1262 if (!context->getBuffer(buffers[i]))
1263 {
1264 context->validationError(entryPoint, GL_INVALID_OPERATION, kInvalidBufferName);
1265 return false;
1266 }
1267 }
1268
1269 for (GLuint i = 0; i < numTextureBarriers; ++i)
1270 {
1271 if (!context->getTexture(textures[i]))
1272 {
1273 context->validationError(entryPoint, GL_INVALID_OPERATION, kInvalidTextureName);
1274 return false;
1275 }
1276 if (!IsValidImageLayout(FromGLenum<ImageLayout>(dstLayouts[i])))
1277 {
1278 context->validationError(entryPoint, GL_INVALID_ENUM, kInvalidImageLayout);
1279 return false;
1280 }
1281 }
1282
1283 return true;
1284 }
1285
ValidateWaitSemaphoreEXT(const Context * context,angle::EntryPoint entryPoint,SemaphoreID semaphore,GLuint numBufferBarriers,const BufferID * buffers,GLuint numTextureBarriers,const TextureID * textures,const GLenum * srcLayouts)1286 bool ValidateWaitSemaphoreEXT(const Context *context,
1287 angle::EntryPoint entryPoint,
1288 SemaphoreID semaphore,
1289 GLuint numBufferBarriers,
1290 const BufferID *buffers,
1291 GLuint numTextureBarriers,
1292 const TextureID *textures,
1293 const GLenum *srcLayouts)
1294 {
1295 if (!context->getExtensions().semaphoreEXT)
1296 {
1297 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
1298 return false;
1299 }
1300
1301 for (GLuint i = 0; i < numBufferBarriers; ++i)
1302 {
1303 if (!context->getBuffer(buffers[i]))
1304 {
1305 context->validationError(entryPoint, GL_INVALID_OPERATION, kInvalidBufferName);
1306 return false;
1307 }
1308 }
1309
1310 for (GLuint i = 0; i < numTextureBarriers; ++i)
1311 {
1312 if (!context->getTexture(textures[i]))
1313 {
1314 context->validationError(entryPoint, GL_INVALID_OPERATION, kInvalidTextureName);
1315 return false;
1316 }
1317 if (!IsValidImageLayout(FromGLenum<ImageLayout>(srcLayouts[i])))
1318 {
1319 context->validationError(entryPoint, GL_INVALID_ENUM, kInvalidImageLayout);
1320 return false;
1321 }
1322 }
1323
1324 return true;
1325 }
1326
ValidateImportSemaphoreFdEXT(const Context * context,angle::EntryPoint entryPoint,SemaphoreID semaphore,HandleType handleType,GLint fd)1327 bool ValidateImportSemaphoreFdEXT(const Context *context,
1328 angle::EntryPoint entryPoint,
1329 SemaphoreID semaphore,
1330 HandleType handleType,
1331 GLint fd)
1332 {
1333 if (!context->getExtensions().semaphoreFdEXT)
1334 {
1335 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
1336 return false;
1337 }
1338
1339 switch (handleType)
1340 {
1341 case HandleType::OpaqueFd:
1342 break;
1343 default:
1344 context->validationError(entryPoint, GL_INVALID_ENUM, kInvalidHandleType);
1345 return false;
1346 }
1347
1348 return true;
1349 }
1350
ValidateGetSamplerParameterIivEXT(const Context * context,angle::EntryPoint entryPoint,SamplerID samplerPacked,GLenum pname,const GLint * params)1351 bool ValidateGetSamplerParameterIivEXT(const Context *context,
1352 angle::EntryPoint entryPoint,
1353 SamplerID samplerPacked,
1354 GLenum pname,
1355 const GLint *params)
1356 {
1357 if (context->getClientMajorVersion() < 3)
1358 {
1359 context->validationError(entryPoint, GL_INVALID_OPERATION, kES3Required);
1360 return false;
1361 }
1362 return ValidateGetSamplerParameterBase(context, entryPoint, samplerPacked, pname, nullptr);
1363 }
1364
ValidateGetSamplerParameterIuivEXT(const Context * context,angle::EntryPoint entryPoint,SamplerID samplerPacked,GLenum pname,const GLuint * params)1365 bool ValidateGetSamplerParameterIuivEXT(const Context *context,
1366 angle::EntryPoint entryPoint,
1367 SamplerID samplerPacked,
1368 GLenum pname,
1369 const GLuint *params)
1370 {
1371 if (context->getClientMajorVersion() < 3)
1372 {
1373 context->validationError(entryPoint, GL_INVALID_OPERATION, kES3Required);
1374 return false;
1375 }
1376 return ValidateGetSamplerParameterBase(context, entryPoint, samplerPacked, pname, nullptr);
1377 }
1378
ValidateGetTexParameterIivEXT(const Context * context,angle::EntryPoint entryPoint,TextureType targetPacked,GLenum pname,const GLint * params)1379 bool ValidateGetTexParameterIivEXT(const Context *context,
1380 angle::EntryPoint entryPoint,
1381 TextureType targetPacked,
1382 GLenum pname,
1383 const GLint *params)
1384 {
1385 if (context->getClientMajorVersion() < 3)
1386 {
1387 context->validationError(entryPoint, GL_INVALID_OPERATION, kES3Required);
1388 return false;
1389 }
1390 return ValidateGetTexParameterBase(context, entryPoint, targetPacked, pname, nullptr);
1391 }
1392
ValidateGetTexParameterIuivEXT(const Context * context,angle::EntryPoint entryPoint,TextureType targetPacked,GLenum pname,const GLuint * params)1393 bool ValidateGetTexParameterIuivEXT(const Context *context,
1394 angle::EntryPoint entryPoint,
1395 TextureType targetPacked,
1396 GLenum pname,
1397 const GLuint *params)
1398 {
1399 if (context->getClientMajorVersion() < 3)
1400 {
1401 context->validationError(entryPoint, GL_INVALID_OPERATION, kES3Required);
1402 return false;
1403 }
1404 return ValidateGetTexParameterBase(context, entryPoint, targetPacked, pname, nullptr);
1405 }
1406
ValidateSamplerParameterIivEXT(const Context * context,angle::EntryPoint entryPoint,SamplerID samplerPacked,GLenum pname,const GLint * param)1407 bool ValidateSamplerParameterIivEXT(const Context *context,
1408 angle::EntryPoint entryPoint,
1409 SamplerID samplerPacked,
1410 GLenum pname,
1411 const GLint *param)
1412 {
1413 if (context->getClientMajorVersion() < 3)
1414 {
1415 context->validationError(entryPoint, GL_INVALID_OPERATION, kES3Required);
1416 return false;
1417 }
1418 return ValidateSamplerParameterBase(context, entryPoint, samplerPacked, pname, -1, true, param);
1419 }
1420
ValidateSamplerParameterIuivEXT(const Context * context,angle::EntryPoint entryPoint,SamplerID samplerPacked,GLenum pname,const GLuint * param)1421 bool ValidateSamplerParameterIuivEXT(const Context *context,
1422 angle::EntryPoint entryPoint,
1423 SamplerID samplerPacked,
1424 GLenum pname,
1425 const GLuint *param)
1426 {
1427 if (context->getClientMajorVersion() < 3)
1428 {
1429 context->validationError(entryPoint, GL_INVALID_OPERATION, kES3Required);
1430 return false;
1431 }
1432 return ValidateSamplerParameterBase(context, entryPoint, samplerPacked, pname, -1, true, param);
1433 }
1434
ValidateTexParameterIivEXT(const Context * context,angle::EntryPoint entryPoint,TextureType targetPacked,GLenum pname,const GLint * params)1435 bool ValidateTexParameterIivEXT(const Context *context,
1436 angle::EntryPoint entryPoint,
1437 TextureType targetPacked,
1438 GLenum pname,
1439 const GLint *params)
1440 {
1441 if (context->getClientMajorVersion() < 3)
1442 {
1443 context->validationError(entryPoint, GL_INVALID_OPERATION, kES3Required);
1444 return false;
1445 }
1446 return ValidateTexParameterBase(context, entryPoint, targetPacked, pname, -1, true, params);
1447 }
1448
ValidateTexParameterIuivEXT(const Context * context,angle::EntryPoint entryPoint,TextureType targetPacked,GLenum pname,const GLuint * params)1449 bool ValidateTexParameterIuivEXT(const Context *context,
1450 angle::EntryPoint entryPoint,
1451 TextureType targetPacked,
1452 GLenum pname,
1453 const GLuint *params)
1454 {
1455 if (context->getClientMajorVersion() < 3)
1456 {
1457 context->validationError(entryPoint, GL_INVALID_OPERATION, kES3Required);
1458 return false;
1459 }
1460 return ValidateTexParameterBase(context, entryPoint, targetPacked, pname, -1, true, params);
1461 }
1462
ValidateImportSemaphoreZirconHandleANGLE(const Context * context,angle::EntryPoint entryPoint,SemaphoreID semaphore,HandleType handleType,GLuint handle)1463 bool ValidateImportSemaphoreZirconHandleANGLE(const Context *context,
1464 angle::EntryPoint entryPoint,
1465 SemaphoreID semaphore,
1466 HandleType handleType,
1467 GLuint handle)
1468 {
1469 if (!context->getExtensions().semaphoreFuchsiaANGLE)
1470 {
1471 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
1472 return false;
1473 }
1474
1475 switch (handleType)
1476 {
1477 case HandleType::ZirconEvent:
1478 break;
1479 default:
1480 context->validationError(entryPoint, GL_INVALID_ENUM, kInvalidHandleType);
1481 return false;
1482 }
1483
1484 return true;
1485 }
1486
ValidateFramebufferFetchBarrierEXT(const Context * context,angle::EntryPoint entryPoint)1487 bool ValidateFramebufferFetchBarrierEXT(const Context *context, angle::EntryPoint entryPoint)
1488 {
1489 return true;
1490 }
1491
ValidatePatchParameteriEXT(const Context * context,angle::EntryPoint entryPoint,GLenum pname,GLint value)1492 bool ValidatePatchParameteriEXT(const Context *context,
1493 angle::EntryPoint entryPoint,
1494 GLenum pname,
1495 GLint value)
1496 {
1497 if (!context->getExtensions().tessellationShaderEXT)
1498 {
1499 context->validationError(entryPoint, GL_INVALID_OPERATION,
1500 kTessellationShaderExtensionNotEnabled);
1501 return false;
1502 }
1503
1504 if (pname != GL_PATCH_VERTICES)
1505 {
1506 context->validationError(entryPoint, GL_INVALID_ENUM, kInvalidPname);
1507 return false;
1508 }
1509
1510 if (value <= 0)
1511 {
1512 context->validationError(entryPoint, GL_INVALID_VALUE, kInvalidValueNonPositive);
1513 return false;
1514 }
1515
1516 if (value > context->getCaps().maxPatchVertices)
1517 {
1518 context->validationError(entryPoint, GL_INVALID_VALUE, kInvalidValueExceedsMaxPatchSize);
1519 return false;
1520 }
1521
1522 return true;
1523 }
1524
ValidateTexStorageMemFlags2DANGLE(const Context * context,angle::EntryPoint entryPoint,TextureType targetPacked,GLsizei levels,GLenum internalFormat,GLsizei width,GLsizei height,MemoryObjectID memoryPacked,GLuint64 offset,GLbitfield createFlags,GLbitfield usageFlags,const void * imageCreateInfoPNext)1525 bool ValidateTexStorageMemFlags2DANGLE(const Context *context,
1526 angle::EntryPoint entryPoint,
1527 TextureType targetPacked,
1528 GLsizei levels,
1529 GLenum internalFormat,
1530 GLsizei width,
1531 GLsizei height,
1532 MemoryObjectID memoryPacked,
1533 GLuint64 offset,
1534 GLbitfield createFlags,
1535 GLbitfield usageFlags,
1536 const void *imageCreateInfoPNext)
1537 {
1538 if (!context->getExtensions().memoryObjectFlagsANGLE)
1539 {
1540 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
1541 return false;
1542 }
1543
1544 if (!ValidateTexStorageMem2DEXT(context, entryPoint, targetPacked, levels, internalFormat,
1545 width, height, memoryPacked, offset))
1546 {
1547 return false;
1548 }
1549
1550 // |createFlags| and |usageFlags| must only have bits specified by the extension.
1551 constexpr GLbitfield kAllCreateFlags =
1552 GL_CREATE_SPARSE_BINDING_BIT_ANGLE | GL_CREATE_SPARSE_RESIDENCY_BIT_ANGLE |
1553 GL_CREATE_SPARSE_ALIASED_BIT_ANGLE | GL_CREATE_MUTABLE_FORMAT_BIT_ANGLE |
1554 GL_CREATE_CUBE_COMPATIBLE_BIT_ANGLE | GL_CREATE_ALIAS_BIT_ANGLE |
1555 GL_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT_ANGLE | GL_CREATE_2D_ARRAY_COMPATIBLE_BIT_ANGLE |
1556 GL_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT_ANGLE | GL_CREATE_EXTENDED_USAGE_BIT_ANGLE |
1557 GL_CREATE_PROTECTED_BIT_ANGLE | GL_CREATE_DISJOINT_BIT_ANGLE |
1558 GL_CREATE_CORNER_SAMPLED_BIT_ANGLE | GL_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_ANGLE |
1559 GL_CREATE_SUBSAMPLED_BIT_ANGLE;
1560
1561 if ((createFlags & ~kAllCreateFlags) != 0)
1562 {
1563 context->validationError(entryPoint, GL_INVALID_VALUE, kInvalidExternalCreateFlags);
1564 return false;
1565 }
1566
1567 constexpr GLbitfield kAllUsageFlags =
1568 GL_USAGE_TRANSFER_SRC_BIT_ANGLE | GL_USAGE_TRANSFER_DST_BIT_ANGLE |
1569 GL_USAGE_SAMPLED_BIT_ANGLE | GL_USAGE_STORAGE_BIT_ANGLE |
1570 GL_USAGE_COLOR_ATTACHMENT_BIT_ANGLE | GL_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT_ANGLE |
1571 GL_USAGE_TRANSIENT_ATTACHMENT_BIT_ANGLE | GL_USAGE_INPUT_ATTACHMENT_BIT_ANGLE |
1572 GL_USAGE_SHADING_RATE_IMAGE_BIT_ANGLE | GL_USAGE_FRAGMENT_DENSITY_MAP_BIT_ANGLE;
1573
1574 if ((usageFlags & ~kAllUsageFlags) != 0)
1575 {
1576 context->validationError(entryPoint, GL_INVALID_VALUE, kInvalidExternalUsageFlags);
1577 return false;
1578 }
1579
1580 return true;
1581 }
1582
ValidateTexStorageMemFlags2DMultisampleANGLE(const Context * context,angle::EntryPoint entryPoint,TextureType targetPacked,GLsizei samples,GLenum internalFormat,GLsizei width,GLsizei height,GLboolean fixedSampleLocations,MemoryObjectID memoryPacked,GLuint64 offset,GLbitfield createFlags,GLbitfield usageFlags,const void * imageCreateInfoPNext)1583 bool ValidateTexStorageMemFlags2DMultisampleANGLE(const Context *context,
1584 angle::EntryPoint entryPoint,
1585 TextureType targetPacked,
1586 GLsizei samples,
1587 GLenum internalFormat,
1588 GLsizei width,
1589 GLsizei height,
1590 GLboolean fixedSampleLocations,
1591 MemoryObjectID memoryPacked,
1592 GLuint64 offset,
1593 GLbitfield createFlags,
1594 GLbitfield usageFlags,
1595 const void *imageCreateInfoPNext)
1596 {
1597 UNIMPLEMENTED();
1598 return false;
1599 }
1600
ValidateTexStorageMemFlags3DANGLE(const Context * context,angle::EntryPoint entryPoint,TextureType targetPacked,GLsizei levels,GLenum internalFormat,GLsizei width,GLsizei height,GLsizei depth,MemoryObjectID memoryPacked,GLuint64 offset,GLbitfield createFlags,GLbitfield usageFlags,const void * imageCreateInfoPNext)1601 bool ValidateTexStorageMemFlags3DANGLE(const Context *context,
1602 angle::EntryPoint entryPoint,
1603 TextureType targetPacked,
1604 GLsizei levels,
1605 GLenum internalFormat,
1606 GLsizei width,
1607 GLsizei height,
1608 GLsizei depth,
1609 MemoryObjectID memoryPacked,
1610 GLuint64 offset,
1611 GLbitfield createFlags,
1612 GLbitfield usageFlags,
1613 const void *imageCreateInfoPNext)
1614 {
1615 UNIMPLEMENTED();
1616 return false;
1617 }
1618
ValidateTexStorageMemFlags3DMultisampleANGLE(const Context * context,angle::EntryPoint entryPoint,TextureType targetPacked,GLsizei samples,GLenum internalFormat,GLsizei width,GLsizei height,GLsizei depth,GLboolean fixedSampleLocations,MemoryObjectID memoryPacked,GLuint64 offset,GLbitfield createFlags,GLbitfield usageFlags,const void * imageCreateInfoPNext)1619 bool ValidateTexStorageMemFlags3DMultisampleANGLE(const Context *context,
1620 angle::EntryPoint entryPoint,
1621 TextureType targetPacked,
1622 GLsizei samples,
1623 GLenum internalFormat,
1624 GLsizei width,
1625 GLsizei height,
1626 GLsizei depth,
1627 GLboolean fixedSampleLocations,
1628 MemoryObjectID memoryPacked,
1629 GLuint64 offset,
1630 GLbitfield createFlags,
1631 GLbitfield usageFlags,
1632 const void *imageCreateInfoPNext)
1633 {
1634 UNIMPLEMENTED();
1635 return false;
1636 }
1637
1638 // GL_EXT_buffer_storage
ValidateBufferStorageEXT(const Context * context,angle::EntryPoint entryPoint,BufferBinding targetPacked,GLsizeiptr size,const void * data,GLbitfield flags)1639 bool ValidateBufferStorageEXT(const Context *context,
1640 angle::EntryPoint entryPoint,
1641 BufferBinding targetPacked,
1642 GLsizeiptr size,
1643 const void *data,
1644 GLbitfield flags)
1645 {
1646 if (!context->isValidBufferBinding(targetPacked))
1647 {
1648 context->validationError(entryPoint, GL_INVALID_ENUM, kInvalidBufferTypes);
1649 return false;
1650 }
1651
1652 if (size <= 0)
1653 {
1654 context->validationError(entryPoint, GL_INVALID_VALUE, kNonPositiveSize);
1655 return false;
1656 }
1657
1658 constexpr GLbitfield kAllUsageFlags =
1659 (GL_DYNAMIC_STORAGE_BIT_EXT | GL_MAP_READ_BIT | GL_MAP_WRITE_BIT |
1660 GL_MAP_PERSISTENT_BIT_EXT | GL_MAP_COHERENT_BIT_EXT | GL_CLIENT_STORAGE_BIT_EXT);
1661 if ((flags & ~kAllUsageFlags) != 0)
1662 {
1663 context->validationError(entryPoint, GL_INVALID_VALUE, kInvalidBufferUsageFlags);
1664 return false;
1665 }
1666
1667 if (((flags & GL_MAP_PERSISTENT_BIT_EXT) != 0) &&
1668 ((flags & (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)) == 0))
1669 {
1670 context->validationError(entryPoint, GL_INVALID_VALUE, kInvalidBufferUsageFlags);
1671 return false;
1672 }
1673
1674 if (((flags & GL_MAP_COHERENT_BIT_EXT) != 0) && ((flags & GL_MAP_PERSISTENT_BIT_EXT) == 0))
1675 {
1676 context->validationError(entryPoint, GL_INVALID_VALUE, kInvalidBufferUsageFlags);
1677 return false;
1678 }
1679
1680 Buffer *buffer = context->getState().getTargetBuffer(targetPacked);
1681
1682 if (buffer == nullptr)
1683 {
1684 context->validationError(entryPoint, GL_INVALID_OPERATION, kBufferNotBound);
1685 return false;
1686 }
1687
1688 if (buffer->isImmutable())
1689 {
1690 context->validationError(entryPoint, GL_INVALID_OPERATION, kBufferImmutable);
1691 return false;
1692 }
1693
1694 return true;
1695 }
1696
1697 // GL_EXT_clip_control
ValidateClipControlEXT(const Context * context,angle::EntryPoint entryPoint,GLenum origin,GLenum depth)1698 bool ValidateClipControlEXT(const Context *context,
1699 angle::EntryPoint entryPoint,
1700 GLenum origin,
1701 GLenum depth)
1702 {
1703 if ((origin != GL_LOWER_LEFT_EXT) && (origin != GL_UPPER_LEFT_EXT))
1704 {
1705 context->validationError(entryPoint, GL_INVALID_ENUM, kInvalidOriginEnum);
1706 return false;
1707 }
1708
1709 if ((depth != GL_NEGATIVE_ONE_TO_ONE_EXT) && (depth != GL_ZERO_TO_ONE_EXT))
1710 {
1711 context->validationError(entryPoint, GL_INVALID_ENUM, kInvalidDepthEnum);
1712 return false;
1713 }
1714
1715 return true;
1716 }
1717
1718 // GL_EXT_external_buffer
ValidateBufferStorageExternalEXT(const Context * context,angle::EntryPoint entryPoint,BufferBinding targetPacked,GLintptr offset,GLsizeiptr size,GLeglClientBufferEXT clientBuffer,GLbitfield flags)1719 bool ValidateBufferStorageExternalEXT(const Context *context,
1720 angle::EntryPoint entryPoint,
1721 BufferBinding targetPacked,
1722 GLintptr offset,
1723 GLsizeiptr size,
1724 GLeglClientBufferEXT clientBuffer,
1725 GLbitfield flags)
1726 {
1727 if (!ValidateBufferStorageEXT(context, entryPoint, targetPacked, size, nullptr, flags))
1728 {
1729 return false;
1730 }
1731
1732 if (offset != 0)
1733 {
1734 context->validationError(entryPoint, GL_INVALID_VALUE, kExternalBufferInvalidOffset);
1735 return false;
1736 }
1737
1738 if (clientBuffer == nullptr && size > 0)
1739 {
1740 context->validationError(entryPoint, GL_INVALID_VALUE, kClientBufferInvalid);
1741 return false;
1742 }
1743
1744 return true;
1745 }
1746
ValidateNamedBufferStorageExternalEXT(const Context * context,angle::EntryPoint entryPoint,GLuint buffer,GLintptr offset,GLsizeiptr size,GLeglClientBufferEXT clientBuffer,GLbitfield flags)1747 bool ValidateNamedBufferStorageExternalEXT(const Context *context,
1748 angle::EntryPoint entryPoint,
1749 GLuint buffer,
1750 GLintptr offset,
1751 GLsizeiptr size,
1752 GLeglClientBufferEXT clientBuffer,
1753 GLbitfield flags)
1754 {
1755 UNIMPLEMENTED();
1756 return false;
1757 }
1758
1759 // GL_EXT_primitive_bounding_box
ValidatePrimitiveBoundingBoxEXT(const Context * context,angle::EntryPoint entryPoint,GLfloat minX,GLfloat minY,GLfloat minZ,GLfloat minW,GLfloat maxX,GLfloat maxY,GLfloat maxZ,GLfloat maxW)1760 bool ValidatePrimitiveBoundingBoxEXT(const Context *context,
1761 angle::EntryPoint entryPoint,
1762 GLfloat minX,
1763 GLfloat minY,
1764 GLfloat minZ,
1765 GLfloat minW,
1766 GLfloat maxX,
1767 GLfloat maxY,
1768 GLfloat maxZ,
1769 GLfloat maxW)
1770 {
1771 if (!context->getExtensions().primitiveBoundingBoxEXT)
1772 {
1773 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
1774 return false;
1775 }
1776
1777 return true;
1778 }
1779
1780 // GL_EXT_separate_shader_objects
ValidateActiveShaderProgramEXT(const Context * context,angle::EntryPoint entryPoint,ProgramPipelineID pipelinePacked,ShaderProgramID programPacked)1781 bool ValidateActiveShaderProgramEXT(const Context *context,
1782 angle::EntryPoint entryPoint,
1783 ProgramPipelineID pipelinePacked,
1784 ShaderProgramID programPacked)
1785 {
1786 if (!context->getExtensions().separateShaderObjectsEXT)
1787 {
1788 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
1789 return false;
1790 }
1791
1792 return ValidateActiveShaderProgramBase(context, entryPoint, pipelinePacked, programPacked);
1793 }
1794
ValidateBindProgramPipelineEXT(const Context * context,angle::EntryPoint entryPoint,ProgramPipelineID pipelinePacked)1795 bool ValidateBindProgramPipelineEXT(const Context *context,
1796 angle::EntryPoint entryPoint,
1797 ProgramPipelineID pipelinePacked)
1798 {
1799 if (!context->getExtensions().separateShaderObjectsEXT)
1800 {
1801 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
1802 return false;
1803 }
1804
1805 return ValidateBindProgramPipelineBase(context, entryPoint, pipelinePacked);
1806 }
1807
ValidateCreateShaderProgramvEXT(const Context * context,angle::EntryPoint entryPoint,ShaderType typePacked,GLsizei count,const GLchar ** strings)1808 bool ValidateCreateShaderProgramvEXT(const Context *context,
1809 angle::EntryPoint entryPoint,
1810 ShaderType typePacked,
1811 GLsizei count,
1812 const GLchar **strings)
1813 {
1814 if (!context->getExtensions().separateShaderObjectsEXT)
1815 {
1816 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
1817 return false;
1818 }
1819
1820 return ValidateCreateShaderProgramvBase(context, entryPoint, typePacked, count, strings);
1821 }
1822
ValidateDeleteProgramPipelinesEXT(const Context * context,angle::EntryPoint entryPoint,GLsizei n,const ProgramPipelineID * pipelinesPacked)1823 bool ValidateDeleteProgramPipelinesEXT(const Context *context,
1824 angle::EntryPoint entryPoint,
1825 GLsizei n,
1826 const ProgramPipelineID *pipelinesPacked)
1827 {
1828 if (!context->getExtensions().separateShaderObjectsEXT)
1829 {
1830 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
1831 return false;
1832 }
1833
1834 return ValidateDeleteProgramPipelinesBase(context, entryPoint, n, pipelinesPacked);
1835 }
1836
ValidateGenProgramPipelinesEXT(const Context * context,angle::EntryPoint entryPoint,GLsizei n,const ProgramPipelineID * pipelinesPacked)1837 bool ValidateGenProgramPipelinesEXT(const Context *context,
1838 angle::EntryPoint entryPoint,
1839 GLsizei n,
1840 const ProgramPipelineID *pipelinesPacked)
1841 {
1842 if (!context->getExtensions().separateShaderObjectsEXT)
1843 {
1844 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
1845 return false;
1846 }
1847
1848 return ValidateGenProgramPipelinesBase(context, entryPoint, n, pipelinesPacked);
1849 }
1850
ValidateGetProgramPipelineInfoLogEXT(const Context * context,angle::EntryPoint entryPoint,ProgramPipelineID pipelinePacked,GLsizei bufSize,const GLsizei * length,const GLchar * infoLog)1851 bool ValidateGetProgramPipelineInfoLogEXT(const Context *context,
1852 angle::EntryPoint entryPoint,
1853 ProgramPipelineID pipelinePacked,
1854 GLsizei bufSize,
1855 const GLsizei *length,
1856 const GLchar *infoLog)
1857 {
1858 if (!context->getExtensions().separateShaderObjectsEXT)
1859 {
1860 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
1861 return false;
1862 }
1863
1864 return ValidateGetProgramPipelineInfoLogBase(context, entryPoint, pipelinePacked, bufSize,
1865 length, infoLog);
1866 }
1867
ValidateGetProgramPipelineivEXT(const Context * context,angle::EntryPoint entryPoint,ProgramPipelineID pipelinePacked,GLenum pname,const GLint * params)1868 bool ValidateGetProgramPipelineivEXT(const Context *context,
1869 angle::EntryPoint entryPoint,
1870 ProgramPipelineID pipelinePacked,
1871 GLenum pname,
1872 const GLint *params)
1873 {
1874 if (!context->getExtensions().separateShaderObjectsEXT)
1875 {
1876 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
1877 return false;
1878 }
1879
1880 return ValidateGetProgramPipelineivBase(context, entryPoint, pipelinePacked, pname, params);
1881 }
1882
ValidateIsProgramPipelineEXT(const Context * context,angle::EntryPoint entryPoint,ProgramPipelineID pipelinePacked)1883 bool ValidateIsProgramPipelineEXT(const Context *context,
1884 angle::EntryPoint entryPoint,
1885 ProgramPipelineID pipelinePacked)
1886 {
1887 if (!context->getExtensions().separateShaderObjectsEXT)
1888 {
1889 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
1890 return false;
1891 }
1892
1893 return ValidateIsProgramPipelineBase(context, entryPoint, pipelinePacked);
1894 }
1895
ValidateProgramParameteriEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,GLenum pname,GLint value)1896 bool ValidateProgramParameteriEXT(const Context *context,
1897 angle::EntryPoint entryPoint,
1898 ShaderProgramID programPacked,
1899 GLenum pname,
1900 GLint value)
1901 {
1902 if (!context->getExtensions().separateShaderObjectsEXT)
1903 {
1904 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
1905 return false;
1906 }
1907
1908 return ValidateProgramParameteriBase(context, entryPoint, programPacked, pname, value);
1909 }
1910
ValidateProgramUniform1fEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLfloat v0)1911 bool ValidateProgramUniform1fEXT(const Context *context,
1912 angle::EntryPoint entryPoint,
1913 ShaderProgramID programPacked,
1914 UniformLocation locationPacked,
1915 GLfloat v0)
1916 {
1917 if (!context->getExtensions().separateShaderObjectsEXT)
1918 {
1919 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
1920 return false;
1921 }
1922
1923 return ValidateProgramUniform1fBase(context, entryPoint, programPacked, locationPacked, v0);
1924 }
1925
ValidateProgramUniform1fvEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,const GLfloat * value)1926 bool ValidateProgramUniform1fvEXT(const Context *context,
1927 angle::EntryPoint entryPoint,
1928 ShaderProgramID programPacked,
1929 UniformLocation locationPacked,
1930 GLsizei count,
1931 const GLfloat *value)
1932 {
1933 if (!context->getExtensions().separateShaderObjectsEXT)
1934 {
1935 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
1936 return false;
1937 }
1938
1939 return ValidateProgramUniform1fvBase(context, entryPoint, programPacked, locationPacked, count,
1940 value);
1941 }
1942
ValidateProgramUniform1iEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLint v0)1943 bool ValidateProgramUniform1iEXT(const Context *context,
1944 angle::EntryPoint entryPoint,
1945 ShaderProgramID programPacked,
1946 UniformLocation locationPacked,
1947 GLint v0)
1948 {
1949 if (!context->getExtensions().separateShaderObjectsEXT)
1950 {
1951 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
1952 return false;
1953 }
1954
1955 return ValidateProgramUniform1iBase(context, entryPoint, programPacked, locationPacked, v0);
1956 }
1957
ValidateProgramUniform1ivEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,const GLint * value)1958 bool ValidateProgramUniform1ivEXT(const Context *context,
1959 angle::EntryPoint entryPoint,
1960 ShaderProgramID programPacked,
1961 UniformLocation locationPacked,
1962 GLsizei count,
1963 const GLint *value)
1964 {
1965 if (!context->getExtensions().separateShaderObjectsEXT)
1966 {
1967 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
1968 return false;
1969 }
1970
1971 return ValidateProgramUniform1ivBase(context, entryPoint, programPacked, locationPacked, count,
1972 value);
1973 }
1974
ValidateProgramUniform1uiEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLuint v0)1975 bool ValidateProgramUniform1uiEXT(const Context *context,
1976 angle::EntryPoint entryPoint,
1977 ShaderProgramID programPacked,
1978 UniformLocation locationPacked,
1979 GLuint v0)
1980 {
1981 if (!context->getExtensions().separateShaderObjectsEXT)
1982 {
1983 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
1984 return false;
1985 }
1986
1987 return ValidateProgramUniform1uiBase(context, entryPoint, programPacked, locationPacked, v0);
1988 }
1989
ValidateProgramUniform1uivEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,const GLuint * value)1990 bool ValidateProgramUniform1uivEXT(const Context *context,
1991 angle::EntryPoint entryPoint,
1992 ShaderProgramID programPacked,
1993 UniformLocation locationPacked,
1994 GLsizei count,
1995 const GLuint *value)
1996 {
1997 if (!context->getExtensions().separateShaderObjectsEXT)
1998 {
1999 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
2000 return false;
2001 }
2002
2003 return ValidateProgramUniform1uivBase(context, entryPoint, programPacked, locationPacked, count,
2004 value);
2005 }
2006
ValidateProgramUniform2fEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLfloat v0,GLfloat v1)2007 bool ValidateProgramUniform2fEXT(const Context *context,
2008 angle::EntryPoint entryPoint,
2009 ShaderProgramID programPacked,
2010 UniformLocation locationPacked,
2011 GLfloat v0,
2012 GLfloat v1)
2013 {
2014 if (!context->getExtensions().separateShaderObjectsEXT)
2015 {
2016 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
2017 return false;
2018 }
2019
2020 return ValidateProgramUniform2fBase(context, entryPoint, programPacked, locationPacked, v0, v1);
2021 }
2022
ValidateProgramUniform2fvEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,const GLfloat * value)2023 bool ValidateProgramUniform2fvEXT(const Context *context,
2024 angle::EntryPoint entryPoint,
2025 ShaderProgramID programPacked,
2026 UniformLocation locationPacked,
2027 GLsizei count,
2028 const GLfloat *value)
2029 {
2030 if (!context->getExtensions().separateShaderObjectsEXT)
2031 {
2032 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
2033 return false;
2034 }
2035
2036 return ValidateProgramUniform2fvBase(context, entryPoint, programPacked, locationPacked, count,
2037 value);
2038 }
2039
ValidateProgramUniform2iEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLint v0,GLint v1)2040 bool ValidateProgramUniform2iEXT(const Context *context,
2041 angle::EntryPoint entryPoint,
2042 ShaderProgramID programPacked,
2043 UniformLocation locationPacked,
2044 GLint v0,
2045 GLint v1)
2046 {
2047 if (!context->getExtensions().separateShaderObjectsEXT)
2048 {
2049 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
2050 return false;
2051 }
2052
2053 return ValidateProgramUniform2iBase(context, entryPoint, programPacked, locationPacked, v0, v1);
2054 }
2055
ValidateProgramUniform2ivEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,const GLint * value)2056 bool ValidateProgramUniform2ivEXT(const Context *context,
2057 angle::EntryPoint entryPoint,
2058 ShaderProgramID programPacked,
2059 UniformLocation locationPacked,
2060 GLsizei count,
2061 const GLint *value)
2062 {
2063 if (!context->getExtensions().separateShaderObjectsEXT)
2064 {
2065 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
2066 return false;
2067 }
2068
2069 return ValidateProgramUniform2ivBase(context, entryPoint, programPacked, locationPacked, count,
2070 value);
2071 }
2072
ValidateProgramUniform2uiEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLuint v0,GLuint v1)2073 bool ValidateProgramUniform2uiEXT(const Context *context,
2074 angle::EntryPoint entryPoint,
2075 ShaderProgramID programPacked,
2076 UniformLocation locationPacked,
2077 GLuint v0,
2078 GLuint v1)
2079 {
2080 if (!context->getExtensions().separateShaderObjectsEXT)
2081 {
2082 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
2083 return false;
2084 }
2085
2086 return ValidateProgramUniform2uiBase(context, entryPoint, programPacked, locationPacked, v0,
2087 v1);
2088 }
2089
ValidateProgramUniform2uivEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,const GLuint * value)2090 bool ValidateProgramUniform2uivEXT(const Context *context,
2091 angle::EntryPoint entryPoint,
2092 ShaderProgramID programPacked,
2093 UniformLocation locationPacked,
2094 GLsizei count,
2095 const GLuint *value)
2096 {
2097 if (!context->getExtensions().separateShaderObjectsEXT)
2098 {
2099 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
2100 return false;
2101 }
2102
2103 return ValidateProgramUniform2uivBase(context, entryPoint, programPacked, locationPacked, count,
2104 value);
2105 }
2106
ValidateProgramUniform3fEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLfloat v0,GLfloat v1,GLfloat v2)2107 bool ValidateProgramUniform3fEXT(const Context *context,
2108 angle::EntryPoint entryPoint,
2109 ShaderProgramID programPacked,
2110 UniformLocation locationPacked,
2111 GLfloat v0,
2112 GLfloat v1,
2113 GLfloat v2)
2114 {
2115 if (!context->getExtensions().separateShaderObjectsEXT)
2116 {
2117 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
2118 return false;
2119 }
2120
2121 return ValidateProgramUniform3fBase(context, entryPoint, programPacked, locationPacked, v0, v1,
2122 v2);
2123 }
2124
ValidateProgramUniform3fvEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,const GLfloat * value)2125 bool ValidateProgramUniform3fvEXT(const Context *context,
2126 angle::EntryPoint entryPoint,
2127 ShaderProgramID programPacked,
2128 UniformLocation locationPacked,
2129 GLsizei count,
2130 const GLfloat *value)
2131 {
2132 if (!context->getExtensions().separateShaderObjectsEXT)
2133 {
2134 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
2135 return false;
2136 }
2137
2138 return ValidateProgramUniform3fvBase(context, entryPoint, programPacked, locationPacked, count,
2139 value);
2140 }
2141
ValidateProgramUniform3iEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLint v0,GLint v1,GLint v2)2142 bool ValidateProgramUniform3iEXT(const Context *context,
2143 angle::EntryPoint entryPoint,
2144 ShaderProgramID programPacked,
2145 UniformLocation locationPacked,
2146 GLint v0,
2147 GLint v1,
2148 GLint v2)
2149 {
2150 if (!context->getExtensions().separateShaderObjectsEXT)
2151 {
2152 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
2153 return false;
2154 }
2155
2156 return ValidateProgramUniform3iBase(context, entryPoint, programPacked, locationPacked, v0, v1,
2157 v2);
2158 }
2159
ValidateProgramUniform3ivEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,const GLint * value)2160 bool ValidateProgramUniform3ivEXT(const Context *context,
2161 angle::EntryPoint entryPoint,
2162 ShaderProgramID programPacked,
2163 UniformLocation locationPacked,
2164 GLsizei count,
2165 const GLint *value)
2166 {
2167 if (!context->getExtensions().separateShaderObjectsEXT)
2168 {
2169 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
2170 return false;
2171 }
2172
2173 return ValidateProgramUniform3ivBase(context, entryPoint, programPacked, locationPacked, count,
2174 value);
2175 }
2176
ValidateProgramUniform3uiEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLuint v0,GLuint v1,GLuint v2)2177 bool ValidateProgramUniform3uiEXT(const Context *context,
2178 angle::EntryPoint entryPoint,
2179 ShaderProgramID programPacked,
2180 UniformLocation locationPacked,
2181 GLuint v0,
2182 GLuint v1,
2183 GLuint v2)
2184 {
2185 if (!context->getExtensions().separateShaderObjectsEXT)
2186 {
2187 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
2188 return false;
2189 }
2190
2191 return ValidateProgramUniform3uiBase(context, entryPoint, programPacked, locationPacked, v0, v1,
2192 v2);
2193 }
2194
ValidateProgramUniform3uivEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,const GLuint * value)2195 bool ValidateProgramUniform3uivEXT(const Context *context,
2196 angle::EntryPoint entryPoint,
2197 ShaderProgramID programPacked,
2198 UniformLocation locationPacked,
2199 GLsizei count,
2200 const GLuint *value)
2201 {
2202 if (!context->getExtensions().separateShaderObjectsEXT)
2203 {
2204 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
2205 return false;
2206 }
2207
2208 return ValidateProgramUniform3uivBase(context, entryPoint, programPacked, locationPacked, count,
2209 value);
2210 }
2211
ValidateProgramUniform4fEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLfloat v0,GLfloat v1,GLfloat v2,GLfloat v3)2212 bool ValidateProgramUniform4fEXT(const Context *context,
2213 angle::EntryPoint entryPoint,
2214 ShaderProgramID programPacked,
2215 UniformLocation locationPacked,
2216 GLfloat v0,
2217 GLfloat v1,
2218 GLfloat v2,
2219 GLfloat v3)
2220 {
2221 if (!context->getExtensions().separateShaderObjectsEXT)
2222 {
2223 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
2224 return false;
2225 }
2226
2227 return ValidateProgramUniform4fBase(context, entryPoint, programPacked, locationPacked, v0, v1,
2228 v2, v3);
2229 }
2230
ValidateProgramUniform4fvEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,const GLfloat * value)2231 bool ValidateProgramUniform4fvEXT(const Context *context,
2232 angle::EntryPoint entryPoint,
2233 ShaderProgramID programPacked,
2234 UniformLocation locationPacked,
2235 GLsizei count,
2236 const GLfloat *value)
2237 {
2238 if (!context->getExtensions().separateShaderObjectsEXT)
2239 {
2240 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
2241 return false;
2242 }
2243
2244 return ValidateProgramUniform4fvBase(context, entryPoint, programPacked, locationPacked, count,
2245 value);
2246 }
2247
ValidateProgramUniform4iEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLint v0,GLint v1,GLint v2,GLint v3)2248 bool ValidateProgramUniform4iEXT(const Context *context,
2249 angle::EntryPoint entryPoint,
2250 ShaderProgramID programPacked,
2251 UniformLocation locationPacked,
2252 GLint v0,
2253 GLint v1,
2254 GLint v2,
2255 GLint v3)
2256 {
2257 if (!context->getExtensions().separateShaderObjectsEXT)
2258 {
2259 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
2260 return false;
2261 }
2262
2263 return ValidateProgramUniform4iBase(context, entryPoint, programPacked, locationPacked, v0, v1,
2264 v2, v3);
2265 }
2266
ValidateProgramUniform4ivEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,const GLint * value)2267 bool ValidateProgramUniform4ivEXT(const Context *context,
2268 angle::EntryPoint entryPoint,
2269 ShaderProgramID programPacked,
2270 UniformLocation locationPacked,
2271 GLsizei count,
2272 const GLint *value)
2273 {
2274 return ValidateProgramUniform4ivBase(context, entryPoint, programPacked, locationPacked, count,
2275 value);
2276 }
2277
ValidateProgramUniform4uiEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLuint v0,GLuint v1,GLuint v2,GLuint v3)2278 bool ValidateProgramUniform4uiEXT(const Context *context,
2279 angle::EntryPoint entryPoint,
2280 ShaderProgramID programPacked,
2281 UniformLocation locationPacked,
2282 GLuint v0,
2283 GLuint v1,
2284 GLuint v2,
2285 GLuint v3)
2286 {
2287 if (!context->getExtensions().separateShaderObjectsEXT)
2288 {
2289 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
2290 return false;
2291 }
2292
2293 return ValidateProgramUniform4uiBase(context, entryPoint, programPacked, locationPacked, v0, v1,
2294 v2, v3);
2295 }
2296
ValidateProgramUniform4uivEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,const GLuint * value)2297 bool ValidateProgramUniform4uivEXT(const Context *context,
2298 angle::EntryPoint entryPoint,
2299 ShaderProgramID programPacked,
2300 UniformLocation locationPacked,
2301 GLsizei count,
2302 const GLuint *value)
2303 {
2304 return ValidateProgramUniform4uivBase(context, entryPoint, programPacked, locationPacked, count,
2305 value);
2306 }
2307
ValidateProgramUniformMatrix2fvEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,GLboolean transpose,const GLfloat * value)2308 bool ValidateProgramUniformMatrix2fvEXT(const Context *context,
2309 angle::EntryPoint entryPoint,
2310 ShaderProgramID programPacked,
2311 UniformLocation locationPacked,
2312 GLsizei count,
2313 GLboolean transpose,
2314 const GLfloat *value)
2315 {
2316 if (!context->getExtensions().separateShaderObjectsEXT)
2317 {
2318 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
2319 return false;
2320 }
2321
2322 return ValidateProgramUniformMatrix2fvBase(context, entryPoint, programPacked, locationPacked,
2323 count, transpose, value);
2324 }
2325
ValidateProgramUniformMatrix2x3fvEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,GLboolean transpose,const GLfloat * value)2326 bool ValidateProgramUniformMatrix2x3fvEXT(const Context *context,
2327 angle::EntryPoint entryPoint,
2328 ShaderProgramID programPacked,
2329 UniformLocation locationPacked,
2330 GLsizei count,
2331 GLboolean transpose,
2332 const GLfloat *value)
2333 {
2334 if (!context->getExtensions().separateShaderObjectsEXT)
2335 {
2336 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
2337 return false;
2338 }
2339
2340 return ValidateProgramUniformMatrix2x3fvBase(context, entryPoint, programPacked, locationPacked,
2341 count, transpose, value);
2342 }
2343
ValidateProgramUniformMatrix2x4fvEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,GLboolean transpose,const GLfloat * value)2344 bool ValidateProgramUniformMatrix2x4fvEXT(const Context *context,
2345 angle::EntryPoint entryPoint,
2346 ShaderProgramID programPacked,
2347 UniformLocation locationPacked,
2348 GLsizei count,
2349 GLboolean transpose,
2350 const GLfloat *value)
2351 {
2352 if (!context->getExtensions().separateShaderObjectsEXT)
2353 {
2354 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
2355 return false;
2356 }
2357
2358 return ValidateProgramUniformMatrix2x4fvBase(context, entryPoint, programPacked, locationPacked,
2359 count, transpose, value);
2360 }
2361
ValidateProgramUniformMatrix3fvEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,GLboolean transpose,const GLfloat * value)2362 bool ValidateProgramUniformMatrix3fvEXT(const Context *context,
2363 angle::EntryPoint entryPoint,
2364 ShaderProgramID programPacked,
2365 UniformLocation locationPacked,
2366 GLsizei count,
2367 GLboolean transpose,
2368 const GLfloat *value)
2369 {
2370 if (!context->getExtensions().separateShaderObjectsEXT)
2371 {
2372 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
2373 return false;
2374 }
2375
2376 return ValidateProgramUniformMatrix3fvBase(context, entryPoint, programPacked, locationPacked,
2377 count, transpose, value);
2378 }
2379
ValidateProgramUniformMatrix3x2fvEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,GLboolean transpose,const GLfloat * value)2380 bool ValidateProgramUniformMatrix3x2fvEXT(const Context *context,
2381 angle::EntryPoint entryPoint,
2382 ShaderProgramID programPacked,
2383 UniformLocation locationPacked,
2384 GLsizei count,
2385 GLboolean transpose,
2386 const GLfloat *value)
2387 {
2388 if (!context->getExtensions().separateShaderObjectsEXT)
2389 {
2390 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
2391 return false;
2392 }
2393
2394 return ValidateProgramUniformMatrix3x2fvBase(context, entryPoint, programPacked, locationPacked,
2395 count, transpose, value);
2396 }
2397
ValidateProgramUniformMatrix3x4fvEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,GLboolean transpose,const GLfloat * value)2398 bool ValidateProgramUniformMatrix3x4fvEXT(const Context *context,
2399 angle::EntryPoint entryPoint,
2400 ShaderProgramID programPacked,
2401 UniformLocation locationPacked,
2402 GLsizei count,
2403 GLboolean transpose,
2404 const GLfloat *value)
2405 {
2406 if (!context->getExtensions().separateShaderObjectsEXT)
2407 {
2408 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
2409 return false;
2410 }
2411
2412 return ValidateProgramUniformMatrix3x4fvBase(context, entryPoint, programPacked, locationPacked,
2413 count, transpose, value);
2414 }
2415
ValidateProgramUniformMatrix4fvEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,GLboolean transpose,const GLfloat * value)2416 bool ValidateProgramUniformMatrix4fvEXT(const Context *context,
2417 angle::EntryPoint entryPoint,
2418 ShaderProgramID programPacked,
2419 UniformLocation locationPacked,
2420 GLsizei count,
2421 GLboolean transpose,
2422 const GLfloat *value)
2423 {
2424 if (!context->getExtensions().separateShaderObjectsEXT)
2425 {
2426 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
2427 return false;
2428 }
2429
2430 return ValidateProgramUniformMatrix4fvBase(context, entryPoint, programPacked, locationPacked,
2431 count, transpose, value);
2432 }
2433
ValidateProgramUniformMatrix4x2fvEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,GLboolean transpose,const GLfloat * value)2434 bool ValidateProgramUniformMatrix4x2fvEXT(const Context *context,
2435 angle::EntryPoint entryPoint,
2436 ShaderProgramID programPacked,
2437 UniformLocation locationPacked,
2438 GLsizei count,
2439 GLboolean transpose,
2440 const GLfloat *value)
2441 {
2442 if (!context->getExtensions().separateShaderObjectsEXT)
2443 {
2444 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
2445 return false;
2446 }
2447
2448 return ValidateProgramUniformMatrix4x2fvBase(context, entryPoint, programPacked, locationPacked,
2449 count, transpose, value);
2450 }
2451
ValidateProgramUniformMatrix4x3fvEXT(const Context * context,angle::EntryPoint entryPoint,ShaderProgramID programPacked,UniformLocation locationPacked,GLsizei count,GLboolean transpose,const GLfloat * value)2452 bool ValidateProgramUniformMatrix4x3fvEXT(const Context *context,
2453 angle::EntryPoint entryPoint,
2454 ShaderProgramID programPacked,
2455 UniformLocation locationPacked,
2456 GLsizei count,
2457 GLboolean transpose,
2458 const GLfloat *value)
2459 {
2460 if (!context->getExtensions().separateShaderObjectsEXT)
2461 {
2462 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
2463 return false;
2464 }
2465
2466 return ValidateProgramUniformMatrix4x3fvBase(context, entryPoint, programPacked, locationPacked,
2467 count, transpose, value);
2468 }
2469
ValidateUseProgramStagesEXT(const Context * context,angle::EntryPoint entryPoint,ProgramPipelineID pipelinePacked,GLbitfield stages,ShaderProgramID programPacked)2470 bool ValidateUseProgramStagesEXT(const Context *context,
2471 angle::EntryPoint entryPoint,
2472 ProgramPipelineID pipelinePacked,
2473 GLbitfield stages,
2474 ShaderProgramID programPacked)
2475 {
2476 if (!context->getExtensions().separateShaderObjectsEXT)
2477 {
2478 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
2479 return false;
2480 }
2481
2482 return ValidateUseProgramStagesBase(context, entryPoint, pipelinePacked, stages, programPacked);
2483 }
2484
ValidateValidateProgramPipelineEXT(const Context * context,angle::EntryPoint entryPoint,ProgramPipelineID pipelinePacked)2485 bool ValidateValidateProgramPipelineEXT(const Context *context,
2486 angle::EntryPoint entryPoint,
2487 ProgramPipelineID pipelinePacked)
2488 {
2489 if (!context->getExtensions().separateShaderObjectsEXT)
2490 {
2491 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
2492 return false;
2493 }
2494
2495 return ValidateValidateProgramPipelineBase(context, entryPoint, pipelinePacked);
2496 }
2497
2498 // GL_EXT_debug_label
ValidateGetObjectLabelEXT(const Context * context,angle::EntryPoint entryPoint,GLenum type,GLuint object,GLsizei bufSize,const GLsizei * length,const GLchar * label)2499 bool ValidateGetObjectLabelEXT(const Context *context,
2500 angle::EntryPoint entryPoint,
2501 GLenum type,
2502 GLuint object,
2503 GLsizei bufSize,
2504 const GLsizei *length,
2505 const GLchar *label)
2506 {
2507 if (!context->getExtensions().debugLabelEXT)
2508 {
2509 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
2510 return false;
2511 }
2512
2513 if (bufSize < 0)
2514 {
2515 context->validationError(entryPoint, GL_INVALID_VALUE, kNegativeBufferSize);
2516 return false;
2517 }
2518
2519 return ValidateObjectIdentifierAndName(context, entryPoint, type, object);
2520 }
2521
ValidateLabelObjectEXT(const Context * context,angle::EntryPoint entryPoint,GLenum type,GLuint object,GLsizei length,const GLchar * label)2522 bool ValidateLabelObjectEXT(const Context *context,
2523 angle::EntryPoint entryPoint,
2524 GLenum type,
2525 GLuint object,
2526 GLsizei length,
2527 const GLchar *label)
2528 {
2529 if (!context->getExtensions().debugLabelEXT)
2530 {
2531 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
2532 return false;
2533 }
2534
2535 if (length < 0)
2536 {
2537 context->validationError(entryPoint, GL_INVALID_VALUE, kNegativeLength);
2538 return false;
2539 }
2540
2541 return ValidateObjectIdentifierAndName(context, entryPoint, type, object);
2542 }
2543
ValidateEGLImageTargetTextureStorageEXT(const Context * context,angle::EntryPoint entryPoint,GLuint texture,GLeglImageOES image,const GLint * attrib_list)2544 bool ValidateEGLImageTargetTextureStorageEXT(const Context *context,
2545 angle::EntryPoint entryPoint,
2546 GLuint texture,
2547 GLeglImageOES image,
2548 const GLint *attrib_list)
2549 {
2550 UNREACHABLE();
2551 return false;
2552 }
2553
ValidateEGLImageTargetTexStorageEXT(const Context * context,angle::EntryPoint entryPoint,GLenum target,GLeglImageOES image,const GLint * attrib_list)2554 bool ValidateEGLImageTargetTexStorageEXT(const Context *context,
2555 angle::EntryPoint entryPoint,
2556 GLenum target,
2557 GLeglImageOES image,
2558 const GLint *attrib_list)
2559 {
2560 UNREACHABLE();
2561 return false;
2562 }
2563
ValidateAcquireTexturesANGLE(const Context * context,angle::EntryPoint entryPoint,GLuint numTextures,const TextureID * textures,const GLenum * layouts)2564 bool ValidateAcquireTexturesANGLE(const Context *context,
2565 angle::EntryPoint entryPoint,
2566 GLuint numTextures,
2567 const TextureID *textures,
2568 const GLenum *layouts)
2569 {
2570 if (!context->getExtensions().vulkanImageANGLE)
2571 {
2572 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
2573 return false;
2574 }
2575
2576 for (GLuint i = 0; i < numTextures; ++i)
2577 {
2578 if (!context->getTexture(textures[i]))
2579 {
2580 context->validationError(entryPoint, GL_INVALID_OPERATION, kInvalidTextureName);
2581 return false;
2582 }
2583 if (!IsValidImageLayout(FromGLenum<ImageLayout>(layouts[i])))
2584 {
2585 context->validationError(entryPoint, GL_INVALID_ENUM, kInvalidImageLayout);
2586 return false;
2587 }
2588 }
2589
2590 return true;
2591 }
2592
ValidateReleaseTexturesANGLE(const Context * context,angle::EntryPoint entryPoint,GLuint numTextures,const TextureID * textures,const GLenum * layouts)2593 bool ValidateReleaseTexturesANGLE(const Context *context,
2594 angle::EntryPoint entryPoint,
2595 GLuint numTextures,
2596 const TextureID *textures,
2597 const GLenum *layouts)
2598 {
2599 if (!context->getExtensions().vulkanImageANGLE)
2600 {
2601 context->validationError(entryPoint, GL_INVALID_OPERATION, kExtensionNotEnabled);
2602 return false;
2603 }
2604 for (GLuint i = 0; i < numTextures; ++i)
2605 {
2606 if (!context->getTexture(textures[i]))
2607 {
2608 context->validationError(entryPoint, GL_INVALID_OPERATION, kInvalidTextureName);
2609 return false;
2610 }
2611 }
2612
2613 return true;
2614 }
2615
2616 } // namespace gl
2617