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