• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2018 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 // validationES1.cpp: Validation functions for OpenGL ES 1.0 entry point parameters
8 
9 #include "libANGLE/validationES1_autogen.h"
10 
11 #include "common/debug.h"
12 #include "libANGLE/Context.h"
13 #include "libANGLE/ErrorStrings.h"
14 #include "libANGLE/GLES1State.h"
15 #include "libANGLE/queryconversions.h"
16 #include "libANGLE/queryutils.h"
17 #include "libANGLE/validationES.h"
18 
19 #define ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint)                                \
20     do                                                                                    \
21     {                                                                                     \
22         if (state.getClientType() != EGL_OPENGL_API && state.getClientMajorVersion() > 1) \
23         {                                                                                 \
24             errors->validationError(entryPoint, GL_INVALID_OPERATION, kGLES1Only);        \
25             return false;                                                                 \
26         }                                                                                 \
27     } while (0)
28 
29 #define ANGLE_VALIDATE_IS_GLES1_CONTEXT(context, entryPoint) \
30     ANGLE_VALIDATE_IS_GLES1(context->getPrivateState(),      \
31                             context->getMutableErrorSetForValidation(), entryPoint)
32 
33 namespace gl
34 {
35 using namespace err;
36 
ValidateAlphaFuncCommon(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,AlphaTestFunc func)37 bool ValidateAlphaFuncCommon(const PrivateState &state,
38                              ErrorSet *errors,
39                              angle::EntryPoint entryPoint,
40                              AlphaTestFunc func)
41 {
42     switch (func)
43     {
44         case AlphaTestFunc::AlwaysPass:
45         case AlphaTestFunc::Equal:
46         case AlphaTestFunc::Gequal:
47         case AlphaTestFunc::Greater:
48         case AlphaTestFunc::Lequal:
49         case AlphaTestFunc::Less:
50         case AlphaTestFunc::Never:
51         case AlphaTestFunc::NotEqual:
52             return true;
53         default:
54             errors->validationError(entryPoint, GL_INVALID_ENUM, kEnumInvalid);
55             return false;
56     }
57 }
58 
ValidateClientStateCommon(const Context * context,angle::EntryPoint entryPoint,ClientVertexArrayType arrayType)59 bool ValidateClientStateCommon(const Context *context,
60                                angle::EntryPoint entryPoint,
61                                ClientVertexArrayType arrayType)
62 {
63     ANGLE_VALIDATE_IS_GLES1_CONTEXT(context, entryPoint);
64     switch (arrayType)
65     {
66         case ClientVertexArrayType::Vertex:
67         case ClientVertexArrayType::Normal:
68         case ClientVertexArrayType::Color:
69         case ClientVertexArrayType::TextureCoord:
70             return true;
71         case ClientVertexArrayType::PointSize:
72             if (!context->getExtensions().pointSizeArrayOES)
73             {
74                 ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kPointSizeArrayExtensionNotEnabled);
75                 return false;
76             }
77             return true;
78         default:
79             ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidClientState);
80             return false;
81     }
82 }
83 
ValidateBuiltinVertexAttributeCommon(const Context * context,angle::EntryPoint entryPoint,ClientVertexArrayType arrayType,GLint size,VertexAttribType type,GLsizei stride,const void * pointer)84 bool ValidateBuiltinVertexAttributeCommon(const Context *context,
85                                           angle::EntryPoint entryPoint,
86                                           ClientVertexArrayType arrayType,
87                                           GLint size,
88                                           VertexAttribType type,
89                                           GLsizei stride,
90                                           const void *pointer)
91 {
92     ANGLE_VALIDATE_IS_GLES1_CONTEXT(context, entryPoint);
93 
94     if (stride < 0)
95     {
96         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidVertexPointerStride);
97         return false;
98     }
99 
100     int minSize = 1;
101     int maxSize = 4;
102 
103     switch (arrayType)
104     {
105         case ClientVertexArrayType::Vertex:
106         case ClientVertexArrayType::TextureCoord:
107             minSize = 2;
108             maxSize = 4;
109             break;
110         case ClientVertexArrayType::Normal:
111             minSize = 3;
112             maxSize = 3;
113             break;
114         case ClientVertexArrayType::Color:
115             minSize = 4;
116             maxSize = 4;
117             break;
118         case ClientVertexArrayType::PointSize:
119             if (!context->getExtensions().pointSizeArrayOES)
120             {
121                 ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kPointSizeArrayExtensionNotEnabled);
122                 return false;
123             }
124 
125             minSize = 1;
126             maxSize = 1;
127             break;
128         default:
129             UNREACHABLE();
130             return false;
131     }
132 
133     if (size < minSize || size > maxSize)
134     {
135         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidVertexPointerSize);
136         return false;
137     }
138 
139     switch (type)
140     {
141         case VertexAttribType::Byte:
142             if (arrayType == ClientVertexArrayType::PointSize)
143             {
144                 ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidVertexPointerType);
145                 return false;
146             }
147             break;
148         case VertexAttribType::Short:
149             if (arrayType == ClientVertexArrayType::PointSize ||
150                 arrayType == ClientVertexArrayType::Color)
151             {
152                 ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidVertexPointerType);
153                 return false;
154             }
155             break;
156         case VertexAttribType::Fixed:
157         case VertexAttribType::Float:
158             break;
159         case VertexAttribType::UnsignedByte:
160             if (arrayType != ClientVertexArrayType::Color)
161             {
162                 ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidVertexPointerType);
163                 return false;
164             }
165             break;
166         default:
167             ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidVertexPointerType);
168             return false;
169     }
170 
171     return true;
172 }
173 
ValidateLightCaps(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum light)174 bool ValidateLightCaps(const PrivateState &state,
175                        ErrorSet *errors,
176                        angle::EntryPoint entryPoint,
177                        GLenum light)
178 {
179     if (light < GL_LIGHT0 || light >= GL_LIGHT0 + state.getCaps().maxLights)
180     {
181         errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidLight);
182         return false;
183     }
184 
185     return true;
186 }
187 
ValidateLightCommon(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum light,LightParameter pname,const GLfloat * params)188 bool ValidateLightCommon(const PrivateState &state,
189                          ErrorSet *errors,
190                          angle::EntryPoint entryPoint,
191                          GLenum light,
192                          LightParameter pname,
193                          const GLfloat *params)
194 {
195 
196     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
197 
198     if (!ValidateLightCaps(state, errors, entryPoint, light))
199     {
200         return false;
201     }
202 
203     switch (pname)
204     {
205         case LightParameter::Ambient:
206         case LightParameter::Diffuse:
207         case LightParameter::Specular:
208         case LightParameter::Position:
209         case LightParameter::SpotDirection:
210             return true;
211         case LightParameter::SpotExponent:
212             if (params[0] < 0.0f || params[0] > 128.0f)
213             {
214                 errors->validationError(entryPoint, GL_INVALID_VALUE, kLightParameterOutOfRange);
215                 return false;
216             }
217             return true;
218         case LightParameter::SpotCutoff:
219             if (params[0] == 180.0f)
220             {
221                 return true;
222             }
223             if (params[0] < 0.0f || params[0] > 90.0f)
224             {
225                 errors->validationError(entryPoint, GL_INVALID_VALUE, kLightParameterOutOfRange);
226                 return false;
227             }
228             return true;
229         case LightParameter::ConstantAttenuation:
230         case LightParameter::LinearAttenuation:
231         case LightParameter::QuadraticAttenuation:
232             if (params[0] < 0.0f)
233             {
234                 errors->validationError(entryPoint, GL_INVALID_VALUE, kLightParameterOutOfRange);
235                 return false;
236             }
237             return true;
238         default:
239             errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidLightParameter);
240             return false;
241     }
242 }
243 
ValidateLightSingleComponent(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum light,LightParameter pname,GLfloat param)244 bool ValidateLightSingleComponent(const PrivateState &state,
245                                   ErrorSet *errors,
246                                   angle::EntryPoint entryPoint,
247                                   GLenum light,
248                                   LightParameter pname,
249                                   GLfloat param)
250 {
251     if (!ValidateLightCommon(state, errors, entryPoint, light, pname, &param))
252     {
253         return false;
254     }
255 
256     if (GetLightParameterCount(pname) > 1)
257     {
258         errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidLightParameter);
259         return false;
260     }
261 
262     return true;
263 }
264 
ValidateMaterialCommon(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum face,MaterialParameter pname,const GLfloat * params)265 bool ValidateMaterialCommon(const PrivateState &state,
266                             ErrorSet *errors,
267                             angle::EntryPoint entryPoint,
268                             GLenum face,
269                             MaterialParameter pname,
270                             const GLfloat *params)
271 {
272     switch (pname)
273     {
274         case MaterialParameter::Ambient:
275         case MaterialParameter::AmbientAndDiffuse:
276         case MaterialParameter::Diffuse:
277         case MaterialParameter::Specular:
278         case MaterialParameter::Emission:
279             return true;
280         case MaterialParameter::Shininess:
281             if (params[0] < 0.0f || params[0] > 128.0f)
282             {
283                 errors->validationError(entryPoint, GL_INVALID_VALUE, kMaterialParameterOutOfRange);
284                 return false;
285             }
286             return true;
287         default:
288             errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidMaterialParameter);
289             return false;
290     }
291 }
292 
ValidateMaterialSetting(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum face,MaterialParameter pname,const GLfloat * params)293 bool ValidateMaterialSetting(const PrivateState &state,
294                              ErrorSet *errors,
295                              angle::EntryPoint entryPoint,
296                              GLenum face,
297                              MaterialParameter pname,
298                              const GLfloat *params)
299 {
300     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
301 
302     if (face != GL_FRONT_AND_BACK)
303     {
304         errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidMaterialFace);
305         return false;
306     }
307 
308     return ValidateMaterialCommon(state, errors, entryPoint, face, pname, params);
309 }
310 
ValidateMaterialQuery(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum face,MaterialParameter pname)311 bool ValidateMaterialQuery(const PrivateState &state,
312                            ErrorSet *errors,
313                            angle::EntryPoint entryPoint,
314                            GLenum face,
315                            MaterialParameter pname)
316 {
317     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
318 
319     if (face != GL_FRONT && face != GL_BACK)
320     {
321         errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidMaterialFace);
322         return false;
323     }
324 
325     GLfloat validateParams[4] = {0.0f, 0.0f, 0.0f, 0.0f};
326 
327     return ValidateMaterialCommon(state, errors, entryPoint, face, pname, validateParams);
328 }
329 
ValidateMaterialSingleComponent(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum face,MaterialParameter pname,GLfloat param)330 bool ValidateMaterialSingleComponent(const PrivateState &state,
331                                      ErrorSet *errors,
332                                      angle::EntryPoint entryPoint,
333                                      GLenum face,
334                                      MaterialParameter pname,
335                                      GLfloat param)
336 {
337     if (!ValidateMaterialSetting(state, errors, entryPoint, face, pname, &param))
338     {
339         return false;
340     }
341 
342     if (GetMaterialParameterCount(pname) > 1)
343     {
344         errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidMaterialParameter);
345         return false;
346     }
347 
348     return true;
349 }
350 
ValidateLightModelCommon(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum pname)351 bool ValidateLightModelCommon(const PrivateState &state,
352                               ErrorSet *errors,
353                               angle::EntryPoint entryPoint,
354                               GLenum pname)
355 {
356     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
357     switch (pname)
358     {
359         case GL_LIGHT_MODEL_AMBIENT:
360         case GL_LIGHT_MODEL_TWO_SIDE:
361             return true;
362         default:
363             errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidLightModelParameter);
364             return false;
365     }
366 }
367 
ValidateLightModelSingleComponent(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum pname)368 bool ValidateLightModelSingleComponent(const PrivateState &state,
369                                        ErrorSet *errors,
370                                        angle::EntryPoint entryPoint,
371                                        GLenum pname)
372 {
373     if (!ValidateLightModelCommon(state, errors, entryPoint, pname))
374     {
375         return false;
376     }
377 
378     switch (pname)
379     {
380         case GL_LIGHT_MODEL_TWO_SIDE:
381             return true;
382         default:
383             errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidLightModelParameter);
384             return false;
385     }
386 }
387 
ValidateClipPlaneCommon(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum plane)388 bool ValidateClipPlaneCommon(const PrivateState &state,
389                              ErrorSet *errors,
390                              angle::EntryPoint entryPoint,
391                              GLenum plane)
392 {
393     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
394 
395     if (plane < GL_CLIP_PLANE0 || plane >= GL_CLIP_PLANE0 + state.getCaps().maxClipPlanes)
396     {
397         errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidClipPlane);
398         return false;
399     }
400 
401     return true;
402 }
403 
ValidateFogCommon(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum pname,const GLfloat * params)404 bool ValidateFogCommon(const PrivateState &state,
405                        ErrorSet *errors,
406                        angle::EntryPoint entryPoint,
407                        GLenum pname,
408                        const GLfloat *params)
409 {
410     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
411 
412     switch (pname)
413     {
414         case GL_FOG_MODE:
415         {
416             GLenum modeParam = static_cast<GLenum>(params[0]);
417             switch (modeParam)
418             {
419                 case GL_EXP:
420                 case GL_EXP2:
421                 case GL_LINEAR:
422                     return true;
423                 default:
424                     errors->validationError(entryPoint, GL_INVALID_VALUE, kInvalidFogMode);
425                     return false;
426             }
427         }
428         case GL_FOG_START:
429         case GL_FOG_END:
430         case GL_FOG_COLOR:
431             break;
432         case GL_FOG_DENSITY:
433             if (params[0] < 0.0f)
434             {
435                 errors->validationError(entryPoint, GL_INVALID_VALUE, kInvalidFogDensity);
436                 return false;
437             }
438             break;
439         default:
440             errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidFogParameter);
441             return false;
442     }
443     return true;
444 }
445 
ValidateTexEnvCommon(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,TextureEnvTarget target,TextureEnvParameter pname,const GLfloat * params)446 bool ValidateTexEnvCommon(const PrivateState &state,
447                           ErrorSet *errors,
448                           angle::EntryPoint entryPoint,
449                           TextureEnvTarget target,
450                           TextureEnvParameter pname,
451                           const GLfloat *params)
452 {
453     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
454 
455     switch (target)
456     {
457         case TextureEnvTarget::Env:
458             switch (pname)
459             {
460                 case TextureEnvParameter::Mode:
461                 {
462                     TextureEnvMode mode = FromGLenum<TextureEnvMode>(ConvertToGLenum(params[0]));
463                     switch (mode)
464                     {
465                         case TextureEnvMode::Add:
466                         case TextureEnvMode::Blend:
467                         case TextureEnvMode::Combine:
468                         case TextureEnvMode::Decal:
469                         case TextureEnvMode::Modulate:
470                         case TextureEnvMode::Replace:
471                             break;
472                         default:
473                             errors->validationError(entryPoint, GL_INVALID_VALUE,
474                                                     kInvalidTextureEnvMode);
475                             return false;
476                     }
477                     break;
478                 }
479                 case TextureEnvParameter::CombineRgb:
480                 case TextureEnvParameter::CombineAlpha:
481                 {
482                     TextureCombine combine = FromGLenum<TextureCombine>(ConvertToGLenum(params[0]));
483                     switch (combine)
484                     {
485                         case TextureCombine::Add:
486                         case TextureCombine::AddSigned:
487                         case TextureCombine::Interpolate:
488                         case TextureCombine::Modulate:
489                         case TextureCombine::Replace:
490                         case TextureCombine::Subtract:
491                             break;
492                         case TextureCombine::Dot3Rgb:
493                         case TextureCombine::Dot3Rgba:
494                             if (pname == TextureEnvParameter::CombineAlpha)
495                             {
496                                 errors->validationError(entryPoint, GL_INVALID_VALUE,
497                                                         kInvalidTextureCombine);
498                                 return false;
499                             }
500                             break;
501                         default:
502                             errors->validationError(entryPoint, GL_INVALID_VALUE,
503                                                     kInvalidTextureCombine);
504                             return false;
505                     }
506                     break;
507                 }
508                 case TextureEnvParameter::Src0Rgb:
509                 case TextureEnvParameter::Src1Rgb:
510                 case TextureEnvParameter::Src2Rgb:
511                 case TextureEnvParameter::Src0Alpha:
512                 case TextureEnvParameter::Src1Alpha:
513                 case TextureEnvParameter::Src2Alpha:
514                 {
515                     TextureSrc combine = FromGLenum<TextureSrc>(ConvertToGLenum(params[0]));
516                     switch (combine)
517                     {
518                         case TextureSrc::Constant:
519                         case TextureSrc::Previous:
520                         case TextureSrc::PrimaryColor:
521                         case TextureSrc::Texture:
522                             break;
523                         default:
524                             errors->validationError(entryPoint, GL_INVALID_VALUE,
525                                                     kInvalidTextureCombineSrc);
526                             return false;
527                     }
528                     break;
529                 }
530                 case TextureEnvParameter::Op0Rgb:
531                 case TextureEnvParameter::Op1Rgb:
532                 case TextureEnvParameter::Op2Rgb:
533                 case TextureEnvParameter::Op0Alpha:
534                 case TextureEnvParameter::Op1Alpha:
535                 case TextureEnvParameter::Op2Alpha:
536                 {
537                     TextureOp operand = FromGLenum<TextureOp>(ConvertToGLenum(params[0]));
538                     switch (operand)
539                     {
540                         case TextureOp::SrcAlpha:
541                         case TextureOp::OneMinusSrcAlpha:
542                             break;
543                         case TextureOp::SrcColor:
544                         case TextureOp::OneMinusSrcColor:
545                             if (pname == TextureEnvParameter::Op0Alpha ||
546                                 pname == TextureEnvParameter::Op1Alpha ||
547                                 pname == TextureEnvParameter::Op2Alpha)
548                             {
549                                 errors->validationError(entryPoint, GL_INVALID_VALUE,
550                                                         kInvalidTextureCombine);
551                                 return false;
552                             }
553                             break;
554                         default:
555                             errors->validationError(entryPoint, GL_INVALID_VALUE,
556                                                     kInvalidTextureCombineOp);
557                             return false;
558                     }
559                     break;
560                 }
561                 case TextureEnvParameter::RgbScale:
562                 case TextureEnvParameter::AlphaScale:
563                     if (params[0] != 1.0f && params[0] != 2.0f && params[0] != 4.0f)
564                     {
565                         errors->validationError(entryPoint, GL_INVALID_VALUE,
566                                                 kInvalidTextureEnvScale);
567                         return false;
568                     }
569                     break;
570                 case TextureEnvParameter::Color:
571                     break;
572                 default:
573                     errors->validationError(entryPoint, GL_INVALID_ENUM,
574                                             kInvalidTextureEnvParameter);
575                     return false;
576             }
577             break;
578         case TextureEnvTarget::PointSprite:
579             if (!state.getExtensions().pointSpriteOES)
580             {
581                 errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidTextureEnvTarget);
582                 return false;
583             }
584             switch (pname)
585             {
586                 case TextureEnvParameter::PointCoordReplace:
587                     break;
588                 default:
589                     errors->validationError(entryPoint, GL_INVALID_ENUM,
590                                             kInvalidTextureEnvParameter);
591                     return false;
592             }
593             break;
594         default:
595             errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidTextureEnvTarget);
596             return false;
597     }
598     return true;
599 }
600 
ValidateGetTexEnvCommon(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,TextureEnvTarget target,TextureEnvParameter pname)601 bool ValidateGetTexEnvCommon(const PrivateState &state,
602                              ErrorSet *errors,
603                              angle::EntryPoint entryPoint,
604                              TextureEnvTarget target,
605                              TextureEnvParameter pname)
606 {
607     GLfloat validateParams[4] = {};
608     switch (pname)
609     {
610         case TextureEnvParameter::Mode:
611             ConvertPackedEnum(TextureEnvMode::Add, validateParams);
612             break;
613         case TextureEnvParameter::CombineRgb:
614         case TextureEnvParameter::CombineAlpha:
615             ConvertPackedEnum(TextureCombine::Add, validateParams);
616             break;
617         case TextureEnvParameter::Src0Rgb:
618         case TextureEnvParameter::Src1Rgb:
619         case TextureEnvParameter::Src2Rgb:
620         case TextureEnvParameter::Src0Alpha:
621         case TextureEnvParameter::Src1Alpha:
622         case TextureEnvParameter::Src2Alpha:
623             ConvertPackedEnum(TextureSrc::Constant, validateParams);
624             break;
625         case TextureEnvParameter::Op0Rgb:
626         case TextureEnvParameter::Op1Rgb:
627         case TextureEnvParameter::Op2Rgb:
628         case TextureEnvParameter::Op0Alpha:
629         case TextureEnvParameter::Op1Alpha:
630         case TextureEnvParameter::Op2Alpha:
631             ConvertPackedEnum(TextureOp::SrcAlpha, validateParams);
632             break;
633         case TextureEnvParameter::RgbScale:
634         case TextureEnvParameter::AlphaScale:
635         case TextureEnvParameter::PointCoordReplace:
636             validateParams[0] = 1.0f;
637             break;
638         default:
639             break;
640     }
641 
642     return ValidateTexEnvCommon(state, errors, entryPoint, target, pname, validateParams);
643 }
644 
ValidatePointParameterCommon(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,PointParameter pname,const GLfloat * params)645 bool ValidatePointParameterCommon(const PrivateState &state,
646                                   ErrorSet *errors,
647                                   angle::EntryPoint entryPoint,
648                                   PointParameter pname,
649                                   const GLfloat *params)
650 {
651     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
652 
653     switch (pname)
654     {
655         case PointParameter::PointSizeMin:
656         case PointParameter::PointSizeMax:
657         case PointParameter::PointFadeThresholdSize:
658         case PointParameter::PointDistanceAttenuation:
659             for (unsigned int i = 0; i < GetPointParameterCount(pname); i++)
660             {
661                 if (params[i] < 0.0f)
662                 {
663                     errors->validationError(entryPoint, GL_INVALID_VALUE,
664                                             kInvalidPointParameterValue);
665                     return false;
666                 }
667             }
668             break;
669         default:
670             errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidPointParameter);
671             return false;
672     }
673 
674     return true;
675 }
676 
ValidatePointSizeCommon(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfloat size)677 bool ValidatePointSizeCommon(const PrivateState &state,
678                              ErrorSet *errors,
679                              angle::EntryPoint entryPoint,
680                              GLfloat size)
681 {
682     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
683 
684     if (size <= 0.0f)
685     {
686         errors->validationError(entryPoint, GL_INVALID_VALUE, kInvalidPointSizeValue);
687         return false;
688     }
689 
690     return true;
691 }
692 
ValidateDrawTexCommon(const Context * context,angle::EntryPoint entryPoint,float width,float height)693 bool ValidateDrawTexCommon(const Context *context,
694                            angle::EntryPoint entryPoint,
695                            float width,
696                            float height)
697 {
698     ANGLE_VALIDATE_IS_GLES1_CONTEXT(context, entryPoint);
699 
700     if (width <= 0.0f || height <= 0.0f)
701     {
702         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kNonPositiveDrawTextureDimension);
703         return false;
704     }
705 
706     return true;
707 }
708 
709 }  // namespace gl
710 
711 namespace gl
712 {
713 
ValidateAlphaFunc(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,AlphaTestFunc func,GLfloat ref)714 bool ValidateAlphaFunc(const PrivateState &state,
715                        ErrorSet *errors,
716                        angle::EntryPoint entryPoint,
717                        AlphaTestFunc func,
718                        GLfloat ref)
719 {
720     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
721     return ValidateAlphaFuncCommon(state, errors, entryPoint, func);
722 }
723 
ValidateAlphaFuncx(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,AlphaTestFunc func,GLfixed ref)724 bool ValidateAlphaFuncx(const PrivateState &state,
725                         ErrorSet *errors,
726                         angle::EntryPoint entryPoint,
727                         AlphaTestFunc func,
728                         GLfixed ref)
729 {
730     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
731     return ValidateAlphaFuncCommon(state, errors, entryPoint, func);
732 }
733 
ValidateClearColorx(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfixed red,GLfixed green,GLfixed blue,GLfixed alpha)734 bool ValidateClearColorx(const PrivateState &state,
735                          ErrorSet *errors,
736                          angle::EntryPoint entryPoint,
737                          GLfixed red,
738                          GLfixed green,
739                          GLfixed blue,
740                          GLfixed alpha)
741 {
742     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
743     return true;
744 }
745 
ValidateClearDepthx(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfixed depth)746 bool ValidateClearDepthx(const PrivateState &state,
747                          ErrorSet *errors,
748                          angle::EntryPoint entryPoint,
749                          GLfixed depth)
750 {
751     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
752     return true;
753 }
754 
ValidateClientActiveTexture(const Context * context,angle::EntryPoint entryPoint,GLenum texture)755 bool ValidateClientActiveTexture(const Context *context,
756                                  angle::EntryPoint entryPoint,
757                                  GLenum texture)
758 {
759     ANGLE_VALIDATE_IS_GLES1_CONTEXT(context, entryPoint);
760     return ValidateMultitextureUnit(context->getPrivateState(),
761                                     context->getMutableErrorSetForValidation(), entryPoint,
762                                     texture);
763 }
764 
ValidateClipPlanef(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum plane,const GLfloat * eqn)765 bool ValidateClipPlanef(const PrivateState &state,
766                         ErrorSet *errors,
767                         angle::EntryPoint entryPoint,
768                         GLenum plane,
769                         const GLfloat *eqn)
770 {
771     return ValidateClipPlaneCommon(state, errors, entryPoint, plane);
772 }
773 
ValidateClipPlanex(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum plane,const GLfixed * equation)774 bool ValidateClipPlanex(const PrivateState &state,
775                         ErrorSet *errors,
776                         angle::EntryPoint entryPoint,
777                         GLenum plane,
778                         const GLfixed *equation)
779 {
780     return ValidateClipPlaneCommon(state, errors, entryPoint, plane);
781 }
782 
ValidateColor4f(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfloat red,GLfloat green,GLfloat blue,GLfloat alpha)783 bool ValidateColor4f(const PrivateState &state,
784                      ErrorSet *errors,
785                      angle::EntryPoint entryPoint,
786                      GLfloat red,
787                      GLfloat green,
788                      GLfloat blue,
789                      GLfloat alpha)
790 {
791     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
792     return true;
793 }
794 
ValidateColor4ub(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLubyte red,GLubyte green,GLubyte blue,GLubyte alpha)795 bool ValidateColor4ub(const PrivateState &state,
796                       ErrorSet *errors,
797                       angle::EntryPoint entryPoint,
798                       GLubyte red,
799                       GLubyte green,
800                       GLubyte blue,
801                       GLubyte alpha)
802 {
803     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
804     return true;
805 }
806 
ValidateColor4x(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfixed red,GLfixed green,GLfixed blue,GLfixed alpha)807 bool ValidateColor4x(const PrivateState &state,
808                      ErrorSet *errors,
809                      angle::EntryPoint entryPoint,
810                      GLfixed red,
811                      GLfixed green,
812                      GLfixed blue,
813                      GLfixed alpha)
814 {
815     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
816     return true;
817 }
818 
ValidateColorPointer(const Context * context,angle::EntryPoint entryPoint,GLint size,VertexAttribType type,GLsizei stride,const void * pointer)819 bool ValidateColorPointer(const Context *context,
820                           angle::EntryPoint entryPoint,
821                           GLint size,
822                           VertexAttribType type,
823                           GLsizei stride,
824                           const void *pointer)
825 {
826     return ValidateBuiltinVertexAttributeCommon(context, entryPoint, ClientVertexArrayType::Color,
827                                                 size, type, stride, pointer);
828 }
829 
ValidateCullFace(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum mode)830 bool ValidateCullFace(const PrivateState &state,
831                       ErrorSet *errors,
832                       angle::EntryPoint entryPoint,
833                       GLenum mode)
834 {
835     UNIMPLEMENTED();
836     return true;
837 }
838 
ValidateDepthRangex(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfixed n,GLfixed f)839 bool ValidateDepthRangex(const PrivateState &state,
840                          ErrorSet *errors,
841                          angle::EntryPoint entryPoint,
842                          GLfixed n,
843                          GLfixed f)
844 {
845     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
846     if (state.isWebGL() && n > f)
847     {
848         errors->validationError(entryPoint, GL_INVALID_OPERATION, kInvalidDepthRange);
849         return false;
850     }
851 
852     return true;
853 }
854 
ValidateDisableClientState(const Context * context,angle::EntryPoint entryPoint,ClientVertexArrayType arrayType)855 bool ValidateDisableClientState(const Context *context,
856                                 angle::EntryPoint entryPoint,
857                                 ClientVertexArrayType arrayType)
858 {
859     return ValidateClientStateCommon(context, entryPoint, arrayType);
860 }
861 
ValidateEnableClientState(const Context * context,angle::EntryPoint entryPoint,ClientVertexArrayType arrayType)862 bool ValidateEnableClientState(const Context *context,
863                                angle::EntryPoint entryPoint,
864                                ClientVertexArrayType arrayType)
865 {
866     return ValidateClientStateCommon(context, entryPoint, arrayType);
867 }
868 
ValidateFogf(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum pname,GLfloat param)869 bool ValidateFogf(const PrivateState &state,
870                   ErrorSet *errors,
871                   angle::EntryPoint entryPoint,
872                   GLenum pname,
873                   GLfloat param)
874 {
875     return ValidateFogCommon(state, errors, entryPoint, pname, &param);
876 }
877 
ValidateFogfv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum pname,const GLfloat * params)878 bool ValidateFogfv(const PrivateState &state,
879                    ErrorSet *errors,
880                    angle::EntryPoint entryPoint,
881                    GLenum pname,
882                    const GLfloat *params)
883 {
884     return ValidateFogCommon(state, errors, entryPoint, pname, params);
885 }
886 
ValidateFogx(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum pname,GLfixed param)887 bool ValidateFogx(const PrivateState &state,
888                   ErrorSet *errors,
889                   angle::EntryPoint entryPoint,
890                   GLenum pname,
891                   GLfixed param)
892 {
893     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
894     GLfloat asFloat =
895         pname == GL_FOG_MODE ? static_cast<GLfloat>(param) : ConvertFixedToFloat(param);
896     return ValidateFogCommon(state, errors, entryPoint, pname, &asFloat);
897 }
898 
ValidateFogxv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum pname,const GLfixed * params)899 bool ValidateFogxv(const PrivateState &state,
900                    ErrorSet *errors,
901                    angle::EntryPoint entryPoint,
902                    GLenum pname,
903                    const GLfixed *params)
904 {
905     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
906     unsigned int paramCount = GetFogParameterCount(pname);
907     GLfloat paramsf[4]      = {};
908 
909     if (pname == GL_FOG_MODE)
910     {
911         paramsf[0] = static_cast<GLfloat>(params[0]);
912     }
913     else
914     {
915         for (unsigned int i = 0; i < paramCount; i++)
916         {
917             paramsf[i] = ConvertFixedToFloat(params[i]);
918         }
919     }
920 
921     return ValidateFogCommon(state, errors, entryPoint, pname, paramsf);
922 }
923 
ValidateFrustumf(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfloat l,GLfloat r,GLfloat b,GLfloat t,GLfloat n,GLfloat f)924 bool ValidateFrustumf(const PrivateState &state,
925                       ErrorSet *errors,
926                       angle::EntryPoint entryPoint,
927                       GLfloat l,
928                       GLfloat r,
929                       GLfloat b,
930                       GLfloat t,
931                       GLfloat n,
932                       GLfloat f)
933 {
934     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
935     if (l == r || b == t || n == f || n <= 0.0f || f <= 0.0f)
936     {
937         errors->validationError(entryPoint, GL_INVALID_VALUE, kInvalidProjectionMatrix);
938         return false;
939     }
940     return true;
941 }
942 
ValidateFrustumx(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfixed l,GLfixed r,GLfixed b,GLfixed t,GLfixed n,GLfixed f)943 bool ValidateFrustumx(const PrivateState &state,
944                       ErrorSet *errors,
945                       angle::EntryPoint entryPoint,
946                       GLfixed l,
947                       GLfixed r,
948                       GLfixed b,
949                       GLfixed t,
950                       GLfixed n,
951                       GLfixed f)
952 {
953     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
954     if (l == r || b == t || n == f || n <= 0 || f <= 0)
955     {
956         errors->validationError(entryPoint, GL_INVALID_VALUE, kInvalidProjectionMatrix);
957         return false;
958     }
959     return true;
960 }
961 
ValidateGetBufferParameteriv(const Context * context,angle::EntryPoint entryPoint,GLenum target,GLenum pname,const GLint * params)962 bool ValidateGetBufferParameteriv(const Context *context,
963                                   angle::EntryPoint entryPoint,
964                                   GLenum target,
965                                   GLenum pname,
966                                   const GLint *params)
967 {
968     UNIMPLEMENTED();
969     return true;
970 }
971 
ValidateGetClipPlanef(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum plane,const GLfloat * equation)972 bool ValidateGetClipPlanef(const PrivateState &state,
973                            ErrorSet *errors,
974                            angle::EntryPoint entryPoint,
975                            GLenum plane,
976                            const GLfloat *equation)
977 {
978     return ValidateClipPlaneCommon(state, errors, entryPoint, plane);
979 }
980 
ValidateGetClipPlanex(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum plane,const GLfixed * equation)981 bool ValidateGetClipPlanex(const PrivateState &state,
982                            ErrorSet *errors,
983                            angle::EntryPoint entryPoint,
984                            GLenum plane,
985                            const GLfixed *equation)
986 {
987     return ValidateClipPlaneCommon(state, errors, entryPoint, plane);
988 }
989 
ValidateGetFixedv(const Context * context,angle::EntryPoint entryPoint,GLenum pname,const GLfixed * params)990 bool ValidateGetFixedv(const Context *context,
991                        angle::EntryPoint entryPoint,
992                        GLenum pname,
993                        const GLfixed *params)
994 {
995     ANGLE_VALIDATE_IS_GLES1_CONTEXT(context, entryPoint);
996     GLenum nativeType;
997     unsigned int numParams = 0;
998     return ValidateStateQuery(context, entryPoint, pname, &nativeType, &numParams);
999 }
1000 
ValidateGetLightfv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum light,LightParameter pname,const GLfloat * params)1001 bool ValidateGetLightfv(const PrivateState &state,
1002                         ErrorSet *errors,
1003                         angle::EntryPoint entryPoint,
1004                         GLenum light,
1005                         LightParameter pname,
1006                         const GLfloat *params)
1007 {
1008     GLfloat validateParams[4] = {0.0f, 0.0f, 0.0f, 0.0f};
1009     return ValidateLightCommon(state, errors, entryPoint, light, pname, validateParams);
1010 }
1011 
ValidateGetLightxv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum light,LightParameter pname,const GLfixed * params)1012 bool ValidateGetLightxv(const PrivateState &state,
1013                         ErrorSet *errors,
1014                         angle::EntryPoint entryPoint,
1015                         GLenum light,
1016                         LightParameter pname,
1017                         const GLfixed *params)
1018 {
1019     GLfloat validateParams[4] = {0.0f, 0.0f, 0.0f, 0.0f};
1020     return ValidateLightCommon(state, errors, entryPoint, light, pname, validateParams);
1021 }
1022 
ValidateGetMaterialfv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum face,MaterialParameter pname,const GLfloat * params)1023 bool ValidateGetMaterialfv(const PrivateState &state,
1024                            ErrorSet *errors,
1025                            angle::EntryPoint entryPoint,
1026                            GLenum face,
1027                            MaterialParameter pname,
1028                            const GLfloat *params)
1029 {
1030     return ValidateMaterialQuery(state, errors, entryPoint, face, pname);
1031 }
1032 
ValidateGetMaterialxv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum face,MaterialParameter pname,const GLfixed * params)1033 bool ValidateGetMaterialxv(const PrivateState &state,
1034                            ErrorSet *errors,
1035                            angle::EntryPoint entryPoint,
1036                            GLenum face,
1037                            MaterialParameter pname,
1038                            const GLfixed *params)
1039 {
1040     return ValidateMaterialQuery(state, errors, entryPoint, face, pname);
1041 }
1042 
ValidateGetTexEnvfv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,TextureEnvTarget target,TextureEnvParameter pname,const GLfloat * params)1043 bool ValidateGetTexEnvfv(const PrivateState &state,
1044                          ErrorSet *errors,
1045                          angle::EntryPoint entryPoint,
1046                          TextureEnvTarget target,
1047                          TextureEnvParameter pname,
1048                          const GLfloat *params)
1049 {
1050     return ValidateGetTexEnvCommon(state, errors, entryPoint, target, pname);
1051 }
1052 
ValidateGetTexEnviv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,TextureEnvTarget target,TextureEnvParameter pname,const GLint * params)1053 bool ValidateGetTexEnviv(const PrivateState &state,
1054                          ErrorSet *errors,
1055                          angle::EntryPoint entryPoint,
1056                          TextureEnvTarget target,
1057                          TextureEnvParameter pname,
1058                          const GLint *params)
1059 {
1060     return ValidateGetTexEnvCommon(state, errors, entryPoint, target, pname);
1061 }
1062 
ValidateGetTexEnvxv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,TextureEnvTarget target,TextureEnvParameter pname,const GLfixed * params)1063 bool ValidateGetTexEnvxv(const PrivateState &state,
1064                          ErrorSet *errors,
1065                          angle::EntryPoint entryPoint,
1066                          TextureEnvTarget target,
1067                          TextureEnvParameter pname,
1068                          const GLfixed *params)
1069 {
1070     return ValidateGetTexEnvCommon(state, errors, entryPoint, target, pname);
1071 }
1072 
ValidateGetTexParameterxv(const Context * context,angle::EntryPoint entryPoint,TextureType target,GLenum pname,const GLfixed * params)1073 bool ValidateGetTexParameterxv(const Context *context,
1074                                angle::EntryPoint entryPoint,
1075                                TextureType target,
1076                                GLenum pname,
1077                                const GLfixed *params)
1078 {
1079     ANGLE_VALIDATE_IS_GLES1_CONTEXT(context, entryPoint);
1080 
1081     if (!ValidateGetTexParameterBase(context, entryPoint, target, pname, nullptr))
1082     {
1083         return false;
1084     }
1085 
1086     return true;
1087 }
1088 
ValidateLightModelf(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum pname,GLfloat param)1089 bool ValidateLightModelf(const PrivateState &state,
1090                          ErrorSet *errors,
1091                          angle::EntryPoint entryPoint,
1092                          GLenum pname,
1093                          GLfloat param)
1094 {
1095     return ValidateLightModelSingleComponent(state, errors, entryPoint, pname);
1096 }
1097 
ValidateLightModelfv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum pname,const GLfloat * params)1098 bool ValidateLightModelfv(const PrivateState &state,
1099                           ErrorSet *errors,
1100                           angle::EntryPoint entryPoint,
1101                           GLenum pname,
1102                           const GLfloat *params)
1103 {
1104     return ValidateLightModelCommon(state, errors, entryPoint, pname);
1105 }
1106 
ValidateLightModelx(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum pname,GLfixed param)1107 bool ValidateLightModelx(const PrivateState &state,
1108                          ErrorSet *errors,
1109                          angle::EntryPoint entryPoint,
1110                          GLenum pname,
1111                          GLfixed param)
1112 {
1113     return ValidateLightModelSingleComponent(state, errors, entryPoint, pname);
1114 }
1115 
ValidateLightModelxv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum pname,const GLfixed * param)1116 bool ValidateLightModelxv(const PrivateState &state,
1117                           ErrorSet *errors,
1118                           angle::EntryPoint entryPoint,
1119                           GLenum pname,
1120                           const GLfixed *param)
1121 {
1122     return ValidateLightModelCommon(state, errors, entryPoint, pname);
1123 }
1124 
ValidateLightf(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum light,LightParameter pname,GLfloat param)1125 bool ValidateLightf(const PrivateState &state,
1126                     ErrorSet *errors,
1127                     angle::EntryPoint entryPoint,
1128                     GLenum light,
1129                     LightParameter pname,
1130                     GLfloat param)
1131 {
1132     return ValidateLightSingleComponent(state, errors, entryPoint, light, pname, param);
1133 }
1134 
ValidateLightfv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum light,LightParameter pname,const GLfloat * params)1135 bool ValidateLightfv(const PrivateState &state,
1136                      ErrorSet *errors,
1137                      angle::EntryPoint entryPoint,
1138                      GLenum light,
1139                      LightParameter pname,
1140                      const GLfloat *params)
1141 {
1142     return ValidateLightCommon(state, errors, entryPoint, light, pname, params);
1143 }
1144 
ValidateLightx(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum light,LightParameter pname,GLfixed param)1145 bool ValidateLightx(const PrivateState &state,
1146                     ErrorSet *errors,
1147                     angle::EntryPoint entryPoint,
1148                     GLenum light,
1149                     LightParameter pname,
1150                     GLfixed param)
1151 {
1152     return ValidateLightSingleComponent(state, errors, entryPoint, light, pname,
1153                                         ConvertFixedToFloat(param));
1154 }
1155 
ValidateLightxv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum light,LightParameter pname,const GLfixed * params)1156 bool ValidateLightxv(const PrivateState &state,
1157                      ErrorSet *errors,
1158                      angle::EntryPoint entryPoint,
1159                      GLenum light,
1160                      LightParameter pname,
1161                      const GLfixed *params)
1162 {
1163     GLfloat paramsf[4];
1164     for (unsigned int i = 0; i < GetLightParameterCount(pname); i++)
1165     {
1166         paramsf[i] = ConvertFixedToFloat(params[i]);
1167     }
1168 
1169     return ValidateLightCommon(state, errors, entryPoint, light, pname, paramsf);
1170 }
1171 
ValidateLineWidthx(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfixed width)1172 bool ValidateLineWidthx(const PrivateState &state,
1173                         ErrorSet *errors,
1174                         angle::EntryPoint entryPoint,
1175                         GLfixed width)
1176 {
1177     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1178     if (width <= 0)
1179     {
1180         errors->validationError(entryPoint, GL_INVALID_VALUE, kInvalidWidth);
1181         return false;
1182     }
1183 
1184     return true;
1185 }
1186 
ValidateLoadIdentity(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint)1187 bool ValidateLoadIdentity(const PrivateState &state, ErrorSet *errors, angle::EntryPoint entryPoint)
1188 {
1189     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1190     return true;
1191 }
1192 
ValidateLoadMatrixf(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,const GLfloat * m)1193 bool ValidateLoadMatrixf(const PrivateState &state,
1194                          ErrorSet *errors,
1195                          angle::EntryPoint entryPoint,
1196                          const GLfloat *m)
1197 {
1198     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1199     return true;
1200 }
1201 
ValidateLoadMatrixx(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,const GLfixed * m)1202 bool ValidateLoadMatrixx(const PrivateState &state,
1203                          ErrorSet *errors,
1204                          angle::EntryPoint entryPoint,
1205                          const GLfixed *m)
1206 {
1207     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1208     return true;
1209 }
1210 
ValidateLogicOp(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,LogicalOperation opcode)1211 bool ValidateLogicOp(const PrivateState &state,
1212                      ErrorSet *errors,
1213                      angle::EntryPoint entryPoint,
1214                      LogicalOperation opcode)
1215 {
1216     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1217     return ValidateLogicOpCommon(state, errors, entryPoint, opcode);
1218 }
1219 
ValidateMaterialf(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum face,MaterialParameter pname,GLfloat param)1220 bool ValidateMaterialf(const PrivateState &state,
1221                        ErrorSet *errors,
1222                        angle::EntryPoint entryPoint,
1223                        GLenum face,
1224                        MaterialParameter pname,
1225                        GLfloat param)
1226 {
1227     return ValidateMaterialSingleComponent(state, errors, entryPoint, face, pname, param);
1228 }
1229 
ValidateMaterialfv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum face,MaterialParameter pname,const GLfloat * params)1230 bool ValidateMaterialfv(const PrivateState &state,
1231                         ErrorSet *errors,
1232                         angle::EntryPoint entryPoint,
1233                         GLenum face,
1234                         MaterialParameter pname,
1235                         const GLfloat *params)
1236 {
1237     return ValidateMaterialSetting(state, errors, entryPoint, face, pname, params);
1238 }
1239 
ValidateMaterialx(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum face,MaterialParameter pname,GLfixed param)1240 bool ValidateMaterialx(const PrivateState &state,
1241                        ErrorSet *errors,
1242                        angle::EntryPoint entryPoint,
1243                        GLenum face,
1244                        MaterialParameter pname,
1245                        GLfixed param)
1246 {
1247     return ValidateMaterialSingleComponent(state, errors, entryPoint, face, pname,
1248                                            ConvertFixedToFloat(param));
1249 }
1250 
ValidateMaterialxv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum face,MaterialParameter pname,const GLfixed * params)1251 bool ValidateMaterialxv(const PrivateState &state,
1252                         ErrorSet *errors,
1253                         angle::EntryPoint entryPoint,
1254                         GLenum face,
1255                         MaterialParameter pname,
1256                         const GLfixed *params)
1257 {
1258     GLfloat paramsf[4];
1259 
1260     for (unsigned int i = 0; i < GetMaterialParameterCount(pname); i++)
1261     {
1262         paramsf[i] = ConvertFixedToFloat(params[i]);
1263     }
1264 
1265     return ValidateMaterialSetting(state, errors, entryPoint, face, pname, paramsf);
1266 }
1267 
ValidateMatrixMode(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,MatrixType mode)1268 bool ValidateMatrixMode(const PrivateState &state,
1269                         ErrorSet *errors,
1270                         angle::EntryPoint entryPoint,
1271                         MatrixType mode)
1272 {
1273     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1274     switch (mode)
1275     {
1276         case MatrixType::Projection:
1277         case MatrixType::Modelview:
1278         case MatrixType::Texture:
1279             return true;
1280         default:
1281             errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidMatrixMode);
1282             return false;
1283     }
1284 }
1285 
ValidateMultMatrixf(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,const GLfloat * m)1286 bool ValidateMultMatrixf(const PrivateState &state,
1287                          ErrorSet *errors,
1288                          angle::EntryPoint entryPoint,
1289                          const GLfloat *m)
1290 {
1291     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1292     return true;
1293 }
1294 
ValidateMultMatrixx(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,const GLfixed * m)1295 bool ValidateMultMatrixx(const PrivateState &state,
1296                          ErrorSet *errors,
1297                          angle::EntryPoint entryPoint,
1298                          const GLfixed *m)
1299 {
1300     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1301     return true;
1302 }
1303 
ValidateMultiTexCoord4f(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum target,GLfloat s,GLfloat t,GLfloat r,GLfloat q)1304 bool ValidateMultiTexCoord4f(const PrivateState &state,
1305                              ErrorSet *errors,
1306                              angle::EntryPoint entryPoint,
1307                              GLenum target,
1308                              GLfloat s,
1309                              GLfloat t,
1310                              GLfloat r,
1311                              GLfloat q)
1312 {
1313     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1314     return ValidateMultitextureUnit(state, errors, entryPoint, target);
1315 }
1316 
ValidateMultiTexCoord4x(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLenum target,GLfixed s,GLfixed t,GLfixed r,GLfixed q)1317 bool ValidateMultiTexCoord4x(const PrivateState &state,
1318                              ErrorSet *errors,
1319                              angle::EntryPoint entryPoint,
1320                              GLenum target,
1321                              GLfixed s,
1322                              GLfixed t,
1323                              GLfixed r,
1324                              GLfixed q)
1325 {
1326     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1327     return ValidateMultitextureUnit(state, errors, entryPoint, target);
1328 }
1329 
ValidateNormal3f(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfloat nx,GLfloat ny,GLfloat nz)1330 bool ValidateNormal3f(const PrivateState &state,
1331                       ErrorSet *errors,
1332                       angle::EntryPoint entryPoint,
1333                       GLfloat nx,
1334                       GLfloat ny,
1335                       GLfloat nz)
1336 {
1337     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1338     return true;
1339 }
1340 
ValidateNormal3x(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfixed nx,GLfixed ny,GLfixed nz)1341 bool ValidateNormal3x(const PrivateState &state,
1342                       ErrorSet *errors,
1343                       angle::EntryPoint entryPoint,
1344                       GLfixed nx,
1345                       GLfixed ny,
1346                       GLfixed nz)
1347 {
1348     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1349     return true;
1350 }
1351 
ValidateNormalPointer(const Context * context,angle::EntryPoint entryPoint,VertexAttribType type,GLsizei stride,const void * pointer)1352 bool ValidateNormalPointer(const Context *context,
1353                            angle::EntryPoint entryPoint,
1354                            VertexAttribType type,
1355                            GLsizei stride,
1356                            const void *pointer)
1357 {
1358     return ValidateBuiltinVertexAttributeCommon(context, entryPoint, ClientVertexArrayType::Normal,
1359                                                 3, type, stride, pointer);
1360 }
1361 
ValidateOrthof(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfloat l,GLfloat r,GLfloat b,GLfloat t,GLfloat n,GLfloat f)1362 bool ValidateOrthof(const PrivateState &state,
1363                     ErrorSet *errors,
1364                     angle::EntryPoint entryPoint,
1365                     GLfloat l,
1366                     GLfloat r,
1367                     GLfloat b,
1368                     GLfloat t,
1369                     GLfloat n,
1370                     GLfloat f)
1371 {
1372     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1373     // [OpenGL ES 1.1.12] section 2.10.2 page 31:
1374     // If l is equal to r, b is equal to t, or n is equal to f, the
1375     // error INVALID VALUE results.
1376     if (l == r || b == t || n == f)
1377     {
1378         errors->validationError(entryPoint, GL_INVALID_VALUE, kInvalidProjectionMatrix);
1379         return false;
1380     }
1381     return true;
1382 }
1383 
ValidateOrthox(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfixed l,GLfixed r,GLfixed b,GLfixed t,GLfixed n,GLfixed f)1384 bool ValidateOrthox(const PrivateState &state,
1385                     ErrorSet *errors,
1386                     angle::EntryPoint entryPoint,
1387                     GLfixed l,
1388                     GLfixed r,
1389                     GLfixed b,
1390                     GLfixed t,
1391                     GLfixed n,
1392                     GLfixed f)
1393 {
1394     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1395     if (l == r || b == t || n == f)
1396     {
1397         errors->validationError(entryPoint, GL_INVALID_VALUE, kInvalidProjectionMatrix);
1398         return false;
1399     }
1400     return true;
1401 }
1402 
ValidatePointParameterf(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,PointParameter pname,GLfloat param)1403 bool ValidatePointParameterf(const PrivateState &state,
1404                              ErrorSet *errors,
1405                              angle::EntryPoint entryPoint,
1406                              PointParameter pname,
1407                              GLfloat param)
1408 {
1409     unsigned int paramCount = GetPointParameterCount(pname);
1410     if (paramCount != 1)
1411     {
1412         errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidPointParameter);
1413         return false;
1414     }
1415 
1416     return ValidatePointParameterCommon(state, errors, entryPoint, pname, &param);
1417 }
1418 
ValidatePointParameterfv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,PointParameter pname,const GLfloat * params)1419 bool ValidatePointParameterfv(const PrivateState &state,
1420                               ErrorSet *errors,
1421                               angle::EntryPoint entryPoint,
1422                               PointParameter pname,
1423                               const GLfloat *params)
1424 {
1425     return ValidatePointParameterCommon(state, errors, entryPoint, pname, params);
1426 }
1427 
ValidatePointParameterx(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,PointParameter pname,GLfixed param)1428 bool ValidatePointParameterx(const PrivateState &state,
1429                              ErrorSet *errors,
1430                              angle::EntryPoint entryPoint,
1431                              PointParameter pname,
1432                              GLfixed param)
1433 {
1434     unsigned int paramCount = GetPointParameterCount(pname);
1435     if (paramCount != 1)
1436     {
1437         errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidPointParameter);
1438         return false;
1439     }
1440 
1441     GLfloat paramf = ConvertFixedToFloat(param);
1442     return ValidatePointParameterCommon(state, errors, entryPoint, pname, &paramf);
1443 }
1444 
ValidatePointParameterxv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,PointParameter pname,const GLfixed * params)1445 bool ValidatePointParameterxv(const PrivateState &state,
1446                               ErrorSet *errors,
1447                               angle::EntryPoint entryPoint,
1448                               PointParameter pname,
1449                               const GLfixed *params)
1450 {
1451     GLfloat paramsf[4] = {};
1452     for (unsigned int i = 0; i < GetPointParameterCount(pname); i++)
1453     {
1454         paramsf[i] = ConvertFixedToFloat(params[i]);
1455     }
1456     return ValidatePointParameterCommon(state, errors, entryPoint, pname, paramsf);
1457 }
1458 
ValidatePointSize(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfloat size)1459 bool ValidatePointSize(const PrivateState &state,
1460                        ErrorSet *errors,
1461                        angle::EntryPoint entryPoint,
1462                        GLfloat size)
1463 {
1464     return ValidatePointSizeCommon(state, errors, entryPoint, size);
1465 }
1466 
ValidatePointSizex(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfixed size)1467 bool ValidatePointSizex(const PrivateState &state,
1468                         ErrorSet *errors,
1469                         angle::EntryPoint entryPoint,
1470                         GLfixed size)
1471 {
1472     return ValidatePointSizeCommon(state, errors, entryPoint, ConvertFixedToFloat(size));
1473 }
1474 
ValidatePolygonOffsetx(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfixed factor,GLfixed units)1475 bool ValidatePolygonOffsetx(const PrivateState &state,
1476                             ErrorSet *errors,
1477                             angle::EntryPoint entryPoint,
1478                             GLfixed factor,
1479                             GLfixed units)
1480 {
1481     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1482     return true;
1483 }
1484 
ValidatePopMatrix(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint)1485 bool ValidatePopMatrix(const PrivateState &state, ErrorSet *errors, angle::EntryPoint entryPoint)
1486 {
1487     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1488     const auto &stack = state.gles1().currentMatrixStack();
1489     if (stack.size() == 1)
1490     {
1491         errors->validationError(entryPoint, GL_STACK_UNDERFLOW, kMatrixStackUnderflow);
1492         return false;
1493     }
1494     return true;
1495 }
1496 
ValidatePushMatrix(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint)1497 bool ValidatePushMatrix(const PrivateState &state, ErrorSet *errors, angle::EntryPoint entryPoint)
1498 {
1499     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1500     const auto &stack = state.gles1().currentMatrixStack();
1501     if (stack.size() == stack.max_size())
1502     {
1503         errors->validationError(entryPoint, GL_STACK_OVERFLOW, kMatrixStackOverflow);
1504         return false;
1505     }
1506     return true;
1507 }
1508 
ValidateRotatef(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfloat angle,GLfloat x,GLfloat y,GLfloat z)1509 bool ValidateRotatef(const PrivateState &state,
1510                      ErrorSet *errors,
1511                      angle::EntryPoint entryPoint,
1512                      GLfloat angle,
1513                      GLfloat x,
1514                      GLfloat y,
1515                      GLfloat z)
1516 {
1517     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1518     return true;
1519 }
1520 
ValidateRotatex(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfixed angle,GLfixed x,GLfixed y,GLfixed z)1521 bool ValidateRotatex(const PrivateState &state,
1522                      ErrorSet *errors,
1523                      angle::EntryPoint entryPoint,
1524                      GLfixed angle,
1525                      GLfixed x,
1526                      GLfixed y,
1527                      GLfixed z)
1528 {
1529     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1530     return true;
1531 }
1532 
ValidateSampleCoveragex(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLclampx value,GLboolean invert)1533 bool ValidateSampleCoveragex(const PrivateState &state,
1534                              ErrorSet *errors,
1535                              angle::EntryPoint entryPoint,
1536                              GLclampx value,
1537                              GLboolean invert)
1538 {
1539     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1540     return true;
1541 }
1542 
ValidateScalef(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfloat x,GLfloat y,GLfloat z)1543 bool ValidateScalef(const PrivateState &state,
1544                     ErrorSet *errors,
1545                     angle::EntryPoint entryPoint,
1546                     GLfloat x,
1547                     GLfloat y,
1548                     GLfloat z)
1549 {
1550     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1551     return true;
1552 }
1553 
ValidateScalex(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfixed x,GLfixed y,GLfixed z)1554 bool ValidateScalex(const PrivateState &state,
1555                     ErrorSet *errors,
1556                     angle::EntryPoint entryPoint,
1557                     GLfixed x,
1558                     GLfixed y,
1559                     GLfixed z)
1560 {
1561     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1562     return true;
1563 }
1564 
ValidateShadeModel(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,ShadingModel mode)1565 bool ValidateShadeModel(const PrivateState &state,
1566                         ErrorSet *errors,
1567                         angle::EntryPoint entryPoint,
1568                         ShadingModel mode)
1569 {
1570     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1571     switch (mode)
1572     {
1573         case ShadingModel::Flat:
1574         case ShadingModel::Smooth:
1575             return true;
1576         default:
1577             errors->validationError(entryPoint, GL_INVALID_ENUM, kInvalidShadingModel);
1578             return false;
1579     }
1580 }
1581 
ValidateTexCoordPointer(const Context * context,angle::EntryPoint entryPoint,GLint size,VertexAttribType type,GLsizei stride,const void * pointer)1582 bool ValidateTexCoordPointer(const Context *context,
1583                              angle::EntryPoint entryPoint,
1584                              GLint size,
1585                              VertexAttribType type,
1586                              GLsizei stride,
1587                              const void *pointer)
1588 {
1589     return ValidateBuiltinVertexAttributeCommon(
1590         context, entryPoint, ClientVertexArrayType::TextureCoord, size, type, stride, pointer);
1591 }
1592 
ValidateTexEnvf(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,TextureEnvTarget target,TextureEnvParameter pname,GLfloat param)1593 bool ValidateTexEnvf(const PrivateState &state,
1594                      ErrorSet *errors,
1595                      angle::EntryPoint entryPoint,
1596                      TextureEnvTarget target,
1597                      TextureEnvParameter pname,
1598                      GLfloat param)
1599 {
1600     return ValidateTexEnvCommon(state, errors, entryPoint, target, pname, &param);
1601 }
1602 
ValidateTexEnvfv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,TextureEnvTarget target,TextureEnvParameter pname,const GLfloat * params)1603 bool ValidateTexEnvfv(const PrivateState &state,
1604                       ErrorSet *errors,
1605                       angle::EntryPoint entryPoint,
1606                       TextureEnvTarget target,
1607                       TextureEnvParameter pname,
1608                       const GLfloat *params)
1609 {
1610     return ValidateTexEnvCommon(state, errors, entryPoint, target, pname, params);
1611 }
1612 
ValidateTexEnvi(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,TextureEnvTarget target,TextureEnvParameter pname,GLint param)1613 bool ValidateTexEnvi(const PrivateState &state,
1614                      ErrorSet *errors,
1615                      angle::EntryPoint entryPoint,
1616                      TextureEnvTarget target,
1617                      TextureEnvParameter pname,
1618                      GLint param)
1619 {
1620     GLfloat paramf = static_cast<GLfloat>(param);
1621     return ValidateTexEnvCommon(state, errors, entryPoint, target, pname, &paramf);
1622 }
1623 
ValidateTexEnviv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,TextureEnvTarget target,TextureEnvParameter pname,const GLint * params)1624 bool ValidateTexEnviv(const PrivateState &state,
1625                       ErrorSet *errors,
1626                       angle::EntryPoint entryPoint,
1627                       TextureEnvTarget target,
1628                       TextureEnvParameter pname,
1629                       const GLint *params)
1630 {
1631     GLfloat paramsf[4];
1632     for (unsigned int i = 0; i < GetTextureEnvParameterCount(pname); i++)
1633     {
1634         paramsf[i] = static_cast<GLfloat>(params[i]);
1635     }
1636     return ValidateTexEnvCommon(state, errors, entryPoint, target, pname, paramsf);
1637 }
1638 
ValidateTexEnvx(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,TextureEnvTarget target,TextureEnvParameter pname,GLfixed param)1639 bool ValidateTexEnvx(const PrivateState &state,
1640                      ErrorSet *errors,
1641                      angle::EntryPoint entryPoint,
1642                      TextureEnvTarget target,
1643                      TextureEnvParameter pname,
1644                      GLfixed param)
1645 {
1646     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1647     GLfloat paramsf[4] = {};
1648     ConvertTextureEnvFromFixed(pname, &param, paramsf);
1649     return ValidateTexEnvCommon(state, errors, entryPoint, target, pname, paramsf);
1650 }
1651 
ValidateTexEnvxv(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,TextureEnvTarget target,TextureEnvParameter pname,const GLfixed * params)1652 bool ValidateTexEnvxv(const PrivateState &state,
1653                       ErrorSet *errors,
1654                       angle::EntryPoint entryPoint,
1655                       TextureEnvTarget target,
1656                       TextureEnvParameter pname,
1657                       const GLfixed *params)
1658 {
1659     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1660     GLfloat paramsf[4] = {};
1661     ConvertTextureEnvFromFixed(pname, params, paramsf);
1662     return ValidateTexEnvCommon(state, errors, entryPoint, target, pname, paramsf);
1663 }
1664 
ValidateTexParameterBaseForGLfixed(const Context * context,angle::EntryPoint entryPoint,TextureType target,GLenum pname,GLsizei bufSize,bool vectorParams,const GLfixed * params)1665 bool ValidateTexParameterBaseForGLfixed(const Context *context,
1666                                         angle::EntryPoint entryPoint,
1667                                         TextureType target,
1668                                         GLenum pname,
1669                                         GLsizei bufSize,
1670                                         bool vectorParams,
1671                                         const GLfixed *params)
1672 {
1673     // Convert GLfixed parameter for GL_TEXTURE_MAX_ANISOTROPY_EXT independently
1674     // since it compares against 1 and maxTextureAnisotropy instead of just 0
1675     // (other values are fine to leave unconverted since they only check positive or negative or
1676     // are used as enums)
1677     GLfloat paramValue;
1678     if (pname == GL_TEXTURE_MAX_ANISOTROPY_EXT)
1679     {
1680         paramValue = ConvertFixedToFloat(static_cast<GLfixed>(params[0]));
1681     }
1682     else
1683     {
1684         paramValue = static_cast<GLfloat>(params[0]);
1685     }
1686     return ValidateTexParameterBase(context, entryPoint, target, pname, bufSize, vectorParams,
1687                                     &paramValue);
1688 }
1689 
ValidateTexParameterx(const Context * context,angle::EntryPoint entryPoint,TextureType target,GLenum pname,GLfixed param)1690 bool ValidateTexParameterx(const Context *context,
1691                            angle::EntryPoint entryPoint,
1692                            TextureType target,
1693                            GLenum pname,
1694                            GLfixed param)
1695 {
1696     ANGLE_VALIDATE_IS_GLES1_CONTEXT(context, entryPoint);
1697     return ValidateTexParameterBaseForGLfixed(context, entryPoint, target, pname, -1, false,
1698                                               &param);
1699 }
1700 
ValidateTexParameterxv(const Context * context,angle::EntryPoint entryPoint,TextureType target,GLenum pname,const GLfixed * params)1701 bool ValidateTexParameterxv(const Context *context,
1702                             angle::EntryPoint entryPoint,
1703                             TextureType target,
1704                             GLenum pname,
1705                             const GLfixed *params)
1706 {
1707     ANGLE_VALIDATE_IS_GLES1_CONTEXT(context, entryPoint);
1708     return ValidateTexParameterBaseForGLfixed(context, entryPoint, target, pname, -1, true, params);
1709 }
1710 
ValidateTranslatef(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfloat x,GLfloat y,GLfloat z)1711 bool ValidateTranslatef(const PrivateState &state,
1712                         ErrorSet *errors,
1713                         angle::EntryPoint entryPoint,
1714                         GLfloat x,
1715                         GLfloat y,
1716                         GLfloat z)
1717 {
1718     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1719     return true;
1720 }
1721 
ValidateTranslatex(const PrivateState & state,ErrorSet * errors,angle::EntryPoint entryPoint,GLfixed x,GLfixed y,GLfixed z)1722 bool ValidateTranslatex(const PrivateState &state,
1723                         ErrorSet *errors,
1724                         angle::EntryPoint entryPoint,
1725                         GLfixed x,
1726                         GLfixed y,
1727                         GLfixed z)
1728 {
1729     ANGLE_VALIDATE_IS_GLES1(state, errors, entryPoint);
1730     return true;
1731 }
1732 
ValidateVertexPointer(const Context * context,angle::EntryPoint entryPoint,GLint size,VertexAttribType type,GLsizei stride,const void * pointer)1733 bool ValidateVertexPointer(const Context *context,
1734                            angle::EntryPoint entryPoint,
1735                            GLint size,
1736                            VertexAttribType type,
1737                            GLsizei stride,
1738                            const void *pointer)
1739 {
1740     return ValidateBuiltinVertexAttributeCommon(context, entryPoint, ClientVertexArrayType::Vertex,
1741                                                 size, type, stride, pointer);
1742 }
1743 
ValidateDrawTexfOES(const Context * context,angle::EntryPoint entryPoint,GLfloat x,GLfloat y,GLfloat z,GLfloat width,GLfloat height)1744 bool ValidateDrawTexfOES(const Context *context,
1745                          angle::EntryPoint entryPoint,
1746                          GLfloat x,
1747                          GLfloat y,
1748                          GLfloat z,
1749                          GLfloat width,
1750                          GLfloat height)
1751 {
1752     return ValidateDrawTexCommon(context, entryPoint, width, height);
1753 }
1754 
ValidateDrawTexfvOES(const Context * context,angle::EntryPoint entryPoint,const GLfloat * coords)1755 bool ValidateDrawTexfvOES(const Context *context,
1756                           angle::EntryPoint entryPoint,
1757                           const GLfloat *coords)
1758 {
1759     return ValidateDrawTexCommon(context, entryPoint, coords[3], coords[4]);
1760 }
1761 
ValidateDrawTexiOES(const Context * context,angle::EntryPoint entryPoint,GLint x,GLint y,GLint z,GLint width,GLint height)1762 bool ValidateDrawTexiOES(const Context *context,
1763                          angle::EntryPoint entryPoint,
1764                          GLint x,
1765                          GLint y,
1766                          GLint z,
1767                          GLint width,
1768                          GLint height)
1769 {
1770     return ValidateDrawTexCommon(context, entryPoint, static_cast<GLfloat>(width),
1771                                  static_cast<GLfloat>(height));
1772 }
1773 
ValidateDrawTexivOES(const Context * context,angle::EntryPoint entryPoint,const GLint * coords)1774 bool ValidateDrawTexivOES(const Context *context, angle::EntryPoint entryPoint, const GLint *coords)
1775 {
1776     return ValidateDrawTexCommon(context, entryPoint, static_cast<GLfloat>(coords[3]),
1777                                  static_cast<GLfloat>(coords[4]));
1778 }
1779 
ValidateDrawTexsOES(const Context * context,angle::EntryPoint entryPoint,GLshort x,GLshort y,GLshort z,GLshort width,GLshort height)1780 bool ValidateDrawTexsOES(const Context *context,
1781                          angle::EntryPoint entryPoint,
1782                          GLshort x,
1783                          GLshort y,
1784                          GLshort z,
1785                          GLshort width,
1786                          GLshort height)
1787 {
1788     return ValidateDrawTexCommon(context, entryPoint, static_cast<GLfloat>(width),
1789                                  static_cast<GLfloat>(height));
1790 }
1791 
ValidateDrawTexsvOES(const Context * context,angle::EntryPoint entryPoint,const GLshort * coords)1792 bool ValidateDrawTexsvOES(const Context *context,
1793                           angle::EntryPoint entryPoint,
1794                           const GLshort *coords)
1795 {
1796     return ValidateDrawTexCommon(context, entryPoint, static_cast<GLfloat>(coords[3]),
1797                                  static_cast<GLfloat>(coords[4]));
1798 }
1799 
ValidateDrawTexxOES(const Context * context,angle::EntryPoint entryPoint,GLfixed x,GLfixed y,GLfixed z,GLfixed width,GLfixed height)1800 bool ValidateDrawTexxOES(const Context *context,
1801                          angle::EntryPoint entryPoint,
1802                          GLfixed x,
1803                          GLfixed y,
1804                          GLfixed z,
1805                          GLfixed width,
1806                          GLfixed height)
1807 {
1808     return ValidateDrawTexCommon(context, entryPoint, ConvertFixedToFloat(width),
1809                                  ConvertFixedToFloat(height));
1810 }
1811 
ValidateDrawTexxvOES(const Context * context,angle::EntryPoint entryPoint,const GLfixed * coords)1812 bool ValidateDrawTexxvOES(const Context *context,
1813                           angle::EntryPoint entryPoint,
1814                           const GLfixed *coords)
1815 {
1816     return ValidateDrawTexCommon(context, entryPoint, ConvertFixedToFloat(coords[3]),
1817                                  ConvertFixedToFloat(coords[4]));
1818 }
1819 
ValidateCurrentPaletteMatrixOES(const Context * context,angle::EntryPoint entryPoint,GLuint matrixpaletteindex)1820 bool ValidateCurrentPaletteMatrixOES(const Context *context,
1821                                      angle::EntryPoint entryPoint,
1822                                      GLuint matrixpaletteindex)
1823 {
1824     UNIMPLEMENTED();
1825     return true;
1826 }
1827 
ValidateLoadPaletteFromModelViewMatrixOES(const Context * context,angle::EntryPoint entryPoint)1828 bool ValidateLoadPaletteFromModelViewMatrixOES(const Context *context, angle::EntryPoint entryPoint)
1829 {
1830     UNIMPLEMENTED();
1831     return true;
1832 }
1833 
ValidateMatrixIndexPointerOES(const Context * context,angle::EntryPoint entryPoint,GLint size,GLenum type,GLsizei stride,const void * pointer)1834 bool ValidateMatrixIndexPointerOES(const Context *context,
1835                                    angle::EntryPoint entryPoint,
1836                                    GLint size,
1837                                    GLenum type,
1838                                    GLsizei stride,
1839                                    const void *pointer)
1840 {
1841     UNIMPLEMENTED();
1842     return true;
1843 }
1844 
ValidateWeightPointerOES(const Context * context,angle::EntryPoint entryPoint,GLint size,GLenum type,GLsizei stride,const void * pointer)1845 bool ValidateWeightPointerOES(const Context *context,
1846                               angle::EntryPoint entryPoint,
1847                               GLint size,
1848                               GLenum type,
1849                               GLsizei stride,
1850                               const void *pointer)
1851 {
1852     UNIMPLEMENTED();
1853     return true;
1854 }
1855 
ValidatePointSizePointerOES(const Context * context,angle::EntryPoint entryPoint,VertexAttribType type,GLsizei stride,const void * pointer)1856 bool ValidatePointSizePointerOES(const Context *context,
1857                                  angle::EntryPoint entryPoint,
1858                                  VertexAttribType type,
1859                                  GLsizei stride,
1860                                  const void *pointer)
1861 {
1862     return ValidateBuiltinVertexAttributeCommon(
1863         context, entryPoint, ClientVertexArrayType::PointSize, 1, type, stride, pointer);
1864 }
1865 
ValidateQueryMatrixxOES(const Context * context,angle::EntryPoint entryPoint,const GLfixed * mantissa,const GLint * exponent)1866 bool ValidateQueryMatrixxOES(const Context *context,
1867                              angle::EntryPoint entryPoint,
1868                              const GLfixed *mantissa,
1869                              const GLint *exponent)
1870 {
1871     UNIMPLEMENTED();
1872     return true;
1873 }
1874 
ValidateGenFramebuffersOES(const Context * context,angle::EntryPoint entryPoint,GLsizei n,const FramebufferID * framebuffers)1875 bool ValidateGenFramebuffersOES(const Context *context,
1876                                 angle::EntryPoint entryPoint,
1877                                 GLsizei n,
1878                                 const FramebufferID *framebuffers)
1879 {
1880     if (!context->getExtensions().framebufferObjectOES)
1881     {
1882         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
1883         return false;
1884     }
1885 
1886     return ValidateGenOrDelete(context, entryPoint, n);
1887 }
1888 
ValidateDeleteFramebuffersOES(const Context * context,angle::EntryPoint entryPoint,GLsizei n,const FramebufferID * framebuffers)1889 bool ValidateDeleteFramebuffersOES(const Context *context,
1890                                    angle::EntryPoint entryPoint,
1891                                    GLsizei n,
1892                                    const FramebufferID *framebuffers)
1893 {
1894     if (!context->getExtensions().framebufferObjectOES)
1895     {
1896         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
1897         return false;
1898     }
1899 
1900     return ValidateGenOrDelete(context, entryPoint, n);
1901 }
1902 
ValidateGenRenderbuffersOES(const Context * context,angle::EntryPoint entryPoint,GLsizei n,const RenderbufferID * renderbuffers)1903 bool ValidateGenRenderbuffersOES(const Context *context,
1904                                  angle::EntryPoint entryPoint,
1905                                  GLsizei n,
1906                                  const RenderbufferID *renderbuffers)
1907 {
1908     if (!context->getExtensions().framebufferObjectOES)
1909     {
1910         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
1911         return false;
1912     }
1913 
1914     return ValidateGenOrDelete(context, entryPoint, n);
1915 }
1916 
ValidateDeleteRenderbuffersOES(const Context * context,angle::EntryPoint entryPoint,GLsizei n,const RenderbufferID * renderbuffers)1917 bool ValidateDeleteRenderbuffersOES(const Context *context,
1918                                     angle::EntryPoint entryPoint,
1919                                     GLsizei n,
1920                                     const RenderbufferID *renderbuffers)
1921 {
1922     if (!context->getExtensions().framebufferObjectOES)
1923     {
1924         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
1925         return false;
1926     }
1927 
1928     return ValidateGenOrDelete(context, entryPoint, n);
1929 }
1930 
ValidateBindFramebufferOES(const Context * context,angle::EntryPoint entryPoint,GLenum target,FramebufferID framebuffer)1931 bool ValidateBindFramebufferOES(const Context *context,
1932                                 angle::EntryPoint entryPoint,
1933                                 GLenum target,
1934                                 FramebufferID framebuffer)
1935 {
1936     if (!context->getExtensions().framebufferObjectOES)
1937     {
1938         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
1939         return false;
1940     }
1941 
1942     return ValidateBindFramebufferBase(context, entryPoint, target, framebuffer);
1943 }
1944 
ValidateBindRenderbufferOES(const Context * context,angle::EntryPoint entryPoint,GLenum target,RenderbufferID renderbuffer)1945 bool ValidateBindRenderbufferOES(const Context *context,
1946                                  angle::EntryPoint entryPoint,
1947                                  GLenum target,
1948                                  RenderbufferID renderbuffer)
1949 {
1950     if (!context->getExtensions().framebufferObjectOES)
1951     {
1952         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
1953         return false;
1954     }
1955 
1956     return ValidateBindRenderbufferBase(context, entryPoint, target, renderbuffer);
1957 }
1958 
ValidateCheckFramebufferStatusOES(const Context * context,angle::EntryPoint entryPoint,GLenum target)1959 bool ValidateCheckFramebufferStatusOES(const Context *context,
1960                                        angle::EntryPoint entryPoint,
1961                                        GLenum target)
1962 {
1963     if (!context->getExtensions().framebufferObjectOES)
1964     {
1965         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
1966         return false;
1967     }
1968 
1969     if (!ValidFramebufferTarget(context, target))
1970     {
1971         ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidFramebufferTarget);
1972         return false;
1973     }
1974 
1975     return true;
1976 }
1977 
ValidateFramebufferRenderbufferOES(const Context * context,angle::EntryPoint entryPoint,GLenum target,GLenum attachment,GLenum rbtarget,RenderbufferID renderbuffer)1978 bool ValidateFramebufferRenderbufferOES(const Context *context,
1979                                         angle::EntryPoint entryPoint,
1980                                         GLenum target,
1981                                         GLenum attachment,
1982                                         GLenum rbtarget,
1983                                         RenderbufferID renderbuffer)
1984 {
1985     if (!context->getExtensions().framebufferObjectOES)
1986     {
1987         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
1988         return false;
1989     }
1990 
1991     return ValidateFramebufferRenderbufferBase(context, entryPoint, target, attachment, rbtarget,
1992                                                renderbuffer);
1993 }
1994 
ValidateFramebufferTexture2DOES(const Context * context,angle::EntryPoint entryPoint,GLenum target,GLenum attachment,TextureTarget textarget,TextureID texture,GLint level)1995 bool ValidateFramebufferTexture2DOES(const Context *context,
1996                                      angle::EntryPoint entryPoint,
1997                                      GLenum target,
1998                                      GLenum attachment,
1999                                      TextureTarget textarget,
2000                                      TextureID texture,
2001                                      GLint level)
2002 {
2003     if (!context->getExtensions().framebufferObjectOES)
2004     {
2005         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
2006         return false;
2007     }
2008 
2009     if (level != 0)
2010     {
2011         ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidFramebufferTextureLevel);
2012         return false;
2013     }
2014 
2015     if (!ValidateFramebufferTextureBase(context, entryPoint, target, attachment, texture, level))
2016     {
2017         return false;
2018     }
2019 
2020     if (texture.value != 0)
2021     {
2022         Texture *tex = context->getTexture(texture);
2023         ASSERT(tex);
2024 
2025         const Caps &caps = context->getCaps();
2026 
2027         switch (textarget)
2028         {
2029             case TextureTarget::_2D:
2030             {
2031                 if (level > log2(caps.max2DTextureSize))
2032                 {
2033                     ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidMipLevel);
2034                     return false;
2035                 }
2036                 if (tex->getType() != TextureType::_2D)
2037                 {
2038                     ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kInvalidTextureTarget);
2039                     return false;
2040                 }
2041             }
2042             break;
2043 
2044             case TextureTarget::CubeMapNegativeX:
2045             case TextureTarget::CubeMapNegativeY:
2046             case TextureTarget::CubeMapNegativeZ:
2047             case TextureTarget::CubeMapPositiveX:
2048             case TextureTarget::CubeMapPositiveY:
2049             case TextureTarget::CubeMapPositiveZ:
2050             {
2051                 if (!context->getExtensions().textureCubeMapOES)
2052                 {
2053                     ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidTextureTarget);
2054                     return false;
2055                 }
2056 
2057                 if (level > log2(caps.maxCubeMapTextureSize))
2058                 {
2059                     ANGLE_VALIDATION_ERROR(GL_INVALID_VALUE, kInvalidMipLevel);
2060                     return false;
2061                 }
2062                 if (tex->getType() != TextureType::CubeMap)
2063                 {
2064                     ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kTextureTargetMismatch);
2065                     return false;
2066                 }
2067             }
2068             break;
2069 
2070             default:
2071                 ANGLE_VALIDATION_ERROR(GL_INVALID_ENUM, kInvalidTextureTarget);
2072                 return false;
2073         }
2074     }
2075 
2076     return true;
2077 }
2078 
ValidateGenerateMipmapOES(const Context * context,angle::EntryPoint entryPoint,TextureType target)2079 bool ValidateGenerateMipmapOES(const Context *context,
2080                                angle::EntryPoint entryPoint,
2081                                TextureType target)
2082 {
2083     if (!context->getExtensions().framebufferObjectOES)
2084     {
2085         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
2086         return false;
2087     }
2088 
2089     return ValidateGenerateMipmapBase(context, entryPoint, target);
2090 }
2091 
ValidateGetFramebufferAttachmentParameterivOES(const Context * context,angle::EntryPoint entryPoint,GLenum target,GLenum attachment,GLenum pname,const GLint * params)2092 bool ValidateGetFramebufferAttachmentParameterivOES(const Context *context,
2093                                                     angle::EntryPoint entryPoint,
2094                                                     GLenum target,
2095                                                     GLenum attachment,
2096                                                     GLenum pname,
2097                                                     const GLint *params)
2098 {
2099     if (!context->getExtensions().framebufferObjectOES)
2100     {
2101         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
2102         return false;
2103     }
2104 
2105     return ValidateGetFramebufferAttachmentParameterivBase(context, entryPoint, target, attachment,
2106                                                            pname, nullptr);
2107 }
2108 
ValidateGetRenderbufferParameterivOES(const Context * context,angle::EntryPoint entryPoint,GLenum target,GLenum pname,const GLint * params)2109 bool ValidateGetRenderbufferParameterivOES(const Context *context,
2110                                            angle::EntryPoint entryPoint,
2111                                            GLenum target,
2112                                            GLenum pname,
2113                                            const GLint *params)
2114 {
2115     if (!context->getExtensions().framebufferObjectOES)
2116     {
2117         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
2118         return false;
2119     }
2120 
2121     return ValidateGetRenderbufferParameterivBase(context, entryPoint, target, pname, nullptr);
2122 }
2123 
ValidateIsFramebufferOES(const Context * context,angle::EntryPoint entryPoint,FramebufferID framebuffer)2124 bool ValidateIsFramebufferOES(const Context *context,
2125                               angle::EntryPoint entryPoint,
2126                               FramebufferID framebuffer)
2127 {
2128     if (!context->getExtensions().framebufferObjectOES)
2129     {
2130         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
2131         return false;
2132     }
2133 
2134     return true;
2135 }
2136 
ValidateIsRenderbufferOES(const Context * context,angle::EntryPoint entryPoint,RenderbufferID renderbuffer)2137 bool ValidateIsRenderbufferOES(const Context *context,
2138                                angle::EntryPoint entryPoint,
2139                                RenderbufferID renderbuffer)
2140 {
2141     if (!context->getExtensions().framebufferObjectOES)
2142     {
2143         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
2144         return false;
2145     }
2146 
2147     return true;
2148 }
2149 
ValidateRenderbufferStorageOES(const Context * context,angle::EntryPoint entryPoint,GLenum target,GLenum internalformat,GLsizei width,GLsizei height)2150 bool ValidateRenderbufferStorageOES(const Context *context,
2151                                     angle::EntryPoint entryPoint,
2152                                     GLenum target,
2153                                     GLenum internalformat,
2154                                     GLsizei width,
2155                                     GLsizei height)
2156 {
2157     if (!context->getExtensions().framebufferObjectOES)
2158     {
2159         ANGLE_VALIDATION_ERROR(GL_INVALID_OPERATION, kExtensionNotEnabled);
2160         return false;
2161     }
2162 
2163     return ValidateRenderbufferStorageParametersBase(context, entryPoint, target, 0, internalformat,
2164                                                      width, height);
2165 }
2166 
2167 // GL_OES_texture_cube_map
2168 
ValidateGetTexGenfvOES(const Context * context,angle::EntryPoint entryPoint,GLenum coord,GLenum pname,const GLfloat * params)2169 bool ValidateGetTexGenfvOES(const Context *context,
2170                             angle::EntryPoint entryPoint,
2171                             GLenum coord,
2172                             GLenum pname,
2173                             const GLfloat *params)
2174 {
2175     UNIMPLEMENTED();
2176     return true;
2177 }
2178 
ValidateGetTexGenivOES(const Context * context,angle::EntryPoint entryPoint,GLenum coord,GLenum pname,const int * params)2179 bool ValidateGetTexGenivOES(const Context *context,
2180                             angle::EntryPoint entryPoint,
2181                             GLenum coord,
2182                             GLenum pname,
2183                             const int *params)
2184 {
2185     UNIMPLEMENTED();
2186     return true;
2187 }
2188 
ValidateGetTexGenxvOES(const Context * context,angle::EntryPoint entryPoint,GLenum coord,GLenum pname,const GLfixed * params)2189 bool ValidateGetTexGenxvOES(const Context *context,
2190                             angle::EntryPoint entryPoint,
2191                             GLenum coord,
2192                             GLenum pname,
2193                             const GLfixed *params)
2194 {
2195     UNIMPLEMENTED();
2196     return true;
2197 }
2198 
ValidateTexGenfvOES(const Context * context,angle::EntryPoint entryPoint,GLenum coord,GLenum pname,const GLfloat * params)2199 bool ValidateTexGenfvOES(const Context *context,
2200                          angle::EntryPoint entryPoint,
2201                          GLenum coord,
2202                          GLenum pname,
2203                          const GLfloat *params)
2204 {
2205     UNIMPLEMENTED();
2206     return true;
2207 }
2208 
ValidateTexGenivOES(const Context * context,angle::EntryPoint entryPoint,GLenum coord,GLenum pname,const GLint * param)2209 bool ValidateTexGenivOES(const Context *context,
2210                          angle::EntryPoint entryPoint,
2211                          GLenum coord,
2212                          GLenum pname,
2213                          const GLint *param)
2214 {
2215     UNIMPLEMENTED();
2216     return true;
2217 }
2218 
ValidateTexGenxvOES(const Context * context,angle::EntryPoint entryPoint,GLenum coord,GLenum pname,const GLint * param)2219 bool ValidateTexGenxvOES(const Context *context,
2220                          angle::EntryPoint entryPoint,
2221                          GLenum coord,
2222                          GLenum pname,
2223                          const GLint *param)
2224 {
2225     UNIMPLEMENTED();
2226     return true;
2227 }
2228 
ValidateTexGenfOES(const Context * context,angle::EntryPoint entryPoint,GLenum coord,GLenum pname,GLfloat param)2229 bool ValidateTexGenfOES(const Context *context,
2230                         angle::EntryPoint entryPoint,
2231                         GLenum coord,
2232                         GLenum pname,
2233                         GLfloat param)
2234 {
2235     UNIMPLEMENTED();
2236     return true;
2237 }
2238 
ValidateTexGeniOES(const Context * context,angle::EntryPoint entryPoint,GLenum coord,GLenum pname,GLint param)2239 bool ValidateTexGeniOES(const Context *context,
2240                         angle::EntryPoint entryPoint,
2241                         GLenum coord,
2242                         GLenum pname,
2243                         GLint param)
2244 {
2245     UNIMPLEMENTED();
2246     return true;
2247 }
2248 
ValidateTexGenxOES(const Context * context,angle::EntryPoint entryPoint,GLenum coord,GLenum pname,GLfixed param)2249 bool ValidateTexGenxOES(const Context *context,
2250                         angle::EntryPoint entryPoint,
2251                         GLenum coord,
2252                         GLenum pname,
2253                         GLfixed param)
2254 {
2255     UNIMPLEMENTED();
2256     return true;
2257 }
2258 
2259 }  // namespace gl
2260