blob: 8f8c619f721bf35a1a2370f90ceceabf63d7677f [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{
Lingfeng Yangf97641c2018-06-21 19:22:45 -0700843 ANGLE_VALIDATE_IS_GLES1(context);
844
845 if (!ValidateGetTexParameterBase(context, target, pname, nullptr))
846 {
847 return false;
848 }
849
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500850 return true;
851}
852
853bool ValidateLightModelf(Context *context, GLenum pname, GLfloat param)
854{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700855 return ValidateLightModelSingleComponent(context, pname);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500856}
857
858bool ValidateLightModelfv(Context *context, GLenum pname, const GLfloat *params)
859{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700860 return ValidateLightModelCommon(context, pname);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500861}
862
863bool ValidateLightModelx(Context *context, GLenum pname, GLfixed param)
864{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700865 return ValidateLightModelSingleComponent(context, pname);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500866}
867
868bool ValidateLightModelxv(Context *context, GLenum pname, const GLfixed *param)
869{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700870 return ValidateLightModelCommon(context, pname);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500871}
872
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700873bool ValidateLightf(Context *context, GLenum light, LightParameter pname, GLfloat param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500874{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700875 return ValidateLightSingleComponent(context, light, pname, param);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500876}
877
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700878bool ValidateLightfv(Context *context, GLenum light, LightParameter pname, const GLfloat *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500879{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700880 return ValidateLightCommon(context, light, pname, params);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500881}
882
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700883bool ValidateLightx(Context *context, GLenum light, LightParameter pname, GLfixed param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500884{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700885 return ValidateLightSingleComponent(context, light, pname, FixedToFloat(param));
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500886}
887
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700888bool ValidateLightxv(Context *context, GLenum light, LightParameter pname, const GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500889{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700890 GLfloat paramsf[4];
891 for (unsigned int i = 0; i < GetLightParameterCount(pname); i++)
892 {
893 paramsf[i] = FixedToFloat(params[i]);
894 }
895
896 return ValidateLightCommon(context, light, pname, paramsf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500897}
898
899bool ValidateLineWidthx(Context *context, GLfixed width)
900{
901 UNIMPLEMENTED();
902 return true;
903}
904
905bool ValidateLoadIdentity(Context *context)
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 ValidateLoadMatrixf(Context *context, const GLfloat *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 ValidateLoadMatrixx(Context *context, const GLfixed *m)
918{
Lingfeng Yang3a41af62018-04-09 07:28:56 -0700919 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500920 return true;
921}
922
923bool ValidateLogicOp(Context *context, GLenum opcode)
924{
925 UNIMPLEMENTED();
926 return true;
927}
928
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700929bool ValidateMaterialf(Context *context, GLenum face, MaterialParameter pname, GLfloat param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500930{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700931 return ValidateMaterialSingleComponent(context, face, pname, param);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500932}
933
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700934bool ValidateMaterialfv(Context *context,
935 GLenum face,
936 MaterialParameter pname,
937 const GLfloat *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500938{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700939 return ValidateMaterialCommon(context, face, pname, params);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500940}
941
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700942bool ValidateMaterialx(Context *context, GLenum face, MaterialParameter pname, GLfixed param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500943{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700944 return ValidateMaterialSingleComponent(context, face, pname, FixedToFloat(param));
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500945}
946
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700947bool ValidateMaterialxv(Context *context,
948 GLenum face,
949 MaterialParameter pname,
950 const GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500951{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700952 GLfloat paramsf[4];
953
954 for (unsigned int i = 0; i < GetMaterialParameterCount(pname); i++)
955 {
956 paramsf[i] = FixedToFloat(params[i]);
957 }
958
959 return ValidateMaterialCommon(context, face, pname, paramsf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500960}
961
Lingfeng Yang00af4632018-04-02 12:42:24 -0700962bool ValidateMatrixMode(Context *context, MatrixType mode)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500963{
Lingfeng Yangd2488ab2018-04-04 09:25:48 -0700964 ANGLE_VALIDATE_IS_GLES1(context);
965 switch (mode)
966 {
967 case MatrixType::Projection:
968 case MatrixType::Modelview:
969 case MatrixType::Texture:
970 return true;
971 default:
972 ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidMatrixMode);
973 return false;
974 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500975}
976
977bool ValidateMultMatrixf(Context *context, const GLfloat *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 ValidateMultMatrixx(Context *context, const GLfixed *m)
984{
Lingfeng Yang568fc392018-04-09 07:57:23 -0700985 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500986 return true;
987}
988
989bool ValidateMultiTexCoord4f(Context *context,
990 GLenum target,
991 GLfloat s,
992 GLfloat t,
993 GLfloat r,
994 GLfloat q)
995{
Lingfeng Yang038dd532018-03-29 17:31:52 -0700996 ANGLE_VALIDATE_IS_GLES1(context);
997 return ValidateMultitextureUnit(context, target);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500998}
999
1000bool ValidateMultiTexCoord4x(Context *context,
Lingfeng Yang038dd532018-03-29 17:31:52 -07001001 GLenum target,
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001002 GLfixed s,
1003 GLfixed t,
1004 GLfixed r,
1005 GLfixed q)
1006{
Lingfeng Yang038dd532018-03-29 17:31:52 -07001007 ANGLE_VALIDATE_IS_GLES1(context);
1008 return ValidateMultitextureUnit(context, target);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001009}
1010
1011bool ValidateNormal3f(Context *context, GLfloat nx, GLfloat ny, GLfloat 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 ValidateNormal3x(Context *context, GLfixed nx, GLfixed ny, GLfixed nz)
1018{
Lingfeng Yang5a7e61b2018-03-29 16:50:32 -07001019 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001020 return true;
1021}
1022
1023bool ValidateNormalPointer(Context *context, GLenum type, GLsizei stride, const void *pointer)
1024{
Lingfeng Yangabb09f12018-04-16 10:43:53 -07001025 return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::Normal, 3, type,
1026 stride, pointer);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001027}
1028
1029bool ValidateOrthof(Context *context,
1030 GLfloat l,
1031 GLfloat r,
1032 GLfloat b,
1033 GLfloat t,
1034 GLfloat n,
1035 GLfloat f)
1036{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001037 ANGLE_VALIDATE_IS_GLES1(context);
1038 if (l == r || b == t || n == f || n <= 0.0f || f <= 0.0f)
1039 {
1040 ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidProjectionMatrix);
1041 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001042 return true;
1043}
1044
1045bool ValidateOrthox(Context *context,
1046 GLfixed l,
1047 GLfixed r,
1048 GLfixed b,
1049 GLfixed t,
1050 GLfixed n,
1051 GLfixed f)
1052{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001053 ANGLE_VALIDATE_IS_GLES1(context);
1054 if (l == r || b == t || n == f || n <= 0 || f <= 0)
1055 {
1056 ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidProjectionMatrix);
1057 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001058 return true;
1059}
1060
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001061bool ValidatePointParameterf(Context *context, PointParameter pname, GLfloat param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001062{
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001063 unsigned int paramCount = GetPointParameterCount(pname);
1064 if (paramCount != 1)
1065 {
1066 ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPointParameter);
1067 return false;
1068 }
1069
1070 return ValidatePointParameterCommon(context, pname, &param);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001071}
1072
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001073bool ValidatePointParameterfv(Context *context, PointParameter pname, const GLfloat *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001074{
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001075 return ValidatePointParameterCommon(context, pname, params);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001076}
1077
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001078bool ValidatePointParameterx(Context *context, PointParameter pname, GLfixed param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001079{
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001080 unsigned int paramCount = GetPointParameterCount(pname);
1081 if (paramCount != 1)
1082 {
1083 ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPointParameter);
1084 return false;
1085 }
1086
1087 GLfloat paramf = FixedToFloat(param);
1088 return ValidatePointParameterCommon(context, pname, &paramf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001089}
1090
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001091bool ValidatePointParameterxv(Context *context, PointParameter pname, const GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001092{
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001093 GLfloat paramsf[4] = {};
1094 for (unsigned int i = 0; i < GetPointParameterCount(pname); i++)
1095 {
1096 paramsf[i] = FixedToFloat(params[i]);
1097 }
1098 return ValidatePointParameterCommon(context, pname, paramsf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001099}
1100
1101bool ValidatePointSize(Context *context, GLfloat size)
1102{
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001103 return ValidatePointSizeCommon(context, size);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001104}
1105
1106bool ValidatePointSizex(Context *context, GLfixed size)
1107{
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001108 return ValidatePointSizeCommon(context, FixedToFloat(size));
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001109}
1110
1111bool ValidatePolygonOffsetx(Context *context, GLfixed factor, GLfixed units)
1112{
1113 UNIMPLEMENTED();
1114 return true;
1115}
1116
1117bool ValidatePopMatrix(Context *context)
1118{
Lingfeng Yange547aac2018-04-05 09:39:20 -07001119 ANGLE_VALIDATE_IS_GLES1(context);
1120 const auto &stack = context->getGLState().gles1().currentMatrixStack();
1121 if (stack.size() == 1)
1122 {
1123 ANGLE_VALIDATION_ERR(context, StackUnderflow(), MatrixStackUnderflow);
1124 return false;
1125 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001126 return true;
1127}
1128
1129bool ValidatePushMatrix(Context *context)
1130{
Lingfeng Yange547aac2018-04-05 09:39:20 -07001131 ANGLE_VALIDATE_IS_GLES1(context);
1132 const auto &stack = context->getGLState().gles1().currentMatrixStack();
1133 if (stack.size() == stack.max_size())
1134 {
1135 ANGLE_VALIDATION_ERR(context, StackOverflow(), MatrixStackOverflow);
1136 return false;
1137 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001138 return true;
1139}
1140
1141bool ValidateRotatef(Context *context, GLfloat angle, GLfloat x, GLfloat y, GLfloat 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 ValidateRotatex(Context *context, GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
1148{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001149 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001150 return true;
1151}
1152
1153bool ValidateSampleCoveragex(Context *context, GLclampx value, GLboolean invert)
1154{
1155 UNIMPLEMENTED();
1156 return true;
1157}
1158
1159bool ValidateScalef(Context *context, GLfloat x, GLfloat y, GLfloat 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
1165bool ValidateScalex(Context *context, GLfixed x, GLfixed y, GLfixed z)
1166{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001167 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001168 return true;
1169}
1170
Lingfeng Yanga0cfa872018-05-30 21:12:17 -07001171bool ValidateShadeModel(Context *context, ShadingModel mode)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001172{
Lingfeng Yanga0cfa872018-05-30 21:12:17 -07001173 ANGLE_VALIDATE_IS_GLES1(context);
1174 switch (mode)
1175 {
1176 case ShadingModel::Flat:
1177 case ShadingModel::Smooth:
1178 return true;
1179 default:
1180 ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidShadingModel);
1181 return false;
1182 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001183}
1184
1185bool ValidateTexCoordPointer(Context *context,
1186 GLint size,
1187 GLenum type,
1188 GLsizei stride,
1189 const void *pointer)
1190{
Lingfeng Yangabb09f12018-04-16 10:43:53 -07001191 return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::TextureCoord, size,
1192 type, stride, pointer);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001193}
1194
Lingfeng Yang74be2962018-06-07 09:13:38 -07001195bool ValidateTexEnvf(Context *context,
1196 TextureEnvTarget target,
1197 TextureEnvParameter pname,
1198 GLfloat param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001199{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001200 return ValidateTexEnvCommon(context, target, pname, &param);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001201}
1202
Lingfeng Yang74be2962018-06-07 09:13:38 -07001203bool ValidateTexEnvfv(Context *context,
1204 TextureEnvTarget target,
1205 TextureEnvParameter pname,
1206 const GLfloat *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001207{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001208 return ValidateTexEnvCommon(context, target, pname, params);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001209}
1210
Lingfeng Yang74be2962018-06-07 09:13:38 -07001211bool ValidateTexEnvi(Context *context,
1212 TextureEnvTarget target,
1213 TextureEnvParameter pname,
1214 GLint param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001215{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001216 GLfloat paramf = static_cast<GLfloat>(param);
1217 return ValidateTexEnvCommon(context, target, pname, &paramf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001218}
1219
Lingfeng Yang74be2962018-06-07 09:13:38 -07001220bool ValidateTexEnviv(Context *context,
1221 TextureEnvTarget target,
1222 TextureEnvParameter pname,
1223 const GLint *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001224{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001225 GLfloat paramsf[4];
1226 for (unsigned int i = 0; i < GetTextureEnvParameterCount(pname); i++)
1227 {
1228 paramsf[i] = static_cast<GLfloat>(params[i]);
1229 }
1230 return ValidateTexEnvCommon(context, target, pname, paramsf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001231}
1232
Lingfeng Yang74be2962018-06-07 09:13:38 -07001233bool ValidateTexEnvx(Context *context,
1234 TextureEnvTarget target,
1235 TextureEnvParameter pname,
1236 GLfixed param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001237{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001238 GLfloat paramf = static_cast<GLfloat>(param);
1239 return ValidateTexEnvCommon(context, target, pname, &paramf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001240}
1241
Lingfeng Yang74be2962018-06-07 09:13:38 -07001242bool ValidateTexEnvxv(Context *context,
1243 TextureEnvTarget target,
1244 TextureEnvParameter pname,
1245 const GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001246{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001247 GLfloat paramsf[4];
1248 for (unsigned int i = 0; i < GetTextureEnvParameterCount(pname); i++)
1249 {
1250 paramsf[i] = static_cast<GLfloat>(params[i]);
1251 }
1252 return ValidateTexEnvCommon(context, target, pname, paramsf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001253}
1254
Corentin Wallezf0e89be2017-11-08 14:00:32 -08001255bool ValidateTexParameterx(Context *context, TextureType target, GLenum pname, GLfixed param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001256{
Lingfeng Yangf97641c2018-06-21 19:22:45 -07001257 ANGLE_VALIDATE_IS_GLES1(context);
1258 GLfloat paramf = FixedToFloat(param);
1259 return ValidateTexParameterBase(context, target, pname, 1, &paramf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001260}
1261
Corentin Wallezf0e89be2017-11-08 14:00:32 -08001262bool ValidateTexParameterxv(Context *context,
1263 TextureType target,
1264 GLenum pname,
1265 const GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001266{
Lingfeng Yangf97641c2018-06-21 19:22:45 -07001267 ANGLE_VALIDATE_IS_GLES1(context);
1268 GLfloat paramsf[4] = {};
1269 for (unsigned int i = 0; i < GetTexParameterCount(pname); i++)
1270 {
1271 paramsf[i] = FixedToFloat(params[i]);
1272 }
1273 return ValidateTexParameterBase(context, target, pname, -1, paramsf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001274}
1275
1276bool ValidateTranslatef(Context *context, GLfloat x, GLfloat y, GLfloat z)
1277{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001278 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001279 return true;
1280}
1281
1282bool ValidateTranslatex(Context *context, GLfixed x, GLfixed y, GLfixed z)
1283{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001284 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001285 return true;
1286}
1287
1288bool ValidateVertexPointer(Context *context,
1289 GLint size,
1290 GLenum type,
1291 GLsizei stride,
1292 const void *pointer)
1293{
Lingfeng Yangabb09f12018-04-16 10:43:53 -07001294 return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::Vertex, size, type,
1295 stride, pointer);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001296}
1297
1298bool ValidateDrawTexfOES(Context *context,
1299 GLfloat x,
1300 GLfloat y,
1301 GLfloat z,
1302 GLfloat width,
1303 GLfloat height)
1304{
1305 UNIMPLEMENTED();
1306 return true;
1307}
1308
1309bool ValidateDrawTexfvOES(Context *context, const GLfloat *coords)
1310{
1311 UNIMPLEMENTED();
1312 return true;
1313}
1314
1315bool ValidateDrawTexiOES(Context *context, GLint x, GLint y, GLint z, GLint width, GLint height)
1316{
1317 UNIMPLEMENTED();
1318 return true;
1319}
1320
1321bool ValidateDrawTexivOES(Context *context, const GLint *coords)
1322{
1323 UNIMPLEMENTED();
1324 return true;
1325}
1326
1327bool ValidateDrawTexsOES(Context *context,
1328 GLshort x,
1329 GLshort y,
1330 GLshort z,
1331 GLshort width,
1332 GLshort height)
1333{
1334 UNIMPLEMENTED();
1335 return true;
1336}
1337
1338bool ValidateDrawTexsvOES(Context *context, const GLshort *coords)
1339{
1340 UNIMPLEMENTED();
1341 return true;
1342}
1343
1344bool ValidateDrawTexxOES(Context *context,
1345 GLfixed x,
1346 GLfixed y,
1347 GLfixed z,
1348 GLfixed width,
1349 GLfixed height)
1350{
1351 UNIMPLEMENTED();
1352 return true;
1353}
1354
1355bool ValidateDrawTexxvOES(Context *context, const GLfixed *coords)
1356{
1357 UNIMPLEMENTED();
1358 return true;
1359}
1360
1361bool ValidateCurrentPaletteMatrixOES(Context *context, GLuint matrixpaletteindex)
1362{
1363 UNIMPLEMENTED();
1364 return true;
1365}
1366
1367bool ValidateLoadPaletteFromModelViewMatrixOES(Context *context)
1368{
1369 UNIMPLEMENTED();
1370 return true;
1371}
1372
1373bool ValidateMatrixIndexPointerOES(Context *context,
1374 GLint size,
1375 GLenum type,
1376 GLsizei stride,
1377 const void *pointer)
1378{
1379 UNIMPLEMENTED();
1380 return true;
1381}
1382
1383bool ValidateWeightPointerOES(Context *context,
1384 GLint size,
1385 GLenum type,
1386 GLsizei stride,
1387 const void *pointer)
1388{
1389 UNIMPLEMENTED();
1390 return true;
1391}
1392
1393bool ValidatePointSizePointerOES(Context *context, GLenum type, GLsizei stride, const void *pointer)
1394{
Lingfeng Yangabb09f12018-04-16 10:43:53 -07001395 return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::PointSize, 1, type,
1396 stride, pointer);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001397}
1398
1399bool ValidateQueryMatrixxOES(Context *context, GLfixed *mantissa, GLint *exponent)
1400{
1401 UNIMPLEMENTED();
1402 return true;
1403}
Lingfeng Yanga0648782018-03-12 14:45:25 -07001404
1405bool ValidateGenFramebuffersOES(Context *context, GLsizei n, GLuint *framebuffers)
1406{
1407 UNIMPLEMENTED();
1408 return true;
1409}
1410
1411bool ValidateDeleteFramebuffersOES(Context *context, GLsizei n, const GLuint *framebuffers)
1412{
1413 UNIMPLEMENTED();
1414 return true;
1415}
1416
1417bool ValidateGenRenderbuffersOES(Context *context, GLsizei n, GLuint *renderbuffers)
1418{
1419 UNIMPLEMENTED();
1420 return true;
1421}
1422
1423bool ValidateDeleteRenderbuffersOES(Context *context, GLsizei n, const GLuint *renderbuffers)
1424{
1425 UNIMPLEMENTED();
1426 return true;
1427}
1428
1429bool ValidateBindFramebufferOES(Context *context, GLenum target, GLuint framebuffer)
1430{
1431 UNIMPLEMENTED();
1432 return true;
1433}
1434
1435bool ValidateBindRenderbufferOES(Context *context, GLenum target, GLuint renderbuffer)
1436{
1437 UNIMPLEMENTED();
1438 return true;
1439}
1440
1441bool ValidateCheckFramebufferStatusOES(Context *context, GLenum target)
1442{
1443 UNIMPLEMENTED();
1444 return true;
1445}
1446
1447bool ValidateFramebufferRenderbufferOES(Context *context,
1448 GLenum target,
1449 GLenum attachment,
1450 GLenum rbtarget,
1451 GLuint renderbuffer)
1452{
1453 UNIMPLEMENTED();
1454 return true;
1455}
1456
1457bool ValidateFramebufferTexture2DOES(Context *context,
1458 GLenum target,
1459 GLenum attachment,
1460 TextureTarget textarget,
1461 GLuint texture,
1462 GLint level)
1463{
1464 UNIMPLEMENTED();
1465 return true;
1466}
1467
1468bool ValidateGenerateMipmapOES(Context *context, TextureType target)
1469{
1470 UNIMPLEMENTED();
1471 return true;
1472}
1473
1474bool ValidateGetFramebufferAttachmentParameterivOES(Context *context,
1475 GLenum target,
1476 GLenum attachment,
1477 GLenum pname,
1478 GLint *params)
1479{
1480 UNIMPLEMENTED();
1481 return true;
1482}
1483
1484bool ValidateGetRenderbufferParameterivOES(Context *context,
1485 GLenum target,
1486 GLenum pname,
1487 GLint *params)
1488{
1489 UNIMPLEMENTED();
1490 return true;
1491}
1492
1493bool ValidateIsFramebufferOES(Context *context, GLuint framebuffer)
1494{
1495 UNIMPLEMENTED();
1496 return true;
1497}
1498
1499bool ValidateIsRenderbufferOES(Context *context, GLuint renderbuffer)
1500{
1501 UNIMPLEMENTED();
1502 return true;
1503}
1504
1505bool ValidateRenderbufferStorageOES(Context *context,
1506 GLenum target,
1507 GLint internalformat,
1508 GLsizei width,
1509 GLsizei height)
1510{
1511 UNIMPLEMENTED();
1512 return true;
1513}
1514
1515// GL_OES_texture_cube_map
1516
1517bool ValidateGetTexGenfvOES(Context *context, GLenum coord, GLenum pname, GLfloat *params)
1518{
1519 UNIMPLEMENTED();
1520 return true;
1521}
1522
1523bool ValidateGetTexGenivOES(Context *context, GLenum coord, GLenum pname, int *params)
1524{
1525 UNIMPLEMENTED();
1526 return true;
1527}
1528
1529bool ValidateGetTexGenxvOES(Context *context, GLenum coord, GLenum pname, GLfixed *params)
1530{
1531 UNIMPLEMENTED();
1532 return true;
1533}
1534
1535bool ValidateTexGenfvOES(Context *context, GLenum coord, GLenum pname, const GLfloat *params)
1536{
1537 UNIMPLEMENTED();
1538 return true;
1539}
1540
1541bool ValidateTexGenivOES(Context *context, GLenum coord, GLenum pname, const GLint *param)
1542{
1543 UNIMPLEMENTED();
1544 return true;
1545}
1546
1547bool ValidateTexGenxvOES(Context *context, GLenum coord, GLenum pname, const GLint *param)
1548{
1549 UNIMPLEMENTED();
1550 return true;
1551}
1552
1553bool ValidateTexGenfOES(Context *context, GLenum coord, GLenum pname, GLfloat param)
1554{
1555 UNIMPLEMENTED();
1556 return true;
1557}
1558
1559bool ValidateTexGeniOES(Context *context, GLenum coord, GLenum pname, GLint param)
1560{
1561 UNIMPLEMENTED();
1562 return true;
1563}
1564
1565bool ValidateTexGenxOES(Context *context, GLenum coord, GLenum pname, GLfixed param)
1566{
1567 UNIMPLEMENTED();
1568 return true;
1569}
Lingfeng Yang01074432018-04-16 10:19:51 -07001570
1571} // namespace gl