blob: c34102bae8b68b0001ac7330f4203a68b0ae3989 [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 Yang9c4c0922018-06-13 09:29:00 -0700379 switch (target)
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700380 {
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700381 case TextureEnvTarget::Env:
382 switch (pname)
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700383 {
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700384 case TextureEnvParameter::Mode:
385 {
386 TextureEnvMode mode = FromGLenum<TextureEnvMode>(ConvertToGLenum(params[0]));
387 switch (mode)
Lingfeng Yang4004ae02018-06-13 09:29:00 -0700388 {
Lingfeng Yang9c4c0922018-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 Yang9c4c0922018-06-13 09:29:00 -0700489 case TextureEnvParameter::Color:
490 break;
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700491 default:
Lingfeng Yang9c4c0922018-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 Yang9c4c0922018-06-13 09:29:00 -0700496 case TextureEnvTarget::PointSprite:
497 if (!context->getExtensions().pointSprite)
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700498 {
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700499 ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTextureEnvTarget);
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700500 return false;
501 }
Lingfeng Yang9c4c0922018-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 Yang9c4c0922018-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 Yang9c4c0922018-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 Yang9c4c0922018-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 Yang9c4c0922018-06-13 09:29:00 -07001055bool ValidatePointParameterf(Context *context, PointParameter pname, GLfloat param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001056{
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001057 unsigned int paramCount = GetPointParameterCount(pname);
1058 if (paramCount != 1)
1059 {
1060 ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPointParameter);
1061 return false;
1062 }
1063
1064 return ValidatePointParameterCommon(context, pname, &param);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001065}
1066
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001067bool ValidatePointParameterfv(Context *context, PointParameter pname, const GLfloat *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001068{
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001069 return ValidatePointParameterCommon(context, pname, params);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001070}
1071
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001072bool ValidatePointParameterx(Context *context, PointParameter pname, GLfixed param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001073{
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001074 unsigned int paramCount = GetPointParameterCount(pname);
1075 if (paramCount != 1)
1076 {
1077 ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPointParameter);
1078 return false;
1079 }
1080
1081 GLfloat paramf = FixedToFloat(param);
1082 return ValidatePointParameterCommon(context, pname, &paramf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001083}
1084
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001085bool ValidatePointParameterxv(Context *context, PointParameter pname, const GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001086{
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001087 GLfloat paramsf[4] = {};
1088 for (unsigned int i = 0; i < GetPointParameterCount(pname); i++)
1089 {
1090 paramsf[i] = FixedToFloat(params[i]);
1091 }
1092 return ValidatePointParameterCommon(context, pname, paramsf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001093}
1094
1095bool ValidatePointSize(Context *context, GLfloat size)
1096{
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001097 return ValidatePointSizeCommon(context, size);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001098}
1099
1100bool ValidatePointSizex(Context *context, GLfixed size)
1101{
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001102 return ValidatePointSizeCommon(context, FixedToFloat(size));
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001103}
1104
1105bool ValidatePolygonOffsetx(Context *context, GLfixed factor, GLfixed units)
1106{
1107 UNIMPLEMENTED();
1108 return true;
1109}
1110
1111bool ValidatePopMatrix(Context *context)
1112{
Lingfeng Yange547aac2018-04-05 09:39:20 -07001113 ANGLE_VALIDATE_IS_GLES1(context);
1114 const auto &stack = context->getGLState().gles1().currentMatrixStack();
1115 if (stack.size() == 1)
1116 {
1117 ANGLE_VALIDATION_ERR(context, StackUnderflow(), MatrixStackUnderflow);
1118 return false;
1119 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001120 return true;
1121}
1122
1123bool ValidatePushMatrix(Context *context)
1124{
Lingfeng Yange547aac2018-04-05 09:39:20 -07001125 ANGLE_VALIDATE_IS_GLES1(context);
1126 const auto &stack = context->getGLState().gles1().currentMatrixStack();
1127 if (stack.size() == stack.max_size())
1128 {
1129 ANGLE_VALIDATION_ERR(context, StackOverflow(), MatrixStackOverflow);
1130 return false;
1131 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001132 return true;
1133}
1134
1135bool ValidateRotatef(Context *context, GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
1136{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001137 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001138 return true;
1139}
1140
1141bool ValidateRotatex(Context *context, GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
1142{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001143 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001144 return true;
1145}
1146
1147bool ValidateSampleCoveragex(Context *context, GLclampx value, GLboolean invert)
1148{
1149 UNIMPLEMENTED();
1150 return true;
1151}
1152
1153bool ValidateScalef(Context *context, GLfloat x, GLfloat y, GLfloat z)
1154{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001155 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001156 return true;
1157}
1158
1159bool ValidateScalex(Context *context, GLfixed x, GLfixed y, GLfixed z)
1160{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001161 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001162 return true;
1163}
1164
Lingfeng Yanga0cfa872018-05-30 21:12:17 -07001165bool ValidateShadeModel(Context *context, ShadingModel mode)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001166{
Lingfeng Yanga0cfa872018-05-30 21:12:17 -07001167 ANGLE_VALIDATE_IS_GLES1(context);
1168 switch (mode)
1169 {
1170 case ShadingModel::Flat:
1171 case ShadingModel::Smooth:
1172 return true;
1173 default:
1174 ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidShadingModel);
1175 return false;
1176 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001177}
1178
1179bool ValidateTexCoordPointer(Context *context,
1180 GLint size,
1181 GLenum type,
1182 GLsizei stride,
1183 const void *pointer)
1184{
Lingfeng Yangabb09f12018-04-16 10:43:53 -07001185 return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::TextureCoord, size,
1186 type, stride, pointer);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001187}
1188
Lingfeng Yang74be2962018-06-07 09:13:38 -07001189bool ValidateTexEnvf(Context *context,
1190 TextureEnvTarget target,
1191 TextureEnvParameter pname,
1192 GLfloat param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001193{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001194 return ValidateTexEnvCommon(context, target, pname, &param);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001195}
1196
Lingfeng Yang74be2962018-06-07 09:13:38 -07001197bool ValidateTexEnvfv(Context *context,
1198 TextureEnvTarget target,
1199 TextureEnvParameter pname,
1200 const GLfloat *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001201{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001202 return ValidateTexEnvCommon(context, target, pname, params);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001203}
1204
Lingfeng Yang74be2962018-06-07 09:13:38 -07001205bool ValidateTexEnvi(Context *context,
1206 TextureEnvTarget target,
1207 TextureEnvParameter pname,
1208 GLint param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001209{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001210 GLfloat paramf = static_cast<GLfloat>(param);
1211 return ValidateTexEnvCommon(context, target, pname, &paramf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001212}
1213
Lingfeng Yang74be2962018-06-07 09:13:38 -07001214bool ValidateTexEnviv(Context *context,
1215 TextureEnvTarget target,
1216 TextureEnvParameter pname,
1217 const GLint *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001218{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001219 GLfloat paramsf[4];
1220 for (unsigned int i = 0; i < GetTextureEnvParameterCount(pname); i++)
1221 {
1222 paramsf[i] = static_cast<GLfloat>(params[i]);
1223 }
1224 return ValidateTexEnvCommon(context, target, pname, paramsf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001225}
1226
Lingfeng Yang74be2962018-06-07 09:13:38 -07001227bool ValidateTexEnvx(Context *context,
1228 TextureEnvTarget target,
1229 TextureEnvParameter pname,
1230 GLfixed param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001231{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001232 GLfloat paramf = static_cast<GLfloat>(param);
1233 return ValidateTexEnvCommon(context, target, pname, &paramf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001234}
1235
Lingfeng Yang74be2962018-06-07 09:13:38 -07001236bool ValidateTexEnvxv(Context *context,
1237 TextureEnvTarget target,
1238 TextureEnvParameter pname,
1239 const GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001240{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001241 GLfloat paramsf[4];
1242 for (unsigned int i = 0; i < GetTextureEnvParameterCount(pname); i++)
1243 {
1244 paramsf[i] = static_cast<GLfloat>(params[i]);
1245 }
1246 return ValidateTexEnvCommon(context, target, pname, paramsf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001247}
1248
Corentin Wallezf0e89be2017-11-08 14:00:32 -08001249bool ValidateTexParameterx(Context *context, TextureType target, GLenum pname, GLfixed param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001250{
1251 UNIMPLEMENTED();
1252 return true;
1253}
1254
Corentin Wallezf0e89be2017-11-08 14:00:32 -08001255bool ValidateTexParameterxv(Context *context,
1256 TextureType target,
1257 GLenum pname,
1258 const GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001259{
1260 UNIMPLEMENTED();
1261 return true;
1262}
1263
1264bool ValidateTranslatef(Context *context, GLfloat x, GLfloat y, GLfloat z)
1265{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001266 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001267 return true;
1268}
1269
1270bool ValidateTranslatex(Context *context, GLfixed x, GLfixed y, GLfixed z)
1271{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001272 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001273 return true;
1274}
1275
1276bool ValidateVertexPointer(Context *context,
1277 GLint size,
1278 GLenum type,
1279 GLsizei stride,
1280 const void *pointer)
1281{
Lingfeng Yangabb09f12018-04-16 10:43:53 -07001282 return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::Vertex, size, type,
1283 stride, pointer);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001284}
1285
1286bool ValidateDrawTexfOES(Context *context,
1287 GLfloat x,
1288 GLfloat y,
1289 GLfloat z,
1290 GLfloat width,
1291 GLfloat height)
1292{
1293 UNIMPLEMENTED();
1294 return true;
1295}
1296
1297bool ValidateDrawTexfvOES(Context *context, const GLfloat *coords)
1298{
1299 UNIMPLEMENTED();
1300 return true;
1301}
1302
1303bool ValidateDrawTexiOES(Context *context, GLint x, GLint y, GLint z, GLint width, GLint height)
1304{
1305 UNIMPLEMENTED();
1306 return true;
1307}
1308
1309bool ValidateDrawTexivOES(Context *context, const GLint *coords)
1310{
1311 UNIMPLEMENTED();
1312 return true;
1313}
1314
1315bool ValidateDrawTexsOES(Context *context,
1316 GLshort x,
1317 GLshort y,
1318 GLshort z,
1319 GLshort width,
1320 GLshort height)
1321{
1322 UNIMPLEMENTED();
1323 return true;
1324}
1325
1326bool ValidateDrawTexsvOES(Context *context, const GLshort *coords)
1327{
1328 UNIMPLEMENTED();
1329 return true;
1330}
1331
1332bool ValidateDrawTexxOES(Context *context,
1333 GLfixed x,
1334 GLfixed y,
1335 GLfixed z,
1336 GLfixed width,
1337 GLfixed height)
1338{
1339 UNIMPLEMENTED();
1340 return true;
1341}
1342
1343bool ValidateDrawTexxvOES(Context *context, const GLfixed *coords)
1344{
1345 UNIMPLEMENTED();
1346 return true;
1347}
1348
1349bool ValidateCurrentPaletteMatrixOES(Context *context, GLuint matrixpaletteindex)
1350{
1351 UNIMPLEMENTED();
1352 return true;
1353}
1354
1355bool ValidateLoadPaletteFromModelViewMatrixOES(Context *context)
1356{
1357 UNIMPLEMENTED();
1358 return true;
1359}
1360
1361bool ValidateMatrixIndexPointerOES(Context *context,
1362 GLint size,
1363 GLenum type,
1364 GLsizei stride,
1365 const void *pointer)
1366{
1367 UNIMPLEMENTED();
1368 return true;
1369}
1370
1371bool ValidateWeightPointerOES(Context *context,
1372 GLint size,
1373 GLenum type,
1374 GLsizei stride,
1375 const void *pointer)
1376{
1377 UNIMPLEMENTED();
1378 return true;
1379}
1380
1381bool ValidatePointSizePointerOES(Context *context, GLenum type, GLsizei stride, const void *pointer)
1382{
Lingfeng Yangabb09f12018-04-16 10:43:53 -07001383 return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::PointSize, 1, type,
1384 stride, pointer);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001385}
1386
1387bool ValidateQueryMatrixxOES(Context *context, GLfixed *mantissa, GLint *exponent)
1388{
1389 UNIMPLEMENTED();
1390 return true;
1391}
Lingfeng Yanga0648782018-03-12 14:45:25 -07001392
1393bool ValidateGenFramebuffersOES(Context *context, GLsizei n, GLuint *framebuffers)
1394{
1395 UNIMPLEMENTED();
1396 return true;
1397}
1398
1399bool ValidateDeleteFramebuffersOES(Context *context, GLsizei n, const GLuint *framebuffers)
1400{
1401 UNIMPLEMENTED();
1402 return true;
1403}
1404
1405bool ValidateGenRenderbuffersOES(Context *context, GLsizei n, GLuint *renderbuffers)
1406{
1407 UNIMPLEMENTED();
1408 return true;
1409}
1410
1411bool ValidateDeleteRenderbuffersOES(Context *context, GLsizei n, const GLuint *renderbuffers)
1412{
1413 UNIMPLEMENTED();
1414 return true;
1415}
1416
1417bool ValidateBindFramebufferOES(Context *context, GLenum target, GLuint framebuffer)
1418{
1419 UNIMPLEMENTED();
1420 return true;
1421}
1422
1423bool ValidateBindRenderbufferOES(Context *context, GLenum target, GLuint renderbuffer)
1424{
1425 UNIMPLEMENTED();
1426 return true;
1427}
1428
1429bool ValidateCheckFramebufferStatusOES(Context *context, GLenum target)
1430{
1431 UNIMPLEMENTED();
1432 return true;
1433}
1434
1435bool ValidateFramebufferRenderbufferOES(Context *context,
1436 GLenum target,
1437 GLenum attachment,
1438 GLenum rbtarget,
1439 GLuint renderbuffer)
1440{
1441 UNIMPLEMENTED();
1442 return true;
1443}
1444
1445bool ValidateFramebufferTexture2DOES(Context *context,
1446 GLenum target,
1447 GLenum attachment,
1448 TextureTarget textarget,
1449 GLuint texture,
1450 GLint level)
1451{
1452 UNIMPLEMENTED();
1453 return true;
1454}
1455
1456bool ValidateGenerateMipmapOES(Context *context, TextureType target)
1457{
1458 UNIMPLEMENTED();
1459 return true;
1460}
1461
1462bool ValidateGetFramebufferAttachmentParameterivOES(Context *context,
1463 GLenum target,
1464 GLenum attachment,
1465 GLenum pname,
1466 GLint *params)
1467{
1468 UNIMPLEMENTED();
1469 return true;
1470}
1471
1472bool ValidateGetRenderbufferParameterivOES(Context *context,
1473 GLenum target,
1474 GLenum pname,
1475 GLint *params)
1476{
1477 UNIMPLEMENTED();
1478 return true;
1479}
1480
1481bool ValidateIsFramebufferOES(Context *context, GLuint framebuffer)
1482{
1483 UNIMPLEMENTED();
1484 return true;
1485}
1486
1487bool ValidateIsRenderbufferOES(Context *context, GLuint renderbuffer)
1488{
1489 UNIMPLEMENTED();
1490 return true;
1491}
1492
1493bool ValidateRenderbufferStorageOES(Context *context,
1494 GLenum target,
1495 GLint internalformat,
1496 GLsizei width,
1497 GLsizei height)
1498{
1499 UNIMPLEMENTED();
1500 return true;
1501}
1502
1503// GL_OES_texture_cube_map
1504
1505bool ValidateGetTexGenfvOES(Context *context, GLenum coord, GLenum pname, GLfloat *params)
1506{
1507 UNIMPLEMENTED();
1508 return true;
1509}
1510
1511bool ValidateGetTexGenivOES(Context *context, GLenum coord, GLenum pname, int *params)
1512{
1513 UNIMPLEMENTED();
1514 return true;
1515}
1516
1517bool ValidateGetTexGenxvOES(Context *context, GLenum coord, GLenum pname, GLfixed *params)
1518{
1519 UNIMPLEMENTED();
1520 return true;
1521}
1522
1523bool ValidateTexGenfvOES(Context *context, GLenum coord, GLenum pname, const GLfloat *params)
1524{
1525 UNIMPLEMENTED();
1526 return true;
1527}
1528
1529bool ValidateTexGenivOES(Context *context, GLenum coord, GLenum pname, const GLint *param)
1530{
1531 UNIMPLEMENTED();
1532 return true;
1533}
1534
1535bool ValidateTexGenxvOES(Context *context, GLenum coord, GLenum pname, const GLint *param)
1536{
1537 UNIMPLEMENTED();
1538 return true;
1539}
1540
1541bool ValidateTexGenfOES(Context *context, GLenum coord, GLenum pname, GLfloat param)
1542{
1543 UNIMPLEMENTED();
1544 return true;
1545}
1546
1547bool ValidateTexGeniOES(Context *context, GLenum coord, GLenum pname, GLint param)
1548{
1549 UNIMPLEMENTED();
1550 return true;
1551}
1552
1553bool ValidateTexGenxOES(Context *context, GLenum coord, GLenum pname, GLfixed param)
1554{
1555 UNIMPLEMENTED();
1556 return true;
1557}
Lingfeng Yang01074432018-04-16 10:19:51 -07001558
1559} // namespace gl