blob: e463a050d8b532f171ad4a3a1f1ed2115371b03e [file] [log] [blame]
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001//
2// Copyright (c) 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.h"
10
11#include "common/debug.h"
Lingfeng Yang13b708f2018-03-21 12:14:10 -070012#include "libANGLE/Context.h"
13#include "libANGLE/ErrorStrings.h"
Lingfeng Yangd0febe72018-05-17 22:36:52 -070014#include "libANGLE/GLES1State.h"
Lingfeng Yang45b5a872018-06-07 11:33:25 -070015#include "libANGLE/queryconversions.h"
Lingfeng Yangd0febe72018-05-17 22:36:52 -070016#include "libANGLE/queryutils.h"
Lingfeng Yang038dd532018-03-29 17:31:52 -070017#include "libANGLE/validationES.h"
Lingfeng Yang13b708f2018-03-21 12:14:10 -070018
19#define ANGLE_VALIDATE_IS_GLES1(context) \
20 if (context->getClientMajorVersion() > 1) \
21 { \
22 ANGLE_VALIDATION_ERR(context, InvalidOperation(), GLES1Only); \
23 return false; \
24 }
25
Lingfeng Yang01074432018-04-16 10:19:51 -070026namespace gl
Lingfeng Yang13b708f2018-03-21 12:14:10 -070027{
28
Lingfeng Yangabb09f12018-04-16 10:43:53 -070029bool ValidateAlphaFuncCommon(Context *context, AlphaTestFunc func)
Lingfeng Yang13b708f2018-03-21 12:14:10 -070030{
31 switch (func)
32 {
Lingfeng Yangabb09f12018-04-16 10:43:53 -070033 case AlphaTestFunc::AlwaysPass:
34 case AlphaTestFunc::Equal:
35 case AlphaTestFunc::Gequal:
36 case AlphaTestFunc::Greater:
37 case AlphaTestFunc::Lequal:
38 case AlphaTestFunc::Less:
39 case AlphaTestFunc::Never:
40 case AlphaTestFunc::NotEqual:
Lingfeng Yang13b708f2018-03-21 12:14:10 -070041 return true;
42 default:
Lingfeng Yang01074432018-04-16 10:19:51 -070043 ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
Lingfeng Yang13b708f2018-03-21 12:14:10 -070044 return false;
45 }
46}
47
Lingfeng Yangabb09f12018-04-16 10:43:53 -070048bool ValidateClientStateCommon(Context *context, ClientVertexArrayType arrayType)
Lingfeng Yang01074432018-04-16 10:19:51 -070049{
50 ANGLE_VALIDATE_IS_GLES1(context);
51 switch (arrayType)
52 {
Lingfeng Yangabb09f12018-04-16 10:43:53 -070053 case ClientVertexArrayType::Vertex:
54 case ClientVertexArrayType::Normal:
55 case ClientVertexArrayType::Color:
56 case ClientVertexArrayType::TextureCoord:
Lingfeng Yang01074432018-04-16 10:19:51 -070057 return true;
Lingfeng Yangabb09f12018-04-16 10:43:53 -070058 case ClientVertexArrayType::PointSize:
Lingfeng Yang01074432018-04-16 10:19:51 -070059 if (!context->getExtensions().pointSizeArray)
60 {
61 ANGLE_VALIDATION_ERR(context, InvalidEnum(), PointSizeArrayExtensionNotEnabled);
62 return false;
63 }
64 return true;
65 default:
66 ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidClientState);
67 return false;
68 }
69}
70
Lingfeng Yangabb09f12018-04-16 10:43:53 -070071bool ValidateBuiltinVertexAttributeCommon(Context *context,
72 ClientVertexArrayType arrayType,
73 GLint size,
74 GLenum type,
75 GLsizei stride,
76 const void *pointer)
77{
78 ANGLE_VALIDATE_IS_GLES1(context);
79
80 if (stride < 0)
81 {
82 ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidVertexPointerStride);
83 return false;
84 }
85
86 int minSize = 1;
87 int maxSize = 4;
88
89 switch (arrayType)
90 {
91 case ClientVertexArrayType::Vertex:
92 case ClientVertexArrayType::TextureCoord:
93 minSize = 2;
94 maxSize = 4;
95 break;
96 case ClientVertexArrayType::Normal:
97 minSize = 3;
98 maxSize = 3;
99 break;
100 case ClientVertexArrayType::Color:
101 minSize = 4;
102 maxSize = 4;
103 break;
104 case ClientVertexArrayType::PointSize:
105 if (!context->getExtensions().pointSizeArray)
106 {
107 ANGLE_VALIDATION_ERR(context, InvalidEnum(), PointSizeArrayExtensionNotEnabled);
108 return false;
109 }
110
111 minSize = 1;
112 maxSize = 1;
113 break;
114 default:
115 UNREACHABLE();
116 return false;
117 }
118
119 if (size < minSize || size > maxSize)
120 {
121 ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidVertexPointerSize);
122 return false;
123 }
124
125 switch (type)
126 {
127 case GL_BYTE:
128 if (arrayType == ClientVertexArrayType::PointSize)
129 {
130 ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidVertexPointerType);
131 return false;
132 }
133 break;
134 case GL_SHORT:
135 if (arrayType == ClientVertexArrayType::PointSize ||
136 arrayType == ClientVertexArrayType::Color)
137 {
138 ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidVertexPointerType);
139 return false;
140 }
141 break;
142 case GL_FIXED:
143 case GL_FLOAT:
144 break;
145 default:
146 ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidVertexPointerType);
147 return false;
148 }
149
150 return true;
151}
152
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700153bool ValidateLightCaps(Context *context, GLenum light)
154{
155 if (light < GL_LIGHT0 || light >= GL_LIGHT0 + context->getCaps().maxLights)
156 {
157 ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidLight);
158 return false;
159 }
160
161 return true;
162}
163
164bool ValidateLightCommon(Context *context,
165 GLenum light,
166 LightParameter pname,
167 const GLfloat *params)
168{
169
170 ANGLE_VALIDATE_IS_GLES1(context);
171
172 if (!ValidateLightCaps(context, light))
173 {
174 return false;
175 }
176
177 switch (pname)
178 {
179 case LightParameter::Ambient:
180 case LightParameter::Diffuse:
181 case LightParameter::Specular:
182 case LightParameter::Position:
183 case LightParameter::SpotDirection:
184 return true;
185 case LightParameter::SpotExponent:
186 if (params[0] < 0.0f || params[0] > 128.0f)
187 {
188 ANGLE_VALIDATION_ERR(context, InvalidValue(), LightParameterOutOfRange);
189 return false;
190 }
191 return true;
192 case LightParameter::SpotCutoff:
193 if (params[0] == 180.0f)
194 {
195 return true;
196 }
197 if (params[0] < 0.0f || params[0] > 90.0f)
198 {
199 ANGLE_VALIDATION_ERR(context, InvalidValue(), LightParameterOutOfRange);
200 return false;
201 }
202 return true;
203 case LightParameter::ConstantAttenuation:
204 case LightParameter::LinearAttenuation:
205 case LightParameter::QuadraticAttenuation:
206 if (params[0] < 0.0f)
207 {
208 ANGLE_VALIDATION_ERR(context, InvalidValue(), LightParameterOutOfRange);
209 return false;
210 }
211 return true;
212 default:
213 ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidLightParameter);
214 return false;
215 }
216}
217
218bool ValidateLightSingleComponent(Context *context,
219 GLenum light,
220 LightParameter pname,
221 GLfloat param)
222{
223 if (!ValidateLightCommon(context, light, pname, &param))
224 {
225 return false;
226 }
227
228 if (GetLightParameterCount(pname) > 1)
229 {
230 ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidLightParameter);
231 return false;
232 }
233
234 return true;
235}
236
237bool ValidateMaterialCommon(Context *context,
238 GLenum face,
239 MaterialParameter pname,
240 const GLfloat *params)
241{
242 ANGLE_VALIDATE_IS_GLES1(context);
243
244 if (face != GL_FRONT_AND_BACK)
245 {
246 ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidMaterialFace);
247 return false;
248 }
249
250 switch (pname)
251 {
252 case MaterialParameter::Ambient:
253 case MaterialParameter::Diffuse:
254 case MaterialParameter::Specular:
255 case MaterialParameter::Emission:
256 return true;
257 case MaterialParameter::Shininess:
258 if (params[0] < 0.0f || params[0] > 128.0f)
259 {
260 ANGLE_VALIDATION_ERR(context, InvalidValue(), MaterialParameterOutOfRange);
261 return false;
262 }
263 return true;
264 default:
265 ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidMaterialParameter);
266 return false;
267 }
268}
269
270bool ValidateMaterialSingleComponent(Context *context,
271 GLenum face,
272 MaterialParameter pname,
273 GLfloat param)
274{
275 if (!ValidateMaterialCommon(context, face, pname, &param))
276 {
277 return false;
278 }
279
280 if (GetMaterialParameterCount(pname) > 1)
281 {
282 ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidMaterialParameter);
283 return false;
284 }
285
286 return true;
287}
288
289bool ValidateLightModelCommon(Context *context, GLenum pname)
290{
291 ANGLE_VALIDATE_IS_GLES1(context);
292 switch (pname)
293 {
294 case GL_LIGHT_MODEL_AMBIENT:
295 case GL_LIGHT_MODEL_TWO_SIDE:
296 return true;
297 default:
298 ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidLightModelParameter);
299 return false;
300 }
301}
302
303bool ValidateLightModelSingleComponent(Context *context, GLenum pname)
304{
305 if (!ValidateLightModelCommon(context, pname))
306 {
307 return false;
308 }
309
310 switch (pname)
311 {
312 case GL_LIGHT_MODEL_TWO_SIDE:
313 return true;
314 default:
315 ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidLightModelParameter);
316 return false;
317 }
318}
319
Lingfeng Yang060088a2018-05-30 20:40:57 -0700320bool ValidateClipPlaneCommon(Context *context, GLenum plane)
321{
322 ANGLE_VALIDATE_IS_GLES1(context);
323
324 if (plane < GL_CLIP_PLANE0 || plane >= GL_CLIP_PLANE0 + context->getCaps().maxClipPlanes)
325 {
326 ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidClipPlane);
327 return false;
328 }
329
330 return true;
331}
332
Lingfeng Yang7ba3f422018-06-01 09:43:04 -0700333bool ValidateFogCommon(Context *context, GLenum pname, const GLfloat *params)
334{
335 ANGLE_VALIDATE_IS_GLES1(context);
336
337 switch (pname)
338 {
339 case GL_FOG_MODE:
340 {
341 GLenum modeParam = static_cast<GLenum>(params[0]);
342 switch (modeParam)
343 {
344 case GL_EXP:
345 case GL_EXP2:
346 case GL_LINEAR:
347 return true;
348 default:
349 ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidFogMode);
350 return false;
351 }
352 }
353 break;
354 case GL_FOG_START:
355 case GL_FOG_END:
356 case GL_FOG_COLOR:
357 break;
358 case GL_FOG_DENSITY:
359 if (params[0] < 0.0f)
360 {
361 ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidFogDensity);
362 return false;
363 }
364 break;
365 default:
366 ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidFogParameter);
367 return false;
368 }
369 return true;
370}
371
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700372bool ValidateTexEnvCommon(Context *context,
373 TextureEnvTarget target,
374 TextureEnvParameter pname,
375 const GLfloat *params)
376{
377 ANGLE_VALIDATE_IS_GLES1(context);
378
Lingfeng Yang4004ae02018-06-13 09:29:00 -0700379 switch (target)
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700380 {
Lingfeng Yang4004ae02018-06-13 09:29:00 -0700381 case TextureEnvTarget::Env:
382 switch (pname)
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700383 {
Lingfeng Yang4004ae02018-06-13 09:29:00 -0700384 case TextureEnvParameter::Mode:
385 {
386 TextureEnvMode mode = FromGLenum<TextureEnvMode>(ConvertToGLenum(params[0]));
387 switch (mode)
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700388 {
Lingfeng Yang4004ae02018-06-13 09:29:00 -0700389 case TextureEnvMode::Add:
390 case TextureEnvMode::Blend:
391 case TextureEnvMode::Combine:
392 case TextureEnvMode::Decal:
393 case TextureEnvMode::Modulate:
394 case TextureEnvMode::Replace:
395 break;
396 default:
397 ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidTextureEnvMode);
398 return false;
399 }
400 break;
401 }
402 case TextureEnvParameter::CombineRgb:
403 case TextureEnvParameter::CombineAlpha:
404 {
405 TextureCombine combine = FromGLenum<TextureCombine>(ConvertToGLenum(params[0]));
406 switch (combine)
407 {
408 case TextureCombine::Add:
409 case TextureCombine::AddSigned:
410 case TextureCombine::Interpolate:
411 case TextureCombine::Modulate:
412 case TextureCombine::Replace:
413 case TextureCombine::Subtract:
414 break;
415 case TextureCombine::Dot3Rgb:
416 case TextureCombine::Dot3Rgba:
417 if (pname == TextureEnvParameter::CombineAlpha)
418 {
419 ANGLE_VALIDATION_ERR(context, InvalidValue(),
420 InvalidTextureCombine);
421 return false;
422 }
423 break;
424 default:
425 ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidTextureCombine);
426 return false;
427 }
428 break;
429 }
430 case TextureEnvParameter::Src0Rgb:
431 case TextureEnvParameter::Src1Rgb:
432 case TextureEnvParameter::Src2Rgb:
433 case TextureEnvParameter::Src0Alpha:
434 case TextureEnvParameter::Src1Alpha:
435 case TextureEnvParameter::Src2Alpha:
436 {
437 TextureSrc combine = FromGLenum<TextureSrc>(ConvertToGLenum(params[0]));
438 switch (combine)
439 {
440 case TextureSrc::Constant:
441 case TextureSrc::Previous:
442 case TextureSrc::PrimaryColor:
443 case TextureSrc::Texture:
444 break;
445 default:
446 ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidTextureCombineSrc);
447 return false;
448 }
449 break;
450 }
451 case TextureEnvParameter::Op0Rgb:
452 case TextureEnvParameter::Op1Rgb:
453 case TextureEnvParameter::Op2Rgb:
454 case TextureEnvParameter::Op0Alpha:
455 case TextureEnvParameter::Op1Alpha:
456 case TextureEnvParameter::Op2Alpha:
457 {
458 TextureOp operand = FromGLenum<TextureOp>(ConvertToGLenum(params[0]));
459 switch (operand)
460 {
461 case TextureOp::SrcAlpha:
462 case TextureOp::OneMinusSrcAlpha:
463 break;
464 case TextureOp::SrcColor:
465 case TextureOp::OneMinusSrcColor:
466 if (pname == TextureEnvParameter::Op0Alpha ||
467 pname == TextureEnvParameter::Op1Alpha ||
468 pname == TextureEnvParameter::Op2Alpha)
469 {
470 ANGLE_VALIDATION_ERR(context, InvalidValue(),
471 InvalidTextureCombine);
472 return false;
473 }
474 break;
475 default:
476 ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidTextureCombineOp);
477 return false;
478 }
479 break;
480 }
481 case TextureEnvParameter::RgbScale:
482 case TextureEnvParameter::AlphaScale:
483 if (params[0] != 1.0f && params[0] != 2.0f && params[0] != 4.0f)
484 {
485 ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidTextureEnvScale);
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700486 return false;
487 }
488 break;
Lingfeng Yang4004ae02018-06-13 09:29:00 -0700489 case TextureEnvParameter::Color:
490 break;
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700491 default:
Lingfeng Yang4004ae02018-06-13 09:29:00 -0700492 ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTextureEnvParameter);
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700493 return false;
494 }
495 break;
Lingfeng Yang4004ae02018-06-13 09:29:00 -0700496 case TextureEnvTarget::PointSprite:
497 if (!context->getExtensions().pointSprite)
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700498 {
Lingfeng Yang4004ae02018-06-13 09:29:00 -0700499 ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTextureEnvTarget);
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700500 return false;
501 }
Lingfeng Yang4004ae02018-06-13 09:29:00 -0700502 switch (pname)
503 {
504 case TextureEnvParameter::PointCoordReplace:
505 break;
506 default:
507 ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTextureEnvParameter);
508 return false;
509 }
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700510 break;
511 default:
Lingfeng Yang4004ae02018-06-13 09:29:00 -0700512 ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTextureEnvTarget);
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700513 return false;
514 }
515 return true;
516}
517
518bool ValidateGetTexEnvCommon(Context *context, TextureEnvTarget target, TextureEnvParameter pname)
519{
520 GLfloat dummy[4] = {};
521 switch (pname)
522 {
523 case TextureEnvParameter::Mode:
524 ConvertPackedEnum(TextureEnvMode::Add, dummy);
525 break;
526 case TextureEnvParameter::CombineRgb:
527 case TextureEnvParameter::CombineAlpha:
528 ConvertPackedEnum(TextureCombine::Add, dummy);
529 break;
530 case TextureEnvParameter::Src0Rgb:
531 case TextureEnvParameter::Src1Rgb:
532 case TextureEnvParameter::Src2Rgb:
533 case TextureEnvParameter::Src0Alpha:
534 case TextureEnvParameter::Src1Alpha:
535 case TextureEnvParameter::Src2Alpha:
536 ConvertPackedEnum(TextureSrc::Constant, dummy);
537 break;
538 case TextureEnvParameter::Op0Rgb:
539 case TextureEnvParameter::Op1Rgb:
540 case TextureEnvParameter::Op2Rgb:
541 case TextureEnvParameter::Op0Alpha:
542 case TextureEnvParameter::Op1Alpha:
543 case TextureEnvParameter::Op2Alpha:
544 ConvertPackedEnum(TextureOp::SrcAlpha, dummy);
545 break;
546 case TextureEnvParameter::RgbScale:
547 case TextureEnvParameter::AlphaScale:
Lingfeng Yang4004ae02018-06-13 09:29:00 -0700548 case TextureEnvParameter::PointCoordReplace:
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700549 dummy[0] = 1.0f;
550 break;
551 default:
552 break;
553 }
554
555 return ValidateTexEnvCommon(context, target, pname, dummy);
556}
557
Lingfeng Yang4004ae02018-06-13 09:29:00 -0700558bool ValidatePointParameterCommon(Context *context, PointParameter pname, const GLfloat *params)
559{
560 ANGLE_VALIDATE_IS_GLES1(context);
561
562 switch (pname)
563 {
564 case PointParameter::PointSizeMin:
565 case PointParameter::PointSizeMax:
566 case PointParameter::PointFadeThresholdSize:
567 case PointParameter::PointDistanceAttenuation:
568 for (unsigned int i = 0; i < GetPointParameterCount(pname); i++)
569 {
570 if (params[i] < 0.0f)
571 {
572 ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidPointParameterValue);
573 return false;
574 }
575 }
576 break;
577 default:
578 ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPointParameter);
579 return false;
580 }
581
582 return true;
583}
584
585bool ValidatePointSizeCommon(Context *context, GLfloat size)
586{
587 ANGLE_VALIDATE_IS_GLES1(context);
588
589 if (size <= 0.0f)
590 {
591 ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidPointSizeValue);
592 return false;
593 }
594
595 return true;
596}
597
Lingfeng Yang01074432018-04-16 10:19:51 -0700598} // namespace gl
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500599
600namespace gl
601{
602
Lingfeng Yang13b708f2018-03-21 12:14:10 -0700603bool ValidateAlphaFunc(Context *context, AlphaTestFunc func, GLfloat ref)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500604{
Lingfeng Yang13b708f2018-03-21 12:14:10 -0700605 ANGLE_VALIDATE_IS_GLES1(context);
606 return ValidateAlphaFuncCommon(context, func);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500607}
608
Lingfeng Yang13b708f2018-03-21 12:14:10 -0700609bool ValidateAlphaFuncx(Context *context, AlphaTestFunc func, GLfixed ref)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500610{
Lingfeng Yang13b708f2018-03-21 12:14:10 -0700611 ANGLE_VALIDATE_IS_GLES1(context);
612 return ValidateAlphaFuncCommon(context, func);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500613}
614
615bool ValidateClearColorx(Context *context, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
616{
617 UNIMPLEMENTED();
618 return true;
619}
620
621bool ValidateClearDepthx(Context *context, GLfixed depth)
622{
623 UNIMPLEMENTED();
624 return true;
625}
626
627bool ValidateClientActiveTexture(Context *context, GLenum texture)
628{
Lingfeng Yang96310cd2018-03-28 11:56:28 -0700629 ANGLE_VALIDATE_IS_GLES1(context);
Lingfeng Yang038dd532018-03-29 17:31:52 -0700630 return ValidateMultitextureUnit(context, texture);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500631}
632
Lingfeng Yang060088a2018-05-30 20:40:57 -0700633bool ValidateClipPlanef(Context *context, GLenum plane, const GLfloat *eqn)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500634{
Lingfeng Yang060088a2018-05-30 20:40:57 -0700635 return ValidateClipPlaneCommon(context, plane);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500636}
637
638bool ValidateClipPlanex(Context *context, GLenum plane, const GLfixed *equation)
639{
Lingfeng Yang060088a2018-05-30 20:40:57 -0700640 return ValidateClipPlaneCommon(context, plane);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500641}
642
643bool ValidateColor4f(Context *context, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
644{
Lingfeng Yanga43994c2018-03-29 07:21:41 -0700645 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500646 return true;
647}
648
649bool ValidateColor4ub(Context *context, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
650{
Lingfeng Yanga43994c2018-03-29 07:21:41 -0700651 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500652 return true;
653}
654
655bool ValidateColor4x(Context *context, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
656{
Lingfeng Yanga43994c2018-03-29 07:21:41 -0700657 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500658 return true;
659}
660
661bool ValidateColorPointer(Context *context,
662 GLint size,
663 GLenum type,
664 GLsizei stride,
665 const void *pointer)
666{
Lingfeng Yangabb09f12018-04-16 10:43:53 -0700667 return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::Color, size, type,
668 stride, pointer);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500669}
670
671bool ValidateCullFace(Context *context, GLenum mode)
672{
673 UNIMPLEMENTED();
674 return true;
675}
676
677bool ValidateDepthRangex(Context *context, GLfixed n, GLfixed f)
678{
679 UNIMPLEMENTED();
680 return true;
681}
682
Lingfeng Yang01074432018-04-16 10:19:51 -0700683bool ValidateDisableClientState(Context *context, ClientVertexArrayType arrayType)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500684{
Lingfeng Yang01074432018-04-16 10:19:51 -0700685 return ValidateClientStateCommon(context, arrayType);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500686}
687
Lingfeng Yang01074432018-04-16 10:19:51 -0700688bool ValidateEnableClientState(Context *context, ClientVertexArrayType arrayType)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500689{
Lingfeng Yang01074432018-04-16 10:19:51 -0700690 return ValidateClientStateCommon(context, arrayType);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500691}
692
693bool ValidateFogf(Context *context, GLenum pname, GLfloat param)
694{
Lingfeng Yang7ba3f422018-06-01 09:43:04 -0700695 return ValidateFogCommon(context, pname, &param);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500696}
697
698bool ValidateFogfv(Context *context, GLenum pname, const GLfloat *params)
699{
Lingfeng Yang7ba3f422018-06-01 09:43:04 -0700700 return ValidateFogCommon(context, pname, params);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500701}
702
703bool ValidateFogx(Context *context, GLenum pname, GLfixed param)
704{
Lingfeng Yang7ba3f422018-06-01 09:43:04 -0700705 GLfloat asFloat = FixedToFloat(param);
706 return ValidateFogCommon(context, pname, &asFloat);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500707}
708
Lingfeng Yang7ba3f422018-06-01 09:43:04 -0700709bool ValidateFogxv(Context *context, GLenum pname, const GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500710{
Lingfeng Yang7ba3f422018-06-01 09:43:04 -0700711 unsigned int paramCount = GetFogParameterCount(pname);
712 GLfloat paramsf[4] = {};
713
714 for (unsigned int i = 0; i < paramCount; i++)
715 {
716 paramsf[i] = FixedToFloat(params[i]);
717 }
718
719 return ValidateFogCommon(context, pname, paramsf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500720}
721
722bool ValidateFrustumf(Context *context,
723 GLfloat l,
724 GLfloat r,
725 GLfloat b,
726 GLfloat t,
727 GLfloat n,
728 GLfloat f)
729{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -0700730 ANGLE_VALIDATE_IS_GLES1(context);
731 if (l == r || b == t || n == f || n <= 0.0f || f <= 0.0f)
732 {
733 ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidProjectionMatrix);
734 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500735 return true;
736}
737
738bool ValidateFrustumx(Context *context,
739 GLfixed l,
740 GLfixed r,
741 GLfixed b,
742 GLfixed t,
743 GLfixed n,
744 GLfixed f)
745{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -0700746 ANGLE_VALIDATE_IS_GLES1(context);
747 if (l == r || b == t || n == f || n <= 0 || f <= 0)
748 {
749 ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidProjectionMatrix);
750 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500751 return true;
752}
753
754bool ValidateGetBufferParameteriv(Context *context, GLenum target, GLenum pname, GLint *params)
755{
756 UNIMPLEMENTED();
757 return true;
758}
759
760bool ValidateGetClipPlanef(Context *context, GLenum plane, GLfloat *equation)
761{
Lingfeng Yang060088a2018-05-30 20:40:57 -0700762 return ValidateClipPlaneCommon(context, plane);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500763}
764
765bool ValidateGetClipPlanex(Context *context, GLenum plane, GLfixed *equation)
766{
Lingfeng Yang060088a2018-05-30 20:40:57 -0700767 return ValidateClipPlaneCommon(context, plane);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500768}
769
770bool ValidateGetFixedv(Context *context, GLenum pname, GLfixed *params)
771{
772 UNIMPLEMENTED();
773 return true;
774}
775
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700776bool ValidateGetLightfv(Context *context, GLenum light, LightParameter pname, GLfloat *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500777{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700778 GLfloat dummyParams[4] = {0.0f, 0.0f, 0.0f, 0.0f};
779 return ValidateLightCommon(context, light, pname, dummyParams);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500780}
781
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700782bool ValidateGetLightxv(Context *context, GLenum light, LightParameter pname, GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500783{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700784 GLfloat dummyParams[4] = {0.0f, 0.0f, 0.0f, 0.0f};
785 return ValidateLightCommon(context, light, pname, dummyParams);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500786}
787
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700788bool ValidateGetMaterialfv(Context *context, GLenum face, MaterialParameter pname, GLfloat *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500789{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700790 GLfloat dummyParams[4] = {0.0f, 0.0f, 0.0f, 0.0f};
791 return ValidateMaterialCommon(context, face, pname, dummyParams);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500792}
793
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700794bool ValidateGetMaterialxv(Context *context, GLenum face, MaterialParameter pname, GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500795{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700796 GLfloat dummyParams[4] = {0.0f, 0.0f, 0.0f, 0.0f};
797 return ValidateMaterialCommon(context, face, pname, dummyParams);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500798}
799
800bool ValidateGetPointerv(Context *context, GLenum pname, void **params)
801{
Lingfeng Yangabb09f12018-04-16 10:43:53 -0700802 ANGLE_VALIDATE_IS_GLES1(context);
803 switch (pname)
804 {
805 case GL_VERTEX_ARRAY_POINTER:
806 case GL_NORMAL_ARRAY_POINTER:
807 case GL_COLOR_ARRAY_POINTER:
808 case GL_TEXTURE_COORD_ARRAY_POINTER:
809 case GL_POINT_SIZE_ARRAY_POINTER_OES:
810 return true;
811 default:
812 ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPointerQuery);
813 return false;
814 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500815}
816
Lingfeng Yang74be2962018-06-07 09:13:38 -0700817bool ValidateGetTexEnvfv(Context *context,
818 TextureEnvTarget target,
819 TextureEnvParameter pname,
820 GLfloat *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500821{
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700822 return ValidateGetTexEnvCommon(context, target, pname);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500823}
824
Lingfeng Yang74be2962018-06-07 09:13:38 -0700825bool ValidateGetTexEnviv(Context *context,
826 TextureEnvTarget target,
827 TextureEnvParameter pname,
828 GLint *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500829{
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700830 return ValidateGetTexEnvCommon(context, target, pname);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500831}
832
Lingfeng Yang74be2962018-06-07 09:13:38 -0700833bool ValidateGetTexEnvxv(Context *context,
834 TextureEnvTarget target,
835 TextureEnvParameter pname,
836 GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500837{
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700838 return ValidateGetTexEnvCommon(context, target, pname);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500839}
840
Corentin Wallezf0e89be2017-11-08 14:00:32 -0800841bool ValidateGetTexParameterxv(Context *context, TextureType target, GLenum pname, GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500842{
843 UNIMPLEMENTED();
844 return true;
845}
846
847bool ValidateLightModelf(Context *context, GLenum pname, GLfloat param)
848{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700849 return ValidateLightModelSingleComponent(context, pname);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500850}
851
852bool ValidateLightModelfv(Context *context, GLenum pname, const GLfloat *params)
853{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700854 return ValidateLightModelCommon(context, pname);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500855}
856
857bool ValidateLightModelx(Context *context, GLenum pname, GLfixed param)
858{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700859 return ValidateLightModelSingleComponent(context, pname);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500860}
861
862bool ValidateLightModelxv(Context *context, GLenum pname, const GLfixed *param)
863{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700864 return ValidateLightModelCommon(context, pname);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500865}
866
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700867bool ValidateLightf(Context *context, GLenum light, LightParameter pname, GLfloat param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500868{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700869 return ValidateLightSingleComponent(context, light, pname, param);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500870}
871
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700872bool ValidateLightfv(Context *context, GLenum light, LightParameter pname, const GLfloat *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500873{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700874 return ValidateLightCommon(context, light, pname, params);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500875}
876
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700877bool ValidateLightx(Context *context, GLenum light, LightParameter pname, GLfixed param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500878{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700879 return ValidateLightSingleComponent(context, light, pname, FixedToFloat(param));
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500880}
881
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700882bool ValidateLightxv(Context *context, GLenum light, LightParameter pname, const GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500883{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700884 GLfloat paramsf[4];
885 for (unsigned int i = 0; i < GetLightParameterCount(pname); i++)
886 {
887 paramsf[i] = FixedToFloat(params[i]);
888 }
889
890 return ValidateLightCommon(context, light, pname, paramsf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500891}
892
893bool ValidateLineWidthx(Context *context, GLfixed width)
894{
895 UNIMPLEMENTED();
896 return true;
897}
898
899bool ValidateLoadIdentity(Context *context)
900{
Lingfeng Yang3a41af62018-04-09 07:28:56 -0700901 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500902 return true;
903}
904
905bool ValidateLoadMatrixf(Context *context, const GLfloat *m)
906{
Lingfeng Yang3a41af62018-04-09 07:28:56 -0700907 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500908 return true;
909}
910
911bool ValidateLoadMatrixx(Context *context, const GLfixed *m)
912{
Lingfeng Yang3a41af62018-04-09 07:28:56 -0700913 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500914 return true;
915}
916
917bool ValidateLogicOp(Context *context, GLenum opcode)
918{
919 UNIMPLEMENTED();
920 return true;
921}
922
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700923bool ValidateMaterialf(Context *context, GLenum face, MaterialParameter pname, GLfloat param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500924{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700925 return ValidateMaterialSingleComponent(context, face, pname, param);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500926}
927
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700928bool ValidateMaterialfv(Context *context,
929 GLenum face,
930 MaterialParameter pname,
931 const GLfloat *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500932{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700933 return ValidateMaterialCommon(context, face, pname, params);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500934}
935
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700936bool ValidateMaterialx(Context *context, GLenum face, MaterialParameter pname, GLfixed param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500937{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700938 return ValidateMaterialSingleComponent(context, face, pname, FixedToFloat(param));
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500939}
940
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700941bool ValidateMaterialxv(Context *context,
942 GLenum face,
943 MaterialParameter pname,
944 const GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500945{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700946 GLfloat paramsf[4];
947
948 for (unsigned int i = 0; i < GetMaterialParameterCount(pname); i++)
949 {
950 paramsf[i] = FixedToFloat(params[i]);
951 }
952
953 return ValidateMaterialCommon(context, face, pname, paramsf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500954}
955
Lingfeng Yang00af4632018-04-02 12:42:24 -0700956bool ValidateMatrixMode(Context *context, MatrixType mode)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500957{
Lingfeng Yangd2488ab2018-04-04 09:25:48 -0700958 ANGLE_VALIDATE_IS_GLES1(context);
959 switch (mode)
960 {
961 case MatrixType::Projection:
962 case MatrixType::Modelview:
963 case MatrixType::Texture:
964 return true;
965 default:
966 ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidMatrixMode);
967 return false;
968 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500969}
970
971bool ValidateMultMatrixf(Context *context, const GLfloat *m)
972{
Lingfeng Yang568fc392018-04-09 07:57:23 -0700973 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500974 return true;
975}
976
977bool ValidateMultMatrixx(Context *context, const GLfixed *m)
978{
Lingfeng Yang568fc392018-04-09 07:57:23 -0700979 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500980 return true;
981}
982
983bool ValidateMultiTexCoord4f(Context *context,
984 GLenum target,
985 GLfloat s,
986 GLfloat t,
987 GLfloat r,
988 GLfloat q)
989{
Lingfeng Yang038dd532018-03-29 17:31:52 -0700990 ANGLE_VALIDATE_IS_GLES1(context);
991 return ValidateMultitextureUnit(context, target);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500992}
993
994bool ValidateMultiTexCoord4x(Context *context,
Lingfeng Yang038dd532018-03-29 17:31:52 -0700995 GLenum target,
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500996 GLfixed s,
997 GLfixed t,
998 GLfixed r,
999 GLfixed q)
1000{
Lingfeng Yang038dd532018-03-29 17:31:52 -07001001 ANGLE_VALIDATE_IS_GLES1(context);
1002 return ValidateMultitextureUnit(context, target);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001003}
1004
1005bool ValidateNormal3f(Context *context, GLfloat nx, GLfloat ny, GLfloat nz)
1006{
Lingfeng Yang5a7e61b2018-03-29 16:50:32 -07001007 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001008 return true;
1009}
1010
1011bool ValidateNormal3x(Context *context, GLfixed nx, GLfixed ny, GLfixed nz)
1012{
Lingfeng Yang5a7e61b2018-03-29 16:50:32 -07001013 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001014 return true;
1015}
1016
1017bool ValidateNormalPointer(Context *context, GLenum type, GLsizei stride, const void *pointer)
1018{
Lingfeng Yangabb09f12018-04-16 10:43:53 -07001019 return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::Normal, 3, type,
1020 stride, pointer);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001021}
1022
1023bool ValidateOrthof(Context *context,
1024 GLfloat l,
1025 GLfloat r,
1026 GLfloat b,
1027 GLfloat t,
1028 GLfloat n,
1029 GLfloat f)
1030{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001031 ANGLE_VALIDATE_IS_GLES1(context);
1032 if (l == r || b == t || n == f || n <= 0.0f || f <= 0.0f)
1033 {
1034 ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidProjectionMatrix);
1035 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001036 return true;
1037}
1038
1039bool ValidateOrthox(Context *context,
1040 GLfixed l,
1041 GLfixed r,
1042 GLfixed b,
1043 GLfixed t,
1044 GLfixed n,
1045 GLfixed f)
1046{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001047 ANGLE_VALIDATE_IS_GLES1(context);
1048 if (l == r || b == t || n == f || n <= 0 || f <= 0)
1049 {
1050 ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidProjectionMatrix);
1051 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001052 return true;
1053}
1054
Lingfeng Yang4004ae02018-06-13 09:29:00 -07001055bool ValidatePointParameterf(Context *context, PointParameter pname, GLfloat param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001056{
Lingfeng Yang4004ae02018-06-13 09:29:00 -07001057 unsigned int paramCount = GetPointParameterCount(pname);
1058 if (paramCount != 1)
1059 {
1060 ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPointParameter);
1061 }
1062
1063 return ValidatePointParameterCommon(context, pname, &param);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001064}
1065
Lingfeng Yang4004ae02018-06-13 09:29:00 -07001066bool ValidatePointParameterfv(Context *context, PointParameter pname, const GLfloat *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001067{
Lingfeng Yang4004ae02018-06-13 09:29:00 -07001068 return ValidatePointParameterCommon(context, pname, params);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001069}
1070
Lingfeng Yang4004ae02018-06-13 09:29:00 -07001071bool ValidatePointParameterx(Context *context, PointParameter pname, GLfixed param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001072{
Lingfeng Yang4004ae02018-06-13 09:29:00 -07001073 unsigned int paramCount = GetPointParameterCount(pname);
1074 if (paramCount != 1)
1075 {
1076 ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPointParameter);
1077 }
1078
1079 GLfloat paramf = FixedToFloat(param);
1080 return ValidatePointParameterCommon(context, pname, &paramf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001081}
1082
Lingfeng Yang4004ae02018-06-13 09:29:00 -07001083bool ValidatePointParameterxv(Context *context, PointParameter pname, const GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001084{
Lingfeng Yang4004ae02018-06-13 09:29:00 -07001085 GLfloat paramsf[4] = {};
1086 for (unsigned int i = 0; i < GetPointParameterCount(pname); i++)
1087 {
1088 paramsf[i] = FixedToFloat(params[i]);
1089 }
1090 return ValidatePointParameterCommon(context, pname, paramsf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001091}
1092
1093bool ValidatePointSize(Context *context, GLfloat size)
1094{
Lingfeng Yang4004ae02018-06-13 09:29:00 -07001095 return ValidatePointSizeCommon(context, size);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001096}
1097
1098bool ValidatePointSizex(Context *context, GLfixed size)
1099{
Lingfeng Yang4004ae02018-06-13 09:29:00 -07001100 return ValidatePointSizeCommon(context, FixedToFloat(size));
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001101}
1102
1103bool ValidatePolygonOffsetx(Context *context, GLfixed factor, GLfixed units)
1104{
1105 UNIMPLEMENTED();
1106 return true;
1107}
1108
1109bool ValidatePopMatrix(Context *context)
1110{
Lingfeng Yange547aac2018-04-05 09:39:20 -07001111 ANGLE_VALIDATE_IS_GLES1(context);
1112 const auto &stack = context->getGLState().gles1().currentMatrixStack();
1113 if (stack.size() == 1)
1114 {
1115 ANGLE_VALIDATION_ERR(context, StackUnderflow(), MatrixStackUnderflow);
1116 return false;
1117 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001118 return true;
1119}
1120
1121bool ValidatePushMatrix(Context *context)
1122{
Lingfeng Yange547aac2018-04-05 09:39:20 -07001123 ANGLE_VALIDATE_IS_GLES1(context);
1124 const auto &stack = context->getGLState().gles1().currentMatrixStack();
1125 if (stack.size() == stack.max_size())
1126 {
1127 ANGLE_VALIDATION_ERR(context, StackOverflow(), MatrixStackOverflow);
1128 return false;
1129 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001130 return true;
1131}
1132
1133bool ValidateRotatef(Context *context, GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
1134{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001135 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001136 return true;
1137}
1138
1139bool ValidateRotatex(Context *context, GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
1140{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001141 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001142 return true;
1143}
1144
1145bool ValidateSampleCoveragex(Context *context, GLclampx value, GLboolean invert)
1146{
1147 UNIMPLEMENTED();
1148 return true;
1149}
1150
1151bool ValidateScalef(Context *context, GLfloat x, GLfloat y, GLfloat z)
1152{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001153 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001154 return true;
1155}
1156
1157bool ValidateScalex(Context *context, GLfixed x, GLfixed y, GLfixed z)
1158{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001159 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001160 return true;
1161}
1162
Lingfeng Yanga0cfa872018-05-30 21:12:17 -07001163bool ValidateShadeModel(Context *context, ShadingModel mode)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001164{
Lingfeng Yanga0cfa872018-05-30 21:12:17 -07001165 ANGLE_VALIDATE_IS_GLES1(context);
1166 switch (mode)
1167 {
1168 case ShadingModel::Flat:
1169 case ShadingModel::Smooth:
1170 return true;
1171 default:
1172 ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidShadingModel);
1173 return false;
1174 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001175}
1176
1177bool ValidateTexCoordPointer(Context *context,
1178 GLint size,
1179 GLenum type,
1180 GLsizei stride,
1181 const void *pointer)
1182{
Lingfeng Yangabb09f12018-04-16 10:43:53 -07001183 return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::TextureCoord, size,
1184 type, stride, pointer);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001185}
1186
Lingfeng Yang74be2962018-06-07 09:13:38 -07001187bool ValidateTexEnvf(Context *context,
1188 TextureEnvTarget target,
1189 TextureEnvParameter pname,
1190 GLfloat param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001191{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001192 return ValidateTexEnvCommon(context, target, pname, &param);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001193}
1194
Lingfeng Yang74be2962018-06-07 09:13:38 -07001195bool ValidateTexEnvfv(Context *context,
1196 TextureEnvTarget target,
1197 TextureEnvParameter pname,
1198 const GLfloat *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001199{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001200 return ValidateTexEnvCommon(context, target, pname, params);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001201}
1202
Lingfeng Yang74be2962018-06-07 09:13:38 -07001203bool ValidateTexEnvi(Context *context,
1204 TextureEnvTarget target,
1205 TextureEnvParameter pname,
1206 GLint param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001207{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001208 GLfloat paramf = static_cast<GLfloat>(param);
1209 return ValidateTexEnvCommon(context, target, pname, &paramf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001210}
1211
Lingfeng Yang74be2962018-06-07 09:13:38 -07001212bool ValidateTexEnviv(Context *context,
1213 TextureEnvTarget target,
1214 TextureEnvParameter pname,
1215 const GLint *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001216{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001217 GLfloat paramsf[4];
1218 for (unsigned int i = 0; i < GetTextureEnvParameterCount(pname); i++)
1219 {
1220 paramsf[i] = static_cast<GLfloat>(params[i]);
1221 }
1222 return ValidateTexEnvCommon(context, target, pname, paramsf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001223}
1224
Lingfeng Yang74be2962018-06-07 09:13:38 -07001225bool ValidateTexEnvx(Context *context,
1226 TextureEnvTarget target,
1227 TextureEnvParameter pname,
1228 GLfixed param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001229{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001230 GLfloat paramf = static_cast<GLfloat>(param);
1231 return ValidateTexEnvCommon(context, target, pname, &paramf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001232}
1233
Lingfeng Yang74be2962018-06-07 09:13:38 -07001234bool ValidateTexEnvxv(Context *context,
1235 TextureEnvTarget target,
1236 TextureEnvParameter pname,
1237 const GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001238{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001239 GLfloat paramsf[4];
1240 for (unsigned int i = 0; i < GetTextureEnvParameterCount(pname); i++)
1241 {
1242 paramsf[i] = static_cast<GLfloat>(params[i]);
1243 }
1244 return ValidateTexEnvCommon(context, target, pname, paramsf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001245}
1246
Corentin Wallezf0e89be2017-11-08 14:00:32 -08001247bool ValidateTexParameterx(Context *context, TextureType target, GLenum pname, GLfixed param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001248{
1249 UNIMPLEMENTED();
1250 return true;
1251}
1252
Corentin Wallezf0e89be2017-11-08 14:00:32 -08001253bool ValidateTexParameterxv(Context *context,
1254 TextureType target,
1255 GLenum pname,
1256 const GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001257{
1258 UNIMPLEMENTED();
1259 return true;
1260}
1261
1262bool ValidateTranslatef(Context *context, GLfloat x, GLfloat y, GLfloat z)
1263{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001264 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001265 return true;
1266}
1267
1268bool ValidateTranslatex(Context *context, GLfixed x, GLfixed y, GLfixed z)
1269{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001270 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001271 return true;
1272}
1273
1274bool ValidateVertexPointer(Context *context,
1275 GLint size,
1276 GLenum type,
1277 GLsizei stride,
1278 const void *pointer)
1279{
Lingfeng Yangabb09f12018-04-16 10:43:53 -07001280 return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::Vertex, size, type,
1281 stride, pointer);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001282}
1283
1284bool ValidateDrawTexfOES(Context *context,
1285 GLfloat x,
1286 GLfloat y,
1287 GLfloat z,
1288 GLfloat width,
1289 GLfloat height)
1290{
1291 UNIMPLEMENTED();
1292 return true;
1293}
1294
1295bool ValidateDrawTexfvOES(Context *context, const GLfloat *coords)
1296{
1297 UNIMPLEMENTED();
1298 return true;
1299}
1300
1301bool ValidateDrawTexiOES(Context *context, GLint x, GLint y, GLint z, GLint width, GLint height)
1302{
1303 UNIMPLEMENTED();
1304 return true;
1305}
1306
1307bool ValidateDrawTexivOES(Context *context, const GLint *coords)
1308{
1309 UNIMPLEMENTED();
1310 return true;
1311}
1312
1313bool ValidateDrawTexsOES(Context *context,
1314 GLshort x,
1315 GLshort y,
1316 GLshort z,
1317 GLshort width,
1318 GLshort height)
1319{
1320 UNIMPLEMENTED();
1321 return true;
1322}
1323
1324bool ValidateDrawTexsvOES(Context *context, const GLshort *coords)
1325{
1326 UNIMPLEMENTED();
1327 return true;
1328}
1329
1330bool ValidateDrawTexxOES(Context *context,
1331 GLfixed x,
1332 GLfixed y,
1333 GLfixed z,
1334 GLfixed width,
1335 GLfixed height)
1336{
1337 UNIMPLEMENTED();
1338 return true;
1339}
1340
1341bool ValidateDrawTexxvOES(Context *context, const GLfixed *coords)
1342{
1343 UNIMPLEMENTED();
1344 return true;
1345}
1346
1347bool ValidateCurrentPaletteMatrixOES(Context *context, GLuint matrixpaletteindex)
1348{
1349 UNIMPLEMENTED();
1350 return true;
1351}
1352
1353bool ValidateLoadPaletteFromModelViewMatrixOES(Context *context)
1354{
1355 UNIMPLEMENTED();
1356 return true;
1357}
1358
1359bool ValidateMatrixIndexPointerOES(Context *context,
1360 GLint size,
1361 GLenum type,
1362 GLsizei stride,
1363 const void *pointer)
1364{
1365 UNIMPLEMENTED();
1366 return true;
1367}
1368
1369bool ValidateWeightPointerOES(Context *context,
1370 GLint size,
1371 GLenum type,
1372 GLsizei stride,
1373 const void *pointer)
1374{
1375 UNIMPLEMENTED();
1376 return true;
1377}
1378
1379bool ValidatePointSizePointerOES(Context *context, GLenum type, GLsizei stride, const void *pointer)
1380{
Lingfeng Yangabb09f12018-04-16 10:43:53 -07001381 return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::PointSize, 1, type,
1382 stride, pointer);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001383}
1384
1385bool ValidateQueryMatrixxOES(Context *context, GLfixed *mantissa, GLint *exponent)
1386{
1387 UNIMPLEMENTED();
1388 return true;
1389}
Lingfeng Yanga0648782018-03-12 14:45:25 -07001390
1391bool ValidateGenFramebuffersOES(Context *context, GLsizei n, GLuint *framebuffers)
1392{
1393 UNIMPLEMENTED();
1394 return true;
1395}
1396
1397bool ValidateDeleteFramebuffersOES(Context *context, GLsizei n, const GLuint *framebuffers)
1398{
1399 UNIMPLEMENTED();
1400 return true;
1401}
1402
1403bool ValidateGenRenderbuffersOES(Context *context, GLsizei n, GLuint *renderbuffers)
1404{
1405 UNIMPLEMENTED();
1406 return true;
1407}
1408
1409bool ValidateDeleteRenderbuffersOES(Context *context, GLsizei n, const GLuint *renderbuffers)
1410{
1411 UNIMPLEMENTED();
1412 return true;
1413}
1414
1415bool ValidateBindFramebufferOES(Context *context, GLenum target, GLuint framebuffer)
1416{
1417 UNIMPLEMENTED();
1418 return true;
1419}
1420
1421bool ValidateBindRenderbufferOES(Context *context, GLenum target, GLuint renderbuffer)
1422{
1423 UNIMPLEMENTED();
1424 return true;
1425}
1426
1427bool ValidateCheckFramebufferStatusOES(Context *context, GLenum target)
1428{
1429 UNIMPLEMENTED();
1430 return true;
1431}
1432
1433bool ValidateFramebufferRenderbufferOES(Context *context,
1434 GLenum target,
1435 GLenum attachment,
1436 GLenum rbtarget,
1437 GLuint renderbuffer)
1438{
1439 UNIMPLEMENTED();
1440 return true;
1441}
1442
1443bool ValidateFramebufferTexture2DOES(Context *context,
1444 GLenum target,
1445 GLenum attachment,
1446 TextureTarget textarget,
1447 GLuint texture,
1448 GLint level)
1449{
1450 UNIMPLEMENTED();
1451 return true;
1452}
1453
1454bool ValidateGenerateMipmapOES(Context *context, TextureType target)
1455{
1456 UNIMPLEMENTED();
1457 return true;
1458}
1459
1460bool ValidateGetFramebufferAttachmentParameterivOES(Context *context,
1461 GLenum target,
1462 GLenum attachment,
1463 GLenum pname,
1464 GLint *params)
1465{
1466 UNIMPLEMENTED();
1467 return true;
1468}
1469
1470bool ValidateGetRenderbufferParameterivOES(Context *context,
1471 GLenum target,
1472 GLenum pname,
1473 GLint *params)
1474{
1475 UNIMPLEMENTED();
1476 return true;
1477}
1478
1479bool ValidateIsFramebufferOES(Context *context, GLuint framebuffer)
1480{
1481 UNIMPLEMENTED();
1482 return true;
1483}
1484
1485bool ValidateIsRenderbufferOES(Context *context, GLuint renderbuffer)
1486{
1487 UNIMPLEMENTED();
1488 return true;
1489}
1490
1491bool ValidateRenderbufferStorageOES(Context *context,
1492 GLenum target,
1493 GLint internalformat,
1494 GLsizei width,
1495 GLsizei height)
1496{
1497 UNIMPLEMENTED();
1498 return true;
1499}
1500
1501// GL_OES_texture_cube_map
1502
1503bool ValidateGetTexGenfvOES(Context *context, GLenum coord, GLenum pname, GLfloat *params)
1504{
1505 UNIMPLEMENTED();
1506 return true;
1507}
1508
1509bool ValidateGetTexGenivOES(Context *context, GLenum coord, GLenum pname, int *params)
1510{
1511 UNIMPLEMENTED();
1512 return true;
1513}
1514
1515bool ValidateGetTexGenxvOES(Context *context, GLenum coord, GLenum pname, GLfixed *params)
1516{
1517 UNIMPLEMENTED();
1518 return true;
1519}
1520
1521bool ValidateTexGenfvOES(Context *context, GLenum coord, GLenum pname, const GLfloat *params)
1522{
1523 UNIMPLEMENTED();
1524 return true;
1525}
1526
1527bool ValidateTexGenivOES(Context *context, GLenum coord, GLenum pname, const GLint *param)
1528{
1529 UNIMPLEMENTED();
1530 return true;
1531}
1532
1533bool ValidateTexGenxvOES(Context *context, GLenum coord, GLenum pname, const GLint *param)
1534{
1535 UNIMPLEMENTED();
1536 return true;
1537}
1538
1539bool ValidateTexGenfOES(Context *context, GLenum coord, GLenum pname, GLfloat param)
1540{
1541 UNIMPLEMENTED();
1542 return true;
1543}
1544
1545bool ValidateTexGeniOES(Context *context, GLenum coord, GLenum pname, GLint param)
1546{
1547 UNIMPLEMENTED();
1548 return true;
1549}
1550
1551bool ValidateTexGenxOES(Context *context, GLenum coord, GLenum pname, GLfixed param)
1552{
1553 UNIMPLEMENTED();
1554 return true;
1555}
Lingfeng Yang01074432018-04-16 10:19:51 -07001556
1557} // namespace gl