blob: 57b8b88aa98d7881fac366cd6b6988324f295e12 [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 Madillc09ae152019-02-01 14:16:32 -050019#define ANGLE_VALIDATE_IS_GLES1(context) \
20 do \
21 { \
22 if (context->getClientMajorVersion() > 1) \
23 { \
24 context->validationError(GL_INVALID_OPERATION, kGLES1Only); \
25 return false; \
26 } \
27 } while (0)
Lingfeng Yang13b708f2018-03-21 12:14:10 -070028
Lingfeng Yang01074432018-04-16 10:19:51 -070029namespace gl
Lingfeng Yang13b708f2018-03-21 12:14:10 -070030{
Jamie Madille0472f32018-11-27 16:32:45 -050031using namespace err;
Lingfeng Yang13b708f2018-03-21 12:14:10 -070032
Lingfeng Yangabb09f12018-04-16 10:43:53 -070033bool ValidateAlphaFuncCommon(Context *context, AlphaTestFunc func)
Lingfeng Yang13b708f2018-03-21 12:14:10 -070034{
35 switch (func)
36 {
Lingfeng Yangabb09f12018-04-16 10:43:53 -070037 case AlphaTestFunc::AlwaysPass:
38 case AlphaTestFunc::Equal:
39 case AlphaTestFunc::Gequal:
40 case AlphaTestFunc::Greater:
41 case AlphaTestFunc::Lequal:
42 case AlphaTestFunc::Less:
43 case AlphaTestFunc::Never:
44 case AlphaTestFunc::NotEqual:
Lingfeng Yang13b708f2018-03-21 12:14:10 -070045 return true;
46 default:
Jamie Madille0472f32018-11-27 16:32:45 -050047 context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
Lingfeng Yang13b708f2018-03-21 12:14:10 -070048 return false;
49 }
50}
51
Lingfeng Yangabb09f12018-04-16 10:43:53 -070052bool ValidateClientStateCommon(Context *context, ClientVertexArrayType arrayType)
Lingfeng Yang01074432018-04-16 10:19:51 -070053{
54 ANGLE_VALIDATE_IS_GLES1(context);
55 switch (arrayType)
56 {
Lingfeng Yangabb09f12018-04-16 10:43:53 -070057 case ClientVertexArrayType::Vertex:
58 case ClientVertexArrayType::Normal:
59 case ClientVertexArrayType::Color:
60 case ClientVertexArrayType::TextureCoord:
Lingfeng Yang01074432018-04-16 10:19:51 -070061 return true;
Lingfeng Yangabb09f12018-04-16 10:43:53 -070062 case ClientVertexArrayType::PointSize:
Lingfeng Yang01074432018-04-16 10:19:51 -070063 if (!context->getExtensions().pointSizeArray)
64 {
Jamie Madille0472f32018-11-27 16:32:45 -050065 context->validationError(GL_INVALID_ENUM, kPointSizeArrayExtensionNotEnabled);
Lingfeng Yang01074432018-04-16 10:19:51 -070066 return false;
67 }
68 return true;
69 default:
Jamie Madille0472f32018-11-27 16:32:45 -050070 context->validationError(GL_INVALID_ENUM, kInvalidClientState);
Lingfeng Yang01074432018-04-16 10:19:51 -070071 return false;
72 }
73}
74
Lingfeng Yangabb09f12018-04-16 10:43:53 -070075bool ValidateBuiltinVertexAttributeCommon(Context *context,
76 ClientVertexArrayType arrayType,
77 GLint size,
Jamie Madilldd34b3b2019-01-16 09:59:54 -050078 VertexAttribType type,
Lingfeng Yangabb09f12018-04-16 10:43:53 -070079 GLsizei stride,
80 const void *pointer)
81{
82 ANGLE_VALIDATE_IS_GLES1(context);
83
84 if (stride < 0)
85 {
Jamie Madille0472f32018-11-27 16:32:45 -050086 context->validationError(GL_INVALID_VALUE, kInvalidVertexPointerStride);
Lingfeng Yangabb09f12018-04-16 10:43:53 -070087 return false;
88 }
89
90 int minSize = 1;
91 int maxSize = 4;
92
93 switch (arrayType)
94 {
95 case ClientVertexArrayType::Vertex:
96 case ClientVertexArrayType::TextureCoord:
97 minSize = 2;
98 maxSize = 4;
99 break;
100 case ClientVertexArrayType::Normal:
101 minSize = 3;
102 maxSize = 3;
103 break;
104 case ClientVertexArrayType::Color:
105 minSize = 4;
106 maxSize = 4;
107 break;
108 case ClientVertexArrayType::PointSize:
109 if (!context->getExtensions().pointSizeArray)
110 {
Jamie Madille0472f32018-11-27 16:32:45 -0500111 context->validationError(GL_INVALID_ENUM, kPointSizeArrayExtensionNotEnabled);
Lingfeng Yangabb09f12018-04-16 10:43:53 -0700112 return false;
113 }
114
115 minSize = 1;
116 maxSize = 1;
117 break;
118 default:
119 UNREACHABLE();
120 return false;
121 }
122
123 if (size < minSize || size > maxSize)
124 {
Jamie Madille0472f32018-11-27 16:32:45 -0500125 context->validationError(GL_INVALID_VALUE, kInvalidVertexPointerSize);
Lingfeng Yangabb09f12018-04-16 10:43:53 -0700126 return false;
127 }
128
129 switch (type)
130 {
Jamie Madilldd34b3b2019-01-16 09:59:54 -0500131 case VertexAttribType::Byte:
Lingfeng Yangabb09f12018-04-16 10:43:53 -0700132 if (arrayType == ClientVertexArrayType::PointSize)
133 {
Jamie Madille0472f32018-11-27 16:32:45 -0500134 context->validationError(GL_INVALID_ENUM, kInvalidVertexPointerType);
Lingfeng Yangabb09f12018-04-16 10:43:53 -0700135 return false;
136 }
137 break;
Jamie Madilldd34b3b2019-01-16 09:59:54 -0500138 case VertexAttribType::Short:
Lingfeng Yangabb09f12018-04-16 10:43:53 -0700139 if (arrayType == ClientVertexArrayType::PointSize ||
140 arrayType == ClientVertexArrayType::Color)
141 {
Jamie Madille0472f32018-11-27 16:32:45 -0500142 context->validationError(GL_INVALID_ENUM, kInvalidVertexPointerType);
Lingfeng Yangabb09f12018-04-16 10:43:53 -0700143 return false;
144 }
145 break;
Jamie Madilldd34b3b2019-01-16 09:59:54 -0500146 case VertexAttribType::Fixed:
147 case VertexAttribType::Float:
Lingfeng Yangabb09f12018-04-16 10:43:53 -0700148 break;
149 default:
Jamie Madille0472f32018-11-27 16:32:45 -0500150 context->validationError(GL_INVALID_ENUM, kInvalidVertexPointerType);
Lingfeng Yangabb09f12018-04-16 10:43:53 -0700151 return false;
152 }
153
154 return true;
155}
156
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700157bool ValidateLightCaps(Context *context, GLenum light)
158{
159 if (light < GL_LIGHT0 || light >= GL_LIGHT0 + context->getCaps().maxLights)
160 {
Jamie Madille0472f32018-11-27 16:32:45 -0500161 context->validationError(GL_INVALID_ENUM, kInvalidLight);
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700162 return false;
163 }
164
165 return true;
166}
167
168bool ValidateLightCommon(Context *context,
169 GLenum light,
170 LightParameter pname,
171 const GLfloat *params)
172{
173
174 ANGLE_VALIDATE_IS_GLES1(context);
175
176 if (!ValidateLightCaps(context, light))
177 {
178 return false;
179 }
180
181 switch (pname)
182 {
183 case LightParameter::Ambient:
184 case LightParameter::Diffuse:
185 case LightParameter::Specular:
186 case LightParameter::Position:
187 case LightParameter::SpotDirection:
188 return true;
189 case LightParameter::SpotExponent:
190 if (params[0] < 0.0f || params[0] > 128.0f)
191 {
Jamie Madille0472f32018-11-27 16:32:45 -0500192 context->validationError(GL_INVALID_VALUE, kLightParameterOutOfRange);
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700193 return false;
194 }
195 return true;
196 case LightParameter::SpotCutoff:
197 if (params[0] == 180.0f)
198 {
199 return true;
200 }
201 if (params[0] < 0.0f || params[0] > 90.0f)
202 {
Jamie Madille0472f32018-11-27 16:32:45 -0500203 context->validationError(GL_INVALID_VALUE, kLightParameterOutOfRange);
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700204 return false;
205 }
206 return true;
207 case LightParameter::ConstantAttenuation:
208 case LightParameter::LinearAttenuation:
209 case LightParameter::QuadraticAttenuation:
210 if (params[0] < 0.0f)
211 {
Jamie Madille0472f32018-11-27 16:32:45 -0500212 context->validationError(GL_INVALID_VALUE, kLightParameterOutOfRange);
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700213 return false;
214 }
215 return true;
216 default:
Jamie Madille0472f32018-11-27 16:32:45 -0500217 context->validationError(GL_INVALID_ENUM, kInvalidLightParameter);
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700218 return false;
219 }
220}
221
222bool ValidateLightSingleComponent(Context *context,
223 GLenum light,
224 LightParameter pname,
225 GLfloat param)
226{
227 if (!ValidateLightCommon(context, light, pname, &param))
228 {
229 return false;
230 }
231
232 if (GetLightParameterCount(pname) > 1)
233 {
Jamie Madille0472f32018-11-27 16:32:45 -0500234 context->validationError(GL_INVALID_ENUM, kInvalidLightParameter);
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700235 return false;
236 }
237
238 return true;
239}
240
241bool ValidateMaterialCommon(Context *context,
242 GLenum face,
243 MaterialParameter pname,
244 const GLfloat *params)
245{
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700246 switch (pname)
247 {
248 case MaterialParameter::Ambient:
249 case MaterialParameter::Diffuse:
250 case MaterialParameter::Specular:
251 case MaterialParameter::Emission:
252 return true;
253 case MaterialParameter::Shininess:
254 if (params[0] < 0.0f || params[0] > 128.0f)
255 {
Jamie Madille0472f32018-11-27 16:32:45 -0500256 context->validationError(GL_INVALID_VALUE, kMaterialParameterOutOfRange);
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700257 return false;
258 }
259 return true;
260 default:
Jamie Madille0472f32018-11-27 16:32:45 -0500261 context->validationError(GL_INVALID_ENUM, kInvalidMaterialParameter);
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700262 return false;
263 }
264}
265
Lingfeng Yang6e5bf362018-08-15 09:53:17 -0700266bool ValidateMaterialSetting(Context *context,
267 GLenum face,
268 MaterialParameter pname,
269 const GLfloat *params)
270{
271 ANGLE_VALIDATE_IS_GLES1(context);
272
273 if (face != GL_FRONT_AND_BACK)
274 {
Jamie Madille0472f32018-11-27 16:32:45 -0500275 context->validationError(GL_INVALID_ENUM, kInvalidMaterialFace);
Lingfeng Yang6e5bf362018-08-15 09:53:17 -0700276 return false;
277 }
278
279 return ValidateMaterialCommon(context, face, pname, params);
280}
281
282bool ValidateMaterialQuery(Context *context, GLenum face, MaterialParameter pname)
283{
284 ANGLE_VALIDATE_IS_GLES1(context);
285
286 if (face != GL_FRONT && face != GL_BACK)
287 {
Jamie Madille0472f32018-11-27 16:32:45 -0500288 context->validationError(GL_INVALID_ENUM, kInvalidMaterialFace);
Lingfeng Yang6e5bf362018-08-15 09:53:17 -0700289 return false;
290 }
291
292 GLfloat dummyParams[4] = {0.0f, 0.0f, 0.0f, 0.0f};
293
294 return ValidateMaterialCommon(context, face, pname, dummyParams);
295}
296
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700297bool ValidateMaterialSingleComponent(Context *context,
298 GLenum face,
299 MaterialParameter pname,
300 GLfloat param)
301{
Lingfeng Yang6e5bf362018-08-15 09:53:17 -0700302 if (!ValidateMaterialSetting(context, face, pname, &param))
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700303 {
304 return false;
305 }
306
307 if (GetMaterialParameterCount(pname) > 1)
308 {
Jamie Madille0472f32018-11-27 16:32:45 -0500309 context->validationError(GL_INVALID_ENUM, kInvalidMaterialParameter);
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700310 return false;
311 }
312
313 return true;
314}
315
316bool ValidateLightModelCommon(Context *context, GLenum pname)
317{
318 ANGLE_VALIDATE_IS_GLES1(context);
319 switch (pname)
320 {
321 case GL_LIGHT_MODEL_AMBIENT:
322 case GL_LIGHT_MODEL_TWO_SIDE:
323 return true;
324 default:
Jamie Madille0472f32018-11-27 16:32:45 -0500325 context->validationError(GL_INVALID_ENUM, kInvalidLightModelParameter);
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700326 return false;
327 }
328}
329
330bool ValidateLightModelSingleComponent(Context *context, GLenum pname)
331{
332 if (!ValidateLightModelCommon(context, pname))
333 {
334 return false;
335 }
336
337 switch (pname)
338 {
339 case GL_LIGHT_MODEL_TWO_SIDE:
340 return true;
341 default:
Jamie Madille0472f32018-11-27 16:32:45 -0500342 context->validationError(GL_INVALID_ENUM, kInvalidLightModelParameter);
Lingfeng Yangd0febe72018-05-17 22:36:52 -0700343 return false;
344 }
345}
346
Lingfeng Yang060088a2018-05-30 20:40:57 -0700347bool ValidateClipPlaneCommon(Context *context, GLenum plane)
348{
349 ANGLE_VALIDATE_IS_GLES1(context);
350
351 if (plane < GL_CLIP_PLANE0 || plane >= GL_CLIP_PLANE0 + context->getCaps().maxClipPlanes)
352 {
Jamie Madille0472f32018-11-27 16:32:45 -0500353 context->validationError(GL_INVALID_ENUM, kInvalidClipPlane);
Lingfeng Yang060088a2018-05-30 20:40:57 -0700354 return false;
355 }
356
357 return true;
358}
359
Lingfeng Yang7ba3f422018-06-01 09:43:04 -0700360bool ValidateFogCommon(Context *context, GLenum pname, const GLfloat *params)
361{
362 ANGLE_VALIDATE_IS_GLES1(context);
363
364 switch (pname)
365 {
366 case GL_FOG_MODE:
367 {
368 GLenum modeParam = static_cast<GLenum>(params[0]);
369 switch (modeParam)
370 {
371 case GL_EXP:
372 case GL_EXP2:
373 case GL_LINEAR:
374 return true;
375 default:
Jamie Madille0472f32018-11-27 16:32:45 -0500376 context->validationError(GL_INVALID_VALUE, kInvalidFogMode);
Lingfeng Yang7ba3f422018-06-01 09:43:04 -0700377 return false;
378 }
379 }
380 break;
381 case GL_FOG_START:
382 case GL_FOG_END:
383 case GL_FOG_COLOR:
384 break;
385 case GL_FOG_DENSITY:
386 if (params[0] < 0.0f)
387 {
Jamie Madille0472f32018-11-27 16:32:45 -0500388 context->validationError(GL_INVALID_VALUE, kInvalidFogDensity);
Lingfeng Yang7ba3f422018-06-01 09:43:04 -0700389 return false;
390 }
391 break;
392 default:
Jamie Madille0472f32018-11-27 16:32:45 -0500393 context->validationError(GL_INVALID_ENUM, kInvalidFogParameter);
Lingfeng Yang7ba3f422018-06-01 09:43:04 -0700394 return false;
395 }
396 return true;
397}
398
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700399bool ValidateTexEnvCommon(Context *context,
400 TextureEnvTarget target,
401 TextureEnvParameter pname,
402 const GLfloat *params)
403{
404 ANGLE_VALIDATE_IS_GLES1(context);
405
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700406 switch (target)
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700407 {
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700408 case TextureEnvTarget::Env:
409 switch (pname)
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700410 {
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700411 case TextureEnvParameter::Mode:
412 {
413 TextureEnvMode mode = FromGLenum<TextureEnvMode>(ConvertToGLenum(params[0]));
414 switch (mode)
Lingfeng Yang4004ae02018-06-13 09:29:00 -0700415 {
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700416 case TextureEnvMode::Add:
417 case TextureEnvMode::Blend:
418 case TextureEnvMode::Combine:
419 case TextureEnvMode::Decal:
420 case TextureEnvMode::Modulate:
421 case TextureEnvMode::Replace:
422 break;
423 default:
Jamie Madille0472f32018-11-27 16:32:45 -0500424 context->validationError(GL_INVALID_VALUE, kInvalidTextureEnvMode);
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700425 return false;
426 }
427 break;
428 }
429 case TextureEnvParameter::CombineRgb:
430 case TextureEnvParameter::CombineAlpha:
431 {
432 TextureCombine combine = FromGLenum<TextureCombine>(ConvertToGLenum(params[0]));
433 switch (combine)
434 {
435 case TextureCombine::Add:
436 case TextureCombine::AddSigned:
437 case TextureCombine::Interpolate:
438 case TextureCombine::Modulate:
439 case TextureCombine::Replace:
440 case TextureCombine::Subtract:
441 break;
442 case TextureCombine::Dot3Rgb:
443 case TextureCombine::Dot3Rgba:
444 if (pname == TextureEnvParameter::CombineAlpha)
445 {
Jamie Madille0472f32018-11-27 16:32:45 -0500446 context->validationError(GL_INVALID_VALUE, kInvalidTextureCombine);
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700447 return false;
448 }
449 break;
450 default:
Jamie Madille0472f32018-11-27 16:32:45 -0500451 context->validationError(GL_INVALID_VALUE, kInvalidTextureCombine);
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700452 return false;
453 }
454 break;
455 }
456 case TextureEnvParameter::Src0Rgb:
457 case TextureEnvParameter::Src1Rgb:
458 case TextureEnvParameter::Src2Rgb:
459 case TextureEnvParameter::Src0Alpha:
460 case TextureEnvParameter::Src1Alpha:
461 case TextureEnvParameter::Src2Alpha:
462 {
463 TextureSrc combine = FromGLenum<TextureSrc>(ConvertToGLenum(params[0]));
464 switch (combine)
465 {
466 case TextureSrc::Constant:
467 case TextureSrc::Previous:
468 case TextureSrc::PrimaryColor:
469 case TextureSrc::Texture:
470 break;
471 default:
Jamie Madille0472f32018-11-27 16:32:45 -0500472 context->validationError(GL_INVALID_VALUE, kInvalidTextureCombineSrc);
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700473 return false;
474 }
475 break;
476 }
477 case TextureEnvParameter::Op0Rgb:
478 case TextureEnvParameter::Op1Rgb:
479 case TextureEnvParameter::Op2Rgb:
480 case TextureEnvParameter::Op0Alpha:
481 case TextureEnvParameter::Op1Alpha:
482 case TextureEnvParameter::Op2Alpha:
483 {
484 TextureOp operand = FromGLenum<TextureOp>(ConvertToGLenum(params[0]));
485 switch (operand)
486 {
487 case TextureOp::SrcAlpha:
488 case TextureOp::OneMinusSrcAlpha:
489 break;
490 case TextureOp::SrcColor:
491 case TextureOp::OneMinusSrcColor:
492 if (pname == TextureEnvParameter::Op0Alpha ||
493 pname == TextureEnvParameter::Op1Alpha ||
494 pname == TextureEnvParameter::Op2Alpha)
495 {
Jamie Madille0472f32018-11-27 16:32:45 -0500496 context->validationError(GL_INVALID_VALUE, kInvalidTextureCombine);
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700497 return false;
498 }
499 break;
500 default:
Jamie Madille0472f32018-11-27 16:32:45 -0500501 context->validationError(GL_INVALID_VALUE, kInvalidTextureCombineOp);
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 Madille0472f32018-11-27 16:32:45 -0500510 context->validationError(GL_INVALID_VALUE, kInvalidTextureEnvScale);
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 Madille0472f32018-11-27 16:32:45 -0500517 context->validationError(GL_INVALID_ENUM, kInvalidTextureEnvParameter);
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 Madille0472f32018-11-27 16:32:45 -0500524 context->validationError(GL_INVALID_ENUM, kInvalidTextureEnvTarget);
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 Madille0472f32018-11-27 16:32:45 -0500532 context->validationError(GL_INVALID_ENUM, kInvalidTextureEnvParameter);
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700533 return false;
534 }
Lingfeng Yang45b5a872018-06-07 11:33:25 -0700535 break;
536 default:
Jamie Madille0472f32018-11-27 16:32:45 -0500537 context->validationError(GL_INVALID_ENUM, kInvalidTextureEnvTarget);
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 Madille0472f32018-11-27 16:32:45 -0500597 context->validationError(GL_INVALID_VALUE, kInvalidPointParameterValue);
Lingfeng Yang9c4c0922018-06-13 09:29:00 -0700598 return false;
599 }
600 }
601 break;
602 default:
Jamie Madille0472f32018-11-27 16:32:45 -0500603 context->validationError(GL_INVALID_ENUM, kInvalidPointParameter);
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 Madille0472f32018-11-27 16:32:45 -0500616 context->validationError(GL_INVALID_VALUE, kInvalidPointSizeValue);
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 Madille0472f32018-11-27 16:32:45 -0500629 context->validationError(GL_INVALID_VALUE, kNonPositiveDrawTextureDimension);
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,
Jamie Madilldd34b3b2019-01-16 09:59:54 -0500701 VertexAttribType type,
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500702 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 Madille0472f32018-11-27 16:32:45 -0500771 context->validationError(GL_INVALID_VALUE, kInvalidProjectionMatrix);
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 Madille0472f32018-11-27 16:32:45 -0500787 context->validationError(GL_INVALID_VALUE, kInvalidProjectionMatrix);
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 Madille0472f32018-11-27 16:32:45 -0500848 context->validationError(GL_INVALID_ENUM, kInvalidPointerQuery);
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 Madille0472f32018-11-27 16:32:45 -0500982 context->validationError(GL_INVALID_ENUM, kInvalidLogicOp);
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 Madille0472f32018-11-27 16:32:45 -05001030 context->validationError(GL_INVALID_ENUM, kInvalidMatrixMode);
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
Jamie Madilldd34b3b2019-01-16 09:59:54 -05001081bool ValidateNormalPointer(Context *context,
1082 VertexAttribType type,
1083 GLsizei stride,
1084 const void *pointer)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001085{
Lingfeng Yangabb09f12018-04-16 10:43:53 -07001086 return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::Normal, 3, type,
1087 stride, pointer);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001088}
1089
1090bool ValidateOrthof(Context *context,
1091 GLfloat l,
1092 GLfloat r,
1093 GLfloat b,
1094 GLfloat t,
1095 GLfloat n,
1096 GLfloat f)
1097{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001098 ANGLE_VALIDATE_IS_GLES1(context);
1099 if (l == r || b == t || n == f || n <= 0.0f || f <= 0.0f)
1100 {
Jamie Madille0472f32018-11-27 16:32:45 -05001101 context->validationError(GL_INVALID_VALUE, kInvalidProjectionMatrix);
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001102 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001103 return true;
1104}
1105
1106bool ValidateOrthox(Context *context,
1107 GLfixed l,
1108 GLfixed r,
1109 GLfixed b,
1110 GLfixed t,
1111 GLfixed n,
1112 GLfixed f)
1113{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001114 ANGLE_VALIDATE_IS_GLES1(context);
1115 if (l == r || b == t || n == f || n <= 0 || f <= 0)
1116 {
Jamie Madille0472f32018-11-27 16:32:45 -05001117 context->validationError(GL_INVALID_VALUE, kInvalidProjectionMatrix);
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001118 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001119 return true;
1120}
1121
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001122bool ValidatePointParameterf(Context *context, PointParameter pname, GLfloat param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001123{
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001124 unsigned int paramCount = GetPointParameterCount(pname);
1125 if (paramCount != 1)
1126 {
Jamie Madille0472f32018-11-27 16:32:45 -05001127 context->validationError(GL_INVALID_ENUM, kInvalidPointParameter);
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001128 return false;
1129 }
1130
1131 return ValidatePointParameterCommon(context, pname, &param);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001132}
1133
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001134bool ValidatePointParameterfv(Context *context, PointParameter pname, const GLfloat *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001135{
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001136 return ValidatePointParameterCommon(context, pname, params);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001137}
1138
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001139bool ValidatePointParameterx(Context *context, PointParameter pname, GLfixed param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001140{
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001141 unsigned int paramCount = GetPointParameterCount(pname);
1142 if (paramCount != 1)
1143 {
Jamie Madille0472f32018-11-27 16:32:45 -05001144 context->validationError(GL_INVALID_ENUM, kInvalidPointParameter);
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001145 return false;
1146 }
1147
1148 GLfloat paramf = FixedToFloat(param);
1149 return ValidatePointParameterCommon(context, pname, &paramf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001150}
1151
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001152bool ValidatePointParameterxv(Context *context, PointParameter pname, const GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001153{
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001154 GLfloat paramsf[4] = {};
1155 for (unsigned int i = 0; i < GetPointParameterCount(pname); i++)
1156 {
1157 paramsf[i] = FixedToFloat(params[i]);
1158 }
1159 return ValidatePointParameterCommon(context, pname, paramsf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001160}
1161
1162bool ValidatePointSize(Context *context, GLfloat size)
1163{
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001164 return ValidatePointSizeCommon(context, size);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001165}
1166
1167bool ValidatePointSizex(Context *context, GLfixed size)
1168{
Lingfeng Yang9c4c0922018-06-13 09:29:00 -07001169 return ValidatePointSizeCommon(context, FixedToFloat(size));
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001170}
1171
1172bool ValidatePolygonOffsetx(Context *context, GLfixed factor, GLfixed units)
1173{
1174 UNIMPLEMENTED();
1175 return true;
1176}
1177
1178bool ValidatePopMatrix(Context *context)
1179{
Lingfeng Yange547aac2018-04-05 09:39:20 -07001180 ANGLE_VALIDATE_IS_GLES1(context);
Jamie Madillc3dc5d42018-12-30 12:12:04 -05001181 const auto &stack = context->getState().gles1().currentMatrixStack();
Lingfeng Yange547aac2018-04-05 09:39:20 -07001182 if (stack.size() == 1)
1183 {
Jamie Madille0472f32018-11-27 16:32:45 -05001184 context->validationError(GL_STACK_UNDERFLOW, kMatrixStackUnderflow);
Lingfeng Yange547aac2018-04-05 09:39:20 -07001185 return false;
1186 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001187 return true;
1188}
1189
1190bool ValidatePushMatrix(Context *context)
1191{
Lingfeng Yange547aac2018-04-05 09:39:20 -07001192 ANGLE_VALIDATE_IS_GLES1(context);
Jamie Madillc3dc5d42018-12-30 12:12:04 -05001193 const auto &stack = context->getState().gles1().currentMatrixStack();
Lingfeng Yange547aac2018-04-05 09:39:20 -07001194 if (stack.size() == stack.max_size())
1195 {
Jamie Madille0472f32018-11-27 16:32:45 -05001196 context->validationError(GL_STACK_OVERFLOW, kMatrixStackOverflow);
Lingfeng Yange547aac2018-04-05 09:39:20 -07001197 return false;
1198 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001199 return true;
1200}
1201
1202bool ValidateRotatef(Context *context, GLfloat angle, GLfloat x, GLfloat y, GLfloat 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 ValidateRotatex(Context *context, GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
1209{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001210 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001211 return true;
1212}
1213
1214bool ValidateSampleCoveragex(Context *context, GLclampx value, GLboolean invert)
1215{
1216 UNIMPLEMENTED();
1217 return true;
1218}
1219
1220bool ValidateScalef(Context *context, GLfloat x, GLfloat y, GLfloat 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
1226bool ValidateScalex(Context *context, GLfixed x, GLfixed y, GLfixed z)
1227{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001228 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001229 return true;
1230}
1231
Lingfeng Yanga0cfa872018-05-30 21:12:17 -07001232bool ValidateShadeModel(Context *context, ShadingModel mode)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001233{
Lingfeng Yanga0cfa872018-05-30 21:12:17 -07001234 ANGLE_VALIDATE_IS_GLES1(context);
1235 switch (mode)
1236 {
1237 case ShadingModel::Flat:
1238 case ShadingModel::Smooth:
1239 return true;
1240 default:
Jamie Madille0472f32018-11-27 16:32:45 -05001241 context->validationError(GL_INVALID_ENUM, kInvalidShadingModel);
Lingfeng Yanga0cfa872018-05-30 21:12:17 -07001242 return false;
1243 }
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001244}
1245
1246bool ValidateTexCoordPointer(Context *context,
1247 GLint size,
Jamie Madilldd34b3b2019-01-16 09:59:54 -05001248 VertexAttribType type,
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001249 GLsizei stride,
1250 const void *pointer)
1251{
Lingfeng Yangabb09f12018-04-16 10:43:53 -07001252 return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::TextureCoord, size,
1253 type, stride, pointer);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001254}
1255
Lingfeng Yang74be2962018-06-07 09:13:38 -07001256bool ValidateTexEnvf(Context *context,
1257 TextureEnvTarget target,
1258 TextureEnvParameter pname,
1259 GLfloat param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001260{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001261 return ValidateTexEnvCommon(context, target, pname, &param);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001262}
1263
Lingfeng Yang74be2962018-06-07 09:13:38 -07001264bool ValidateTexEnvfv(Context *context,
1265 TextureEnvTarget target,
1266 TextureEnvParameter pname,
1267 const GLfloat *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001268{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001269 return ValidateTexEnvCommon(context, target, pname, params);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001270}
1271
Lingfeng Yang74be2962018-06-07 09:13:38 -07001272bool ValidateTexEnvi(Context *context,
1273 TextureEnvTarget target,
1274 TextureEnvParameter pname,
1275 GLint param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001276{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001277 GLfloat paramf = static_cast<GLfloat>(param);
1278 return ValidateTexEnvCommon(context, target, pname, &paramf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001279}
1280
Lingfeng Yang74be2962018-06-07 09:13:38 -07001281bool ValidateTexEnviv(Context *context,
1282 TextureEnvTarget target,
1283 TextureEnvParameter pname,
1284 const GLint *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001285{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001286 GLfloat paramsf[4];
1287 for (unsigned int i = 0; i < GetTextureEnvParameterCount(pname); i++)
1288 {
1289 paramsf[i] = static_cast<GLfloat>(params[i]);
1290 }
1291 return ValidateTexEnvCommon(context, target, pname, paramsf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001292}
1293
Lingfeng Yang74be2962018-06-07 09:13:38 -07001294bool ValidateTexEnvx(Context *context,
1295 TextureEnvTarget target,
1296 TextureEnvParameter pname,
1297 GLfixed param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001298{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001299 GLfloat paramf = static_cast<GLfloat>(param);
1300 return ValidateTexEnvCommon(context, target, pname, &paramf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001301}
1302
Lingfeng Yang74be2962018-06-07 09:13:38 -07001303bool ValidateTexEnvxv(Context *context,
1304 TextureEnvTarget target,
1305 TextureEnvParameter pname,
1306 const GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001307{
Lingfeng Yang45b5a872018-06-07 11:33:25 -07001308 GLfloat paramsf[4];
1309 for (unsigned int i = 0; i < GetTextureEnvParameterCount(pname); i++)
1310 {
1311 paramsf[i] = static_cast<GLfloat>(params[i]);
1312 }
1313 return ValidateTexEnvCommon(context, target, pname, paramsf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001314}
1315
Corentin Wallezf0e89be2017-11-08 14:00:32 -08001316bool ValidateTexParameterx(Context *context, TextureType target, GLenum pname, GLfixed param)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001317{
Lingfeng Yangf97641c2018-06-21 19:22:45 -07001318 ANGLE_VALIDATE_IS_GLES1(context);
1319 GLfloat paramf = FixedToFloat(param);
Till Rathmannb8543632018-10-02 19:46:14 +02001320 return ValidateTexParameterBase(context, target, pname, -1, false, &paramf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001321}
1322
Corentin Wallezf0e89be2017-11-08 14:00:32 -08001323bool ValidateTexParameterxv(Context *context,
1324 TextureType target,
1325 GLenum pname,
1326 const GLfixed *params)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001327{
Lingfeng Yangf97641c2018-06-21 19:22:45 -07001328 ANGLE_VALIDATE_IS_GLES1(context);
1329 GLfloat paramsf[4] = {};
1330 for (unsigned int i = 0; i < GetTexParameterCount(pname); i++)
1331 {
1332 paramsf[i] = FixedToFloat(params[i]);
1333 }
Till Rathmannb8543632018-10-02 19:46:14 +02001334 return ValidateTexParameterBase(context, target, pname, -1, true, paramsf);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001335}
1336
1337bool ValidateTranslatef(Context *context, GLfloat x, GLfloat y, GLfloat 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 ValidateTranslatex(Context *context, GLfixed x, GLfixed y, GLfixed z)
1344{
Lingfeng Yangbb5ce5c2018-04-09 08:08:46 -07001345 ANGLE_VALIDATE_IS_GLES1(context);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001346 return true;
1347}
1348
1349bool ValidateVertexPointer(Context *context,
1350 GLint size,
Jamie Madilldd34b3b2019-01-16 09:59:54 -05001351 VertexAttribType type,
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001352 GLsizei stride,
1353 const void *pointer)
1354{
Lingfeng Yangabb09f12018-04-16 10:43:53 -07001355 return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::Vertex, size, type,
1356 stride, pointer);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001357}
1358
1359bool ValidateDrawTexfOES(Context *context,
1360 GLfloat x,
1361 GLfloat y,
1362 GLfloat z,
1363 GLfloat width,
1364 GLfloat height)
1365{
Lingfeng Yang0df813c2018-07-12 12:52:06 -07001366 return ValidateDrawTexCommon(context, width, height);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001367}
1368
1369bool ValidateDrawTexfvOES(Context *context, const GLfloat *coords)
1370{
Lingfeng Yang0df813c2018-07-12 12:52:06 -07001371 return ValidateDrawTexCommon(context, coords[3], coords[4]);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001372}
1373
1374bool ValidateDrawTexiOES(Context *context, GLint x, GLint y, GLint z, GLint width, GLint height)
1375{
Lingfeng Yang0df813c2018-07-12 12:52:06 -07001376 return ValidateDrawTexCommon(context, static_cast<GLfloat>(width),
1377 static_cast<GLfloat>(height));
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001378}
1379
1380bool ValidateDrawTexivOES(Context *context, const GLint *coords)
1381{
Lingfeng Yang0df813c2018-07-12 12:52:06 -07001382 return ValidateDrawTexCommon(context, static_cast<GLfloat>(coords[3]),
1383 static_cast<GLfloat>(coords[4]));
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001384}
1385
1386bool ValidateDrawTexsOES(Context *context,
1387 GLshort x,
1388 GLshort y,
1389 GLshort z,
1390 GLshort width,
1391 GLshort height)
1392{
Lingfeng Yang0df813c2018-07-12 12:52:06 -07001393 return ValidateDrawTexCommon(context, static_cast<GLfloat>(width),
1394 static_cast<GLfloat>(height));
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001395}
1396
1397bool ValidateDrawTexsvOES(Context *context, const GLshort *coords)
1398{
Lingfeng Yang0df813c2018-07-12 12:52:06 -07001399 return ValidateDrawTexCommon(context, static_cast<GLfloat>(coords[3]),
1400 static_cast<GLfloat>(coords[4]));
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001401}
1402
1403bool ValidateDrawTexxOES(Context *context,
1404 GLfixed x,
1405 GLfixed y,
1406 GLfixed z,
1407 GLfixed width,
1408 GLfixed height)
1409{
Lingfeng Yang0df813c2018-07-12 12:52:06 -07001410 return ValidateDrawTexCommon(context, FixedToFloat(width), FixedToFloat(height));
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001411}
1412
1413bool ValidateDrawTexxvOES(Context *context, const GLfixed *coords)
1414{
Lingfeng Yang0df813c2018-07-12 12:52:06 -07001415 return ValidateDrawTexCommon(context, FixedToFloat(coords[3]), FixedToFloat(coords[4]));
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001416}
1417
1418bool ValidateCurrentPaletteMatrixOES(Context *context, GLuint matrixpaletteindex)
1419{
1420 UNIMPLEMENTED();
1421 return true;
1422}
1423
1424bool ValidateLoadPaletteFromModelViewMatrixOES(Context *context)
1425{
1426 UNIMPLEMENTED();
1427 return true;
1428}
1429
1430bool ValidateMatrixIndexPointerOES(Context *context,
1431 GLint size,
1432 GLenum type,
1433 GLsizei stride,
1434 const void *pointer)
1435{
1436 UNIMPLEMENTED();
1437 return true;
1438}
1439
1440bool ValidateWeightPointerOES(Context *context,
1441 GLint size,
1442 GLenum type,
1443 GLsizei stride,
1444 const void *pointer)
1445{
1446 UNIMPLEMENTED();
1447 return true;
1448}
1449
Jamie Madilldd34b3b2019-01-16 09:59:54 -05001450bool ValidatePointSizePointerOES(Context *context,
1451 VertexAttribType type,
1452 GLsizei stride,
1453 const void *pointer)
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001454{
Lingfeng Yangabb09f12018-04-16 10:43:53 -07001455 return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::PointSize, 1, type,
1456 stride, pointer);
Geoff Lang2aaa7b42018-01-12 17:17:27 -05001457}
1458
1459bool ValidateQueryMatrixxOES(Context *context, GLfixed *mantissa, GLint *exponent)
1460{
1461 UNIMPLEMENTED();
1462 return true;
1463}
Lingfeng Yanga0648782018-03-12 14:45:25 -07001464
1465bool ValidateGenFramebuffersOES(Context *context, GLsizei n, GLuint *framebuffers)
1466{
1467 UNIMPLEMENTED();
1468 return true;
1469}
1470
1471bool ValidateDeleteFramebuffersOES(Context *context, GLsizei n, const GLuint *framebuffers)
1472{
1473 UNIMPLEMENTED();
1474 return true;
1475}
1476
1477bool ValidateGenRenderbuffersOES(Context *context, GLsizei n, GLuint *renderbuffers)
1478{
1479 UNIMPLEMENTED();
1480 return true;
1481}
1482
1483bool ValidateDeleteRenderbuffersOES(Context *context, GLsizei n, const GLuint *renderbuffers)
1484{
1485 UNIMPLEMENTED();
1486 return true;
1487}
1488
1489bool ValidateBindFramebufferOES(Context *context, GLenum target, GLuint framebuffer)
1490{
1491 UNIMPLEMENTED();
1492 return true;
1493}
1494
1495bool ValidateBindRenderbufferOES(Context *context, GLenum target, GLuint renderbuffer)
1496{
1497 UNIMPLEMENTED();
1498 return true;
1499}
1500
1501bool ValidateCheckFramebufferStatusOES(Context *context, GLenum target)
1502{
1503 UNIMPLEMENTED();
1504 return true;
1505}
1506
1507bool ValidateFramebufferRenderbufferOES(Context *context,
1508 GLenum target,
1509 GLenum attachment,
1510 GLenum rbtarget,
1511 GLuint renderbuffer)
1512{
1513 UNIMPLEMENTED();
1514 return true;
1515}
1516
1517bool ValidateFramebufferTexture2DOES(Context *context,
1518 GLenum target,
1519 GLenum attachment,
1520 TextureTarget textarget,
1521 GLuint texture,
1522 GLint level)
1523{
1524 UNIMPLEMENTED();
1525 return true;
1526}
1527
1528bool ValidateGenerateMipmapOES(Context *context, TextureType target)
1529{
1530 UNIMPLEMENTED();
1531 return true;
1532}
1533
1534bool ValidateGetFramebufferAttachmentParameterivOES(Context *context,
1535 GLenum target,
1536 GLenum attachment,
1537 GLenum pname,
1538 GLint *params)
1539{
1540 UNIMPLEMENTED();
1541 return true;
1542}
1543
1544bool ValidateGetRenderbufferParameterivOES(Context *context,
1545 GLenum target,
1546 GLenum pname,
1547 GLint *params)
1548{
1549 UNIMPLEMENTED();
1550 return true;
1551}
1552
1553bool ValidateIsFramebufferOES(Context *context, GLuint framebuffer)
1554{
1555 UNIMPLEMENTED();
1556 return true;
1557}
1558
1559bool ValidateIsRenderbufferOES(Context *context, GLuint renderbuffer)
1560{
1561 UNIMPLEMENTED();
1562 return true;
1563}
1564
1565bool ValidateRenderbufferStorageOES(Context *context,
1566 GLenum target,
Jamie Madill778bf092018-11-14 09:54:36 -05001567 GLenum internalformat,
Lingfeng Yanga0648782018-03-12 14:45:25 -07001568 GLsizei width,
1569 GLsizei height)
1570{
1571 UNIMPLEMENTED();
1572 return true;
1573}
1574
1575// GL_OES_texture_cube_map
1576
1577bool ValidateGetTexGenfvOES(Context *context, GLenum coord, GLenum pname, GLfloat *params)
1578{
1579 UNIMPLEMENTED();
1580 return true;
1581}
1582
1583bool ValidateGetTexGenivOES(Context *context, GLenum coord, GLenum pname, int *params)
1584{
1585 UNIMPLEMENTED();
1586 return true;
1587}
1588
1589bool ValidateGetTexGenxvOES(Context *context, GLenum coord, GLenum pname, GLfixed *params)
1590{
1591 UNIMPLEMENTED();
1592 return true;
1593}
1594
1595bool ValidateTexGenfvOES(Context *context, GLenum coord, GLenum pname, const GLfloat *params)
1596{
1597 UNIMPLEMENTED();
1598 return true;
1599}
1600
1601bool ValidateTexGenivOES(Context *context, GLenum coord, GLenum pname, const GLint *param)
1602{
1603 UNIMPLEMENTED();
1604 return true;
1605}
1606
1607bool ValidateTexGenxvOES(Context *context, GLenum coord, GLenum pname, const GLint *param)
1608{
1609 UNIMPLEMENTED();
1610 return true;
1611}
1612
1613bool ValidateTexGenfOES(Context *context, GLenum coord, GLenum pname, GLfloat param)
1614{
1615 UNIMPLEMENTED();
1616 return true;
1617}
1618
1619bool ValidateTexGeniOES(Context *context, GLenum coord, GLenum pname, GLint param)
1620{
1621 UNIMPLEMENTED();
1622 return true;
1623}
1624
1625bool ValidateTexGenxOES(Context *context, GLenum coord, GLenum pname, GLfixed param)
1626{
1627 UNIMPLEMENTED();
1628 return true;
1629}
Lingfeng Yang01074432018-04-16 10:19:51 -07001630
1631} // namespace gl