• 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(context)                                                        \
20     do                                                                                          \
21     {                                                                                           \
22         if (context->getClientType() != EGL_OPENGL_API && context->getClientMajorVersion() > 1) \
23         {                                                                                       \
24             context->validationError(GL_INVALID_OPERATION, kGLES1Only);                         \
25             return false;                                                                       \
26         }                                                                                       \
27     } while (0)
28 
29 namespace gl
30 {
31 using namespace err;
32 
ValidateAlphaFuncCommon(Context * context,AlphaTestFunc func)33 bool ValidateAlphaFuncCommon(Context *context, AlphaTestFunc func)
34 {
35     switch (func)
36     {
37         case AlphaTestFunc::AlwaysPass:
38         case AlphaTestFunc::Equal:
39         case AlphaTestFunc::Gequal:
40         case AlphaTestFunc::Greater:
41         case AlphaTestFunc::Lequal:
42         case AlphaTestFunc::Less:
43         case AlphaTestFunc::Never:
44         case AlphaTestFunc::NotEqual:
45             return true;
46         default:
47             context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
48             return false;
49     }
50 }
51 
ValidateClientStateCommon(Context * context,ClientVertexArrayType arrayType)52 bool ValidateClientStateCommon(Context *context, ClientVertexArrayType arrayType)
53 {
54     ANGLE_VALIDATE_IS_GLES1(context);
55     switch (arrayType)
56     {
57         case ClientVertexArrayType::Vertex:
58         case ClientVertexArrayType::Normal:
59         case ClientVertexArrayType::Color:
60         case ClientVertexArrayType::TextureCoord:
61             return true;
62         case ClientVertexArrayType::PointSize:
63             if (!context->getExtensions().pointSizeArray)
64             {
65                 context->validationError(GL_INVALID_ENUM, kPointSizeArrayExtensionNotEnabled);
66                 return false;
67             }
68             return true;
69         default:
70             context->validationError(GL_INVALID_ENUM, kInvalidClientState);
71             return false;
72     }
73 }
74 
ValidateBuiltinVertexAttributeCommon(Context * context,ClientVertexArrayType arrayType,GLint size,VertexAttribType type,GLsizei stride,const void * pointer)75 bool ValidateBuiltinVertexAttributeCommon(Context *context,
76                                           ClientVertexArrayType arrayType,
77                                           GLint size,
78                                           VertexAttribType type,
79                                           GLsizei stride,
80                                           const void *pointer)
81 {
82     ANGLE_VALIDATE_IS_GLES1(context);
83 
84     if (stride < 0)
85     {
86         context->validationError(GL_INVALID_VALUE, kInvalidVertexPointerStride);
87         return false;
88     }
89 
90     int minSize = 1;
91     int maxSize = 4;
92 
93     switch (arrayType)
94     {
95         case ClientVertexArrayType::Vertex:
96         case ClientVertexArrayType::TextureCoord:
97             minSize = 2;
98             maxSize = 4;
99             break;
100         case ClientVertexArrayType::Normal:
101             minSize = 3;
102             maxSize = 3;
103             break;
104         case ClientVertexArrayType::Color:
105             minSize = 4;
106             maxSize = 4;
107             break;
108         case ClientVertexArrayType::PointSize:
109             if (!context->getExtensions().pointSizeArray)
110             {
111                 context->validationError(GL_INVALID_ENUM, kPointSizeArrayExtensionNotEnabled);
112                 return false;
113             }
114 
115             minSize = 1;
116             maxSize = 1;
117             break;
118         default:
119             UNREACHABLE();
120             return false;
121     }
122 
123     if (size < minSize || size > maxSize)
124     {
125         context->validationError(GL_INVALID_VALUE, kInvalidVertexPointerSize);
126         return false;
127     }
128 
129     switch (type)
130     {
131         case VertexAttribType::Byte:
132             if (arrayType == ClientVertexArrayType::PointSize)
133             {
134                 context->validationError(GL_INVALID_ENUM, kInvalidVertexPointerType);
135                 return false;
136             }
137             break;
138         case VertexAttribType::Short:
139             if (arrayType == ClientVertexArrayType::PointSize ||
140                 arrayType == ClientVertexArrayType::Color)
141             {
142                 context->validationError(GL_INVALID_ENUM, kInvalidVertexPointerType);
143                 return false;
144             }
145             break;
146         case VertexAttribType::Fixed:
147         case VertexAttribType::Float:
148             break;
149         default:
150             context->validationError(GL_INVALID_ENUM, kInvalidVertexPointerType);
151             return false;
152     }
153 
154     return true;
155 }
156 
ValidateLightCaps(Context * context,GLenum light)157 bool ValidateLightCaps(Context *context, GLenum light)
158 {
159     if (light < GL_LIGHT0 || light >= GL_LIGHT0 + context->getCaps().maxLights)
160     {
161         context->validationError(GL_INVALID_ENUM, kInvalidLight);
162         return false;
163     }
164 
165     return true;
166 }
167 
ValidateLightCommon(Context * context,GLenum light,LightParameter pname,const GLfloat * params)168 bool ValidateLightCommon(Context *context,
169                          GLenum light,
170                          LightParameter pname,
171                          const GLfloat *params)
172 {
173 
174     ANGLE_VALIDATE_IS_GLES1(context);
175 
176     if (!ValidateLightCaps(context, light))
177     {
178         return false;
179     }
180 
181     switch (pname)
182     {
183         case LightParameter::Ambient:
184         case LightParameter::Diffuse:
185         case LightParameter::Specular:
186         case LightParameter::Position:
187         case LightParameter::SpotDirection:
188             return true;
189         case LightParameter::SpotExponent:
190             if (params[0] < 0.0f || params[0] > 128.0f)
191             {
192                 context->validationError(GL_INVALID_VALUE, kLightParameterOutOfRange);
193                 return false;
194             }
195             return true;
196         case LightParameter::SpotCutoff:
197             if (params[0] == 180.0f)
198             {
199                 return true;
200             }
201             if (params[0] < 0.0f || params[0] > 90.0f)
202             {
203                 context->validationError(GL_INVALID_VALUE, kLightParameterOutOfRange);
204                 return false;
205             }
206             return true;
207         case LightParameter::ConstantAttenuation:
208         case LightParameter::LinearAttenuation:
209         case LightParameter::QuadraticAttenuation:
210             if (params[0] < 0.0f)
211             {
212                 context->validationError(GL_INVALID_VALUE, kLightParameterOutOfRange);
213                 return false;
214             }
215             return true;
216         default:
217             context->validationError(GL_INVALID_ENUM, kInvalidLightParameter);
218             return false;
219     }
220 }
221 
ValidateLightSingleComponent(Context * context,GLenum light,LightParameter pname,GLfloat param)222 bool ValidateLightSingleComponent(Context *context,
223                                   GLenum light,
224                                   LightParameter pname,
225                                   GLfloat param)
226 {
227     if (!ValidateLightCommon(context, light, pname, &param))
228     {
229         return false;
230     }
231 
232     if (GetLightParameterCount(pname) > 1)
233     {
234         context->validationError(GL_INVALID_ENUM, kInvalidLightParameter);
235         return false;
236     }
237 
238     return true;
239 }
240 
ValidateMaterialCommon(Context * context,GLenum face,MaterialParameter pname,const GLfloat * params)241 bool ValidateMaterialCommon(Context *context,
242                             GLenum face,
243                             MaterialParameter pname,
244                             const GLfloat *params)
245 {
246     switch (pname)
247     {
248         case MaterialParameter::Ambient:
249         case MaterialParameter::Diffuse:
250         case MaterialParameter::Specular:
251         case MaterialParameter::Emission:
252             return true;
253         case MaterialParameter::Shininess:
254             if (params[0] < 0.0f || params[0] > 128.0f)
255             {
256                 context->validationError(GL_INVALID_VALUE, kMaterialParameterOutOfRange);
257                 return false;
258             }
259             return true;
260         default:
261             context->validationError(GL_INVALID_ENUM, kInvalidMaterialParameter);
262             return false;
263     }
264 }
265 
ValidateMaterialSetting(Context * context,GLenum face,MaterialParameter pname,const GLfloat * params)266 bool ValidateMaterialSetting(Context *context,
267                              GLenum face,
268                              MaterialParameter pname,
269                              const GLfloat *params)
270 {
271     ANGLE_VALIDATE_IS_GLES1(context);
272 
273     if (face != GL_FRONT_AND_BACK)
274     {
275         context->validationError(GL_INVALID_ENUM, kInvalidMaterialFace);
276         return false;
277     }
278 
279     return ValidateMaterialCommon(context, face, pname, params);
280 }
281 
ValidateMaterialQuery(Context * context,GLenum face,MaterialParameter pname)282 bool ValidateMaterialQuery(Context *context, GLenum face, MaterialParameter pname)
283 {
284     ANGLE_VALIDATE_IS_GLES1(context);
285 
286     if (face != GL_FRONT && face != GL_BACK)
287     {
288         context->validationError(GL_INVALID_ENUM, kInvalidMaterialFace);
289         return false;
290     }
291 
292     GLfloat dummyParams[4] = {0.0f, 0.0f, 0.0f, 0.0f};
293 
294     return ValidateMaterialCommon(context, face, pname, dummyParams);
295 }
296 
ValidateMaterialSingleComponent(Context * context,GLenum face,MaterialParameter pname,GLfloat param)297 bool ValidateMaterialSingleComponent(Context *context,
298                                      GLenum face,
299                                      MaterialParameter pname,
300                                      GLfloat param)
301 {
302     if (!ValidateMaterialSetting(context, face, pname, &param))
303     {
304         return false;
305     }
306 
307     if (GetMaterialParameterCount(pname) > 1)
308     {
309         context->validationError(GL_INVALID_ENUM, kInvalidMaterialParameter);
310         return false;
311     }
312 
313     return true;
314 }
315 
ValidateLightModelCommon(Context * context,GLenum pname)316 bool ValidateLightModelCommon(Context *context, GLenum pname)
317 {
318     ANGLE_VALIDATE_IS_GLES1(context);
319     switch (pname)
320     {
321         case GL_LIGHT_MODEL_AMBIENT:
322         case GL_LIGHT_MODEL_TWO_SIDE:
323             return true;
324         default:
325             context->validationError(GL_INVALID_ENUM, kInvalidLightModelParameter);
326             return false;
327     }
328 }
329 
ValidateLightModelSingleComponent(Context * context,GLenum pname)330 bool ValidateLightModelSingleComponent(Context *context, GLenum pname)
331 {
332     if (!ValidateLightModelCommon(context, pname))
333     {
334         return false;
335     }
336 
337     switch (pname)
338     {
339         case GL_LIGHT_MODEL_TWO_SIDE:
340             return true;
341         default:
342             context->validationError(GL_INVALID_ENUM, kInvalidLightModelParameter);
343             return false;
344     }
345 }
346 
ValidateClipPlaneCommon(Context * context,GLenum plane)347 bool ValidateClipPlaneCommon(Context *context, GLenum plane)
348 {
349     ANGLE_VALIDATE_IS_GLES1(context);
350 
351     if (plane < GL_CLIP_PLANE0 || plane >= GL_CLIP_PLANE0 + context->getCaps().maxClipPlanes)
352     {
353         context->validationError(GL_INVALID_ENUM, kInvalidClipPlane);
354         return false;
355     }
356 
357     return true;
358 }
359 
ValidateFogCommon(Context * context,GLenum pname,const GLfloat * params)360 bool ValidateFogCommon(Context *context, GLenum pname, const GLfloat *params)
361 {
362     ANGLE_VALIDATE_IS_GLES1(context);
363 
364     switch (pname)
365     {
366         case GL_FOG_MODE:
367         {
368             GLenum modeParam = static_cast<GLenum>(params[0]);
369             switch (modeParam)
370             {
371                 case GL_EXP:
372                 case GL_EXP2:
373                 case GL_LINEAR:
374                     return true;
375                 default:
376                     context->validationError(GL_INVALID_VALUE, kInvalidFogMode);
377                     return false;
378             }
379         }
380         break;
381         case GL_FOG_START:
382         case GL_FOG_END:
383         case GL_FOG_COLOR:
384             break;
385         case GL_FOG_DENSITY:
386             if (params[0] < 0.0f)
387             {
388                 context->validationError(GL_INVALID_VALUE, kInvalidFogDensity);
389                 return false;
390             }
391             break;
392         default:
393             context->validationError(GL_INVALID_ENUM, kInvalidFogParameter);
394             return false;
395     }
396     return true;
397 }
398 
ValidateTexEnvCommon(Context * context,TextureEnvTarget target,TextureEnvParameter pname,const GLfloat * params)399 bool ValidateTexEnvCommon(Context *context,
400                           TextureEnvTarget target,
401                           TextureEnvParameter pname,
402                           const GLfloat *params)
403 {
404     ANGLE_VALIDATE_IS_GLES1(context);
405 
406     switch (target)
407     {
408         case TextureEnvTarget::Env:
409             switch (pname)
410             {
411                 case TextureEnvParameter::Mode:
412                 {
413                     TextureEnvMode mode = FromGLenum<TextureEnvMode>(ConvertToGLenum(params[0]));
414                     switch (mode)
415                     {
416                         case TextureEnvMode::Add:
417                         case TextureEnvMode::Blend:
418                         case TextureEnvMode::Combine:
419                         case TextureEnvMode::Decal:
420                         case TextureEnvMode::Modulate:
421                         case TextureEnvMode::Replace:
422                             break;
423                         default:
424                             context->validationError(GL_INVALID_VALUE, kInvalidTextureEnvMode);
425                             return false;
426                     }
427                     break;
428                 }
429                 case TextureEnvParameter::CombineRgb:
430                 case TextureEnvParameter::CombineAlpha:
431                 {
432                     TextureCombine combine = FromGLenum<TextureCombine>(ConvertToGLenum(params[0]));
433                     switch (combine)
434                     {
435                         case TextureCombine::Add:
436                         case TextureCombine::AddSigned:
437                         case TextureCombine::Interpolate:
438                         case TextureCombine::Modulate:
439                         case TextureCombine::Replace:
440                         case TextureCombine::Subtract:
441                             break;
442                         case TextureCombine::Dot3Rgb:
443                         case TextureCombine::Dot3Rgba:
444                             if (pname == TextureEnvParameter::CombineAlpha)
445                             {
446                                 context->validationError(GL_INVALID_VALUE, kInvalidTextureCombine);
447                                 return false;
448                             }
449                             break;
450                         default:
451                             context->validationError(GL_INVALID_VALUE, kInvalidTextureCombine);
452                             return false;
453                     }
454                     break;
455                 }
456                 case TextureEnvParameter::Src0Rgb:
457                 case TextureEnvParameter::Src1Rgb:
458                 case TextureEnvParameter::Src2Rgb:
459                 case TextureEnvParameter::Src0Alpha:
460                 case TextureEnvParameter::Src1Alpha:
461                 case TextureEnvParameter::Src2Alpha:
462                 {
463                     TextureSrc combine = FromGLenum<TextureSrc>(ConvertToGLenum(params[0]));
464                     switch (combine)
465                     {
466                         case TextureSrc::Constant:
467                         case TextureSrc::Previous:
468                         case TextureSrc::PrimaryColor:
469                         case TextureSrc::Texture:
470                             break;
471                         default:
472                             context->validationError(GL_INVALID_VALUE, kInvalidTextureCombineSrc);
473                             return false;
474                     }
475                     break;
476                 }
477                 case TextureEnvParameter::Op0Rgb:
478                 case TextureEnvParameter::Op1Rgb:
479                 case TextureEnvParameter::Op2Rgb:
480                 case TextureEnvParameter::Op0Alpha:
481                 case TextureEnvParameter::Op1Alpha:
482                 case TextureEnvParameter::Op2Alpha:
483                 {
484                     TextureOp operand = FromGLenum<TextureOp>(ConvertToGLenum(params[0]));
485                     switch (operand)
486                     {
487                         case TextureOp::SrcAlpha:
488                         case TextureOp::OneMinusSrcAlpha:
489                             break;
490                         case TextureOp::SrcColor:
491                         case TextureOp::OneMinusSrcColor:
492                             if (pname == TextureEnvParameter::Op0Alpha ||
493                                 pname == TextureEnvParameter::Op1Alpha ||
494                                 pname == TextureEnvParameter::Op2Alpha)
495                             {
496                                 context->validationError(GL_INVALID_VALUE, kInvalidTextureCombine);
497                                 return false;
498                             }
499                             break;
500                         default:
501                             context->validationError(GL_INVALID_VALUE, kInvalidTextureCombineOp);
502                             return false;
503                     }
504                     break;
505                 }
506                 case TextureEnvParameter::RgbScale:
507                 case TextureEnvParameter::AlphaScale:
508                     if (params[0] != 1.0f && params[0] != 2.0f && params[0] != 4.0f)
509                     {
510                         context->validationError(GL_INVALID_VALUE, kInvalidTextureEnvScale);
511                         return false;
512                     }
513                     break;
514                 case TextureEnvParameter::Color:
515                     break;
516                 default:
517                     context->validationError(GL_INVALID_ENUM, kInvalidTextureEnvParameter);
518                     return false;
519             }
520             break;
521         case TextureEnvTarget::PointSprite:
522             if (!context->getExtensions().pointSprite)
523             {
524                 context->validationError(GL_INVALID_ENUM, kInvalidTextureEnvTarget);
525                 return false;
526             }
527             switch (pname)
528             {
529                 case TextureEnvParameter::PointCoordReplace:
530                     break;
531                 default:
532                     context->validationError(GL_INVALID_ENUM, kInvalidTextureEnvParameter);
533                     return false;
534             }
535             break;
536         default:
537             context->validationError(GL_INVALID_ENUM, kInvalidTextureEnvTarget);
538             return false;
539     }
540     return true;
541 }
542 
ValidateGetTexEnvCommon(Context * context,TextureEnvTarget target,TextureEnvParameter pname)543 bool ValidateGetTexEnvCommon(Context *context, TextureEnvTarget target, TextureEnvParameter pname)
544 {
545     GLfloat dummy[4] = {};
546     switch (pname)
547     {
548         case TextureEnvParameter::Mode:
549             ConvertPackedEnum(TextureEnvMode::Add, dummy);
550             break;
551         case TextureEnvParameter::CombineRgb:
552         case TextureEnvParameter::CombineAlpha:
553             ConvertPackedEnum(TextureCombine::Add, dummy);
554             break;
555         case TextureEnvParameter::Src0Rgb:
556         case TextureEnvParameter::Src1Rgb:
557         case TextureEnvParameter::Src2Rgb:
558         case TextureEnvParameter::Src0Alpha:
559         case TextureEnvParameter::Src1Alpha:
560         case TextureEnvParameter::Src2Alpha:
561             ConvertPackedEnum(TextureSrc::Constant, dummy);
562             break;
563         case TextureEnvParameter::Op0Rgb:
564         case TextureEnvParameter::Op1Rgb:
565         case TextureEnvParameter::Op2Rgb:
566         case TextureEnvParameter::Op0Alpha:
567         case TextureEnvParameter::Op1Alpha:
568         case TextureEnvParameter::Op2Alpha:
569             ConvertPackedEnum(TextureOp::SrcAlpha, dummy);
570             break;
571         case TextureEnvParameter::RgbScale:
572         case TextureEnvParameter::AlphaScale:
573         case TextureEnvParameter::PointCoordReplace:
574             dummy[0] = 1.0f;
575             break;
576         default:
577             break;
578     }
579 
580     return ValidateTexEnvCommon(context, target, pname, dummy);
581 }
582 
ValidatePointParameterCommon(Context * context,PointParameter pname,const GLfloat * params)583 bool ValidatePointParameterCommon(Context *context, PointParameter pname, const GLfloat *params)
584 {
585     ANGLE_VALIDATE_IS_GLES1(context);
586 
587     switch (pname)
588     {
589         case PointParameter::PointSizeMin:
590         case PointParameter::PointSizeMax:
591         case PointParameter::PointFadeThresholdSize:
592         case PointParameter::PointDistanceAttenuation:
593             for (unsigned int i = 0; i < GetPointParameterCount(pname); i++)
594             {
595                 if (params[i] < 0.0f)
596                 {
597                     context->validationError(GL_INVALID_VALUE, kInvalidPointParameterValue);
598                     return false;
599                 }
600             }
601             break;
602         default:
603             context->validationError(GL_INVALID_ENUM, kInvalidPointParameter);
604             return false;
605     }
606 
607     return true;
608 }
609 
ValidatePointSizeCommon(Context * context,GLfloat size)610 bool ValidatePointSizeCommon(Context *context, GLfloat size)
611 {
612     ANGLE_VALIDATE_IS_GLES1(context);
613 
614     if (size <= 0.0f)
615     {
616         context->validationError(GL_INVALID_VALUE, kInvalidPointSizeValue);
617         return false;
618     }
619 
620     return true;
621 }
622 
ValidateDrawTexCommon(Context * context,float width,float height)623 bool ValidateDrawTexCommon(Context *context, float width, float height)
624 {
625     ANGLE_VALIDATE_IS_GLES1(context);
626 
627     if (width <= 0.0f || height <= 0.0f)
628     {
629         context->validationError(GL_INVALID_VALUE, kNonPositiveDrawTextureDimension);
630         return false;
631     }
632 
633     return true;
634 }
635 
636 }  // namespace gl
637 
638 namespace gl
639 {
640 
ValidateAlphaFunc(Context * context,AlphaTestFunc func,GLfloat ref)641 bool ValidateAlphaFunc(Context *context, AlphaTestFunc func, GLfloat ref)
642 {
643     ANGLE_VALIDATE_IS_GLES1(context);
644     return ValidateAlphaFuncCommon(context, func);
645 }
646 
ValidateAlphaFuncx(Context * context,AlphaTestFunc func,GLfixed ref)647 bool ValidateAlphaFuncx(Context *context, AlphaTestFunc func, GLfixed ref)
648 {
649     ANGLE_VALIDATE_IS_GLES1(context);
650     return ValidateAlphaFuncCommon(context, func);
651 }
652 
ValidateClearColorx(Context * context,GLfixed red,GLfixed green,GLfixed blue,GLfixed alpha)653 bool ValidateClearColorx(Context *context, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
654 {
655     UNIMPLEMENTED();
656     return true;
657 }
658 
ValidateClearDepthx(Context * context,GLfixed depth)659 bool ValidateClearDepthx(Context *context, GLfixed depth)
660 {
661     UNIMPLEMENTED();
662     return true;
663 }
664 
ValidateClientActiveTexture(Context * context,GLenum texture)665 bool ValidateClientActiveTexture(Context *context, GLenum texture)
666 {
667     ANGLE_VALIDATE_IS_GLES1(context);
668     return ValidateMultitextureUnit(context, texture);
669 }
670 
ValidateClipPlanef(Context * context,GLenum plane,const GLfloat * eqn)671 bool ValidateClipPlanef(Context *context, GLenum plane, const GLfloat *eqn)
672 {
673     return ValidateClipPlaneCommon(context, plane);
674 }
675 
ValidateClipPlanex(Context * context,GLenum plane,const GLfixed * equation)676 bool ValidateClipPlanex(Context *context, GLenum plane, const GLfixed *equation)
677 {
678     return ValidateClipPlaneCommon(context, plane);
679 }
680 
ValidateColor4f(Context * context,GLfloat red,GLfloat green,GLfloat blue,GLfloat alpha)681 bool ValidateColor4f(Context *context, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
682 {
683     ANGLE_VALIDATE_IS_GLES1(context);
684     return true;
685 }
686 
ValidateColor4ub(Context * context,GLubyte red,GLubyte green,GLubyte blue,GLubyte alpha)687 bool ValidateColor4ub(Context *context, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
688 {
689     ANGLE_VALIDATE_IS_GLES1(context);
690     return true;
691 }
692 
ValidateColor4x(Context * context,GLfixed red,GLfixed green,GLfixed blue,GLfixed alpha)693 bool ValidateColor4x(Context *context, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
694 {
695     ANGLE_VALIDATE_IS_GLES1(context);
696     return true;
697 }
698 
ValidateColorPointer(Context * context,GLint size,VertexAttribType type,GLsizei stride,const void * pointer)699 bool ValidateColorPointer(Context *context,
700                           GLint size,
701                           VertexAttribType type,
702                           GLsizei stride,
703                           const void *pointer)
704 {
705     return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::Color, size, type,
706                                                 stride, pointer);
707 }
708 
ValidateCullFace(Context * context,GLenum mode)709 bool ValidateCullFace(Context *context, GLenum mode)
710 {
711     UNIMPLEMENTED();
712     return true;
713 }
714 
ValidateDepthRangex(Context * context,GLfixed n,GLfixed f)715 bool ValidateDepthRangex(Context *context, GLfixed n, GLfixed f)
716 {
717     UNIMPLEMENTED();
718     return true;
719 }
720 
ValidateDisableClientState(Context * context,ClientVertexArrayType arrayType)721 bool ValidateDisableClientState(Context *context, ClientVertexArrayType arrayType)
722 {
723     return ValidateClientStateCommon(context, arrayType);
724 }
725 
ValidateEnableClientState(Context * context,ClientVertexArrayType arrayType)726 bool ValidateEnableClientState(Context *context, ClientVertexArrayType arrayType)
727 {
728     return ValidateClientStateCommon(context, arrayType);
729 }
730 
ValidateFogf(Context * context,GLenum pname,GLfloat param)731 bool ValidateFogf(Context *context, GLenum pname, GLfloat param)
732 {
733     return ValidateFogCommon(context, pname, &param);
734 }
735 
ValidateFogfv(Context * context,GLenum pname,const GLfloat * params)736 bool ValidateFogfv(Context *context, GLenum pname, const GLfloat *params)
737 {
738     return ValidateFogCommon(context, pname, params);
739 }
740 
ValidateFogx(Context * context,GLenum pname,GLfixed param)741 bool ValidateFogx(Context *context, GLenum pname, GLfixed param)
742 {
743     GLfloat asFloat = FixedToFloat(param);
744     return ValidateFogCommon(context, pname, &asFloat);
745 }
746 
ValidateFogxv(Context * context,GLenum pname,const GLfixed * params)747 bool ValidateFogxv(Context *context, GLenum pname, const GLfixed *params)
748 {
749     unsigned int paramCount = GetFogParameterCount(pname);
750     GLfloat paramsf[4]      = {};
751 
752     for (unsigned int i = 0; i < paramCount; i++)
753     {
754         paramsf[i] = FixedToFloat(params[i]);
755     }
756 
757     return ValidateFogCommon(context, pname, paramsf);
758 }
759 
ValidateFrustumf(Context * context,GLfloat l,GLfloat r,GLfloat b,GLfloat t,GLfloat n,GLfloat f)760 bool ValidateFrustumf(Context *context,
761                       GLfloat l,
762                       GLfloat r,
763                       GLfloat b,
764                       GLfloat t,
765                       GLfloat n,
766                       GLfloat f)
767 {
768     ANGLE_VALIDATE_IS_GLES1(context);
769     if (l == r || b == t || n == f || n <= 0.0f || f <= 0.0f)
770     {
771         context->validationError(GL_INVALID_VALUE, kInvalidProjectionMatrix);
772     }
773     return true;
774 }
775 
ValidateFrustumx(Context * context,GLfixed l,GLfixed r,GLfixed b,GLfixed t,GLfixed n,GLfixed f)776 bool ValidateFrustumx(Context *context,
777                       GLfixed l,
778                       GLfixed r,
779                       GLfixed b,
780                       GLfixed t,
781                       GLfixed n,
782                       GLfixed f)
783 {
784     ANGLE_VALIDATE_IS_GLES1(context);
785     if (l == r || b == t || n == f || n <= 0 || f <= 0)
786     {
787         context->validationError(GL_INVALID_VALUE, kInvalidProjectionMatrix);
788     }
789     return true;
790 }
791 
ValidateGetBufferParameteriv(Context * context,GLenum target,GLenum pname,GLint * params)792 bool ValidateGetBufferParameteriv(Context *context, GLenum target, GLenum pname, GLint *params)
793 {
794     UNIMPLEMENTED();
795     return true;
796 }
797 
ValidateGetClipPlanef(Context * context,GLenum plane,GLfloat * equation)798 bool ValidateGetClipPlanef(Context *context, GLenum plane, GLfloat *equation)
799 {
800     return ValidateClipPlaneCommon(context, plane);
801 }
802 
ValidateGetClipPlanex(Context * context,GLenum plane,GLfixed * equation)803 bool ValidateGetClipPlanex(Context *context, GLenum plane, GLfixed *equation)
804 {
805     return ValidateClipPlaneCommon(context, plane);
806 }
807 
ValidateGetFixedv(Context * context,GLenum pname,GLfixed * params)808 bool ValidateGetFixedv(Context *context, GLenum pname, GLfixed *params)
809 {
810     UNIMPLEMENTED();
811     return true;
812 }
813 
ValidateGetLightfv(Context * context,GLenum light,LightParameter pname,GLfloat * params)814 bool ValidateGetLightfv(Context *context, GLenum light, LightParameter pname, GLfloat *params)
815 {
816     GLfloat dummyParams[4] = {0.0f, 0.0f, 0.0f, 0.0f};
817     return ValidateLightCommon(context, light, pname, dummyParams);
818 }
819 
ValidateGetLightxv(Context * context,GLenum light,LightParameter pname,GLfixed * params)820 bool ValidateGetLightxv(Context *context, GLenum light, LightParameter pname, GLfixed *params)
821 {
822     GLfloat dummyParams[4] = {0.0f, 0.0f, 0.0f, 0.0f};
823     return ValidateLightCommon(context, light, pname, dummyParams);
824 }
825 
ValidateGetMaterialfv(Context * context,GLenum face,MaterialParameter pname,GLfloat * params)826 bool ValidateGetMaterialfv(Context *context, GLenum face, MaterialParameter pname, GLfloat *params)
827 {
828     return ValidateMaterialQuery(context, face, pname);
829 }
830 
ValidateGetMaterialxv(Context * context,GLenum face,MaterialParameter pname,GLfixed * params)831 bool ValidateGetMaterialxv(Context *context, GLenum face, MaterialParameter pname, GLfixed *params)
832 {
833     return ValidateMaterialQuery(context, face, pname);
834 }
835 
ValidateGetPointerv(Context * context,GLenum pname,void ** params)836 bool ValidateGetPointerv(Context *context, GLenum pname, void **params)
837 {
838     ANGLE_VALIDATE_IS_GLES1(context);
839     switch (pname)
840     {
841         case GL_VERTEX_ARRAY_POINTER:
842         case GL_NORMAL_ARRAY_POINTER:
843         case GL_COLOR_ARRAY_POINTER:
844         case GL_TEXTURE_COORD_ARRAY_POINTER:
845         case GL_POINT_SIZE_ARRAY_POINTER_OES:
846             return true;
847         default:
848             context->validationError(GL_INVALID_ENUM, kInvalidPointerQuery);
849             return false;
850     }
851 }
852 
ValidateGetTexEnvfv(Context * context,TextureEnvTarget target,TextureEnvParameter pname,GLfloat * params)853 bool ValidateGetTexEnvfv(Context *context,
854                          TextureEnvTarget target,
855                          TextureEnvParameter pname,
856                          GLfloat *params)
857 {
858     return ValidateGetTexEnvCommon(context, target, pname);
859 }
860 
ValidateGetTexEnviv(Context * context,TextureEnvTarget target,TextureEnvParameter pname,GLint * params)861 bool ValidateGetTexEnviv(Context *context,
862                          TextureEnvTarget target,
863                          TextureEnvParameter pname,
864                          GLint *params)
865 {
866     return ValidateGetTexEnvCommon(context, target, pname);
867 }
868 
ValidateGetTexEnvxv(Context * context,TextureEnvTarget target,TextureEnvParameter pname,GLfixed * params)869 bool ValidateGetTexEnvxv(Context *context,
870                          TextureEnvTarget target,
871                          TextureEnvParameter pname,
872                          GLfixed *params)
873 {
874     return ValidateGetTexEnvCommon(context, target, pname);
875 }
876 
ValidateGetTexParameterxv(Context * context,TextureType target,GLenum pname,GLfixed * params)877 bool ValidateGetTexParameterxv(Context *context, TextureType target, GLenum pname, GLfixed *params)
878 {
879     ANGLE_VALIDATE_IS_GLES1(context);
880 
881     if (!ValidateGetTexParameterBase(context, target, pname, nullptr))
882     {
883         return false;
884     }
885 
886     return true;
887 }
888 
ValidateLightModelf(Context * context,GLenum pname,GLfloat param)889 bool ValidateLightModelf(Context *context, GLenum pname, GLfloat param)
890 {
891     return ValidateLightModelSingleComponent(context, pname);
892 }
893 
ValidateLightModelfv(Context * context,GLenum pname,const GLfloat * params)894 bool ValidateLightModelfv(Context *context, GLenum pname, const GLfloat *params)
895 {
896     return ValidateLightModelCommon(context, pname);
897 }
898 
ValidateLightModelx(Context * context,GLenum pname,GLfixed param)899 bool ValidateLightModelx(Context *context, GLenum pname, GLfixed param)
900 {
901     return ValidateLightModelSingleComponent(context, pname);
902 }
903 
ValidateLightModelxv(Context * context,GLenum pname,const GLfixed * param)904 bool ValidateLightModelxv(Context *context, GLenum pname, const GLfixed *param)
905 {
906     return ValidateLightModelCommon(context, pname);
907 }
908 
ValidateLightf(Context * context,GLenum light,LightParameter pname,GLfloat param)909 bool ValidateLightf(Context *context, GLenum light, LightParameter pname, GLfloat param)
910 {
911     return ValidateLightSingleComponent(context, light, pname, param);
912 }
913 
ValidateLightfv(Context * context,GLenum light,LightParameter pname,const GLfloat * params)914 bool ValidateLightfv(Context *context, GLenum light, LightParameter pname, const GLfloat *params)
915 {
916     return ValidateLightCommon(context, light, pname, params);
917 }
918 
ValidateLightx(Context * context,GLenum light,LightParameter pname,GLfixed param)919 bool ValidateLightx(Context *context, GLenum light, LightParameter pname, GLfixed param)
920 {
921     return ValidateLightSingleComponent(context, light, pname, FixedToFloat(param));
922 }
923 
ValidateLightxv(Context * context,GLenum light,LightParameter pname,const GLfixed * params)924 bool ValidateLightxv(Context *context, GLenum light, LightParameter pname, const GLfixed *params)
925 {
926     GLfloat paramsf[4];
927     for (unsigned int i = 0; i < GetLightParameterCount(pname); i++)
928     {
929         paramsf[i] = FixedToFloat(params[i]);
930     }
931 
932     return ValidateLightCommon(context, light, pname, paramsf);
933 }
934 
ValidateLineWidthx(Context * context,GLfixed width)935 bool ValidateLineWidthx(Context *context, GLfixed width)
936 {
937     UNIMPLEMENTED();
938     return true;
939 }
940 
ValidateLoadIdentity(Context * context)941 bool ValidateLoadIdentity(Context *context)
942 {
943     ANGLE_VALIDATE_IS_GLES1(context);
944     return true;
945 }
946 
ValidateLoadMatrixf(Context * context,const GLfloat * m)947 bool ValidateLoadMatrixf(Context *context, const GLfloat *m)
948 {
949     ANGLE_VALIDATE_IS_GLES1(context);
950     return true;
951 }
952 
ValidateLoadMatrixx(Context * context,const GLfixed * m)953 bool ValidateLoadMatrixx(Context *context, const GLfixed *m)
954 {
955     ANGLE_VALIDATE_IS_GLES1(context);
956     return true;
957 }
958 
ValidateLogicOp(Context * context,LogicalOperation opcode)959 bool ValidateLogicOp(Context *context, LogicalOperation opcode)
960 {
961     ANGLE_VALIDATE_IS_GLES1(context);
962     switch (opcode)
963     {
964         case LogicalOperation::And:
965         case LogicalOperation::AndInverted:
966         case LogicalOperation::AndReverse:
967         case LogicalOperation::Clear:
968         case LogicalOperation::Copy:
969         case LogicalOperation::CopyInverted:
970         case LogicalOperation::Equiv:
971         case LogicalOperation::Invert:
972         case LogicalOperation::Nand:
973         case LogicalOperation::Noop:
974         case LogicalOperation::Nor:
975         case LogicalOperation::Or:
976         case LogicalOperation::OrInverted:
977         case LogicalOperation::OrReverse:
978         case LogicalOperation::Set:
979         case LogicalOperation::Xor:
980             return true;
981         default:
982             context->validationError(GL_INVALID_ENUM, kInvalidLogicOp);
983             return false;
984     }
985 }
986 
ValidateMaterialf(Context * context,GLenum face,MaterialParameter pname,GLfloat param)987 bool ValidateMaterialf(Context *context, GLenum face, MaterialParameter pname, GLfloat param)
988 {
989     return ValidateMaterialSingleComponent(context, face, pname, param);
990 }
991 
ValidateMaterialfv(Context * context,GLenum face,MaterialParameter pname,const GLfloat * params)992 bool ValidateMaterialfv(Context *context,
993                         GLenum face,
994                         MaterialParameter pname,
995                         const GLfloat *params)
996 {
997     return ValidateMaterialSetting(context, face, pname, params);
998 }
999 
ValidateMaterialx(Context * context,GLenum face,MaterialParameter pname,GLfixed param)1000 bool ValidateMaterialx(Context *context, GLenum face, MaterialParameter pname, GLfixed param)
1001 {
1002     return ValidateMaterialSingleComponent(context, face, pname, FixedToFloat(param));
1003 }
1004 
ValidateMaterialxv(Context * context,GLenum face,MaterialParameter pname,const GLfixed * params)1005 bool ValidateMaterialxv(Context *context,
1006                         GLenum face,
1007                         MaterialParameter pname,
1008                         const GLfixed *params)
1009 {
1010     GLfloat paramsf[4];
1011 
1012     for (unsigned int i = 0; i < GetMaterialParameterCount(pname); i++)
1013     {
1014         paramsf[i] = FixedToFloat(params[i]);
1015     }
1016 
1017     return ValidateMaterialSetting(context, face, pname, paramsf);
1018 }
1019 
ValidateMatrixMode(Context * context,MatrixType mode)1020 bool ValidateMatrixMode(Context *context, MatrixType mode)
1021 {
1022     ANGLE_VALIDATE_IS_GLES1(context);
1023     switch (mode)
1024     {
1025         case MatrixType::Projection:
1026         case MatrixType::Modelview:
1027         case MatrixType::Texture:
1028             return true;
1029         default:
1030             context->validationError(GL_INVALID_ENUM, kInvalidMatrixMode);
1031             return false;
1032     }
1033 }
1034 
ValidateMultMatrixf(Context * context,const GLfloat * m)1035 bool ValidateMultMatrixf(Context *context, const GLfloat *m)
1036 {
1037     ANGLE_VALIDATE_IS_GLES1(context);
1038     return true;
1039 }
1040 
ValidateMultMatrixx(Context * context,const GLfixed * m)1041 bool ValidateMultMatrixx(Context *context, const GLfixed *m)
1042 {
1043     ANGLE_VALIDATE_IS_GLES1(context);
1044     return true;
1045 }
1046 
ValidateMultiTexCoord4f(Context * context,GLenum target,GLfloat s,GLfloat t,GLfloat r,GLfloat q)1047 bool ValidateMultiTexCoord4f(Context *context,
1048                              GLenum target,
1049                              GLfloat s,
1050                              GLfloat t,
1051                              GLfloat r,
1052                              GLfloat q)
1053 {
1054     ANGLE_VALIDATE_IS_GLES1(context);
1055     return ValidateMultitextureUnit(context, target);
1056 }
1057 
ValidateMultiTexCoord4x(Context * context,GLenum target,GLfixed s,GLfixed t,GLfixed r,GLfixed q)1058 bool ValidateMultiTexCoord4x(Context *context,
1059                              GLenum target,
1060                              GLfixed s,
1061                              GLfixed t,
1062                              GLfixed r,
1063                              GLfixed q)
1064 {
1065     ANGLE_VALIDATE_IS_GLES1(context);
1066     return ValidateMultitextureUnit(context, target);
1067 }
1068 
ValidateNormal3f(Context * context,GLfloat nx,GLfloat ny,GLfloat nz)1069 bool ValidateNormal3f(Context *context, GLfloat nx, GLfloat ny, GLfloat nz)
1070 {
1071     ANGLE_VALIDATE_IS_GLES1(context);
1072     return true;
1073 }
1074 
ValidateNormal3x(Context * context,GLfixed nx,GLfixed ny,GLfixed nz)1075 bool ValidateNormal3x(Context *context, GLfixed nx, GLfixed ny, GLfixed nz)
1076 {
1077     ANGLE_VALIDATE_IS_GLES1(context);
1078     return true;
1079 }
1080 
ValidateNormalPointer(Context * context,VertexAttribType type,GLsizei stride,const void * pointer)1081 bool ValidateNormalPointer(Context *context,
1082                            VertexAttribType type,
1083                            GLsizei stride,
1084                            const void *pointer)
1085 {
1086     return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::Normal, 3, type,
1087                                                 stride, pointer);
1088 }
1089 
ValidateOrthof(Context * context,GLfloat l,GLfloat r,GLfloat b,GLfloat t,GLfloat n,GLfloat f)1090 bool ValidateOrthof(Context *context,
1091                     GLfloat l,
1092                     GLfloat r,
1093                     GLfloat b,
1094                     GLfloat t,
1095                     GLfloat n,
1096                     GLfloat f)
1097 {
1098     ANGLE_VALIDATE_IS_GLES1(context);
1099     if (l == r || b == t || n == f || n <= 0.0f || f <= 0.0f)
1100     {
1101         context->validationError(GL_INVALID_VALUE, kInvalidProjectionMatrix);
1102     }
1103     return true;
1104 }
1105 
ValidateOrthox(Context * context,GLfixed l,GLfixed r,GLfixed b,GLfixed t,GLfixed n,GLfixed f)1106 bool ValidateOrthox(Context *context,
1107                     GLfixed l,
1108                     GLfixed r,
1109                     GLfixed b,
1110                     GLfixed t,
1111                     GLfixed n,
1112                     GLfixed f)
1113 {
1114     ANGLE_VALIDATE_IS_GLES1(context);
1115     if (l == r || b == t || n == f || n <= 0 || f <= 0)
1116     {
1117         context->validationError(GL_INVALID_VALUE, kInvalidProjectionMatrix);
1118     }
1119     return true;
1120 }
1121 
ValidatePointParameterf(Context * context,PointParameter pname,GLfloat param)1122 bool ValidatePointParameterf(Context *context, PointParameter pname, GLfloat param)
1123 {
1124     unsigned int paramCount = GetPointParameterCount(pname);
1125     if (paramCount != 1)
1126     {
1127         context->validationError(GL_INVALID_ENUM, kInvalidPointParameter);
1128         return false;
1129     }
1130 
1131     return ValidatePointParameterCommon(context, pname, &param);
1132 }
1133 
ValidatePointParameterfv(Context * context,PointParameter pname,const GLfloat * params)1134 bool ValidatePointParameterfv(Context *context, PointParameter pname, const GLfloat *params)
1135 {
1136     return ValidatePointParameterCommon(context, pname, params);
1137 }
1138 
ValidatePointParameterx(Context * context,PointParameter pname,GLfixed param)1139 bool ValidatePointParameterx(Context *context, PointParameter pname, GLfixed param)
1140 {
1141     unsigned int paramCount = GetPointParameterCount(pname);
1142     if (paramCount != 1)
1143     {
1144         context->validationError(GL_INVALID_ENUM, kInvalidPointParameter);
1145         return false;
1146     }
1147 
1148     GLfloat paramf = FixedToFloat(param);
1149     return ValidatePointParameterCommon(context, pname, &paramf);
1150 }
1151 
ValidatePointParameterxv(Context * context,PointParameter pname,const GLfixed * params)1152 bool ValidatePointParameterxv(Context *context, PointParameter pname, const GLfixed *params)
1153 {
1154     GLfloat paramsf[4] = {};
1155     for (unsigned int i = 0; i < GetPointParameterCount(pname); i++)
1156     {
1157         paramsf[i] = FixedToFloat(params[i]);
1158     }
1159     return ValidatePointParameterCommon(context, pname, paramsf);
1160 }
1161 
ValidatePointSize(Context * context,GLfloat size)1162 bool ValidatePointSize(Context *context, GLfloat size)
1163 {
1164     return ValidatePointSizeCommon(context, size);
1165 }
1166 
ValidatePointSizex(Context * context,GLfixed size)1167 bool ValidatePointSizex(Context *context, GLfixed size)
1168 {
1169     return ValidatePointSizeCommon(context, FixedToFloat(size));
1170 }
1171 
ValidatePolygonOffsetx(Context * context,GLfixed factor,GLfixed units)1172 bool ValidatePolygonOffsetx(Context *context, GLfixed factor, GLfixed units)
1173 {
1174     UNIMPLEMENTED();
1175     return true;
1176 }
1177 
ValidatePopMatrix(Context * context)1178 bool ValidatePopMatrix(Context *context)
1179 {
1180     ANGLE_VALIDATE_IS_GLES1(context);
1181     const auto &stack = context->getState().gles1().currentMatrixStack();
1182     if (stack.size() == 1)
1183     {
1184         context->validationError(GL_STACK_UNDERFLOW, kMatrixStackUnderflow);
1185         return false;
1186     }
1187     return true;
1188 }
1189 
ValidatePushMatrix(Context * context)1190 bool ValidatePushMatrix(Context *context)
1191 {
1192     ANGLE_VALIDATE_IS_GLES1(context);
1193     const auto &stack = context->getState().gles1().currentMatrixStack();
1194     if (stack.size() == stack.max_size())
1195     {
1196         context->validationError(GL_STACK_OVERFLOW, kMatrixStackOverflow);
1197         return false;
1198     }
1199     return true;
1200 }
1201 
ValidateRotatef(Context * context,GLfloat angle,GLfloat x,GLfloat y,GLfloat z)1202 bool ValidateRotatef(Context *context, GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
1203 {
1204     ANGLE_VALIDATE_IS_GLES1(context);
1205     return true;
1206 }
1207 
ValidateRotatex(Context * context,GLfixed angle,GLfixed x,GLfixed y,GLfixed z)1208 bool ValidateRotatex(Context *context, GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
1209 {
1210     ANGLE_VALIDATE_IS_GLES1(context);
1211     return true;
1212 }
1213 
ValidateSampleCoveragex(Context * context,GLclampx value,GLboolean invert)1214 bool ValidateSampleCoveragex(Context *context, GLclampx value, GLboolean invert)
1215 {
1216     UNIMPLEMENTED();
1217     return true;
1218 }
1219 
ValidateScalef(Context * context,GLfloat x,GLfloat y,GLfloat z)1220 bool ValidateScalef(Context *context, GLfloat x, GLfloat y, GLfloat z)
1221 {
1222     ANGLE_VALIDATE_IS_GLES1(context);
1223     return true;
1224 }
1225 
ValidateScalex(Context * context,GLfixed x,GLfixed y,GLfixed z)1226 bool ValidateScalex(Context *context, GLfixed x, GLfixed y, GLfixed z)
1227 {
1228     ANGLE_VALIDATE_IS_GLES1(context);
1229     return true;
1230 }
1231 
ValidateShadeModel(Context * context,ShadingModel mode)1232 bool ValidateShadeModel(Context *context, ShadingModel mode)
1233 {
1234     ANGLE_VALIDATE_IS_GLES1(context);
1235     switch (mode)
1236     {
1237         case ShadingModel::Flat:
1238         case ShadingModel::Smooth:
1239             return true;
1240         default:
1241             context->validationError(GL_INVALID_ENUM, kInvalidShadingModel);
1242             return false;
1243     }
1244 }
1245 
ValidateTexCoordPointer(Context * context,GLint size,VertexAttribType type,GLsizei stride,const void * pointer)1246 bool ValidateTexCoordPointer(Context *context,
1247                              GLint size,
1248                              VertexAttribType type,
1249                              GLsizei stride,
1250                              const void *pointer)
1251 {
1252     return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::TextureCoord, size,
1253                                                 type, stride, pointer);
1254 }
1255 
ValidateTexEnvf(Context * context,TextureEnvTarget target,TextureEnvParameter pname,GLfloat param)1256 bool ValidateTexEnvf(Context *context,
1257                      TextureEnvTarget target,
1258                      TextureEnvParameter pname,
1259                      GLfloat param)
1260 {
1261     return ValidateTexEnvCommon(context, target, pname, &param);
1262 }
1263 
ValidateTexEnvfv(Context * context,TextureEnvTarget target,TextureEnvParameter pname,const GLfloat * params)1264 bool ValidateTexEnvfv(Context *context,
1265                       TextureEnvTarget target,
1266                       TextureEnvParameter pname,
1267                       const GLfloat *params)
1268 {
1269     return ValidateTexEnvCommon(context, target, pname, params);
1270 }
1271 
ValidateTexEnvi(Context * context,TextureEnvTarget target,TextureEnvParameter pname,GLint param)1272 bool ValidateTexEnvi(Context *context,
1273                      TextureEnvTarget target,
1274                      TextureEnvParameter pname,
1275                      GLint param)
1276 {
1277     GLfloat paramf = static_cast<GLfloat>(param);
1278     return ValidateTexEnvCommon(context, target, pname, &paramf);
1279 }
1280 
ValidateTexEnviv(Context * context,TextureEnvTarget target,TextureEnvParameter pname,const GLint * params)1281 bool ValidateTexEnviv(Context *context,
1282                       TextureEnvTarget target,
1283                       TextureEnvParameter pname,
1284                       const GLint *params)
1285 {
1286     GLfloat paramsf[4];
1287     for (unsigned int i = 0; i < GetTextureEnvParameterCount(pname); i++)
1288     {
1289         paramsf[i] = static_cast<GLfloat>(params[i]);
1290     }
1291     return ValidateTexEnvCommon(context, target, pname, paramsf);
1292 }
1293 
ValidateTexEnvx(Context * context,TextureEnvTarget target,TextureEnvParameter pname,GLfixed param)1294 bool ValidateTexEnvx(Context *context,
1295                      TextureEnvTarget target,
1296                      TextureEnvParameter pname,
1297                      GLfixed param)
1298 {
1299     GLfloat paramf = static_cast<GLfloat>(param);
1300     return ValidateTexEnvCommon(context, target, pname, &paramf);
1301 }
1302 
ValidateTexEnvxv(Context * context,TextureEnvTarget target,TextureEnvParameter pname,const GLfixed * params)1303 bool ValidateTexEnvxv(Context *context,
1304                       TextureEnvTarget target,
1305                       TextureEnvParameter pname,
1306                       const GLfixed *params)
1307 {
1308     GLfloat paramsf[4];
1309     for (unsigned int i = 0; i < GetTextureEnvParameterCount(pname); i++)
1310     {
1311         paramsf[i] = static_cast<GLfloat>(params[i]);
1312     }
1313     return ValidateTexEnvCommon(context, target, pname, paramsf);
1314 }
1315 
ValidateTexParameterx(Context * context,TextureType target,GLenum pname,GLfixed param)1316 bool ValidateTexParameterx(Context *context, TextureType target, GLenum pname, GLfixed param)
1317 {
1318     ANGLE_VALIDATE_IS_GLES1(context);
1319     GLfloat paramf = FixedToFloat(param);
1320     return ValidateTexParameterBase(context, target, pname, -1, false, &paramf);
1321 }
1322 
ValidateTexParameterxv(Context * context,TextureType target,GLenum pname,const GLfixed * params)1323 bool ValidateTexParameterxv(Context *context,
1324                             TextureType target,
1325                             GLenum pname,
1326                             const GLfixed *params)
1327 {
1328     ANGLE_VALIDATE_IS_GLES1(context);
1329     GLfloat paramsf[4] = {};
1330     for (unsigned int i = 0; i < GetTexParameterCount(pname); i++)
1331     {
1332         paramsf[i] = FixedToFloat(params[i]);
1333     }
1334     return ValidateTexParameterBase(context, target, pname, -1, true, paramsf);
1335 }
1336 
ValidateTranslatef(Context * context,GLfloat x,GLfloat y,GLfloat z)1337 bool ValidateTranslatef(Context *context, GLfloat x, GLfloat y, GLfloat z)
1338 {
1339     ANGLE_VALIDATE_IS_GLES1(context);
1340     return true;
1341 }
1342 
ValidateTranslatex(Context * context,GLfixed x,GLfixed y,GLfixed z)1343 bool ValidateTranslatex(Context *context, GLfixed x, GLfixed y, GLfixed z)
1344 {
1345     ANGLE_VALIDATE_IS_GLES1(context);
1346     return true;
1347 }
1348 
ValidateVertexPointer(Context * context,GLint size,VertexAttribType type,GLsizei stride,const void * pointer)1349 bool ValidateVertexPointer(Context *context,
1350                            GLint size,
1351                            VertexAttribType type,
1352                            GLsizei stride,
1353                            const void *pointer)
1354 {
1355     return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::Vertex, size, type,
1356                                                 stride, pointer);
1357 }
1358 
ValidateDrawTexfOES(Context * context,GLfloat x,GLfloat y,GLfloat z,GLfloat width,GLfloat height)1359 bool ValidateDrawTexfOES(Context *context,
1360                          GLfloat x,
1361                          GLfloat y,
1362                          GLfloat z,
1363                          GLfloat width,
1364                          GLfloat height)
1365 {
1366     return ValidateDrawTexCommon(context, width, height);
1367 }
1368 
ValidateDrawTexfvOES(Context * context,const GLfloat * coords)1369 bool ValidateDrawTexfvOES(Context *context, const GLfloat *coords)
1370 {
1371     return ValidateDrawTexCommon(context, coords[3], coords[4]);
1372 }
1373 
ValidateDrawTexiOES(Context * context,GLint x,GLint y,GLint z,GLint width,GLint height)1374 bool ValidateDrawTexiOES(Context *context, GLint x, GLint y, GLint z, GLint width, GLint height)
1375 {
1376     return ValidateDrawTexCommon(context, static_cast<GLfloat>(width),
1377                                  static_cast<GLfloat>(height));
1378 }
1379 
ValidateDrawTexivOES(Context * context,const GLint * coords)1380 bool ValidateDrawTexivOES(Context *context, const GLint *coords)
1381 {
1382     return ValidateDrawTexCommon(context, static_cast<GLfloat>(coords[3]),
1383                                  static_cast<GLfloat>(coords[4]));
1384 }
1385 
ValidateDrawTexsOES(Context * context,GLshort x,GLshort y,GLshort z,GLshort width,GLshort height)1386 bool ValidateDrawTexsOES(Context *context,
1387                          GLshort x,
1388                          GLshort y,
1389                          GLshort z,
1390                          GLshort width,
1391                          GLshort height)
1392 {
1393     return ValidateDrawTexCommon(context, static_cast<GLfloat>(width),
1394                                  static_cast<GLfloat>(height));
1395 }
1396 
ValidateDrawTexsvOES(Context * context,const GLshort * coords)1397 bool ValidateDrawTexsvOES(Context *context, const GLshort *coords)
1398 {
1399     return ValidateDrawTexCommon(context, static_cast<GLfloat>(coords[3]),
1400                                  static_cast<GLfloat>(coords[4]));
1401 }
1402 
ValidateDrawTexxOES(Context * context,GLfixed x,GLfixed y,GLfixed z,GLfixed width,GLfixed height)1403 bool ValidateDrawTexxOES(Context *context,
1404                          GLfixed x,
1405                          GLfixed y,
1406                          GLfixed z,
1407                          GLfixed width,
1408                          GLfixed height)
1409 {
1410     return ValidateDrawTexCommon(context, FixedToFloat(width), FixedToFloat(height));
1411 }
1412 
ValidateDrawTexxvOES(Context * context,const GLfixed * coords)1413 bool ValidateDrawTexxvOES(Context *context, const GLfixed *coords)
1414 {
1415     return ValidateDrawTexCommon(context, FixedToFloat(coords[3]), FixedToFloat(coords[4]));
1416 }
1417 
ValidateCurrentPaletteMatrixOES(Context * context,GLuint matrixpaletteindex)1418 bool ValidateCurrentPaletteMatrixOES(Context *context, GLuint matrixpaletteindex)
1419 {
1420     UNIMPLEMENTED();
1421     return true;
1422 }
1423 
ValidateLoadPaletteFromModelViewMatrixOES(Context * context)1424 bool ValidateLoadPaletteFromModelViewMatrixOES(Context *context)
1425 {
1426     UNIMPLEMENTED();
1427     return true;
1428 }
1429 
ValidateMatrixIndexPointerOES(Context * context,GLint size,GLenum type,GLsizei stride,const void * pointer)1430 bool ValidateMatrixIndexPointerOES(Context *context,
1431                                    GLint size,
1432                                    GLenum type,
1433                                    GLsizei stride,
1434                                    const void *pointer)
1435 {
1436     UNIMPLEMENTED();
1437     return true;
1438 }
1439 
ValidateWeightPointerOES(Context * context,GLint size,GLenum type,GLsizei stride,const void * pointer)1440 bool ValidateWeightPointerOES(Context *context,
1441                               GLint size,
1442                               GLenum type,
1443                               GLsizei stride,
1444                               const void *pointer)
1445 {
1446     UNIMPLEMENTED();
1447     return true;
1448 }
1449 
ValidatePointSizePointerOES(Context * context,VertexAttribType type,GLsizei stride,const void * pointer)1450 bool ValidatePointSizePointerOES(Context *context,
1451                                  VertexAttribType type,
1452                                  GLsizei stride,
1453                                  const void *pointer)
1454 {
1455     return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::PointSize, 1, type,
1456                                                 stride, pointer);
1457 }
1458 
ValidateQueryMatrixxOES(Context * context,GLfixed * mantissa,GLint * exponent)1459 bool ValidateQueryMatrixxOES(Context *context, GLfixed *mantissa, GLint *exponent)
1460 {
1461     UNIMPLEMENTED();
1462     return true;
1463 }
1464 
ValidateGenFramebuffersOES(Context * context,GLsizei n,GLuint * framebuffers)1465 bool ValidateGenFramebuffersOES(Context *context, GLsizei n, GLuint *framebuffers)
1466 {
1467     UNIMPLEMENTED();
1468     return true;
1469 }
1470 
ValidateDeleteFramebuffersOES(Context * context,GLsizei n,const GLuint * framebuffers)1471 bool ValidateDeleteFramebuffersOES(Context *context, GLsizei n, const GLuint *framebuffers)
1472 {
1473     UNIMPLEMENTED();
1474     return true;
1475 }
1476 
ValidateGenRenderbuffersOES(Context * context,GLsizei n,RenderbufferID * renderbuffers)1477 bool ValidateGenRenderbuffersOES(Context *context, GLsizei n, RenderbufferID *renderbuffers)
1478 {
1479     UNIMPLEMENTED();
1480     return true;
1481 }
1482 
ValidateDeleteRenderbuffersOES(Context * context,GLsizei n,const RenderbufferID * renderbuffers)1483 bool ValidateDeleteRenderbuffersOES(Context *context,
1484                                     GLsizei n,
1485                                     const RenderbufferID *renderbuffers)
1486 {
1487     UNIMPLEMENTED();
1488     return true;
1489 }
1490 
ValidateBindFramebufferOES(Context * context,GLenum target,GLuint framebuffer)1491 bool ValidateBindFramebufferOES(Context *context, GLenum target, GLuint framebuffer)
1492 {
1493     UNIMPLEMENTED();
1494     return true;
1495 }
1496 
ValidateBindRenderbufferOES(Context * context,GLenum target,RenderbufferID renderbuffer)1497 bool ValidateBindRenderbufferOES(Context *context, GLenum target, RenderbufferID renderbuffer)
1498 {
1499     UNIMPLEMENTED();
1500     return true;
1501 }
1502 
ValidateCheckFramebufferStatusOES(Context * context,GLenum target)1503 bool ValidateCheckFramebufferStatusOES(Context *context, GLenum target)
1504 {
1505     UNIMPLEMENTED();
1506     return true;
1507 }
1508 
ValidateFramebufferRenderbufferOES(Context * context,GLenum target,GLenum attachment,GLenum rbtarget,RenderbufferID renderbuffer)1509 bool ValidateFramebufferRenderbufferOES(Context *context,
1510                                         GLenum target,
1511                                         GLenum attachment,
1512                                         GLenum rbtarget,
1513                                         RenderbufferID renderbuffer)
1514 {
1515     UNIMPLEMENTED();
1516     return true;
1517 }
1518 
ValidateFramebufferTexture2DOES(Context * context,GLenum target,GLenum attachment,TextureTarget textarget,TextureID texture,GLint level)1519 bool ValidateFramebufferTexture2DOES(Context *context,
1520                                      GLenum target,
1521                                      GLenum attachment,
1522                                      TextureTarget textarget,
1523                                      TextureID texture,
1524                                      GLint level)
1525 {
1526     UNIMPLEMENTED();
1527     return true;
1528 }
1529 
ValidateGenerateMipmapOES(Context * context,TextureType target)1530 bool ValidateGenerateMipmapOES(Context *context, TextureType target)
1531 {
1532     UNIMPLEMENTED();
1533     return true;
1534 }
1535 
ValidateGetFramebufferAttachmentParameterivOES(Context * context,GLenum target,GLenum attachment,GLenum pname,GLint * params)1536 bool ValidateGetFramebufferAttachmentParameterivOES(Context *context,
1537                                                     GLenum target,
1538                                                     GLenum attachment,
1539                                                     GLenum pname,
1540                                                     GLint *params)
1541 {
1542     UNIMPLEMENTED();
1543     return true;
1544 }
1545 
ValidateGetRenderbufferParameterivOES(Context * context,GLenum target,GLenum pname,GLint * params)1546 bool ValidateGetRenderbufferParameterivOES(Context *context,
1547                                            GLenum target,
1548                                            GLenum pname,
1549                                            GLint *params)
1550 {
1551     UNIMPLEMENTED();
1552     return true;
1553 }
1554 
ValidateIsFramebufferOES(Context * context,GLuint framebuffer)1555 bool ValidateIsFramebufferOES(Context *context, GLuint framebuffer)
1556 {
1557     UNIMPLEMENTED();
1558     return true;
1559 }
1560 
ValidateIsRenderbufferOES(Context * context,RenderbufferID renderbuffer)1561 bool ValidateIsRenderbufferOES(Context *context, RenderbufferID renderbuffer)
1562 {
1563     UNIMPLEMENTED();
1564     return true;
1565 }
1566 
ValidateRenderbufferStorageOES(Context * context,GLenum target,GLenum internalformat,GLsizei width,GLsizei height)1567 bool ValidateRenderbufferStorageOES(Context *context,
1568                                     GLenum target,
1569                                     GLenum internalformat,
1570                                     GLsizei width,
1571                                     GLsizei height)
1572 {
1573     UNIMPLEMENTED();
1574     return true;
1575 }
1576 
1577 // GL_OES_texture_cube_map
1578 
ValidateGetTexGenfvOES(Context * context,GLenum coord,GLenum pname,GLfloat * params)1579 bool ValidateGetTexGenfvOES(Context *context, GLenum coord, GLenum pname, GLfloat *params)
1580 {
1581     UNIMPLEMENTED();
1582     return true;
1583 }
1584 
ValidateGetTexGenivOES(Context * context,GLenum coord,GLenum pname,int * params)1585 bool ValidateGetTexGenivOES(Context *context, GLenum coord, GLenum pname, int *params)
1586 {
1587     UNIMPLEMENTED();
1588     return true;
1589 }
1590 
ValidateGetTexGenxvOES(Context * context,GLenum coord,GLenum pname,GLfixed * params)1591 bool ValidateGetTexGenxvOES(Context *context, GLenum coord, GLenum pname, GLfixed *params)
1592 {
1593     UNIMPLEMENTED();
1594     return true;
1595 }
1596 
ValidateTexGenfvOES(Context * context,GLenum coord,GLenum pname,const GLfloat * params)1597 bool ValidateTexGenfvOES(Context *context, GLenum coord, GLenum pname, const GLfloat *params)
1598 {
1599     UNIMPLEMENTED();
1600     return true;
1601 }
1602 
ValidateTexGenivOES(Context * context,GLenum coord,GLenum pname,const GLint * param)1603 bool ValidateTexGenivOES(Context *context, GLenum coord, GLenum pname, const GLint *param)
1604 {
1605     UNIMPLEMENTED();
1606     return true;
1607 }
1608 
ValidateTexGenxvOES(Context * context,GLenum coord,GLenum pname,const GLint * param)1609 bool ValidateTexGenxvOES(Context *context, GLenum coord, GLenum pname, const GLint *param)
1610 {
1611     UNIMPLEMENTED();
1612     return true;
1613 }
1614 
ValidateTexGenfOES(Context * context,GLenum coord,GLenum pname,GLfloat param)1615 bool ValidateTexGenfOES(Context *context, GLenum coord, GLenum pname, GLfloat param)
1616 {
1617     UNIMPLEMENTED();
1618     return true;
1619 }
1620 
ValidateTexGeniOES(Context * context,GLenum coord,GLenum pname,GLint param)1621 bool ValidateTexGeniOES(Context *context, GLenum coord, GLenum pname, GLint param)
1622 {
1623     UNIMPLEMENTED();
1624     return true;
1625 }
1626 
ValidateTexGenxOES(Context * context,GLenum coord,GLenum pname,GLfixed param)1627 bool ValidateTexGenxOES(Context *context, GLenum coord, GLenum pname, GLfixed param)
1628 {
1629     UNIMPLEMENTED();
1630     return true;
1631 }
1632 
1633 }  // namespace gl
1634