blob: 1bef889678eec4f2095fc29a99ee666942caf698 [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 Madille0472f32018-11-27 16:32:45 -050019#define ANGLE_VALIDATE_IS_GLES1(context) \
20 if (context->getClientMajorVersion() > 1) \
21 { \
22 context->validationError(GL_INVALID_OPERATION, kGLES1Only); \
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{
Jamie Madille0472f32018-11-27 16:32:45 -050028using namespace err;
Lingfeng Yang13b708f2018-03-21 12:14:10 -070029
Lingfeng Yangabb09f12018-04-16 10:43:53 -070030bool ValidateAlphaFuncCommon(Context *context, AlphaTestFunc func)
Lingfeng Yang13b708f2018-03-21 12:14:10 -070031{
32 switch (func)
33 {
Lingfeng Yangabb09f12018-04-16 10:43:53 -070034 case AlphaTestFunc::AlwaysPass:
35 case AlphaTestFunc::Equal:
36 case AlphaTestFunc::Gequal:
37 case AlphaTestFunc::Greater:
38 case AlphaTestFunc::Lequal:
39 case AlphaTestFunc::Less:
40 case AlphaTestFunc::Never:
41 case AlphaTestFunc::NotEqual:
Lingfeng Yang13b708f2018-03-21 12:14:10 -070042 return true;
43 default:
Jamie Madille0472f32018-11-27 16:32:45 -050044 context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
Lingfeng Yang13b708f2018-03-21 12:14:10 -070045 return false;
46 }
47}
48
Lingfeng Yangabb09f12018-04-16 10:43:53 -070049bool ValidateClientStateCommon(Context *context, ClientVertexArrayType arrayType)
Lingfeng Yang01074432018-04-16 10:19:51 -070050{
51 ANGLE_VALIDATE_IS_GLES1(context);
52 switch (arrayType)
53 {
Lingfeng Yangabb09f12018-04-16 10:43:53 -070054 case ClientVertexArrayType::Vertex:
55 case ClientVertexArrayType::Normal:
56 case ClientVertexArrayType::Color:
57 case ClientVertexArrayType::TextureCoord:
Lingfeng Yang01074432018-04-16 10:19:51 -070058 return true;
Lingfeng Yangabb09f12018-04-16 10:43:53 -070059 case ClientVertexArrayType::PointSize:
Lingfeng Yang01074432018-04-16 10:19:51 -070060 if (!context->getExtensions().pointSizeArray)
61 {
Jamie Madille0472f32018-11-27 16:32:45 -050062 context->validationError(GL_INVALID_ENUM, kPointSizeArrayExtensionNotEnabled);
Lingfeng Yang01074432018-04-16 10:19:51 -070063 return false;
64 }
65 return true;
66 default:
Jamie Madille0472f32018-11-27 16:32:45 -050067 context->validationError(GL_INVALID_ENUM, kInvalidClientState);
Lingfeng Yang01074432018-04-16 10:19:51 -070068 return false;
69 }
70}
71
Lingfeng Yangabb09f12018-04-16 10:43:53 -070072bool ValidateBuiltinVertexAttributeCommon(Context *context,
73 ClientVertexArrayType arrayType,
74 GLint size,
75 GLenum type,
76 GLsizei stride,
77 const void *pointer)
78{
79 ANGLE_VALIDATE_IS_GLES1(context);
80
81 if (stride < 0)
82 {
Jamie Madille0472f32018-11-27 16:32:45 -050083 context->validationError(GL_INVALID_VALUE, kInvalidVertexPointerStride);
Lingfeng Yangabb09f12018-04-16 10:43:53 -070084 return false;
85 }
86
87 int minSize = 1;
88 int maxSize = 4;
89
90 switch (arrayType)
91 {
92 case ClientVertexArrayType::Vertex:
93 case ClientVertexArrayType::TextureCoord:
94 minSize = 2;
95 maxSize = 4;
96 break;
97 case ClientVertexArrayType::Normal:
98 minSize = 3;
99 maxSize = 3;
100 break;
101 case ClientVertexArrayType::Color:
102 minSize = 4;
103 maxSize = 4;
104 break;
105 case ClientVertexArrayType::PointSize:
106 if (!context->getExtensions().pointSizeArray)
107 {
Jamie Madille0472f32018-11-27 16:32:45 -0500108 context->validationError(GL_INVALID_ENUM, kPointSizeArrayExtensionNotEnabled);
Lingfeng Yangabb09f12018-04-16 10:43:53 -0700109 return false;
110 }
111
112 minSize = 1;
113 maxSize = 1;
114 break;
115 default:
116 UNREACHABLE();
117 return false;
118 }
119
120 if (size < minSize || size > maxSize)
121 {
Jamie Madille0472f32018-11-27 16:32:45 -0500122 context->validationError(GL_INVALID_VALUE, kInvalidVertexPointerSize);
Lingfeng Yangabb09f12018-04-16 10:43:53 -0700123 return false;
124 }
125
126 switch (type)
127 {
128 case GL_BYTE:
129 if (arrayType == ClientVertexArrayType::PointSize)
130 {
Jamie Madille0472f32018-11-27 16:32:45 -0500131 context->validationError(GL_INVALID_ENUM, kInvalidVertexPointerType);
Lingfeng Yangabb09f12018-04-16 10:43:53 -0700132 return false;
133 }
134 break;
135 case GL_SHORT:
136 if (arrayType == ClientVertexArrayType::PointSize ||
137 arrayType == ClientVertexArrayType::Color)
138 {
Jamie Madille0472f32018-11-27 16:32:45 -0500139 context->validationError(GL_INVALID_ENUM, kInvalidVertexPointerType);
Lingfeng Yangabb09f12018-04-16 10:43:53 -0700140 return false;
141 }
142 break;
143 case GL_FIXED:
144 case GL_FLOAT:
145 break;
146 default:
Jamie Madille0472f32018-11-27 16:32:45 -0500147 context->validationError(GL_INVALID_ENUM, kInvalidVertexPointerType);
Lingfeng Yangabb09f12018-04-16 10:43:53 -0700148 return false;
149 }
150
151 return true;
152}
153
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700154bool ValidateLightCaps(Context *context, GLenum light)
155{
156 if (light < GL_LIGHT0 || light >= GL_LIGHT0 + context->getCaps().maxLights)
157 {
Jamie Madille0472f32018-11-27 16:32:45 -0500158 context->validationError(GL_INVALID_ENUM, kInvalidLight);
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700159 return false;
160 }
161
162 return true;
163}
164
165bool ValidateLightCommon(Context *context,
166 GLenum light,
167 LightParameter pname,
168 const GLfloat *params)
169{
170
171 ANGLE_VALIDATE_IS_GLES1(context);
172
173 if (!ValidateLightCaps(context, light))
174 {
175 return false;
176 }
177
178 switch (pname)
179 {
180 case LightParameter::Ambient:
181 case LightParameter::Diffuse:
182 case LightParameter::Specular:
183 case LightParameter::Position:
184 case LightParameter::SpotDirection:
185 return true;
186 case LightParameter::SpotExponent:
187 if (params[0] < 0.0f || params[0] > 128.0f)
188 {
Jamie Madille0472f32018-11-27 16:32:45 -0500189 context->validationError(GL_INVALID_VALUE, kLightParameterOutOfRange);
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700190 return false;
191 }
192 return true;
193 case LightParameter::SpotCutoff:
194 if (params[0] == 180.0f)
195 {
196 return true;
197 }
198 if (params[0] < 0.0f || params[0] > 90.0f)
199 {
Jamie Madille0472f32018-11-27 16:32:45 -0500200 context->validationError(GL_INVALID_VALUE, kLightParameterOutOfRange);
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700201 return false;
202 }
203 return true;
204 case LightParameter::ConstantAttenuation:
205 case LightParameter::LinearAttenuation:
206 case LightParameter::QuadraticAttenuation:
207 if (params[0] < 0.0f)
208 {
Jamie Madille0472f32018-11-27 16:32:45 -0500209 context->validationError(GL_INVALID_VALUE, kLightParameterOutOfRange);
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700210 return false;
211 }
212 return true;
213 default:
Jamie Madille0472f32018-11-27 16:32:45 -0500214 context->validationError(GL_INVALID_ENUM, kInvalidLightParameter);
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700215 return false;
216 }
217}
218
219bool ValidateLightSingleComponent(Context *context,
220 GLenum light,
221 LightParameter pname,
222 GLfloat param)
223{
224 if (!ValidateLightCommon(context, light, pname, &param))
225 {
226 return false;
227 }
228
229 if (GetLightParameterCount(pname) > 1)
230 {
Jamie Madille0472f32018-11-27 16:32:45 -0500231 context->validationError(GL_INVALID_ENUM, kInvalidLightParameter);
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700232 return false;
233 }
234
235 return true;
236}
237
238bool ValidateMaterialCommon(Context *context,
239 GLenum face,
240 MaterialParameter pname,
241 const GLfloat *params)
242{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700243 switch (pname)
244 {
245 case MaterialParameter::Ambient:
246 case MaterialParameter::Diffuse:
247 case MaterialParameter::Specular:
248 case MaterialParameter::Emission:
249 return true;
250 case MaterialParameter::Shininess:
251 if (params[0] < 0.0f || params[0] > 128.0f)
252 {
Jamie Madille0472f32018-11-27 16:32:45 -0500253 context->validationError(GL_INVALID_VALUE, kMaterialParameterOutOfRange);
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700254 return false;
255 }
256 return true;
257 default:
Jamie Madille0472f32018-11-27 16:32:45 -0500258 context->validationError(GL_INVALID_ENUM, kInvalidMaterialParameter);
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700259 return false;
260 }
261}
262
Lingfeng Yang6e5bf362018-08-15 09:53:17 -0700263bool ValidateMaterialSetting(Context *context,
264 GLenum face,
265 MaterialParameter pname,
266 const GLfloat *params)
267{
268 ANGLE_VALIDATE_IS_GLES1(context);
269
270 if (face != GL_FRONT_AND_BACK)
271 {
Jamie Madille0472f32018-11-27 16:32:45 -0500272 context->validationError(GL_INVALID_ENUM, kInvalidMaterialFace);
Lingfeng Yang6e5bf362018-08-15 09:53:17 -0700273 return false;
274 }
275
276 return ValidateMaterialCommon(context, face, pname, params);
277}
278
279bool ValidateMaterialQuery(Context *context, GLenum face, MaterialParameter pname)
280{
281 ANGLE_VALIDATE_IS_GLES1(context);
282
283 if (face != GL_FRONT && face != GL_BACK)
284 {
Jamie Madille0472f32018-11-27 16:32:45 -0500285 context->validationError(GL_INVALID_ENUM, kInvalidMaterialFace);
Lingfeng Yang6e5bf362018-08-15 09:53:17 -0700286 return false;
287 }
288
289 GLfloat dummyParams[4] = {0.0f, 0.0f, 0.0f, 0.0f};
290
291 return ValidateMaterialCommon(context, face, pname, dummyParams);
292}
293
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700294bool ValidateMaterialSingleComponent(Context *context,
295 GLenum face,
296 MaterialParameter pname,
297 GLfloat param)
298{
Lingfeng Yang6e5bf362018-08-15 09:53:17 -0700299 if (!ValidateMaterialSetting(context, face, pname, &param))
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700300 {
301 return false;
302 }
303
304 if (GetMaterialParameterCount(pname) > 1)
305 {
Jamie Madille0472f32018-11-27 16:32:45 -0500306 context->validationError(GL_INVALID_ENUM, kInvalidMaterialParameter);
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700307 return false;
308 }
309
310 return true;
311}
312
313bool ValidateLightModelCommon(Context *context, GLenum pname)
314{
315 ANGLE_VALIDATE_IS_GLES1(context);
316 switch (pname)
317 {
318 case GL_LIGHT_MODEL_AMBIENT:
319 case GL_LIGHT_MODEL_TWO_SIDE:
320 return true;
321 default:
Jamie Madille0472f32018-11-27 16:32:45 -0500322 context->validationError(GL_INVALID_ENUM, kInvalidLightModelParameter);
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700323 return false;
324 }
325}
326
327bool ValidateLightModelSingleComponent(Context *context, GLenum pname)
328{
329 if (!ValidateLightModelCommon(context, pname))
330 {
331 return false;
332 }
333
334 switch (pname)
335 {
336 case GL_LIGHT_MODEL_TWO_SIDE:
337 return true;
338 default:
Jamie Madille0472f32018-11-27 16:32:45 -0500339 context->validationError(GL_INVALID_ENUM, kInvalidLightModelParameter);
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700340 return false;
341 }
342}
343
Lingfeng Yang060088a2018-05-30 20:40:57 -0700344bool ValidateClipPlaneCommon(Context *context, GLenum plane)
345{
346 ANGLE_VALIDATE_IS_GLES1(context);
347
348 if (plane < GL_CLIP_PLANE0 || plane >= GL_CLIP_PLANE0 + context->getCaps().maxClipPlanes)
349 {
Jamie Madille0472f32018-11-27 16:32:45 -0500350 context->validationError(GL_INVALID_ENUM, kInvalidClipPlane);
Lingfeng Yang060088a2018-05-30 20:40:57 -0700351 return false;
352 }
353
354 return true;
355}
356
Lingfeng Yang7ba3f422018-06-01 09:43:04 -0700357bool ValidateFogCommon(Context *context, GLenum pname, const GLfloat *params)
358{
359 ANGLE_VALIDATE_IS_GLES1(context);
360
361 switch (pname)
362 {
363 case GL_FOG_MODE:
364 {
365 GLenum modeParam = static_cast<GLenum>(params[0]);
366 switch (modeParam)
367 {
368 case GL_EXP:
369 case GL_EXP2:
370 case GL_LINEAR:
371 return true;
372 default:
Jamie Madille0472f32018-11-27 16:32:45 -0500373 context->validationError(GL_INVALID_VALUE, kInvalidFogMode);
Lingfeng Yang7ba3f422018-06-01 09:43:04 -0700374 return false;
375 }
376 }
377 break;
378 case GL_FOG_START:
379 case GL_FOG_END:
380 case GL_FOG_COLOR:
381 break;
382 case GL_FOG_DENSITY:
383 if (params[0] < 0.0f)
384 {
Jamie Madille0472f32018-11-27 16:32:45 -0500385 context->validationError(GL_INVALID_VALUE, kInvalidFogDensity);
Lingfeng Yang7ba3f422018-06-01 09:43:04 -0700386 return false;
387 }
388 break;
389 default:
Jamie Madille0472f32018-11-27 16:32:45 -0500390 context->validationError(GL_INVALID_ENUM, kInvalidFogParameter);
Lingfeng Yang7ba3f422018-06-01 09:43:04 -0700391 return false;
392 }
393 return true;
394}
395
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700396bool ValidateTexEnvCommon(Context *context,
397 TextureEnvTarget target,
398 TextureEnvParameter pname,
399 const GLfloat *params)
400{
401 ANGLE_VALIDATE_IS_GLES1(context);
402
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700403 switch (target)
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700404 {
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700405 case TextureEnvTarget::Env:
406 switch (pname)
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700407 {
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700408 case TextureEnvParameter::Mode:
409 {
410 TextureEnvMode mode = FromGLenum<TextureEnvMode>(ConvertToGLenum(params[0]));
411 switch (mode)
Lingfeng Yang4004ae02018-06-13 09:29:00 -0700412 {
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700413 case TextureEnvMode::Add:
414 case TextureEnvMode::Blend:
415 case TextureEnvMode::Combine:
416 case TextureEnvMode::Decal:
417 case TextureEnvMode::Modulate:
418 case TextureEnvMode::Replace:
419 break;
420 default:
Jamie Madille0472f32018-11-27 16:32:45 -0500421 context->validationError(GL_INVALID_VALUE, kInvalidTextureEnvMode);
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700422 return false;
423 }
424 break;
425 }
426 case TextureEnvParameter::CombineRgb:
427 case TextureEnvParameter::CombineAlpha:
428 {
429 TextureCombine combine = FromGLenum<TextureCombine>(ConvertToGLenum(params[0]));
430 switch (combine)
431 {
432 case TextureCombine::Add:
433 case TextureCombine::AddSigned:
434 case TextureCombine::Interpolate:
435 case TextureCombine::Modulate:
436 case TextureCombine::Replace:
437 case TextureCombine::Subtract:
438 break;
439 case TextureCombine::Dot3Rgb:
440 case TextureCombine::Dot3Rgba:
441 if (pname == TextureEnvParameter::CombineAlpha)
442 {
Jamie Madille0472f32018-11-27 16:32:45 -0500443 context->validationError(GL_INVALID_VALUE, kInvalidTextureCombine);
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700444 return false;
445 }
446 break;
447 default:
Jamie Madille0472f32018-11-27 16:32:45 -0500448 context->validationError(GL_INVALID_VALUE, kInvalidTextureCombine);
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 Madille0472f32018-11-27 16:32:45 -0500469 context->validationError(GL_INVALID_VALUE, kInvalidTextureCombineSrc);
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700470 return false;
471 }
472 break;
473 }
474 case TextureEnvParameter::Op0Rgb:
475 case TextureEnvParameter::Op1Rgb:
476 case TextureEnvParameter::Op2Rgb:
477 case TextureEnvParameter::Op0Alpha:
478 case TextureEnvParameter::Op1Alpha:
479 case TextureEnvParameter::Op2Alpha:
480 {
481 TextureOp operand = FromGLenum<TextureOp>(ConvertToGLenum(params[0]));
482 switch (operand)
483 {
484 case TextureOp::SrcAlpha:
485 case TextureOp::OneMinusSrcAlpha:
486 break;
487 case TextureOp::SrcColor:
488 case TextureOp::OneMinusSrcColor:
489 if (pname == TextureEnvParameter::Op0Alpha ||
490 pname == TextureEnvParameter::Op1Alpha ||
491 pname == TextureEnvParameter::Op2Alpha)
492 {
Jamie Madille0472f32018-11-27 16:32:45 -0500493 context->validationError(GL_INVALID_VALUE, kInvalidTextureCombine);
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700494 return false;
495 }
496 break;
497 default:
Jamie Madille0472f32018-11-27 16:32:45 -0500498 context->validationError(GL_INVALID_VALUE, kInvalidTextureCombineOp);
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700499 return false;
500 }
501 break;
502 }
503 case TextureEnvParameter::RgbScale:
504 case TextureEnvParameter::AlphaScale:
505 if (params[0] != 1.0f && params[0] != 2.0f && params[0] != 4.0f)
506 {
Jamie Madille0472f32018-11-27 16:32:45 -0500507 context->validationError(GL_INVALID_VALUE, kInvalidTextureEnvScale);
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700508 return false;
509 }
510 break;
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700511 case TextureEnvParameter::Color:
512 break;
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700513 default:
Jamie Madille0472f32018-11-27 16:32:45 -0500514 context->validationError(GL_INVALID_ENUM, kInvalidTextureEnvParameter);
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700515 return false;
516 }
517 break;
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700518 case TextureEnvTarget::PointSprite:
519 if (!context->getExtensions().pointSprite)
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700520 {
Jamie Madille0472f32018-11-27 16:32:45 -0500521 context->validationError(GL_INVALID_ENUM, kInvalidTextureEnvTarget);
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700522 return false;
523 }
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700524 switch (pname)
525 {
526 case TextureEnvParameter::PointCoordReplace:
527 break;
528 default:
Jamie Madille0472f32018-11-27 16:32:45 -0500529 context->validationError(GL_INVALID_ENUM, kInvalidTextureEnvParameter);
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700530 return false;
531 }
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700532 break;
533 default:
Jamie Madille0472f32018-11-27 16:32:45 -0500534 context->validationError(GL_INVALID_ENUM, kInvalidTextureEnvTarget);
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700535 return false;
536 }
537 return true;
538}
539
540bool ValidateGetTexEnvCommon(Context *context, TextureEnvTarget target, TextureEnvParameter pname)
541{
542 GLfloat dummy[4] = {};
543 switch (pname)
544 {
545 case TextureEnvParameter::Mode:
546 ConvertPackedEnum(TextureEnvMode::Add, dummy);
547 break;
548 case TextureEnvParameter::CombineRgb:
549 case TextureEnvParameter::CombineAlpha:
550 ConvertPackedEnum(TextureCombine::Add, dummy);
551 break;
552 case TextureEnvParameter::Src0Rgb:
553 case TextureEnvParameter::Src1Rgb:
554 case TextureEnvParameter::Src2Rgb:
555 case TextureEnvParameter::Src0Alpha:
556 case TextureEnvParameter::Src1Alpha:
557 case TextureEnvParameter::Src2Alpha:
558 ConvertPackedEnum(TextureSrc::Constant, dummy);
559 break;
560 case TextureEnvParameter::Op0Rgb:
561 case TextureEnvParameter::Op1Rgb:
562 case TextureEnvParameter::Op2Rgb:
563 case TextureEnvParameter::Op0Alpha:
564 case TextureEnvParameter::Op1Alpha:
565 case TextureEnvParameter::Op2Alpha:
566 ConvertPackedEnum(TextureOp::SrcAlpha, dummy);
567 break;
568 case TextureEnvParameter::RgbScale:
569 case TextureEnvParameter::AlphaScale:
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700570 case TextureEnvParameter::PointCoordReplace:
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700571 dummy[0] = 1.0f;
572 break;
573 default:
574 break;
575 }
576
577 return ValidateTexEnvCommon(context, target, pname, dummy);
578}
579
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700580bool ValidatePointParameterCommon(Context *context, PointParameter pname, const GLfloat *params)
581{
582 ANGLE_VALIDATE_IS_GLES1(context);
583
584 switch (pname)
585 {
586 case PointParameter::PointSizeMin:
587 case PointParameter::PointSizeMax:
588 case PointParameter::PointFadeThresholdSize:
589 case PointParameter::PointDistanceAttenuation:
590 for (unsigned int i = 0; i < GetPointParameterCount(pname); i++)
591 {
592 if (params[i] < 0.0f)
593 {
Jamie Madille0472f32018-11-27 16:32:45 -0500594 context->validationError(GL_INVALID_VALUE, kInvalidPointParameterValue);
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700595 return false;
596 }
597 }
598 break;
599 default:
Jamie Madille0472f32018-11-27 16:32:45 -0500600 context->validationError(GL_INVALID_ENUM, kInvalidPointParameter);
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700601 return false;
602 }
603
604 return true;
605}
606
607bool ValidatePointSizeCommon(Context *context, GLfloat size)
608{
609 ANGLE_VALIDATE_IS_GLES1(context);
610
611 if (size <= 0.0f)
612 {
Jamie Madille0472f32018-11-27 16:32:45 -0500613 context->validationError(GL_INVALID_VALUE, kInvalidPointSizeValue);
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700614 return false;
615 }
616
617 return true;
618}
619
Lingfeng Yang0df813c2018-07-12 12:52:06 -0700620bool ValidateDrawTexCommon(Context *context, float width, float height)
621{
622 ANGLE_VALIDATE_IS_GLES1(context);
623
624 if (width <= 0.0f || height <= 0.0f)
625 {
Jamie Madille0472f32018-11-27 16:32:45 -0500626 context->validationError(GL_INVALID_VALUE, kNonPositiveDrawTextureDimension);
Lingfeng Yang0df813c2018-07-12 12:52:06 -0700627 return false;
628 }
629
630 return true;
631}
632
Lingfeng Yang01074432018-04-16 10:19:51 -0700633} // namespace gl
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500634
635namespace gl
636{
637
Lingfeng Yang13b708f2018-03-21 12:14:10 -0700638bool ValidateAlphaFunc(Context *context, AlphaTestFunc func, GLfloat ref)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500639{
Lingfeng Yang13b708f2018-03-21 12:14:10 -0700640 ANGLE_VALIDATE_IS_GLES1(context);
641 return ValidateAlphaFuncCommon(context, func);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500642}
643
Lingfeng Yang13b708f2018-03-21 12:14:10 -0700644bool ValidateAlphaFuncx(Context *context, AlphaTestFunc func, GLfixed ref)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500645{
Lingfeng Yang13b708f2018-03-21 12:14:10 -0700646 ANGLE_VALIDATE_IS_GLES1(context);
647 return ValidateAlphaFuncCommon(context, func);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500648}
649
650bool ValidateClearColorx(Context *context, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
651{
652 UNIMPLEMENTED();
653 return true;
654}
655
656bool ValidateClearDepthx(Context *context, GLfixed depth)
657{
658 UNIMPLEMENTED();
659 return true;
660}
661
662bool ValidateClientActiveTexture(Context *context, GLenum texture)
663{
Lingfeng Yang96310cd2018-03-28 11:56:28 -0700664 ANGLE_VALIDATE_IS_GLES1(context);
Lingfeng Yang038dd532018-03-29 17:31:52 -0700665 return ValidateMultitextureUnit(context, texture);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500666}
667
Lingfeng Yang060088a2018-05-30 20:40:57 -0700668bool ValidateClipPlanef(Context *context, GLenum plane, const GLfloat *eqn)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500669{
Lingfeng Yang060088a2018-05-30 20:40:57 -0700670 return ValidateClipPlaneCommon(context, plane);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500671}
672
673bool ValidateClipPlanex(Context *context, GLenum plane, const GLfixed *equation)
674{
Lingfeng Yang060088a2018-05-30 20:40:57 -0700675 return ValidateClipPlaneCommon(context, plane);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500676}
677
678bool ValidateColor4f(Context *context, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
679{
Lingfeng Yanga43994c2018-03-29 07:21:41 -0700680 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500681 return true;
682}
683
684bool ValidateColor4ub(Context *context, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
685{
Lingfeng Yanga43994c2018-03-29 07:21:41 -0700686 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500687 return true;
688}
689
690bool ValidateColor4x(Context *context, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
691{
Lingfeng Yanga43994c2018-03-29 07:21:41 -0700692 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500693 return true;
694}
695
696bool ValidateColorPointer(Context *context,
697 GLint size,
698 GLenum type,
699 GLsizei stride,
700 const void *pointer)
701{
Lingfeng Yangabb09f12018-04-16 10:43:53 -0700702 return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::Color, size, type,
703 stride, pointer);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500704}
705
706bool ValidateCullFace(Context *context, GLenum mode)
707{
708 UNIMPLEMENTED();
709 return true;
710}
711
712bool ValidateDepthRangex(Context *context, GLfixed n, GLfixed f)
713{
714 UNIMPLEMENTED();
715 return true;
716}
717
Lingfeng Yang01074432018-04-16 10:19:51 -0700718bool ValidateDisableClientState(Context *context, ClientVertexArrayType arrayType)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500719{
Lingfeng Yang01074432018-04-16 10:19:51 -0700720 return ValidateClientStateCommon(context, arrayType);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500721}
722
Lingfeng Yang01074432018-04-16 10:19:51 -0700723bool ValidateEnableClientState(Context *context, ClientVertexArrayType arrayType)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500724{
Lingfeng Yang01074432018-04-16 10:19:51 -0700725 return ValidateClientStateCommon(context, arrayType);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500726}
727
728bool ValidateFogf(Context *context, GLenum pname, GLfloat param)
729{
Lingfeng Yang7ba3f422018-06-01 09:43:04 -0700730 return ValidateFogCommon(context, pname, &param);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500731}
732
733bool ValidateFogfv(Context *context, GLenum pname, const GLfloat *params)
734{
Lingfeng Yang7ba3f422018-06-01 09:43:04 -0700735 return ValidateFogCommon(context, pname, params);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500736}
737
738bool ValidateFogx(Context *context, GLenum pname, GLfixed param)
739{
Lingfeng Yang7ba3f422018-06-01 09:43:04 -0700740 GLfloat asFloat = FixedToFloat(param);
741 return ValidateFogCommon(context, pname, &asFloat);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500742}
743
Lingfeng Yang7ba3f422018-06-01 09:43:04 -0700744bool ValidateFogxv(Context *context, GLenum pname, const GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500745{
Lingfeng Yang7ba3f422018-06-01 09:43:04 -0700746 unsigned int paramCount = GetFogParameterCount(pname);
747 GLfloat paramsf[4] = {};
748
749 for (unsigned int i = 0; i < paramCount; i++)
750 {
751 paramsf[i] = FixedToFloat(params[i]);
752 }
753
754 return ValidateFogCommon(context, pname, paramsf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500755}
756
757bool ValidateFrustumf(Context *context,
758 GLfloat l,
759 GLfloat r,
760 GLfloat b,
761 GLfloat t,
762 GLfloat n,
763 GLfloat f)
764{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -0700765 ANGLE_VALIDATE_IS_GLES1(context);
766 if (l == r || b == t || n == f || n <= 0.0f || f <= 0.0f)
767 {
Jamie Madille0472f32018-11-27 16:32:45 -0500768 context->validationError(GL_INVALID_VALUE, kInvalidProjectionMatrix);
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -0700769 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500770 return true;
771}
772
773bool ValidateFrustumx(Context *context,
774 GLfixed l,
775 GLfixed r,
776 GLfixed b,
777 GLfixed t,
778 GLfixed n,
779 GLfixed f)
780{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -0700781 ANGLE_VALIDATE_IS_GLES1(context);
782 if (l == r || b == t || n == f || n <= 0 || f <= 0)
783 {
Jamie Madille0472f32018-11-27 16:32:45 -0500784 context->validationError(GL_INVALID_VALUE, kInvalidProjectionMatrix);
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -0700785 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500786 return true;
787}
788
789bool ValidateGetBufferParameteriv(Context *context, GLenum target, GLenum pname, GLint *params)
790{
791 UNIMPLEMENTED();
792 return true;
793}
794
795bool ValidateGetClipPlanef(Context *context, GLenum plane, GLfloat *equation)
796{
Lingfeng Yang060088a2018-05-30 20:40:57 -0700797 return ValidateClipPlaneCommon(context, plane);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500798}
799
800bool ValidateGetClipPlanex(Context *context, GLenum plane, GLfixed *equation)
801{
Lingfeng Yang060088a2018-05-30 20:40:57 -0700802 return ValidateClipPlaneCommon(context, plane);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500803}
804
805bool ValidateGetFixedv(Context *context, GLenum pname, GLfixed *params)
806{
807 UNIMPLEMENTED();
808 return true;
809}
810
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700811bool ValidateGetLightfv(Context *context, GLenum light, LightParameter pname, GLfloat *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500812{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700813 GLfloat dummyParams[4] = {0.0f, 0.0f, 0.0f, 0.0f};
814 return ValidateLightCommon(context, light, pname, dummyParams);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500815}
816
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700817bool ValidateGetLightxv(Context *context, GLenum light, LightParameter pname, GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500818{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700819 GLfloat dummyParams[4] = {0.0f, 0.0f, 0.0f, 0.0f};
820 return ValidateLightCommon(context, light, pname, dummyParams);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500821}
822
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700823bool ValidateGetMaterialfv(Context *context, GLenum face, MaterialParameter pname, GLfloat *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500824{
Lingfeng Yang6e5bf362018-08-15 09:53:17 -0700825 return ValidateMaterialQuery(context, face, pname);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500826}
827
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700828bool ValidateGetMaterialxv(Context *context, GLenum face, MaterialParameter pname, GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500829{
Lingfeng Yang6e5bf362018-08-15 09:53:17 -0700830 return ValidateMaterialQuery(context, face, pname);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500831}
832
833bool ValidateGetPointerv(Context *context, GLenum pname, void **params)
834{
Lingfeng Yangabb09f12018-04-16 10:43:53 -0700835 ANGLE_VALIDATE_IS_GLES1(context);
836 switch (pname)
837 {
838 case GL_VERTEX_ARRAY_POINTER:
839 case GL_NORMAL_ARRAY_POINTER:
840 case GL_COLOR_ARRAY_POINTER:
841 case GL_TEXTURE_COORD_ARRAY_POINTER:
842 case GL_POINT_SIZE_ARRAY_POINTER_OES:
843 return true;
844 default:
Jamie Madille0472f32018-11-27 16:32:45 -0500845 context->validationError(GL_INVALID_ENUM, kInvalidPointerQuery);
Lingfeng Yangabb09f12018-04-16 10:43:53 -0700846 return false;
847 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500848}
849
Lingfeng Yang74be2962018-06-07 09:13:38 -0700850bool ValidateGetTexEnvfv(Context *context,
851 TextureEnvTarget target,
852 TextureEnvParameter pname,
853 GLfloat *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500854{
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700855 return ValidateGetTexEnvCommon(context, target, pname);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500856}
857
Lingfeng Yang74be2962018-06-07 09:13:38 -0700858bool ValidateGetTexEnviv(Context *context,
859 TextureEnvTarget target,
860 TextureEnvParameter pname,
861 GLint *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500862{
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700863 return ValidateGetTexEnvCommon(context, target, pname);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500864}
865
Lingfeng Yang74be2962018-06-07 09:13:38 -0700866bool ValidateGetTexEnvxv(Context *context,
867 TextureEnvTarget target,
868 TextureEnvParameter pname,
869 GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500870{
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700871 return ValidateGetTexEnvCommon(context, target, pname);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500872}
873
Corentin Wallezf0e89be2017-11-08 14:00:32 -0800874bool ValidateGetTexParameterxv(Context *context, TextureType target, GLenum pname, GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500875{
Lingfeng Yangf97641c2018-06-21 19:22:45 -0700876 ANGLE_VALIDATE_IS_GLES1(context);
877
878 if (!ValidateGetTexParameterBase(context, target, pname, nullptr))
879 {
880 return false;
881 }
882
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500883 return true;
884}
885
886bool ValidateLightModelf(Context *context, GLenum pname, GLfloat param)
887{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700888 return ValidateLightModelSingleComponent(context, pname);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500889}
890
891bool ValidateLightModelfv(Context *context, GLenum pname, const GLfloat *params)
892{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700893 return ValidateLightModelCommon(context, pname);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500894}
895
896bool ValidateLightModelx(Context *context, GLenum pname, GLfixed param)
897{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700898 return ValidateLightModelSingleComponent(context, pname);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500899}
900
901bool ValidateLightModelxv(Context *context, GLenum pname, const GLfixed *param)
902{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700903 return ValidateLightModelCommon(context, pname);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500904}
905
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700906bool ValidateLightf(Context *context, GLenum light, LightParameter pname, GLfloat param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500907{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700908 return ValidateLightSingleComponent(context, light, pname, param);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500909}
910
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700911bool ValidateLightfv(Context *context, GLenum light, LightParameter pname, const GLfloat *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500912{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700913 return ValidateLightCommon(context, light, pname, params);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500914}
915
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700916bool ValidateLightx(Context *context, GLenum light, LightParameter pname, GLfixed param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500917{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700918 return ValidateLightSingleComponent(context, light, pname, FixedToFloat(param));
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500919}
920
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700921bool ValidateLightxv(Context *context, GLenum light, LightParameter pname, const GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500922{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700923 GLfloat paramsf[4];
924 for (unsigned int i = 0; i < GetLightParameterCount(pname); i++)
925 {
926 paramsf[i] = FixedToFloat(params[i]);
927 }
928
929 return ValidateLightCommon(context, light, pname, paramsf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500930}
931
932bool ValidateLineWidthx(Context *context, GLfixed width)
933{
934 UNIMPLEMENTED();
935 return true;
936}
937
938bool ValidateLoadIdentity(Context *context)
939{
Lingfeng Yang3a41af62018-04-09 07:28:56 -0700940 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500941 return true;
942}
943
944bool ValidateLoadMatrixf(Context *context, const GLfloat *m)
945{
Lingfeng Yang3a41af62018-04-09 07:28:56 -0700946 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500947 return true;
948}
949
950bool ValidateLoadMatrixx(Context *context, const GLfixed *m)
951{
Lingfeng Yang3a41af62018-04-09 07:28:56 -0700952 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500953 return true;
954}
955
Lingfeng Yang6e5bf362018-08-15 09:53:17 -0700956bool ValidateLogicOp(Context *context, LogicalOperation opcode)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500957{
Lingfeng Yang6e5bf362018-08-15 09:53:17 -0700958 ANGLE_VALIDATE_IS_GLES1(context);
959 switch (opcode)
960 {
961 case LogicalOperation::And:
962 case LogicalOperation::AndInverted:
963 case LogicalOperation::AndReverse:
964 case LogicalOperation::Clear:
965 case LogicalOperation::Copy:
966 case LogicalOperation::CopyInverted:
967 case LogicalOperation::Equiv:
968 case LogicalOperation::Invert:
969 case LogicalOperation::Nand:
970 case LogicalOperation::Noop:
971 case LogicalOperation::Nor:
972 case LogicalOperation::Or:
973 case LogicalOperation::OrInverted:
974 case LogicalOperation::OrReverse:
975 case LogicalOperation::Set:
976 case LogicalOperation::Xor:
977 return true;
978 default:
Jamie Madille0472f32018-11-27 16:32:45 -0500979 context->validationError(GL_INVALID_ENUM, kInvalidLogicOp);
Lingfeng Yang6e5bf362018-08-15 09:53:17 -0700980 return false;
981 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500982}
983
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700984bool ValidateMaterialf(Context *context, GLenum face, MaterialParameter pname, GLfloat param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500985{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700986 return ValidateMaterialSingleComponent(context, face, pname, param);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500987}
988
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700989bool ValidateMaterialfv(Context *context,
990 GLenum face,
991 MaterialParameter pname,
992 const GLfloat *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500993{
Lingfeng Yang6e5bf362018-08-15 09:53:17 -0700994 return ValidateMaterialSetting(context, face, pname, params);
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500995}
996
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700997bool ValidateMaterialx(Context *context, GLenum face, MaterialParameter pname, GLfixed param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500998{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700999 return ValidateMaterialSingleComponent(context, face, pname, FixedToFloat(param));
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001000}
1001
Lingfeng Yangd0febe72018-05-17 22:36:52 -07001002bool ValidateMaterialxv(Context *context,
1003 GLenum face,
1004 MaterialParameter pname,
1005 const GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001006{
Lingfeng Yangd0febe72018-05-17 22:36:52 -07001007 GLfloat paramsf[4];
1008
1009 for (unsigned int i = 0; i < GetMaterialParameterCount(pname); i++)
1010 {
1011 paramsf[i] = FixedToFloat(params[i]);
1012 }
1013
Lingfeng Yang6e5bf362018-08-15 09:53:17 -07001014 return ValidateMaterialSetting(context, face, pname, paramsf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001015}
1016
Lingfeng Yang00af4632018-04-02 12:42:24 -07001017bool ValidateMatrixMode(Context *context, MatrixType mode)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001018{
Lingfeng Yangd2488ab2018-04-04 09:25:48 -07001019 ANGLE_VALIDATE_IS_GLES1(context);
1020 switch (mode)
1021 {
1022 case MatrixType::Projection:
1023 case MatrixType::Modelview:
1024 case MatrixType::Texture:
1025 return true;
1026 default:
Jamie Madille0472f32018-11-27 16:32:45 -05001027 context->validationError(GL_INVALID_ENUM, kInvalidMatrixMode);
Lingfeng Yangd2488ab2018-04-04 09:25:48 -07001028 return false;
1029 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001030}
1031
1032bool ValidateMultMatrixf(Context *context, const GLfloat *m)
1033{
Lingfeng Yang568fc392018-04-09 07:57:23 -07001034 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001035 return true;
1036}
1037
1038bool ValidateMultMatrixx(Context *context, const GLfixed *m)
1039{
Lingfeng Yang568fc392018-04-09 07:57:23 -07001040 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001041 return true;
1042}
1043
1044bool ValidateMultiTexCoord4f(Context *context,
1045 GLenum target,
1046 GLfloat s,
1047 GLfloat t,
1048 GLfloat r,
1049 GLfloat q)
1050{
Lingfeng Yang038dd532018-03-29 17:31:52 -07001051 ANGLE_VALIDATE_IS_GLES1(context);
1052 return ValidateMultitextureUnit(context, target);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001053}
1054
1055bool ValidateMultiTexCoord4x(Context *context,
Lingfeng Yang038dd532018-03-29 17:31:52 -07001056 GLenum target,
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001057 GLfixed s,
1058 GLfixed t,
1059 GLfixed r,
1060 GLfixed q)
1061{
Lingfeng Yang038dd532018-03-29 17:31:52 -07001062 ANGLE_VALIDATE_IS_GLES1(context);
1063 return ValidateMultitextureUnit(context, target);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001064}
1065
1066bool ValidateNormal3f(Context *context, GLfloat nx, GLfloat ny, GLfloat nz)
1067{
Lingfeng Yang5a7e61b2018-03-29 16:50:32 -07001068 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001069 return true;
1070}
1071
1072bool ValidateNormal3x(Context *context, GLfixed nx, GLfixed ny, GLfixed nz)
1073{
Lingfeng Yang5a7e61b2018-03-29 16:50:32 -07001074 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001075 return true;
1076}
1077
1078bool ValidateNormalPointer(Context *context, GLenum type, GLsizei stride, const void *pointer)
1079{
Lingfeng Yangabb09f12018-04-16 10:43:53 -07001080 return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::Normal, 3, type,
1081 stride, pointer);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001082}
1083
1084bool ValidateOrthof(Context *context,
1085 GLfloat l,
1086 GLfloat r,
1087 GLfloat b,
1088 GLfloat t,
1089 GLfloat n,
1090 GLfloat f)
1091{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001092 ANGLE_VALIDATE_IS_GLES1(context);
1093 if (l == r || b == t || n == f || n <= 0.0f || f <= 0.0f)
1094 {
Jamie Madille0472f32018-11-27 16:32:45 -05001095 context->validationError(GL_INVALID_VALUE, kInvalidProjectionMatrix);
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001096 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001097 return true;
1098}
1099
1100bool ValidateOrthox(Context *context,
1101 GLfixed l,
1102 GLfixed r,
1103 GLfixed b,
1104 GLfixed t,
1105 GLfixed n,
1106 GLfixed f)
1107{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001108 ANGLE_VALIDATE_IS_GLES1(context);
1109 if (l == r || b == t || n == f || n <= 0 || f <= 0)
1110 {
Jamie Madille0472f32018-11-27 16:32:45 -05001111 context->validationError(GL_INVALID_VALUE, kInvalidProjectionMatrix);
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001112 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001113 return true;
1114}
1115
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001116bool ValidatePointParameterf(Context *context, PointParameter pname, GLfloat param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001117{
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001118 unsigned int paramCount = GetPointParameterCount(pname);
1119 if (paramCount != 1)
1120 {
Jamie Madille0472f32018-11-27 16:32:45 -05001121 context->validationError(GL_INVALID_ENUM, kInvalidPointParameter);
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001122 return false;
1123 }
1124
1125 return ValidatePointParameterCommon(context, pname, &param);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001126}
1127
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001128bool ValidatePointParameterfv(Context *context, PointParameter pname, const GLfloat *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001129{
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001130 return ValidatePointParameterCommon(context, pname, params);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001131}
1132
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001133bool ValidatePointParameterx(Context *context, PointParameter pname, GLfixed param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001134{
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001135 unsigned int paramCount = GetPointParameterCount(pname);
1136 if (paramCount != 1)
1137 {
Jamie Madille0472f32018-11-27 16:32:45 -05001138 context->validationError(GL_INVALID_ENUM, kInvalidPointParameter);
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001139 return false;
1140 }
1141
1142 GLfloat paramf = FixedToFloat(param);
1143 return ValidatePointParameterCommon(context, pname, &paramf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001144}
1145
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001146bool ValidatePointParameterxv(Context *context, PointParameter pname, const GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001147{
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001148 GLfloat paramsf[4] = {};
1149 for (unsigned int i = 0; i < GetPointParameterCount(pname); i++)
1150 {
1151 paramsf[i] = FixedToFloat(params[i]);
1152 }
1153 return ValidatePointParameterCommon(context, pname, paramsf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001154}
1155
1156bool ValidatePointSize(Context *context, GLfloat size)
1157{
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001158 return ValidatePointSizeCommon(context, size);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001159}
1160
1161bool ValidatePointSizex(Context *context, GLfixed size)
1162{
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001163 return ValidatePointSizeCommon(context, FixedToFloat(size));
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001164}
1165
1166bool ValidatePolygonOffsetx(Context *context, GLfixed factor, GLfixed units)
1167{
1168 UNIMPLEMENTED();
1169 return true;
1170}
1171
1172bool ValidatePopMatrix(Context *context)
1173{
Lingfeng Yange547aac2018-04-05 09:39:20 -07001174 ANGLE_VALIDATE_IS_GLES1(context);
1175 const auto &stack = context->getGLState().gles1().currentMatrixStack();
1176 if (stack.size() == 1)
1177 {
Jamie Madille0472f32018-11-27 16:32:45 -05001178 context->validationError(GL_STACK_UNDERFLOW, kMatrixStackUnderflow);
Lingfeng Yange547aac2018-04-05 09:39:20 -07001179 return false;
1180 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001181 return true;
1182}
1183
1184bool ValidatePushMatrix(Context *context)
1185{
Lingfeng Yange547aac2018-04-05 09:39:20 -07001186 ANGLE_VALIDATE_IS_GLES1(context);
1187 const auto &stack = context->getGLState().gles1().currentMatrixStack();
1188 if (stack.size() == stack.max_size())
1189 {
Jamie Madille0472f32018-11-27 16:32:45 -05001190 context->validationError(GL_STACK_OVERFLOW, kMatrixStackOverflow);
Lingfeng Yange547aac2018-04-05 09:39:20 -07001191 return false;
1192 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001193 return true;
1194}
1195
1196bool ValidateRotatef(Context *context, GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
1197{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001198 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001199 return true;
1200}
1201
1202bool ValidateRotatex(Context *context, GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
1203{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001204 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001205 return true;
1206}
1207
1208bool ValidateSampleCoveragex(Context *context, GLclampx value, GLboolean invert)
1209{
1210 UNIMPLEMENTED();
1211 return true;
1212}
1213
1214bool ValidateScalef(Context *context, GLfloat x, GLfloat y, GLfloat z)
1215{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001216 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001217 return true;
1218}
1219
1220bool ValidateScalex(Context *context, GLfixed x, GLfixed y, GLfixed z)
1221{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001222 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001223 return true;
1224}
1225
Lingfeng Yanga0cfa872018-05-30 21:12:17 -07001226bool ValidateShadeModel(Context *context, ShadingModel mode)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001227{
Lingfeng Yanga0cfa872018-05-30 21:12:17 -07001228 ANGLE_VALIDATE_IS_GLES1(context);
1229 switch (mode)
1230 {
1231 case ShadingModel::Flat:
1232 case ShadingModel::Smooth:
1233 return true;
1234 default:
Jamie Madille0472f32018-11-27 16:32:45 -05001235 context->validationError(GL_INVALID_ENUM, kInvalidShadingModel);
Lingfeng Yanga0cfa872018-05-30 21:12:17 -07001236 return false;
1237 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001238}
1239
1240bool ValidateTexCoordPointer(Context *context,
1241 GLint size,
1242 GLenum type,
1243 GLsizei stride,
1244 const void *pointer)
1245{
Lingfeng Yangabb09f12018-04-16 10:43:53 -07001246 return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::TextureCoord, size,
1247 type, stride, pointer);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001248}
1249
Lingfeng Yang74be2962018-06-07 09:13:38 -07001250bool ValidateTexEnvf(Context *context,
1251 TextureEnvTarget target,
1252 TextureEnvParameter pname,
1253 GLfloat param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001254{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001255 return ValidateTexEnvCommon(context, target, pname, &param);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001256}
1257
Lingfeng Yang74be2962018-06-07 09:13:38 -07001258bool ValidateTexEnvfv(Context *context,
1259 TextureEnvTarget target,
1260 TextureEnvParameter pname,
1261 const GLfloat *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001262{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001263 return ValidateTexEnvCommon(context, target, pname, params);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001264}
1265
Lingfeng Yang74be2962018-06-07 09:13:38 -07001266bool ValidateTexEnvi(Context *context,
1267 TextureEnvTarget target,
1268 TextureEnvParameter pname,
1269 GLint param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001270{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001271 GLfloat paramf = static_cast<GLfloat>(param);
1272 return ValidateTexEnvCommon(context, target, pname, &paramf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001273}
1274
Lingfeng Yang74be2962018-06-07 09:13:38 -07001275bool ValidateTexEnviv(Context *context,
1276 TextureEnvTarget target,
1277 TextureEnvParameter pname,
1278 const GLint *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001279{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001280 GLfloat paramsf[4];
1281 for (unsigned int i = 0; i < GetTextureEnvParameterCount(pname); i++)
1282 {
1283 paramsf[i] = static_cast<GLfloat>(params[i]);
1284 }
1285 return ValidateTexEnvCommon(context, target, pname, paramsf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001286}
1287
Lingfeng Yang74be2962018-06-07 09:13:38 -07001288bool ValidateTexEnvx(Context *context,
1289 TextureEnvTarget target,
1290 TextureEnvParameter pname,
1291 GLfixed param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001292{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001293 GLfloat paramf = static_cast<GLfloat>(param);
1294 return ValidateTexEnvCommon(context, target, pname, &paramf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001295}
1296
Lingfeng Yang74be2962018-06-07 09:13:38 -07001297bool ValidateTexEnvxv(Context *context,
1298 TextureEnvTarget target,
1299 TextureEnvParameter pname,
1300 const GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001301{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001302 GLfloat paramsf[4];
1303 for (unsigned int i = 0; i < GetTextureEnvParameterCount(pname); i++)
1304 {
1305 paramsf[i] = static_cast<GLfloat>(params[i]);
1306 }
1307 return ValidateTexEnvCommon(context, target, pname, paramsf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001308}
1309
Corentin Wallezf0e89be2017-11-08 14:00:32 -08001310bool ValidateTexParameterx(Context *context, TextureType target, GLenum pname, GLfixed param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001311{
Lingfeng Yangf97641c2018-06-21 19:22:45 -07001312 ANGLE_VALIDATE_IS_GLES1(context);
1313 GLfloat paramf = FixedToFloat(param);
Till Rathmannb8543632018-10-02 19:46:14 +02001314 return ValidateTexParameterBase(context, target, pname, -1, false, &paramf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001315}
1316
Corentin Wallezf0e89be2017-11-08 14:00:32 -08001317bool ValidateTexParameterxv(Context *context,
1318 TextureType target,
1319 GLenum pname,
1320 const GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001321{
Lingfeng Yangf97641c2018-06-21 19:22:45 -07001322 ANGLE_VALIDATE_IS_GLES1(context);
1323 GLfloat paramsf[4] = {};
1324 for (unsigned int i = 0; i < GetTexParameterCount(pname); i++)
1325 {
1326 paramsf[i] = FixedToFloat(params[i]);
1327 }
Till Rathmannb8543632018-10-02 19:46:14 +02001328 return ValidateTexParameterBase(context, target, pname, -1, true, paramsf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001329}
1330
1331bool ValidateTranslatef(Context *context, GLfloat x, GLfloat y, GLfloat z)
1332{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001333 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001334 return true;
1335}
1336
1337bool ValidateTranslatex(Context *context, GLfixed x, GLfixed y, GLfixed z)
1338{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001339 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001340 return true;
1341}
1342
1343bool ValidateVertexPointer(Context *context,
1344 GLint size,
1345 GLenum type,
1346 GLsizei stride,
1347 const void *pointer)
1348{
Lingfeng Yangabb09f12018-04-16 10:43:53 -07001349 return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::Vertex, size, type,
1350 stride, pointer);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001351}
1352
1353bool ValidateDrawTexfOES(Context *context,
1354 GLfloat x,
1355 GLfloat y,
1356 GLfloat z,
1357 GLfloat width,
1358 GLfloat height)
1359{
Lingfeng Yang0df813c2018-07-12 12:52:06 -07001360 return ValidateDrawTexCommon(context, width, height);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001361}
1362
1363bool ValidateDrawTexfvOES(Context *context, const GLfloat *coords)
1364{
Lingfeng Yang0df813c2018-07-12 12:52:06 -07001365 return ValidateDrawTexCommon(context, coords[3], coords[4]);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001366}
1367
1368bool ValidateDrawTexiOES(Context *context, GLint x, GLint y, GLint z, GLint width, GLint height)
1369{
Lingfeng Yang0df813c2018-07-12 12:52:06 -07001370 return ValidateDrawTexCommon(context, static_cast<GLfloat>(width),
1371 static_cast<GLfloat>(height));
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001372}
1373
1374bool ValidateDrawTexivOES(Context *context, const GLint *coords)
1375{
Lingfeng Yang0df813c2018-07-12 12:52:06 -07001376 return ValidateDrawTexCommon(context, static_cast<GLfloat>(coords[3]),
1377 static_cast<GLfloat>(coords[4]));
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001378}
1379
1380bool ValidateDrawTexsOES(Context *context,
1381 GLshort x,
1382 GLshort y,
1383 GLshort z,
1384 GLshort width,
1385 GLshort height)
1386{
Lingfeng Yang0df813c2018-07-12 12:52:06 -07001387 return ValidateDrawTexCommon(context, static_cast<GLfloat>(width),
1388 static_cast<GLfloat>(height));
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001389}
1390
1391bool ValidateDrawTexsvOES(Context *context, const GLshort *coords)
1392{
Lingfeng Yang0df813c2018-07-12 12:52:06 -07001393 return ValidateDrawTexCommon(context, static_cast<GLfloat>(coords[3]),
1394 static_cast<GLfloat>(coords[4]));
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001395}
1396
1397bool ValidateDrawTexxOES(Context *context,
1398 GLfixed x,
1399 GLfixed y,
1400 GLfixed z,
1401 GLfixed width,
1402 GLfixed height)
1403{
Lingfeng Yang0df813c2018-07-12 12:52:06 -07001404 return ValidateDrawTexCommon(context, FixedToFloat(width), FixedToFloat(height));
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001405}
1406
1407bool ValidateDrawTexxvOES(Context *context, const GLfixed *coords)
1408{
Lingfeng Yang0df813c2018-07-12 12:52:06 -07001409 return ValidateDrawTexCommon(context, FixedToFloat(coords[3]), FixedToFloat(coords[4]));
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001410}
1411
1412bool ValidateCurrentPaletteMatrixOES(Context *context, GLuint matrixpaletteindex)
1413{
1414 UNIMPLEMENTED();
1415 return true;
1416}
1417
1418bool ValidateLoadPaletteFromModelViewMatrixOES(Context *context)
1419{
1420 UNIMPLEMENTED();
1421 return true;
1422}
1423
1424bool ValidateMatrixIndexPointerOES(Context *context,
1425 GLint size,
1426 GLenum type,
1427 GLsizei stride,
1428 const void *pointer)
1429{
1430 UNIMPLEMENTED();
1431 return true;
1432}
1433
1434bool ValidateWeightPointerOES(Context *context,
1435 GLint size,
1436 GLenum type,
1437 GLsizei stride,
1438 const void *pointer)
1439{
1440 UNIMPLEMENTED();
1441 return true;
1442}
1443
1444bool ValidatePointSizePointerOES(Context *context, GLenum type, GLsizei stride, const void *pointer)
1445{
Lingfeng Yangabb09f12018-04-16 10:43:53 -07001446 return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::PointSize, 1, type,
1447 stride, pointer);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001448}
1449
1450bool ValidateQueryMatrixxOES(Context *context, GLfixed *mantissa, GLint *exponent)
1451{
1452 UNIMPLEMENTED();
1453 return true;
1454}
Lingfeng Yanga0648782018-03-12 14:45:25 -07001455
1456bool ValidateGenFramebuffersOES(Context *context, GLsizei n, GLuint *framebuffers)
1457{
1458 UNIMPLEMENTED();
1459 return true;
1460}
1461
1462bool ValidateDeleteFramebuffersOES(Context *context, GLsizei n, const GLuint *framebuffers)
1463{
1464 UNIMPLEMENTED();
1465 return true;
1466}
1467
1468bool ValidateGenRenderbuffersOES(Context *context, GLsizei n, GLuint *renderbuffers)
1469{
1470 UNIMPLEMENTED();
1471 return true;
1472}
1473
1474bool ValidateDeleteRenderbuffersOES(Context *context, GLsizei n, const GLuint *renderbuffers)
1475{
1476 UNIMPLEMENTED();
1477 return true;
1478}
1479
1480bool ValidateBindFramebufferOES(Context *context, GLenum target, GLuint framebuffer)
1481{
1482 UNIMPLEMENTED();
1483 return true;
1484}
1485
1486bool ValidateBindRenderbufferOES(Context *context, GLenum target, GLuint renderbuffer)
1487{
1488 UNIMPLEMENTED();
1489 return true;
1490}
1491
1492bool ValidateCheckFramebufferStatusOES(Context *context, GLenum target)
1493{
1494 UNIMPLEMENTED();
1495 return true;
1496}
1497
1498bool ValidateFramebufferRenderbufferOES(Context *context,
1499 GLenum target,
1500 GLenum attachment,
1501 GLenum rbtarget,
1502 GLuint renderbuffer)
1503{
1504 UNIMPLEMENTED();
1505 return true;
1506}
1507
1508bool ValidateFramebufferTexture2DOES(Context *context,
1509 GLenum target,
1510 GLenum attachment,
1511 TextureTarget textarget,
1512 GLuint texture,
1513 GLint level)
1514{
1515 UNIMPLEMENTED();
1516 return true;
1517}
1518
1519bool ValidateGenerateMipmapOES(Context *context, TextureType target)
1520{
1521 UNIMPLEMENTED();
1522 return true;
1523}
1524
1525bool ValidateGetFramebufferAttachmentParameterivOES(Context *context,
1526 GLenum target,
1527 GLenum attachment,
1528 GLenum pname,
1529 GLint *params)
1530{
1531 UNIMPLEMENTED();
1532 return true;
1533}
1534
1535bool ValidateGetRenderbufferParameterivOES(Context *context,
1536 GLenum target,
1537 GLenum pname,
1538 GLint *params)
1539{
1540 UNIMPLEMENTED();
1541 return true;
1542}
1543
1544bool ValidateIsFramebufferOES(Context *context, GLuint framebuffer)
1545{
1546 UNIMPLEMENTED();
1547 return true;
1548}
1549
1550bool ValidateIsRenderbufferOES(Context *context, GLuint renderbuffer)
1551{
1552 UNIMPLEMENTED();
1553 return true;
1554}
1555
1556bool ValidateRenderbufferStorageOES(Context *context,
1557 GLenum target,
Jamie Madill778bf092018-11-14 09:54:36 -05001558 GLenum internalformat,
Lingfeng Yanga0648782018-03-12 14:45:25 -07001559 GLsizei width,
1560 GLsizei height)
1561{
1562 UNIMPLEMENTED();
1563 return true;
1564}
1565
1566// GL_OES_texture_cube_map
1567
1568bool ValidateGetTexGenfvOES(Context *context, GLenum coord, GLenum pname, GLfloat *params)
1569{
1570 UNIMPLEMENTED();
1571 return true;
1572}
1573
1574bool ValidateGetTexGenivOES(Context *context, GLenum coord, GLenum pname, int *params)
1575{
1576 UNIMPLEMENTED();
1577 return true;
1578}
1579
1580bool ValidateGetTexGenxvOES(Context *context, GLenum coord, GLenum pname, GLfixed *params)
1581{
1582 UNIMPLEMENTED();
1583 return true;
1584}
1585
1586bool ValidateTexGenfvOES(Context *context, GLenum coord, GLenum pname, const GLfloat *params)
1587{
1588 UNIMPLEMENTED();
1589 return true;
1590}
1591
1592bool ValidateTexGenivOES(Context *context, GLenum coord, GLenum pname, const GLint *param)
1593{
1594 UNIMPLEMENTED();
1595 return true;
1596}
1597
1598bool ValidateTexGenxvOES(Context *context, GLenum coord, GLenum pname, const GLint *param)
1599{
1600 UNIMPLEMENTED();
1601 return true;
1602}
1603
1604bool ValidateTexGenfOES(Context *context, GLenum coord, GLenum pname, GLfloat param)
1605{
1606 UNIMPLEMENTED();
1607 return true;
1608}
1609
1610bool ValidateTexGeniOES(Context *context, GLenum coord, GLenum pname, GLint param)
1611{
1612 UNIMPLEMENTED();
1613 return true;
1614}
1615
1616bool ValidateTexGenxOES(Context *context, GLenum coord, GLenum pname, GLfixed param)
1617{
1618 UNIMPLEMENTED();
1619 return true;
1620}
Lingfeng Yang01074432018-04-16 10:19:51 -07001621
1622} // namespace gl