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