blob: a3cdd5b1d7ad91829b98c4bb37698819764805f2 [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
Jamie Madill778bf092018-11-14 09:54:36 -05009#include "libANGLE/validationES1_autogen.h"
Geoff Lang2aaa7b42018-01-12 17:17:27 -050010
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
Jamie Madill610640f2018-11-21 17:28:41 -050019#define ANGLE_VALIDATE_IS_GLES1(context) \
20 if (context->getClientMajorVersion() > 1) \
21 { \
22 context->validationError(GL_INVALID_OPERATION, kErrorGLES1Only); \
23 return false; \
Lingfeng Yang13b708f2018-03-21 12:14:10 -070024 }
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:
Jamie Madill610640f2018-11-21 17:28:41 -050043 context->validationError(GL_INVALID_ENUM, kErrorEnumNotSupported);
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 {
Jamie Madill610640f2018-11-21 17:28:41 -050061 context->validationError(GL_INVALID_ENUM, kErrorPointSizeArrayExtensionNotEnabled);
Lingfeng Yang01074432018-04-16 10:19:51 -070062 return false;
63 }
64 return true;
65 default:
Jamie Madill610640f2018-11-21 17:28:41 -050066 context->validationError(GL_INVALID_ENUM, kErrorInvalidClientState);
Lingfeng Yang01074432018-04-16 10:19:51 -070067 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 {
Jamie Madill610640f2018-11-21 17:28:41 -050082 context->validationError(GL_INVALID_VALUE, kErrorInvalidVertexPointerStride);
Lingfeng Yangabb09f12018-04-16 10:43:53 -070083 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 {
Jamie Madill610640f2018-11-21 17:28:41 -0500107 context->validationError(GL_INVALID_ENUM, kErrorPointSizeArrayExtensionNotEnabled);
Lingfeng Yangabb09f12018-04-16 10:43:53 -0700108 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 {
Jamie Madill610640f2018-11-21 17:28:41 -0500121 context->validationError(GL_INVALID_VALUE, kErrorInvalidVertexPointerSize);
Lingfeng Yangabb09f12018-04-16 10:43:53 -0700122 return false;
123 }
124
125 switch (type)
126 {
127 case GL_BYTE:
128 if (arrayType == ClientVertexArrayType::PointSize)
129 {
Jamie Madill610640f2018-11-21 17:28:41 -0500130 context->validationError(GL_INVALID_ENUM, kErrorInvalidVertexPointerType);
Lingfeng Yangabb09f12018-04-16 10:43:53 -0700131 return false;
132 }
133 break;
134 case GL_SHORT:
135 if (arrayType == ClientVertexArrayType::PointSize ||
136 arrayType == ClientVertexArrayType::Color)
137 {
Jamie Madill610640f2018-11-21 17:28:41 -0500138 context->validationError(GL_INVALID_ENUM, kErrorInvalidVertexPointerType);
Lingfeng Yangabb09f12018-04-16 10:43:53 -0700139 return false;
140 }
141 break;
142 case GL_FIXED:
143 case GL_FLOAT:
144 break;
145 default:
Jamie Madill610640f2018-11-21 17:28:41 -0500146 context->validationError(GL_INVALID_ENUM, kErrorInvalidVertexPointerType);
Lingfeng Yangabb09f12018-04-16 10:43:53 -0700147 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 {
Jamie Madill610640f2018-11-21 17:28:41 -0500157 context->validationError(GL_INVALID_ENUM, kErrorInvalidLight);
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700158 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 {
Jamie Madill610640f2018-11-21 17:28:41 -0500188 context->validationError(GL_INVALID_VALUE, kErrorLightParameterOutOfRange);
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700189 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 {
Jamie Madill610640f2018-11-21 17:28:41 -0500199 context->validationError(GL_INVALID_VALUE, kErrorLightParameterOutOfRange);
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700200 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 {
Jamie Madill610640f2018-11-21 17:28:41 -0500208 context->validationError(GL_INVALID_VALUE, kErrorLightParameterOutOfRange);
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700209 return false;
210 }
211 return true;
212 default:
Jamie Madill610640f2018-11-21 17:28:41 -0500213 context->validationError(GL_INVALID_ENUM, kErrorInvalidLightParameter);
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700214 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 {
Jamie Madill610640f2018-11-21 17:28:41 -0500230 context->validationError(GL_INVALID_ENUM, kErrorInvalidLightParameter);
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700231 return false;
232 }
233
234 return true;
235}
236
237bool ValidateMaterialCommon(Context *context,
238 GLenum face,
239 MaterialParameter pname,
240 const GLfloat *params)
241{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700242 switch (pname)
243 {
244 case MaterialParameter::Ambient:
245 case MaterialParameter::Diffuse:
246 case MaterialParameter::Specular:
247 case MaterialParameter::Emission:
248 return true;
249 case MaterialParameter::Shininess:
250 if (params[0] < 0.0f || params[0] > 128.0f)
251 {
Jamie Madill610640f2018-11-21 17:28:41 -0500252 context->validationError(GL_INVALID_VALUE, kErrorMaterialParameterOutOfRange);
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700253 return false;
254 }
255 return true;
256 default:
Jamie Madill610640f2018-11-21 17:28:41 -0500257 context->validationError(GL_INVALID_ENUM, kErrorInvalidMaterialParameter);
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700258 return false;
259 }
260}
261
Lingfeng Yang6e5bf362018-08-15 09:53:17 -0700262bool ValidateMaterialSetting(Context *context,
263 GLenum face,
264 MaterialParameter pname,
265 const GLfloat *params)
266{
267 ANGLE_VALIDATE_IS_GLES1(context);
268
269 if (face != GL_FRONT_AND_BACK)
270 {
Jamie Madill610640f2018-11-21 17:28:41 -0500271 context->validationError(GL_INVALID_ENUM, kErrorInvalidMaterialFace);
Lingfeng Yang6e5bf362018-08-15 09:53:17 -0700272 return false;
273 }
274
275 return ValidateMaterialCommon(context, face, pname, params);
276}
277
278bool ValidateMaterialQuery(Context *context, GLenum face, MaterialParameter pname)
279{
280 ANGLE_VALIDATE_IS_GLES1(context);
281
282 if (face != GL_FRONT && face != GL_BACK)
283 {
Jamie Madill610640f2018-11-21 17:28:41 -0500284 context->validationError(GL_INVALID_ENUM, kErrorInvalidMaterialFace);
Lingfeng Yang6e5bf362018-08-15 09:53:17 -0700285 return false;
286 }
287
288 GLfloat dummyParams[4] = {0.0f, 0.0f, 0.0f, 0.0f};
289
290 return ValidateMaterialCommon(context, face, pname, dummyParams);
291}
292
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700293bool ValidateMaterialSingleComponent(Context *context,
294 GLenum face,
295 MaterialParameter pname,
296 GLfloat param)
297{
Lingfeng Yang6e5bf362018-08-15 09:53:17 -0700298 if (!ValidateMaterialSetting(context, face, pname, &param))
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700299 {
300 return false;
301 }
302
303 if (GetMaterialParameterCount(pname) > 1)
304 {
Jamie Madill610640f2018-11-21 17:28:41 -0500305 context->validationError(GL_INVALID_ENUM, kErrorInvalidMaterialParameter);
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700306 return false;
307 }
308
309 return true;
310}
311
312bool ValidateLightModelCommon(Context *context, GLenum pname)
313{
314 ANGLE_VALIDATE_IS_GLES1(context);
315 switch (pname)
316 {
317 case GL_LIGHT_MODEL_AMBIENT:
318 case GL_LIGHT_MODEL_TWO_SIDE:
319 return true;
320 default:
Jamie Madill610640f2018-11-21 17:28:41 -0500321 context->validationError(GL_INVALID_ENUM, kErrorInvalidLightModelParameter);
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700322 return false;
323 }
324}
325
326bool ValidateLightModelSingleComponent(Context *context, GLenum pname)
327{
328 if (!ValidateLightModelCommon(context, pname))
329 {
330 return false;
331 }
332
333 switch (pname)
334 {
335 case GL_LIGHT_MODEL_TWO_SIDE:
336 return true;
337 default:
Jamie Madill610640f2018-11-21 17:28:41 -0500338 context->validationError(GL_INVALID_ENUM, kErrorInvalidLightModelParameter);
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700339 return false;
340 }
341}
342
Lingfeng Yang060088a2018-05-30 20:40:57 -0700343bool ValidateClipPlaneCommon(Context *context, GLenum plane)
344{
345 ANGLE_VALIDATE_IS_GLES1(context);
346
347 if (plane < GL_CLIP_PLANE0 || plane >= GL_CLIP_PLANE0 + context->getCaps().maxClipPlanes)
348 {
Jamie Madill610640f2018-11-21 17:28:41 -0500349 context->validationError(GL_INVALID_ENUM, kErrorInvalidClipPlane);
Lingfeng Yang060088a2018-05-30 20:40:57 -0700350 return false;
351 }
352
353 return true;
354}
355
Lingfeng Yang7ba3f422018-06-01 09:43:04 -0700356bool ValidateFogCommon(Context *context, GLenum pname, const GLfloat *params)
357{
358 ANGLE_VALIDATE_IS_GLES1(context);
359
360 switch (pname)
361 {
362 case GL_FOG_MODE:
363 {
364 GLenum modeParam = static_cast<GLenum>(params[0]);
365 switch (modeParam)
366 {
367 case GL_EXP:
368 case GL_EXP2:
369 case GL_LINEAR:
370 return true;
371 default:
Jamie Madill610640f2018-11-21 17:28:41 -0500372 context->validationError(GL_INVALID_VALUE, kErrorInvalidFogMode);
Lingfeng Yang7ba3f422018-06-01 09:43:04 -0700373 return false;
374 }
375 }
376 break;
377 case GL_FOG_START:
378 case GL_FOG_END:
379 case GL_FOG_COLOR:
380 break;
381 case GL_FOG_DENSITY:
382 if (params[0] < 0.0f)
383 {
Jamie Madill610640f2018-11-21 17:28:41 -0500384 context->validationError(GL_INVALID_VALUE, kErrorInvalidFogDensity);
Lingfeng Yang7ba3f422018-06-01 09:43:04 -0700385 return false;
386 }
387 break;
388 default:
Jamie Madill610640f2018-11-21 17:28:41 -0500389 context->validationError(GL_INVALID_ENUM, kErrorInvalidFogParameter);
Lingfeng Yang7ba3f422018-06-01 09:43:04 -0700390 return false;
391 }
392 return true;
393}
394
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700395bool ValidateTexEnvCommon(Context *context,
396 TextureEnvTarget target,
397 TextureEnvParameter pname,
398 const GLfloat *params)
399{
400 ANGLE_VALIDATE_IS_GLES1(context);
401
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700402 switch (target)
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700403 {
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700404 case TextureEnvTarget::Env:
405 switch (pname)
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700406 {
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700407 case TextureEnvParameter::Mode:
408 {
409 TextureEnvMode mode = FromGLenum<TextureEnvMode>(ConvertToGLenum(params[0]));
410 switch (mode)
Lingfeng Yang4004ae02018-06-13 09:29:00 -0700411 {
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700412 case TextureEnvMode::Add:
413 case TextureEnvMode::Blend:
414 case TextureEnvMode::Combine:
415 case TextureEnvMode::Decal:
416 case TextureEnvMode::Modulate:
417 case TextureEnvMode::Replace:
418 break;
419 default:
Jamie Madill610640f2018-11-21 17:28:41 -0500420 context->validationError(GL_INVALID_VALUE, kErrorInvalidTextureEnvMode);
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700421 return false;
422 }
423 break;
424 }
425 case TextureEnvParameter::CombineRgb:
426 case TextureEnvParameter::CombineAlpha:
427 {
428 TextureCombine combine = FromGLenum<TextureCombine>(ConvertToGLenum(params[0]));
429 switch (combine)
430 {
431 case TextureCombine::Add:
432 case TextureCombine::AddSigned:
433 case TextureCombine::Interpolate:
434 case TextureCombine::Modulate:
435 case TextureCombine::Replace:
436 case TextureCombine::Subtract:
437 break;
438 case TextureCombine::Dot3Rgb:
439 case TextureCombine::Dot3Rgba:
440 if (pname == TextureEnvParameter::CombineAlpha)
441 {
Jamie Madill610640f2018-11-21 17:28:41 -0500442 context->validationError(GL_INVALID_VALUE,
443 kErrorInvalidTextureCombine);
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700444 return false;
445 }
446 break;
447 default:
Jamie Madill610640f2018-11-21 17:28:41 -0500448 context->validationError(GL_INVALID_VALUE, kErrorInvalidTextureCombine);
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700449 return false;
450 }
451 break;
452 }
453 case TextureEnvParameter::Src0Rgb:
454 case TextureEnvParameter::Src1Rgb:
455 case TextureEnvParameter::Src2Rgb:
456 case TextureEnvParameter::Src0Alpha:
457 case TextureEnvParameter::Src1Alpha:
458 case TextureEnvParameter::Src2Alpha:
459 {
460 TextureSrc combine = FromGLenum<TextureSrc>(ConvertToGLenum(params[0]));
461 switch (combine)
462 {
463 case TextureSrc::Constant:
464 case TextureSrc::Previous:
465 case TextureSrc::PrimaryColor:
466 case TextureSrc::Texture:
467 break;
468 default:
Jamie Madill610640f2018-11-21 17:28:41 -0500469 context->validationError(GL_INVALID_VALUE,
470 kErrorInvalidTextureCombineSrc);
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700471 return false;
472 }
473 break;
474 }
475 case TextureEnvParameter::Op0Rgb:
476 case TextureEnvParameter::Op1Rgb:
477 case TextureEnvParameter::Op2Rgb:
478 case TextureEnvParameter::Op0Alpha:
479 case TextureEnvParameter::Op1Alpha:
480 case TextureEnvParameter::Op2Alpha:
481 {
482 TextureOp operand = FromGLenum<TextureOp>(ConvertToGLenum(params[0]));
483 switch (operand)
484 {
485 case TextureOp::SrcAlpha:
486 case TextureOp::OneMinusSrcAlpha:
487 break;
488 case TextureOp::SrcColor:
489 case TextureOp::OneMinusSrcColor:
490 if (pname == TextureEnvParameter::Op0Alpha ||
491 pname == TextureEnvParameter::Op1Alpha ||
492 pname == TextureEnvParameter::Op2Alpha)
493 {
Jamie Madill610640f2018-11-21 17:28:41 -0500494 context->validationError(GL_INVALID_VALUE,
495 kErrorInvalidTextureCombine);
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700496 return false;
497 }
498 break;
499 default:
Jamie Madill610640f2018-11-21 17:28:41 -0500500 context->validationError(GL_INVALID_VALUE,
501 kErrorInvalidTextureCombineOp);
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700502 return false;
503 }
504 break;
505 }
506 case TextureEnvParameter::RgbScale:
507 case TextureEnvParameter::AlphaScale:
508 if (params[0] != 1.0f && params[0] != 2.0f && params[0] != 4.0f)
509 {
Jamie Madill610640f2018-11-21 17:28:41 -0500510 context->validationError(GL_INVALID_VALUE, kErrorInvalidTextureEnvScale);
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700511 return false;
512 }
513 break;
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700514 case TextureEnvParameter::Color:
515 break;
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700516 default:
Jamie Madill610640f2018-11-21 17:28:41 -0500517 context->validationError(GL_INVALID_ENUM, kErrorInvalidTextureEnvParameter);
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700518 return false;
519 }
520 break;
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700521 case TextureEnvTarget::PointSprite:
522 if (!context->getExtensions().pointSprite)
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700523 {
Jamie Madill610640f2018-11-21 17:28:41 -0500524 context->validationError(GL_INVALID_ENUM, kErrorInvalidTextureEnvTarget);
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700525 return false;
526 }
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700527 switch (pname)
528 {
529 case TextureEnvParameter::PointCoordReplace:
530 break;
531 default:
Jamie Madill610640f2018-11-21 17:28:41 -0500532 context->validationError(GL_INVALID_ENUM, kErrorInvalidTextureEnvParameter);
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700533 return false;
534 }
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700535 break;
536 default:
Jamie Madill610640f2018-11-21 17:28:41 -0500537 context->validationError(GL_INVALID_ENUM, kErrorInvalidTextureEnvTarget);
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700538 return false;
539 }
540 return true;
541}
542
543bool ValidateGetTexEnvCommon(Context *context, TextureEnvTarget target, TextureEnvParameter pname)
544{
545 GLfloat dummy[4] = {};
546 switch (pname)
547 {
548 case TextureEnvParameter::Mode:
549 ConvertPackedEnum(TextureEnvMode::Add, dummy);
550 break;
551 case TextureEnvParameter::CombineRgb:
552 case TextureEnvParameter::CombineAlpha:
553 ConvertPackedEnum(TextureCombine::Add, dummy);
554 break;
555 case TextureEnvParameter::Src0Rgb:
556 case TextureEnvParameter::Src1Rgb:
557 case TextureEnvParameter::Src2Rgb:
558 case TextureEnvParameter::Src0Alpha:
559 case TextureEnvParameter::Src1Alpha:
560 case TextureEnvParameter::Src2Alpha:
561 ConvertPackedEnum(TextureSrc::Constant, dummy);
562 break;
563 case TextureEnvParameter::Op0Rgb:
564 case TextureEnvParameter::Op1Rgb:
565 case TextureEnvParameter::Op2Rgb:
566 case TextureEnvParameter::Op0Alpha:
567 case TextureEnvParameter::Op1Alpha:
568 case TextureEnvParameter::Op2Alpha:
569 ConvertPackedEnum(TextureOp::SrcAlpha, dummy);
570 break;
571 case TextureEnvParameter::RgbScale:
572 case TextureEnvParameter::AlphaScale:
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700573 case TextureEnvParameter::PointCoordReplace:
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700574 dummy[0] = 1.0f;
575 break;
576 default:
577 break;
578 }
579
580 return ValidateTexEnvCommon(context, target, pname, dummy);
581}
582
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700583bool ValidatePointParameterCommon(Context *context, PointParameter pname, const GLfloat *params)
584{
585 ANGLE_VALIDATE_IS_GLES1(context);
586
587 switch (pname)
588 {
589 case PointParameter::PointSizeMin:
590 case PointParameter::PointSizeMax:
591 case PointParameter::PointFadeThresholdSize:
592 case PointParameter::PointDistanceAttenuation:
593 for (unsigned int i = 0; i < GetPointParameterCount(pname); i++)
594 {
595 if (params[i] < 0.0f)
596 {
Jamie Madill610640f2018-11-21 17:28:41 -0500597 context->validationError(GL_INVALID_VALUE, kErrorInvalidPointParameterValue);
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700598 return false;
599 }
600 }
601 break;
602 default:
Jamie Madill610640f2018-11-21 17:28:41 -0500603 context->validationError(GL_INVALID_ENUM, kErrorInvalidPointParameter);
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700604 return false;
605 }
606
607 return true;
608}
609
610bool ValidatePointSizeCommon(Context *context, GLfloat size)
611{
612 ANGLE_VALIDATE_IS_GLES1(context);
613
614 if (size <= 0.0f)
615 {
Jamie Madill610640f2018-11-21 17:28:41 -0500616 context->validationError(GL_INVALID_VALUE, kErrorInvalidPointSizeValue);
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700617 return false;
618 }
619
620 return true;
621}
622
Lingfeng Yang0df813c2018-07-12 12:52:06 -0700623bool ValidateDrawTexCommon(Context *context, float width, float height)
624{
625 ANGLE_VALIDATE_IS_GLES1(context);
626
627 if (width <= 0.0f || height <= 0.0f)
628 {
Jamie Madill610640f2018-11-21 17:28:41 -0500629 context->validationError(GL_INVALID_VALUE, kErrorNonPositiveDrawTextureDimension);
Lingfeng Yang0df813c2018-07-12 12:52:06 -0700630 return false;
631 }
632
633 return true;
634}
635
Lingfeng Yang01074432018-04-16 10:19:51 -0700636} // namespace gl
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500637
638namespace gl
639{
640
Lingfeng Yang13b708f2018-03-21 12:14:10 -0700641bool ValidateAlphaFunc(Context *context, AlphaTestFunc func, GLfloat ref)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500642{
Lingfeng Yang13b708f2018-03-21 12:14:10 -0700643 ANGLE_VALIDATE_IS_GLES1(context);
644 return ValidateAlphaFuncCommon(context, func);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500645}
646
Lingfeng Yang13b708f2018-03-21 12:14:10 -0700647bool ValidateAlphaFuncx(Context *context, AlphaTestFunc func, GLfixed ref)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500648{
Lingfeng Yang13b708f2018-03-21 12:14:10 -0700649 ANGLE_VALIDATE_IS_GLES1(context);
650 return ValidateAlphaFuncCommon(context, func);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500651}
652
653bool ValidateClearColorx(Context *context, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
654{
655 UNIMPLEMENTED();
656 return true;
657}
658
659bool ValidateClearDepthx(Context *context, GLfixed depth)
660{
661 UNIMPLEMENTED();
662 return true;
663}
664
665bool ValidateClientActiveTexture(Context *context, GLenum texture)
666{
Lingfeng Yang96310cd2018-03-28 11:56:28 -0700667 ANGLE_VALIDATE_IS_GLES1(context);
Lingfeng Yang038dd532018-03-29 17:31:52 -0700668 return ValidateMultitextureUnit(context, texture);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500669}
670
Lingfeng Yang060088a2018-05-30 20:40:57 -0700671bool ValidateClipPlanef(Context *context, GLenum plane, const GLfloat *eqn)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500672{
Lingfeng Yang060088a2018-05-30 20:40:57 -0700673 return ValidateClipPlaneCommon(context, plane);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500674}
675
676bool ValidateClipPlanex(Context *context, GLenum plane, const GLfixed *equation)
677{
Lingfeng Yang060088a2018-05-30 20:40:57 -0700678 return ValidateClipPlaneCommon(context, plane);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500679}
680
681bool ValidateColor4f(Context *context, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
682{
Lingfeng Yanga43994c2018-03-29 07:21:41 -0700683 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500684 return true;
685}
686
687bool ValidateColor4ub(Context *context, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
688{
Lingfeng Yanga43994c2018-03-29 07:21:41 -0700689 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500690 return true;
691}
692
693bool ValidateColor4x(Context *context, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
694{
Lingfeng Yanga43994c2018-03-29 07:21:41 -0700695 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500696 return true;
697}
698
699bool ValidateColorPointer(Context *context,
700 GLint size,
701 GLenum type,
702 GLsizei stride,
703 const void *pointer)
704{
Lingfeng Yangabb09f12018-04-16 10:43:53 -0700705 return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::Color, size, type,
706 stride, pointer);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500707}
708
709bool ValidateCullFace(Context *context, GLenum mode)
710{
711 UNIMPLEMENTED();
712 return true;
713}
714
715bool ValidateDepthRangex(Context *context, GLfixed n, GLfixed f)
716{
717 UNIMPLEMENTED();
718 return true;
719}
720
Lingfeng Yang01074432018-04-16 10:19:51 -0700721bool ValidateDisableClientState(Context *context, ClientVertexArrayType arrayType)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500722{
Lingfeng Yang01074432018-04-16 10:19:51 -0700723 return ValidateClientStateCommon(context, arrayType);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500724}
725
Lingfeng Yang01074432018-04-16 10:19:51 -0700726bool ValidateEnableClientState(Context *context, ClientVertexArrayType arrayType)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500727{
Lingfeng Yang01074432018-04-16 10:19:51 -0700728 return ValidateClientStateCommon(context, arrayType);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500729}
730
731bool ValidateFogf(Context *context, GLenum pname, GLfloat param)
732{
Lingfeng Yang7ba3f422018-06-01 09:43:04 -0700733 return ValidateFogCommon(context, pname, &param);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500734}
735
736bool ValidateFogfv(Context *context, GLenum pname, const GLfloat *params)
737{
Lingfeng Yang7ba3f422018-06-01 09:43:04 -0700738 return ValidateFogCommon(context, pname, params);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500739}
740
741bool ValidateFogx(Context *context, GLenum pname, GLfixed param)
742{
Lingfeng Yang7ba3f422018-06-01 09:43:04 -0700743 GLfloat asFloat = FixedToFloat(param);
744 return ValidateFogCommon(context, pname, &asFloat);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500745}
746
Lingfeng Yang7ba3f422018-06-01 09:43:04 -0700747bool ValidateFogxv(Context *context, GLenum pname, const GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500748{
Lingfeng Yang7ba3f422018-06-01 09:43:04 -0700749 unsigned int paramCount = GetFogParameterCount(pname);
750 GLfloat paramsf[4] = {};
751
752 for (unsigned int i = 0; i < paramCount; i++)
753 {
754 paramsf[i] = FixedToFloat(params[i]);
755 }
756
757 return ValidateFogCommon(context, pname, paramsf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500758}
759
760bool ValidateFrustumf(Context *context,
761 GLfloat l,
762 GLfloat r,
763 GLfloat b,
764 GLfloat t,
765 GLfloat n,
766 GLfloat f)
767{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -0700768 ANGLE_VALIDATE_IS_GLES1(context);
769 if (l == r || b == t || n == f || n <= 0.0f || f <= 0.0f)
770 {
Jamie Madill610640f2018-11-21 17:28:41 -0500771 context->validationError(GL_INVALID_VALUE, kErrorInvalidProjectionMatrix);
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -0700772 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500773 return true;
774}
775
776bool ValidateFrustumx(Context *context,
777 GLfixed l,
778 GLfixed r,
779 GLfixed b,
780 GLfixed t,
781 GLfixed n,
782 GLfixed f)
783{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -0700784 ANGLE_VALIDATE_IS_GLES1(context);
785 if (l == r || b == t || n == f || n <= 0 || f <= 0)
786 {
Jamie Madill610640f2018-11-21 17:28:41 -0500787 context->validationError(GL_INVALID_VALUE, kErrorInvalidProjectionMatrix);
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -0700788 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500789 return true;
790}
791
792bool ValidateGetBufferParameteriv(Context *context, GLenum target, GLenum pname, GLint *params)
793{
794 UNIMPLEMENTED();
795 return true;
796}
797
798bool ValidateGetClipPlanef(Context *context, GLenum plane, GLfloat *equation)
799{
Lingfeng Yang060088a2018-05-30 20:40:57 -0700800 return ValidateClipPlaneCommon(context, plane);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500801}
802
803bool ValidateGetClipPlanex(Context *context, GLenum plane, GLfixed *equation)
804{
Lingfeng Yang060088a2018-05-30 20:40:57 -0700805 return ValidateClipPlaneCommon(context, plane);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500806}
807
808bool ValidateGetFixedv(Context *context, GLenum pname, GLfixed *params)
809{
810 UNIMPLEMENTED();
811 return true;
812}
813
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700814bool ValidateGetLightfv(Context *context, GLenum light, LightParameter pname, GLfloat *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500815{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700816 GLfloat dummyParams[4] = {0.0f, 0.0f, 0.0f, 0.0f};
817 return ValidateLightCommon(context, light, pname, dummyParams);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500818}
819
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700820bool ValidateGetLightxv(Context *context, GLenum light, LightParameter pname, GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500821{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700822 GLfloat dummyParams[4] = {0.0f, 0.0f, 0.0f, 0.0f};
823 return ValidateLightCommon(context, light, pname, dummyParams);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500824}
825
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700826bool ValidateGetMaterialfv(Context *context, GLenum face, MaterialParameter pname, GLfloat *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500827{
Lingfeng Yang6e5bf362018-08-15 09:53:17 -0700828 return ValidateMaterialQuery(context, face, pname);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500829}
830
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700831bool ValidateGetMaterialxv(Context *context, GLenum face, MaterialParameter pname, GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500832{
Lingfeng Yang6e5bf362018-08-15 09:53:17 -0700833 return ValidateMaterialQuery(context, face, pname);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500834}
835
836bool ValidateGetPointerv(Context *context, GLenum pname, void **params)
837{
Lingfeng Yangabb09f12018-04-16 10:43:53 -0700838 ANGLE_VALIDATE_IS_GLES1(context);
839 switch (pname)
840 {
841 case GL_VERTEX_ARRAY_POINTER:
842 case GL_NORMAL_ARRAY_POINTER:
843 case GL_COLOR_ARRAY_POINTER:
844 case GL_TEXTURE_COORD_ARRAY_POINTER:
845 case GL_POINT_SIZE_ARRAY_POINTER_OES:
846 return true;
847 default:
Jamie Madill610640f2018-11-21 17:28:41 -0500848 context->validationError(GL_INVALID_ENUM, kErrorInvalidPointerQuery);
Lingfeng Yangabb09f12018-04-16 10:43:53 -0700849 return false;
850 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500851}
852
Lingfeng Yang74be2962018-06-07 09:13:38 -0700853bool ValidateGetTexEnvfv(Context *context,
854 TextureEnvTarget target,
855 TextureEnvParameter pname,
856 GLfloat *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500857{
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700858 return ValidateGetTexEnvCommon(context, target, pname);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500859}
860
Lingfeng Yang74be2962018-06-07 09:13:38 -0700861bool ValidateGetTexEnviv(Context *context,
862 TextureEnvTarget target,
863 TextureEnvParameter pname,
864 GLint *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500865{
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700866 return ValidateGetTexEnvCommon(context, target, pname);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500867}
868
Lingfeng Yang74be2962018-06-07 09:13:38 -0700869bool ValidateGetTexEnvxv(Context *context,
870 TextureEnvTarget target,
871 TextureEnvParameter pname,
872 GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500873{
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700874 return ValidateGetTexEnvCommon(context, target, pname);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500875}
876
Corentin Wallezf0e89be2017-11-08 14:00:32 -0800877bool ValidateGetTexParameterxv(Context *context, TextureType target, GLenum pname, GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500878{
Lingfeng Yangf97641c2018-06-21 19:22:45 -0700879 ANGLE_VALIDATE_IS_GLES1(context);
880
881 if (!ValidateGetTexParameterBase(context, target, pname, nullptr))
882 {
883 return false;
884 }
885
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500886 return true;
887}
888
889bool ValidateLightModelf(Context *context, GLenum pname, GLfloat param)
890{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700891 return ValidateLightModelSingleComponent(context, pname);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500892}
893
894bool ValidateLightModelfv(Context *context, GLenum pname, const GLfloat *params)
895{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700896 return ValidateLightModelCommon(context, pname);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500897}
898
899bool ValidateLightModelx(Context *context, GLenum pname, GLfixed param)
900{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700901 return ValidateLightModelSingleComponent(context, pname);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500902}
903
904bool ValidateLightModelxv(Context *context, GLenum pname, const GLfixed *param)
905{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700906 return ValidateLightModelCommon(context, pname);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500907}
908
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700909bool ValidateLightf(Context *context, GLenum light, LightParameter pname, GLfloat param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500910{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700911 return ValidateLightSingleComponent(context, light, pname, param);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500912}
913
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700914bool ValidateLightfv(Context *context, GLenum light, LightParameter pname, const GLfloat *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500915{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700916 return ValidateLightCommon(context, light, pname, params);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500917}
918
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700919bool ValidateLightx(Context *context, GLenum light, LightParameter pname, GLfixed param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500920{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700921 return ValidateLightSingleComponent(context, light, pname, FixedToFloat(param));
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500922}
923
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700924bool ValidateLightxv(Context *context, GLenum light, LightParameter pname, const GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500925{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700926 GLfloat paramsf[4];
927 for (unsigned int i = 0; i < GetLightParameterCount(pname); i++)
928 {
929 paramsf[i] = FixedToFloat(params[i]);
930 }
931
932 return ValidateLightCommon(context, light, pname, paramsf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500933}
934
935bool ValidateLineWidthx(Context *context, GLfixed width)
936{
937 UNIMPLEMENTED();
938 return true;
939}
940
941bool ValidateLoadIdentity(Context *context)
942{
Lingfeng Yang3a41af62018-04-09 07:28:56 -0700943 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500944 return true;
945}
946
947bool ValidateLoadMatrixf(Context *context, const GLfloat *m)
948{
Lingfeng Yang3a41af62018-04-09 07:28:56 -0700949 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500950 return true;
951}
952
953bool ValidateLoadMatrixx(Context *context, const GLfixed *m)
954{
Lingfeng Yang3a41af62018-04-09 07:28:56 -0700955 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500956 return true;
957}
958
Lingfeng Yang6e5bf362018-08-15 09:53:17 -0700959bool ValidateLogicOp(Context *context, LogicalOperation opcode)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500960{
Lingfeng Yang6e5bf362018-08-15 09:53:17 -0700961 ANGLE_VALIDATE_IS_GLES1(context);
962 switch (opcode)
963 {
964 case LogicalOperation::And:
965 case LogicalOperation::AndInverted:
966 case LogicalOperation::AndReverse:
967 case LogicalOperation::Clear:
968 case LogicalOperation::Copy:
969 case LogicalOperation::CopyInverted:
970 case LogicalOperation::Equiv:
971 case LogicalOperation::Invert:
972 case LogicalOperation::Nand:
973 case LogicalOperation::Noop:
974 case LogicalOperation::Nor:
975 case LogicalOperation::Or:
976 case LogicalOperation::OrInverted:
977 case LogicalOperation::OrReverse:
978 case LogicalOperation::Set:
979 case LogicalOperation::Xor:
980 return true;
981 default:
Jamie Madill610640f2018-11-21 17:28:41 -0500982 context->validationError(GL_INVALID_ENUM, kErrorInvalidLogicOp);
Lingfeng Yang6e5bf362018-08-15 09:53:17 -0700983 return false;
984 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500985}
986
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700987bool ValidateMaterialf(Context *context, GLenum face, MaterialParameter pname, GLfloat param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500988{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700989 return ValidateMaterialSingleComponent(context, face, pname, param);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500990}
991
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700992bool ValidateMaterialfv(Context *context,
993 GLenum face,
994 MaterialParameter pname,
995 const GLfloat *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500996{
Lingfeng Yang6e5bf362018-08-15 09:53:17 -0700997 return ValidateMaterialSetting(context, face, pname, params);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500998}
999
Lingfeng Yangd0febe72018-05-17 22:36:52 -07001000bool ValidateMaterialx(Context *context, GLenum face, MaterialParameter pname, GLfixed param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001001{
Lingfeng Yangd0febe72018-05-17 22:36:52 -07001002 return ValidateMaterialSingleComponent(context, face, pname, FixedToFloat(param));
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001003}
1004
Lingfeng Yangd0febe72018-05-17 22:36:52 -07001005bool ValidateMaterialxv(Context *context,
1006 GLenum face,
1007 MaterialParameter pname,
1008 const GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001009{
Lingfeng Yangd0febe72018-05-17 22:36:52 -07001010 GLfloat paramsf[4];
1011
1012 for (unsigned int i = 0; i < GetMaterialParameterCount(pname); i++)
1013 {
1014 paramsf[i] = FixedToFloat(params[i]);
1015 }
1016
Lingfeng Yang6e5bf362018-08-15 09:53:17 -07001017 return ValidateMaterialSetting(context, face, pname, paramsf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001018}
1019
Lingfeng Yang00af4632018-04-02 12:42:24 -07001020bool ValidateMatrixMode(Context *context, MatrixType mode)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001021{
Lingfeng Yangd2488ab2018-04-04 09:25:48 -07001022 ANGLE_VALIDATE_IS_GLES1(context);
1023 switch (mode)
1024 {
1025 case MatrixType::Projection:
1026 case MatrixType::Modelview:
1027 case MatrixType::Texture:
1028 return true;
1029 default:
Jamie Madill610640f2018-11-21 17:28:41 -05001030 context->validationError(GL_INVALID_ENUM, kErrorInvalidMatrixMode);
Lingfeng Yangd2488ab2018-04-04 09:25:48 -07001031 return false;
1032 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001033}
1034
1035bool ValidateMultMatrixf(Context *context, const GLfloat *m)
1036{
Lingfeng Yang568fc392018-04-09 07:57:23 -07001037 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001038 return true;
1039}
1040
1041bool ValidateMultMatrixx(Context *context, const GLfixed *m)
1042{
Lingfeng Yang568fc392018-04-09 07:57:23 -07001043 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001044 return true;
1045}
1046
1047bool ValidateMultiTexCoord4f(Context *context,
1048 GLenum target,
1049 GLfloat s,
1050 GLfloat t,
1051 GLfloat r,
1052 GLfloat q)
1053{
Lingfeng Yang038dd532018-03-29 17:31:52 -07001054 ANGLE_VALIDATE_IS_GLES1(context);
1055 return ValidateMultitextureUnit(context, target);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001056}
1057
1058bool ValidateMultiTexCoord4x(Context *context,
Lingfeng Yang038dd532018-03-29 17:31:52 -07001059 GLenum target,
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001060 GLfixed s,
1061 GLfixed t,
1062 GLfixed r,
1063 GLfixed q)
1064{
Lingfeng Yang038dd532018-03-29 17:31:52 -07001065 ANGLE_VALIDATE_IS_GLES1(context);
1066 return ValidateMultitextureUnit(context, target);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001067}
1068
1069bool ValidateNormal3f(Context *context, GLfloat nx, GLfloat ny, GLfloat nz)
1070{
Lingfeng Yang5a7e61b2018-03-29 16:50:32 -07001071 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001072 return true;
1073}
1074
1075bool ValidateNormal3x(Context *context, GLfixed nx, GLfixed ny, GLfixed nz)
1076{
Lingfeng Yang5a7e61b2018-03-29 16:50:32 -07001077 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001078 return true;
1079}
1080
1081bool ValidateNormalPointer(Context *context, GLenum type, GLsizei stride, const void *pointer)
1082{
Lingfeng Yangabb09f12018-04-16 10:43:53 -07001083 return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::Normal, 3, type,
1084 stride, pointer);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001085}
1086
1087bool ValidateOrthof(Context *context,
1088 GLfloat l,
1089 GLfloat r,
1090 GLfloat b,
1091 GLfloat t,
1092 GLfloat n,
1093 GLfloat f)
1094{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001095 ANGLE_VALIDATE_IS_GLES1(context);
1096 if (l == r || b == t || n == f || n <= 0.0f || f <= 0.0f)
1097 {
Jamie Madill610640f2018-11-21 17:28:41 -05001098 context->validationError(GL_INVALID_VALUE, kErrorInvalidProjectionMatrix);
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001099 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001100 return true;
1101}
1102
1103bool ValidateOrthox(Context *context,
1104 GLfixed l,
1105 GLfixed r,
1106 GLfixed b,
1107 GLfixed t,
1108 GLfixed n,
1109 GLfixed f)
1110{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001111 ANGLE_VALIDATE_IS_GLES1(context);
1112 if (l == r || b == t || n == f || n <= 0 || f <= 0)
1113 {
Jamie Madill610640f2018-11-21 17:28:41 -05001114 context->validationError(GL_INVALID_VALUE, kErrorInvalidProjectionMatrix);
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001115 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001116 return true;
1117}
1118
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001119bool ValidatePointParameterf(Context *context, PointParameter pname, GLfloat param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001120{
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001121 unsigned int paramCount = GetPointParameterCount(pname);
1122 if (paramCount != 1)
1123 {
Jamie Madill610640f2018-11-21 17:28:41 -05001124 context->validationError(GL_INVALID_ENUM, kErrorInvalidPointParameter);
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001125 return false;
1126 }
1127
1128 return ValidatePointParameterCommon(context, pname, &param);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001129}
1130
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001131bool ValidatePointParameterfv(Context *context, PointParameter pname, const GLfloat *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001132{
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001133 return ValidatePointParameterCommon(context, pname, params);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001134}
1135
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001136bool ValidatePointParameterx(Context *context, PointParameter pname, GLfixed param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001137{
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001138 unsigned int paramCount = GetPointParameterCount(pname);
1139 if (paramCount != 1)
1140 {
Jamie Madill610640f2018-11-21 17:28:41 -05001141 context->validationError(GL_INVALID_ENUM, kErrorInvalidPointParameter);
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001142 return false;
1143 }
1144
1145 GLfloat paramf = FixedToFloat(param);
1146 return ValidatePointParameterCommon(context, pname, &paramf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001147}
1148
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001149bool ValidatePointParameterxv(Context *context, PointParameter pname, const GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001150{
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001151 GLfloat paramsf[4] = {};
1152 for (unsigned int i = 0; i < GetPointParameterCount(pname); i++)
1153 {
1154 paramsf[i] = FixedToFloat(params[i]);
1155 }
1156 return ValidatePointParameterCommon(context, pname, paramsf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001157}
1158
1159bool ValidatePointSize(Context *context, GLfloat size)
1160{
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001161 return ValidatePointSizeCommon(context, size);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001162}
1163
1164bool ValidatePointSizex(Context *context, GLfixed size)
1165{
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001166 return ValidatePointSizeCommon(context, FixedToFloat(size));
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001167}
1168
1169bool ValidatePolygonOffsetx(Context *context, GLfixed factor, GLfixed units)
1170{
1171 UNIMPLEMENTED();
1172 return true;
1173}
1174
1175bool ValidatePopMatrix(Context *context)
1176{
Lingfeng Yange547aac2018-04-05 09:39:20 -07001177 ANGLE_VALIDATE_IS_GLES1(context);
1178 const auto &stack = context->getGLState().gles1().currentMatrixStack();
1179 if (stack.size() == 1)
1180 {
Jamie Madill610640f2018-11-21 17:28:41 -05001181 context->validationError(GL_STACK_UNDERFLOW, kErrorMatrixStackUnderflow);
Lingfeng Yange547aac2018-04-05 09:39:20 -07001182 return false;
1183 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001184 return true;
1185}
1186
1187bool ValidatePushMatrix(Context *context)
1188{
Lingfeng Yange547aac2018-04-05 09:39:20 -07001189 ANGLE_VALIDATE_IS_GLES1(context);
1190 const auto &stack = context->getGLState().gles1().currentMatrixStack();
1191 if (stack.size() == stack.max_size())
1192 {
Jamie Madill610640f2018-11-21 17:28:41 -05001193 context->validationError(GL_STACK_OVERFLOW, kErrorMatrixStackOverflow);
Lingfeng Yange547aac2018-04-05 09:39:20 -07001194 return false;
1195 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001196 return true;
1197}
1198
1199bool ValidateRotatef(Context *context, GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
1200{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001201 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001202 return true;
1203}
1204
1205bool ValidateRotatex(Context *context, GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
1206{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001207 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001208 return true;
1209}
1210
1211bool ValidateSampleCoveragex(Context *context, GLclampx value, GLboolean invert)
1212{
1213 UNIMPLEMENTED();
1214 return true;
1215}
1216
1217bool ValidateScalef(Context *context, GLfloat x, GLfloat y, GLfloat z)
1218{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001219 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001220 return true;
1221}
1222
1223bool ValidateScalex(Context *context, GLfixed x, GLfixed y, GLfixed z)
1224{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001225 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001226 return true;
1227}
1228
Lingfeng Yanga0cfa872018-05-30 21:12:17 -07001229bool ValidateShadeModel(Context *context, ShadingModel mode)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001230{
Lingfeng Yanga0cfa872018-05-30 21:12:17 -07001231 ANGLE_VALIDATE_IS_GLES1(context);
1232 switch (mode)
1233 {
1234 case ShadingModel::Flat:
1235 case ShadingModel::Smooth:
1236 return true;
1237 default:
Jamie Madill610640f2018-11-21 17:28:41 -05001238 context->validationError(GL_INVALID_ENUM, kErrorInvalidShadingModel);
Lingfeng Yanga0cfa872018-05-30 21:12:17 -07001239 return false;
1240 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001241}
1242
1243bool ValidateTexCoordPointer(Context *context,
1244 GLint size,
1245 GLenum type,
1246 GLsizei stride,
1247 const void *pointer)
1248{
Lingfeng Yangabb09f12018-04-16 10:43:53 -07001249 return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::TextureCoord, size,
1250 type, stride, pointer);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001251}
1252
Lingfeng Yang74be2962018-06-07 09:13:38 -07001253bool ValidateTexEnvf(Context *context,
1254 TextureEnvTarget target,
1255 TextureEnvParameter pname,
1256 GLfloat param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001257{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001258 return ValidateTexEnvCommon(context, target, pname, &param);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001259}
1260
Lingfeng Yang74be2962018-06-07 09:13:38 -07001261bool ValidateTexEnvfv(Context *context,
1262 TextureEnvTarget target,
1263 TextureEnvParameter pname,
1264 const GLfloat *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001265{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001266 return ValidateTexEnvCommon(context, target, pname, params);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001267}
1268
Lingfeng Yang74be2962018-06-07 09:13:38 -07001269bool ValidateTexEnvi(Context *context,
1270 TextureEnvTarget target,
1271 TextureEnvParameter pname,
1272 GLint param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001273{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001274 GLfloat paramf = static_cast<GLfloat>(param);
1275 return ValidateTexEnvCommon(context, target, pname, &paramf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001276}
1277
Lingfeng Yang74be2962018-06-07 09:13:38 -07001278bool ValidateTexEnviv(Context *context,
1279 TextureEnvTarget target,
1280 TextureEnvParameter pname,
1281 const GLint *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001282{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001283 GLfloat paramsf[4];
1284 for (unsigned int i = 0; i < GetTextureEnvParameterCount(pname); i++)
1285 {
1286 paramsf[i] = static_cast<GLfloat>(params[i]);
1287 }
1288 return ValidateTexEnvCommon(context, target, pname, paramsf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001289}
1290
Lingfeng Yang74be2962018-06-07 09:13:38 -07001291bool ValidateTexEnvx(Context *context,
1292 TextureEnvTarget target,
1293 TextureEnvParameter pname,
1294 GLfixed param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001295{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001296 GLfloat paramf = static_cast<GLfloat>(param);
1297 return ValidateTexEnvCommon(context, target, pname, &paramf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001298}
1299
Lingfeng Yang74be2962018-06-07 09:13:38 -07001300bool ValidateTexEnvxv(Context *context,
1301 TextureEnvTarget target,
1302 TextureEnvParameter pname,
1303 const GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001304{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001305 GLfloat paramsf[4];
1306 for (unsigned int i = 0; i < GetTextureEnvParameterCount(pname); i++)
1307 {
1308 paramsf[i] = static_cast<GLfloat>(params[i]);
1309 }
1310 return ValidateTexEnvCommon(context, target, pname, paramsf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001311}
1312
Corentin Wallezf0e89be2017-11-08 14:00:32 -08001313bool ValidateTexParameterx(Context *context, TextureType target, GLenum pname, GLfixed param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001314{
Lingfeng Yangf97641c2018-06-21 19:22:45 -07001315 ANGLE_VALIDATE_IS_GLES1(context);
1316 GLfloat paramf = FixedToFloat(param);
Till Rathmannb8543632018-10-02 19:46:14 +02001317 return ValidateTexParameterBase(context, target, pname, -1, false, &paramf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001318}
1319
Corentin Wallezf0e89be2017-11-08 14:00:32 -08001320bool ValidateTexParameterxv(Context *context,
1321 TextureType target,
1322 GLenum pname,
1323 const GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001324{
Lingfeng Yangf97641c2018-06-21 19:22:45 -07001325 ANGLE_VALIDATE_IS_GLES1(context);
1326 GLfloat paramsf[4] = {};
1327 for (unsigned int i = 0; i < GetTexParameterCount(pname); i++)
1328 {
1329 paramsf[i] = FixedToFloat(params[i]);
1330 }
Till Rathmannb8543632018-10-02 19:46:14 +02001331 return ValidateTexParameterBase(context, target, pname, -1, true, paramsf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001332}
1333
1334bool ValidateTranslatef(Context *context, GLfloat x, GLfloat y, GLfloat z)
1335{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001336 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001337 return true;
1338}
1339
1340bool ValidateTranslatex(Context *context, GLfixed x, GLfixed y, GLfixed z)
1341{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001342 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001343 return true;
1344}
1345
1346bool ValidateVertexPointer(Context *context,
1347 GLint size,
1348 GLenum type,
1349 GLsizei stride,
1350 const void *pointer)
1351{
Lingfeng Yangabb09f12018-04-16 10:43:53 -07001352 return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::Vertex, size, type,
1353 stride, pointer);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001354}
1355
1356bool ValidateDrawTexfOES(Context *context,
1357 GLfloat x,
1358 GLfloat y,
1359 GLfloat z,
1360 GLfloat width,
1361 GLfloat height)
1362{
Lingfeng Yang0df813c2018-07-12 12:52:06 -07001363 return ValidateDrawTexCommon(context, width, height);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001364}
1365
1366bool ValidateDrawTexfvOES(Context *context, const GLfloat *coords)
1367{
Lingfeng Yang0df813c2018-07-12 12:52:06 -07001368 return ValidateDrawTexCommon(context, coords[3], coords[4]);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001369}
1370
1371bool ValidateDrawTexiOES(Context *context, GLint x, GLint y, GLint z, GLint width, GLint height)
1372{
Lingfeng Yang0df813c2018-07-12 12:52:06 -07001373 return ValidateDrawTexCommon(context, static_cast<GLfloat>(width),
1374 static_cast<GLfloat>(height));
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001375}
1376
1377bool ValidateDrawTexivOES(Context *context, const GLint *coords)
1378{
Lingfeng Yang0df813c2018-07-12 12:52:06 -07001379 return ValidateDrawTexCommon(context, static_cast<GLfloat>(coords[3]),
1380 static_cast<GLfloat>(coords[4]));
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001381}
1382
1383bool ValidateDrawTexsOES(Context *context,
1384 GLshort x,
1385 GLshort y,
1386 GLshort z,
1387 GLshort width,
1388 GLshort height)
1389{
Lingfeng Yang0df813c2018-07-12 12:52:06 -07001390 return ValidateDrawTexCommon(context, static_cast<GLfloat>(width),
1391 static_cast<GLfloat>(height));
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001392}
1393
1394bool ValidateDrawTexsvOES(Context *context, const GLshort *coords)
1395{
Lingfeng Yang0df813c2018-07-12 12:52:06 -07001396 return ValidateDrawTexCommon(context, static_cast<GLfloat>(coords[3]),
1397 static_cast<GLfloat>(coords[4]));
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001398}
1399
1400bool ValidateDrawTexxOES(Context *context,
1401 GLfixed x,
1402 GLfixed y,
1403 GLfixed z,
1404 GLfixed width,
1405 GLfixed height)
1406{
Lingfeng Yang0df813c2018-07-12 12:52:06 -07001407 return ValidateDrawTexCommon(context, FixedToFloat(width), FixedToFloat(height));
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001408}
1409
1410bool ValidateDrawTexxvOES(Context *context, const GLfixed *coords)
1411{
Lingfeng Yang0df813c2018-07-12 12:52:06 -07001412 return ValidateDrawTexCommon(context, FixedToFloat(coords[3]), FixedToFloat(coords[4]));
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001413}
1414
1415bool ValidateCurrentPaletteMatrixOES(Context *context, GLuint matrixpaletteindex)
1416{
1417 UNIMPLEMENTED();
1418 return true;
1419}
1420
1421bool ValidateLoadPaletteFromModelViewMatrixOES(Context *context)
1422{
1423 UNIMPLEMENTED();
1424 return true;
1425}
1426
1427bool ValidateMatrixIndexPointerOES(Context *context,
1428 GLint size,
1429 GLenum type,
1430 GLsizei stride,
1431 const void *pointer)
1432{
1433 UNIMPLEMENTED();
1434 return true;
1435}
1436
1437bool ValidateWeightPointerOES(Context *context,
1438 GLint size,
1439 GLenum type,
1440 GLsizei stride,
1441 const void *pointer)
1442{
1443 UNIMPLEMENTED();
1444 return true;
1445}
1446
1447bool ValidatePointSizePointerOES(Context *context, GLenum type, GLsizei stride, const void *pointer)
1448{
Lingfeng Yangabb09f12018-04-16 10:43:53 -07001449 return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::PointSize, 1, type,
1450 stride, pointer);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001451}
1452
1453bool ValidateQueryMatrixxOES(Context *context, GLfixed *mantissa, GLint *exponent)
1454{
1455 UNIMPLEMENTED();
1456 return true;
1457}
Lingfeng Yanga0648782018-03-12 14:45:25 -07001458
1459bool ValidateGenFramebuffersOES(Context *context, GLsizei n, GLuint *framebuffers)
1460{
1461 UNIMPLEMENTED();
1462 return true;
1463}
1464
1465bool ValidateDeleteFramebuffersOES(Context *context, GLsizei n, const GLuint *framebuffers)
1466{
1467 UNIMPLEMENTED();
1468 return true;
1469}
1470
1471bool ValidateGenRenderbuffersOES(Context *context, GLsizei n, GLuint *renderbuffers)
1472{
1473 UNIMPLEMENTED();
1474 return true;
1475}
1476
1477bool ValidateDeleteRenderbuffersOES(Context *context, GLsizei n, const GLuint *renderbuffers)
1478{
1479 UNIMPLEMENTED();
1480 return true;
1481}
1482
1483bool ValidateBindFramebufferOES(Context *context, GLenum target, GLuint framebuffer)
1484{
1485 UNIMPLEMENTED();
1486 return true;
1487}
1488
1489bool ValidateBindRenderbufferOES(Context *context, GLenum target, GLuint renderbuffer)
1490{
1491 UNIMPLEMENTED();
1492 return true;
1493}
1494
1495bool ValidateCheckFramebufferStatusOES(Context *context, GLenum target)
1496{
1497 UNIMPLEMENTED();
1498 return true;
1499}
1500
1501bool ValidateFramebufferRenderbufferOES(Context *context,
1502 GLenum target,
1503 GLenum attachment,
1504 GLenum rbtarget,
1505 GLuint renderbuffer)
1506{
1507 UNIMPLEMENTED();
1508 return true;
1509}
1510
1511bool ValidateFramebufferTexture2DOES(Context *context,
1512 GLenum target,
1513 GLenum attachment,
1514 TextureTarget textarget,
1515 GLuint texture,
1516 GLint level)
1517{
1518 UNIMPLEMENTED();
1519 return true;
1520}
1521
1522bool ValidateGenerateMipmapOES(Context *context, TextureType target)
1523{
1524 UNIMPLEMENTED();
1525 return true;
1526}
1527
1528bool ValidateGetFramebufferAttachmentParameterivOES(Context *context,
1529 GLenum target,
1530 GLenum attachment,
1531 GLenum pname,
1532 GLint *params)
1533{
1534 UNIMPLEMENTED();
1535 return true;
1536}
1537
1538bool ValidateGetRenderbufferParameterivOES(Context *context,
1539 GLenum target,
1540 GLenum pname,
1541 GLint *params)
1542{
1543 UNIMPLEMENTED();
1544 return true;
1545}
1546
1547bool ValidateIsFramebufferOES(Context *context, GLuint framebuffer)
1548{
1549 UNIMPLEMENTED();
1550 return true;
1551}
1552
1553bool ValidateIsRenderbufferOES(Context *context, GLuint renderbuffer)
1554{
1555 UNIMPLEMENTED();
1556 return true;
1557}
1558
1559bool ValidateRenderbufferStorageOES(Context *context,
1560 GLenum target,
Jamie Madill778bf092018-11-14 09:54:36 -05001561 GLenum internalformat,
Lingfeng Yanga0648782018-03-12 14:45:25 -07001562 GLsizei width,
1563 GLsizei height)
1564{
1565 UNIMPLEMENTED();
1566 return true;
1567}
1568
1569// GL_OES_texture_cube_map
1570
1571bool ValidateGetTexGenfvOES(Context *context, GLenum coord, GLenum pname, GLfloat *params)
1572{
1573 UNIMPLEMENTED();
1574 return true;
1575}
1576
1577bool ValidateGetTexGenivOES(Context *context, GLenum coord, GLenum pname, int *params)
1578{
1579 UNIMPLEMENTED();
1580 return true;
1581}
1582
1583bool ValidateGetTexGenxvOES(Context *context, GLenum coord, GLenum pname, GLfixed *params)
1584{
1585 UNIMPLEMENTED();
1586 return true;
1587}
1588
1589bool ValidateTexGenfvOES(Context *context, GLenum coord, GLenum pname, const GLfloat *params)
1590{
1591 UNIMPLEMENTED();
1592 return true;
1593}
1594
1595bool ValidateTexGenivOES(Context *context, GLenum coord, GLenum pname, const GLint *param)
1596{
1597 UNIMPLEMENTED();
1598 return true;
1599}
1600
1601bool ValidateTexGenxvOES(Context *context, GLenum coord, GLenum pname, const GLint *param)
1602{
1603 UNIMPLEMENTED();
1604 return true;
1605}
1606
1607bool ValidateTexGenfOES(Context *context, GLenum coord, GLenum pname, GLfloat param)
1608{
1609 UNIMPLEMENTED();
1610 return true;
1611}
1612
1613bool ValidateTexGeniOES(Context *context, GLenum coord, GLenum pname, GLint param)
1614{
1615 UNIMPLEMENTED();
1616 return true;
1617}
1618
1619bool ValidateTexGenxOES(Context *context, GLenum coord, GLenum pname, GLfixed param)
1620{
1621 UNIMPLEMENTED();
1622 return true;
1623}
Lingfeng Yang01074432018-04-16 10:19:51 -07001624
1625} // namespace gl