Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1 | // |
| 2 | // Copyright (c) 2018 The ANGLE Project Authors. All rights reserved. |
| 3 | // Use of this source code is governed by a BSD-style license that can be |
| 4 | // found in the LICENSE file. |
| 5 | // |
| 6 | |
| 7 | // validationES1.cpp: Validation functions for OpenGL ES 1.0 entry point parameters |
| 8 | |
| 9 | #include "libANGLE/validationES1.h" |
| 10 | |
| 11 | #include "common/debug.h" |
Lingfeng Yang | 13b708f | 2018-03-21 12:14:10 -0700 | [diff] [blame] | 12 | #include "libANGLE/Context.h" |
| 13 | #include "libANGLE/ErrorStrings.h" |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 14 | #include "libANGLE/GLES1State.h" |
| 15 | #include "libANGLE/queryutils.h" |
Lingfeng Yang | 038dd53 | 2018-03-29 17:31:52 -0700 | [diff] [blame] | 16 | #include "libANGLE/validationES.h" |
Lingfeng Yang | 13b708f | 2018-03-21 12:14:10 -0700 | [diff] [blame] | 17 | |
| 18 | #define ANGLE_VALIDATE_IS_GLES1(context) \ |
| 19 | if (context->getClientMajorVersion() > 1) \ |
| 20 | { \ |
| 21 | ANGLE_VALIDATION_ERR(context, InvalidOperation(), GLES1Only); \ |
| 22 | return false; \ |
| 23 | } |
| 24 | |
Lingfeng Yang | 0107443 | 2018-04-16 10:19:51 -0700 | [diff] [blame] | 25 | namespace gl |
Lingfeng Yang | 13b708f | 2018-03-21 12:14:10 -0700 | [diff] [blame] | 26 | { |
| 27 | |
Lingfeng Yang | abb09f1 | 2018-04-16 10:43:53 -0700 | [diff] [blame] | 28 | bool ValidateAlphaFuncCommon(Context *context, AlphaTestFunc func) |
Lingfeng Yang | 13b708f | 2018-03-21 12:14:10 -0700 | [diff] [blame] | 29 | { |
| 30 | switch (func) |
| 31 | { |
Lingfeng Yang | abb09f1 | 2018-04-16 10:43:53 -0700 | [diff] [blame] | 32 | case AlphaTestFunc::AlwaysPass: |
| 33 | case AlphaTestFunc::Equal: |
| 34 | case AlphaTestFunc::Gequal: |
| 35 | case AlphaTestFunc::Greater: |
| 36 | case AlphaTestFunc::Lequal: |
| 37 | case AlphaTestFunc::Less: |
| 38 | case AlphaTestFunc::Never: |
| 39 | case AlphaTestFunc::NotEqual: |
Lingfeng Yang | 13b708f | 2018-03-21 12:14:10 -0700 | [diff] [blame] | 40 | return true; |
| 41 | default: |
Lingfeng Yang | 0107443 | 2018-04-16 10:19:51 -0700 | [diff] [blame] | 42 | ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported); |
Lingfeng Yang | 13b708f | 2018-03-21 12:14:10 -0700 | [diff] [blame] | 43 | return false; |
| 44 | } |
| 45 | } |
| 46 | |
Lingfeng Yang | abb09f1 | 2018-04-16 10:43:53 -0700 | [diff] [blame] | 47 | bool ValidateClientStateCommon(Context *context, ClientVertexArrayType arrayType) |
Lingfeng Yang | 0107443 | 2018-04-16 10:19:51 -0700 | [diff] [blame] | 48 | { |
| 49 | ANGLE_VALIDATE_IS_GLES1(context); |
| 50 | switch (arrayType) |
| 51 | { |
Lingfeng Yang | abb09f1 | 2018-04-16 10:43:53 -0700 | [diff] [blame] | 52 | case ClientVertexArrayType::Vertex: |
| 53 | case ClientVertexArrayType::Normal: |
| 54 | case ClientVertexArrayType::Color: |
| 55 | case ClientVertexArrayType::TextureCoord: |
Lingfeng Yang | 0107443 | 2018-04-16 10:19:51 -0700 | [diff] [blame] | 56 | return true; |
Lingfeng Yang | abb09f1 | 2018-04-16 10:43:53 -0700 | [diff] [blame] | 57 | case ClientVertexArrayType::PointSize: |
Lingfeng Yang | 0107443 | 2018-04-16 10:19:51 -0700 | [diff] [blame] | 58 | if (!context->getExtensions().pointSizeArray) |
| 59 | { |
| 60 | ANGLE_VALIDATION_ERR(context, InvalidEnum(), PointSizeArrayExtensionNotEnabled); |
| 61 | return false; |
| 62 | } |
| 63 | return true; |
| 64 | default: |
| 65 | ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidClientState); |
| 66 | return false; |
| 67 | } |
| 68 | } |
| 69 | |
Lingfeng Yang | abb09f1 | 2018-04-16 10:43:53 -0700 | [diff] [blame] | 70 | bool ValidateBuiltinVertexAttributeCommon(Context *context, |
| 71 | ClientVertexArrayType arrayType, |
| 72 | GLint size, |
| 73 | GLenum type, |
| 74 | GLsizei stride, |
| 75 | const void *pointer) |
| 76 | { |
| 77 | ANGLE_VALIDATE_IS_GLES1(context); |
| 78 | |
| 79 | if (stride < 0) |
| 80 | { |
| 81 | ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidVertexPointerStride); |
| 82 | return false; |
| 83 | } |
| 84 | |
| 85 | int minSize = 1; |
| 86 | int maxSize = 4; |
| 87 | |
| 88 | switch (arrayType) |
| 89 | { |
| 90 | case ClientVertexArrayType::Vertex: |
| 91 | case ClientVertexArrayType::TextureCoord: |
| 92 | minSize = 2; |
| 93 | maxSize = 4; |
| 94 | break; |
| 95 | case ClientVertexArrayType::Normal: |
| 96 | minSize = 3; |
| 97 | maxSize = 3; |
| 98 | break; |
| 99 | case ClientVertexArrayType::Color: |
| 100 | minSize = 4; |
| 101 | maxSize = 4; |
| 102 | break; |
| 103 | case ClientVertexArrayType::PointSize: |
| 104 | if (!context->getExtensions().pointSizeArray) |
| 105 | { |
| 106 | ANGLE_VALIDATION_ERR(context, InvalidEnum(), PointSizeArrayExtensionNotEnabled); |
| 107 | return false; |
| 108 | } |
| 109 | |
| 110 | minSize = 1; |
| 111 | maxSize = 1; |
| 112 | break; |
| 113 | default: |
| 114 | UNREACHABLE(); |
| 115 | return false; |
| 116 | } |
| 117 | |
| 118 | if (size < minSize || size > maxSize) |
| 119 | { |
| 120 | ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidVertexPointerSize); |
| 121 | return false; |
| 122 | } |
| 123 | |
| 124 | switch (type) |
| 125 | { |
| 126 | case GL_BYTE: |
| 127 | if (arrayType == ClientVertexArrayType::PointSize) |
| 128 | { |
| 129 | ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidVertexPointerType); |
| 130 | return false; |
| 131 | } |
| 132 | break; |
| 133 | case GL_SHORT: |
| 134 | if (arrayType == ClientVertexArrayType::PointSize || |
| 135 | arrayType == ClientVertexArrayType::Color) |
| 136 | { |
| 137 | ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidVertexPointerType); |
| 138 | return false; |
| 139 | } |
| 140 | break; |
| 141 | case GL_FIXED: |
| 142 | case GL_FLOAT: |
| 143 | break; |
| 144 | default: |
| 145 | ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidVertexPointerType); |
| 146 | return false; |
| 147 | } |
| 148 | |
| 149 | return true; |
| 150 | } |
| 151 | |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 152 | bool ValidateLightCaps(Context *context, GLenum light) |
| 153 | { |
| 154 | if (light < GL_LIGHT0 || light >= GL_LIGHT0 + context->getCaps().maxLights) |
| 155 | { |
| 156 | ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidLight); |
| 157 | return false; |
| 158 | } |
| 159 | |
| 160 | return true; |
| 161 | } |
| 162 | |
| 163 | bool ValidateLightCommon(Context *context, |
| 164 | GLenum light, |
| 165 | LightParameter pname, |
| 166 | const GLfloat *params) |
| 167 | { |
| 168 | |
| 169 | ANGLE_VALIDATE_IS_GLES1(context); |
| 170 | |
| 171 | if (!ValidateLightCaps(context, light)) |
| 172 | { |
| 173 | return false; |
| 174 | } |
| 175 | |
| 176 | switch (pname) |
| 177 | { |
| 178 | case LightParameter::Ambient: |
| 179 | case LightParameter::Diffuse: |
| 180 | case LightParameter::Specular: |
| 181 | case LightParameter::Position: |
| 182 | case LightParameter::SpotDirection: |
| 183 | return true; |
| 184 | case LightParameter::SpotExponent: |
| 185 | if (params[0] < 0.0f || params[0] > 128.0f) |
| 186 | { |
| 187 | ANGLE_VALIDATION_ERR(context, InvalidValue(), LightParameterOutOfRange); |
| 188 | return false; |
| 189 | } |
| 190 | return true; |
| 191 | case LightParameter::SpotCutoff: |
| 192 | if (params[0] == 180.0f) |
| 193 | { |
| 194 | return true; |
| 195 | } |
| 196 | if (params[0] < 0.0f || params[0] > 90.0f) |
| 197 | { |
| 198 | ANGLE_VALIDATION_ERR(context, InvalidValue(), LightParameterOutOfRange); |
| 199 | return false; |
| 200 | } |
| 201 | return true; |
| 202 | case LightParameter::ConstantAttenuation: |
| 203 | case LightParameter::LinearAttenuation: |
| 204 | case LightParameter::QuadraticAttenuation: |
| 205 | if (params[0] < 0.0f) |
| 206 | { |
| 207 | ANGLE_VALIDATION_ERR(context, InvalidValue(), LightParameterOutOfRange); |
| 208 | return false; |
| 209 | } |
| 210 | return true; |
| 211 | default: |
| 212 | ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidLightParameter); |
| 213 | return false; |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | bool ValidateLightSingleComponent(Context *context, |
| 218 | GLenum light, |
| 219 | LightParameter pname, |
| 220 | GLfloat param) |
| 221 | { |
| 222 | if (!ValidateLightCommon(context, light, pname, ¶m)) |
| 223 | { |
| 224 | return false; |
| 225 | } |
| 226 | |
| 227 | if (GetLightParameterCount(pname) > 1) |
| 228 | { |
| 229 | ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidLightParameter); |
| 230 | return false; |
| 231 | } |
| 232 | |
| 233 | return true; |
| 234 | } |
| 235 | |
| 236 | bool ValidateMaterialCommon(Context *context, |
| 237 | GLenum face, |
| 238 | MaterialParameter pname, |
| 239 | const GLfloat *params) |
| 240 | { |
| 241 | ANGLE_VALIDATE_IS_GLES1(context); |
| 242 | |
| 243 | if (face != GL_FRONT_AND_BACK) |
| 244 | { |
| 245 | ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidMaterialFace); |
| 246 | return false; |
| 247 | } |
| 248 | |
| 249 | switch (pname) |
| 250 | { |
| 251 | case MaterialParameter::Ambient: |
| 252 | case MaterialParameter::Diffuse: |
| 253 | case MaterialParameter::Specular: |
| 254 | case MaterialParameter::Emission: |
| 255 | return true; |
| 256 | case MaterialParameter::Shininess: |
| 257 | if (params[0] < 0.0f || params[0] > 128.0f) |
| 258 | { |
| 259 | ANGLE_VALIDATION_ERR(context, InvalidValue(), MaterialParameterOutOfRange); |
| 260 | return false; |
| 261 | } |
| 262 | return true; |
| 263 | default: |
| 264 | ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidMaterialParameter); |
| 265 | return false; |
| 266 | } |
| 267 | } |
| 268 | |
| 269 | bool ValidateMaterialSingleComponent(Context *context, |
| 270 | GLenum face, |
| 271 | MaterialParameter pname, |
| 272 | GLfloat param) |
| 273 | { |
| 274 | if (!ValidateMaterialCommon(context, face, pname, ¶m)) |
| 275 | { |
| 276 | return false; |
| 277 | } |
| 278 | |
| 279 | if (GetMaterialParameterCount(pname) > 1) |
| 280 | { |
| 281 | ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidMaterialParameter); |
| 282 | return false; |
| 283 | } |
| 284 | |
| 285 | return true; |
| 286 | } |
| 287 | |
| 288 | bool ValidateLightModelCommon(Context *context, GLenum pname) |
| 289 | { |
| 290 | ANGLE_VALIDATE_IS_GLES1(context); |
| 291 | switch (pname) |
| 292 | { |
| 293 | case GL_LIGHT_MODEL_AMBIENT: |
| 294 | case GL_LIGHT_MODEL_TWO_SIDE: |
| 295 | return true; |
| 296 | default: |
| 297 | ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidLightModelParameter); |
| 298 | return false; |
| 299 | } |
| 300 | } |
| 301 | |
| 302 | bool ValidateLightModelSingleComponent(Context *context, GLenum pname) |
| 303 | { |
| 304 | if (!ValidateLightModelCommon(context, pname)) |
| 305 | { |
| 306 | return false; |
| 307 | } |
| 308 | |
| 309 | switch (pname) |
| 310 | { |
| 311 | case GL_LIGHT_MODEL_TWO_SIDE: |
| 312 | return true; |
| 313 | default: |
| 314 | ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidLightModelParameter); |
| 315 | return false; |
| 316 | } |
| 317 | } |
| 318 | |
Lingfeng Yang | 060088a | 2018-05-30 20:40:57 -0700 | [diff] [blame] | 319 | bool ValidateClipPlaneCommon(Context *context, GLenum plane) |
| 320 | { |
| 321 | ANGLE_VALIDATE_IS_GLES1(context); |
| 322 | |
| 323 | if (plane < GL_CLIP_PLANE0 || plane >= GL_CLIP_PLANE0 + context->getCaps().maxClipPlanes) |
| 324 | { |
| 325 | ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidClipPlane); |
| 326 | return false; |
| 327 | } |
| 328 | |
| 329 | return true; |
| 330 | } |
| 331 | |
Lingfeng Yang | 7ba3f42 | 2018-06-01 09:43:04 -0700 | [diff] [blame^] | 332 | bool ValidateFogCommon(Context *context, GLenum pname, const GLfloat *params) |
| 333 | { |
| 334 | ANGLE_VALIDATE_IS_GLES1(context); |
| 335 | |
| 336 | switch (pname) |
| 337 | { |
| 338 | case GL_FOG_MODE: |
| 339 | { |
| 340 | GLenum modeParam = static_cast<GLenum>(params[0]); |
| 341 | switch (modeParam) |
| 342 | { |
| 343 | case GL_EXP: |
| 344 | case GL_EXP2: |
| 345 | case GL_LINEAR: |
| 346 | return true; |
| 347 | default: |
| 348 | ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidFogMode); |
| 349 | return false; |
| 350 | } |
| 351 | } |
| 352 | break; |
| 353 | case GL_FOG_START: |
| 354 | case GL_FOG_END: |
| 355 | case GL_FOG_COLOR: |
| 356 | break; |
| 357 | case GL_FOG_DENSITY: |
| 358 | if (params[0] < 0.0f) |
| 359 | { |
| 360 | ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidFogDensity); |
| 361 | return false; |
| 362 | } |
| 363 | break; |
| 364 | default: |
| 365 | ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidFogParameter); |
| 366 | return false; |
| 367 | } |
| 368 | return true; |
| 369 | } |
| 370 | |
Lingfeng Yang | 0107443 | 2018-04-16 10:19:51 -0700 | [diff] [blame] | 371 | } // namespace gl |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 372 | |
| 373 | namespace gl |
| 374 | { |
| 375 | |
Lingfeng Yang | 13b708f | 2018-03-21 12:14:10 -0700 | [diff] [blame] | 376 | bool ValidateAlphaFunc(Context *context, AlphaTestFunc func, GLfloat ref) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 377 | { |
Lingfeng Yang | 13b708f | 2018-03-21 12:14:10 -0700 | [diff] [blame] | 378 | ANGLE_VALIDATE_IS_GLES1(context); |
| 379 | return ValidateAlphaFuncCommon(context, func); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 380 | } |
| 381 | |
Lingfeng Yang | 13b708f | 2018-03-21 12:14:10 -0700 | [diff] [blame] | 382 | bool ValidateAlphaFuncx(Context *context, AlphaTestFunc func, GLfixed ref) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 383 | { |
Lingfeng Yang | 13b708f | 2018-03-21 12:14:10 -0700 | [diff] [blame] | 384 | ANGLE_VALIDATE_IS_GLES1(context); |
| 385 | return ValidateAlphaFuncCommon(context, func); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 386 | } |
| 387 | |
| 388 | bool ValidateClearColorx(Context *context, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) |
| 389 | { |
| 390 | UNIMPLEMENTED(); |
| 391 | return true; |
| 392 | } |
| 393 | |
| 394 | bool ValidateClearDepthx(Context *context, GLfixed depth) |
| 395 | { |
| 396 | UNIMPLEMENTED(); |
| 397 | return true; |
| 398 | } |
| 399 | |
| 400 | bool ValidateClientActiveTexture(Context *context, GLenum texture) |
| 401 | { |
Lingfeng Yang | 96310cd | 2018-03-28 11:56:28 -0700 | [diff] [blame] | 402 | ANGLE_VALIDATE_IS_GLES1(context); |
Lingfeng Yang | 038dd53 | 2018-03-29 17:31:52 -0700 | [diff] [blame] | 403 | return ValidateMultitextureUnit(context, texture); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 404 | } |
| 405 | |
Lingfeng Yang | 060088a | 2018-05-30 20:40:57 -0700 | [diff] [blame] | 406 | bool ValidateClipPlanef(Context *context, GLenum plane, const GLfloat *eqn) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 407 | { |
Lingfeng Yang | 060088a | 2018-05-30 20:40:57 -0700 | [diff] [blame] | 408 | return ValidateClipPlaneCommon(context, plane); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 409 | } |
| 410 | |
| 411 | bool ValidateClipPlanex(Context *context, GLenum plane, const GLfixed *equation) |
| 412 | { |
Lingfeng Yang | 060088a | 2018-05-30 20:40:57 -0700 | [diff] [blame] | 413 | return ValidateClipPlaneCommon(context, plane); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 414 | } |
| 415 | |
| 416 | bool ValidateColor4f(Context *context, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) |
| 417 | { |
Lingfeng Yang | a43994c | 2018-03-29 07:21:41 -0700 | [diff] [blame] | 418 | ANGLE_VALIDATE_IS_GLES1(context); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 419 | return true; |
| 420 | } |
| 421 | |
| 422 | bool ValidateColor4ub(Context *context, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) |
| 423 | { |
Lingfeng Yang | a43994c | 2018-03-29 07:21:41 -0700 | [diff] [blame] | 424 | ANGLE_VALIDATE_IS_GLES1(context); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 425 | return true; |
| 426 | } |
| 427 | |
| 428 | bool ValidateColor4x(Context *context, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) |
| 429 | { |
Lingfeng Yang | a43994c | 2018-03-29 07:21:41 -0700 | [diff] [blame] | 430 | ANGLE_VALIDATE_IS_GLES1(context); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 431 | return true; |
| 432 | } |
| 433 | |
| 434 | bool ValidateColorPointer(Context *context, |
| 435 | GLint size, |
| 436 | GLenum type, |
| 437 | GLsizei stride, |
| 438 | const void *pointer) |
| 439 | { |
Lingfeng Yang | abb09f1 | 2018-04-16 10:43:53 -0700 | [diff] [blame] | 440 | return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::Color, size, type, |
| 441 | stride, pointer); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 442 | } |
| 443 | |
| 444 | bool ValidateCullFace(Context *context, GLenum mode) |
| 445 | { |
| 446 | UNIMPLEMENTED(); |
| 447 | return true; |
| 448 | } |
| 449 | |
| 450 | bool ValidateDepthRangex(Context *context, GLfixed n, GLfixed f) |
| 451 | { |
| 452 | UNIMPLEMENTED(); |
| 453 | return true; |
| 454 | } |
| 455 | |
Lingfeng Yang | 0107443 | 2018-04-16 10:19:51 -0700 | [diff] [blame] | 456 | bool ValidateDisableClientState(Context *context, ClientVertexArrayType arrayType) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 457 | { |
Lingfeng Yang | 0107443 | 2018-04-16 10:19:51 -0700 | [diff] [blame] | 458 | return ValidateClientStateCommon(context, arrayType); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 459 | } |
| 460 | |
Lingfeng Yang | 0107443 | 2018-04-16 10:19:51 -0700 | [diff] [blame] | 461 | bool ValidateEnableClientState(Context *context, ClientVertexArrayType arrayType) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 462 | { |
Lingfeng Yang | 0107443 | 2018-04-16 10:19:51 -0700 | [diff] [blame] | 463 | return ValidateClientStateCommon(context, arrayType); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 464 | } |
| 465 | |
| 466 | bool ValidateFogf(Context *context, GLenum pname, GLfloat param) |
| 467 | { |
Lingfeng Yang | 7ba3f42 | 2018-06-01 09:43:04 -0700 | [diff] [blame^] | 468 | return ValidateFogCommon(context, pname, ¶m); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 469 | } |
| 470 | |
| 471 | bool ValidateFogfv(Context *context, GLenum pname, const GLfloat *params) |
| 472 | { |
Lingfeng Yang | 7ba3f42 | 2018-06-01 09:43:04 -0700 | [diff] [blame^] | 473 | return ValidateFogCommon(context, pname, params); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 474 | } |
| 475 | |
| 476 | bool ValidateFogx(Context *context, GLenum pname, GLfixed param) |
| 477 | { |
Lingfeng Yang | 7ba3f42 | 2018-06-01 09:43:04 -0700 | [diff] [blame^] | 478 | GLfloat asFloat = FixedToFloat(param); |
| 479 | return ValidateFogCommon(context, pname, &asFloat); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 480 | } |
| 481 | |
Lingfeng Yang | 7ba3f42 | 2018-06-01 09:43:04 -0700 | [diff] [blame^] | 482 | bool ValidateFogxv(Context *context, GLenum pname, const GLfixed *params) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 483 | { |
Lingfeng Yang | 7ba3f42 | 2018-06-01 09:43:04 -0700 | [diff] [blame^] | 484 | unsigned int paramCount = GetFogParameterCount(pname); |
| 485 | GLfloat paramsf[4] = {}; |
| 486 | |
| 487 | for (unsigned int i = 0; i < paramCount; i++) |
| 488 | { |
| 489 | paramsf[i] = FixedToFloat(params[i]); |
| 490 | } |
| 491 | |
| 492 | return ValidateFogCommon(context, pname, paramsf); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 493 | } |
| 494 | |
| 495 | bool ValidateFrustumf(Context *context, |
| 496 | GLfloat l, |
| 497 | GLfloat r, |
| 498 | GLfloat b, |
| 499 | GLfloat t, |
| 500 | GLfloat n, |
| 501 | GLfloat f) |
| 502 | { |
Lingfeng Yang | bb5ce5c | 2018-04-09 08:08:46 -0700 | [diff] [blame] | 503 | ANGLE_VALIDATE_IS_GLES1(context); |
| 504 | if (l == r || b == t || n == f || n <= 0.0f || f <= 0.0f) |
| 505 | { |
| 506 | ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidProjectionMatrix); |
| 507 | } |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 508 | return true; |
| 509 | } |
| 510 | |
| 511 | bool ValidateFrustumx(Context *context, |
| 512 | GLfixed l, |
| 513 | GLfixed r, |
| 514 | GLfixed b, |
| 515 | GLfixed t, |
| 516 | GLfixed n, |
| 517 | GLfixed f) |
| 518 | { |
Lingfeng Yang | bb5ce5c | 2018-04-09 08:08:46 -0700 | [diff] [blame] | 519 | ANGLE_VALIDATE_IS_GLES1(context); |
| 520 | if (l == r || b == t || n == f || n <= 0 || f <= 0) |
| 521 | { |
| 522 | ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidProjectionMatrix); |
| 523 | } |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 524 | return true; |
| 525 | } |
| 526 | |
| 527 | bool ValidateGetBufferParameteriv(Context *context, GLenum target, GLenum pname, GLint *params) |
| 528 | { |
| 529 | UNIMPLEMENTED(); |
| 530 | return true; |
| 531 | } |
| 532 | |
| 533 | bool ValidateGetClipPlanef(Context *context, GLenum plane, GLfloat *equation) |
| 534 | { |
Lingfeng Yang | 060088a | 2018-05-30 20:40:57 -0700 | [diff] [blame] | 535 | return ValidateClipPlaneCommon(context, plane); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 536 | } |
| 537 | |
| 538 | bool ValidateGetClipPlanex(Context *context, GLenum plane, GLfixed *equation) |
| 539 | { |
Lingfeng Yang | 060088a | 2018-05-30 20:40:57 -0700 | [diff] [blame] | 540 | return ValidateClipPlaneCommon(context, plane); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 541 | } |
| 542 | |
| 543 | bool ValidateGetFixedv(Context *context, GLenum pname, GLfixed *params) |
| 544 | { |
| 545 | UNIMPLEMENTED(); |
| 546 | return true; |
| 547 | } |
| 548 | |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 549 | bool ValidateGetLightfv(Context *context, GLenum light, LightParameter pname, GLfloat *params) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 550 | { |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 551 | GLfloat dummyParams[4] = {0.0f, 0.0f, 0.0f, 0.0f}; |
| 552 | return ValidateLightCommon(context, light, pname, dummyParams); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 553 | } |
| 554 | |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 555 | bool ValidateGetLightxv(Context *context, GLenum light, LightParameter pname, GLfixed *params) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 556 | { |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 557 | GLfloat dummyParams[4] = {0.0f, 0.0f, 0.0f, 0.0f}; |
| 558 | return ValidateLightCommon(context, light, pname, dummyParams); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 559 | } |
| 560 | |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 561 | bool ValidateGetMaterialfv(Context *context, GLenum face, MaterialParameter pname, GLfloat *params) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 562 | { |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 563 | GLfloat dummyParams[4] = {0.0f, 0.0f, 0.0f, 0.0f}; |
| 564 | return ValidateMaterialCommon(context, face, pname, dummyParams); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 565 | } |
| 566 | |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 567 | bool ValidateGetMaterialxv(Context *context, GLenum face, MaterialParameter pname, GLfixed *params) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 568 | { |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 569 | GLfloat dummyParams[4] = {0.0f, 0.0f, 0.0f, 0.0f}; |
| 570 | return ValidateMaterialCommon(context, face, pname, dummyParams); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 571 | } |
| 572 | |
| 573 | bool ValidateGetPointerv(Context *context, GLenum pname, void **params) |
| 574 | { |
Lingfeng Yang | abb09f1 | 2018-04-16 10:43:53 -0700 | [diff] [blame] | 575 | ANGLE_VALIDATE_IS_GLES1(context); |
| 576 | switch (pname) |
| 577 | { |
| 578 | case GL_VERTEX_ARRAY_POINTER: |
| 579 | case GL_NORMAL_ARRAY_POINTER: |
| 580 | case GL_COLOR_ARRAY_POINTER: |
| 581 | case GL_TEXTURE_COORD_ARRAY_POINTER: |
| 582 | case GL_POINT_SIZE_ARRAY_POINTER_OES: |
| 583 | return true; |
| 584 | default: |
| 585 | ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPointerQuery); |
| 586 | return false; |
| 587 | } |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 588 | } |
| 589 | |
| 590 | bool ValidateGetTexEnvfv(Context *context, GLenum target, GLenum pname, GLfloat *params) |
| 591 | { |
| 592 | UNIMPLEMENTED(); |
| 593 | return true; |
| 594 | } |
| 595 | |
| 596 | bool ValidateGetTexEnviv(Context *context, GLenum target, GLenum pname, GLint *params) |
| 597 | { |
| 598 | UNIMPLEMENTED(); |
| 599 | return true; |
| 600 | } |
| 601 | |
| 602 | bool ValidateGetTexEnvxv(Context *context, GLenum target, GLenum pname, GLfixed *params) |
| 603 | { |
| 604 | UNIMPLEMENTED(); |
| 605 | return true; |
| 606 | } |
| 607 | |
Corentin Wallez | f0e89be | 2017-11-08 14:00:32 -0800 | [diff] [blame] | 608 | bool ValidateGetTexParameterxv(Context *context, TextureType target, GLenum pname, GLfixed *params) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 609 | { |
| 610 | UNIMPLEMENTED(); |
| 611 | return true; |
| 612 | } |
| 613 | |
| 614 | bool ValidateLightModelf(Context *context, GLenum pname, GLfloat param) |
| 615 | { |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 616 | return ValidateLightModelSingleComponent(context, pname); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 617 | } |
| 618 | |
| 619 | bool ValidateLightModelfv(Context *context, GLenum pname, const GLfloat *params) |
| 620 | { |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 621 | return ValidateLightModelCommon(context, pname); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 622 | } |
| 623 | |
| 624 | bool ValidateLightModelx(Context *context, GLenum pname, GLfixed param) |
| 625 | { |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 626 | return ValidateLightModelSingleComponent(context, pname); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 627 | } |
| 628 | |
| 629 | bool ValidateLightModelxv(Context *context, GLenum pname, const GLfixed *param) |
| 630 | { |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 631 | return ValidateLightModelCommon(context, pname); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 632 | } |
| 633 | |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 634 | bool ValidateLightf(Context *context, GLenum light, LightParameter pname, GLfloat param) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 635 | { |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 636 | return ValidateLightSingleComponent(context, light, pname, param); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 637 | } |
| 638 | |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 639 | bool ValidateLightfv(Context *context, GLenum light, LightParameter pname, const GLfloat *params) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 640 | { |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 641 | return ValidateLightCommon(context, light, pname, params); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 642 | } |
| 643 | |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 644 | bool ValidateLightx(Context *context, GLenum light, LightParameter pname, GLfixed param) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 645 | { |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 646 | return ValidateLightSingleComponent(context, light, pname, FixedToFloat(param)); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 647 | } |
| 648 | |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 649 | bool ValidateLightxv(Context *context, GLenum light, LightParameter pname, const GLfixed *params) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 650 | { |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 651 | GLfloat paramsf[4]; |
| 652 | for (unsigned int i = 0; i < GetLightParameterCount(pname); i++) |
| 653 | { |
| 654 | paramsf[i] = FixedToFloat(params[i]); |
| 655 | } |
| 656 | |
| 657 | return ValidateLightCommon(context, light, pname, paramsf); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 658 | } |
| 659 | |
| 660 | bool ValidateLineWidthx(Context *context, GLfixed width) |
| 661 | { |
| 662 | UNIMPLEMENTED(); |
| 663 | return true; |
| 664 | } |
| 665 | |
| 666 | bool ValidateLoadIdentity(Context *context) |
| 667 | { |
Lingfeng Yang | 3a41af6 | 2018-04-09 07:28:56 -0700 | [diff] [blame] | 668 | ANGLE_VALIDATE_IS_GLES1(context); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 669 | return true; |
| 670 | } |
| 671 | |
| 672 | bool ValidateLoadMatrixf(Context *context, const GLfloat *m) |
| 673 | { |
Lingfeng Yang | 3a41af6 | 2018-04-09 07:28:56 -0700 | [diff] [blame] | 674 | ANGLE_VALIDATE_IS_GLES1(context); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 675 | return true; |
| 676 | } |
| 677 | |
| 678 | bool ValidateLoadMatrixx(Context *context, const GLfixed *m) |
| 679 | { |
Lingfeng Yang | 3a41af6 | 2018-04-09 07:28:56 -0700 | [diff] [blame] | 680 | ANGLE_VALIDATE_IS_GLES1(context); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 681 | return true; |
| 682 | } |
| 683 | |
| 684 | bool ValidateLogicOp(Context *context, GLenum opcode) |
| 685 | { |
| 686 | UNIMPLEMENTED(); |
| 687 | return true; |
| 688 | } |
| 689 | |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 690 | bool ValidateMaterialf(Context *context, GLenum face, MaterialParameter pname, GLfloat param) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 691 | { |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 692 | return ValidateMaterialSingleComponent(context, face, pname, param); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 693 | } |
| 694 | |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 695 | bool ValidateMaterialfv(Context *context, |
| 696 | GLenum face, |
| 697 | MaterialParameter pname, |
| 698 | const GLfloat *params) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 699 | { |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 700 | return ValidateMaterialCommon(context, face, pname, params); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 701 | } |
| 702 | |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 703 | bool ValidateMaterialx(Context *context, GLenum face, MaterialParameter pname, GLfixed param) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 704 | { |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 705 | return ValidateMaterialSingleComponent(context, face, pname, FixedToFloat(param)); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 706 | } |
| 707 | |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 708 | bool ValidateMaterialxv(Context *context, |
| 709 | GLenum face, |
| 710 | MaterialParameter pname, |
| 711 | const GLfixed *params) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 712 | { |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 713 | GLfloat paramsf[4]; |
| 714 | |
| 715 | for (unsigned int i = 0; i < GetMaterialParameterCount(pname); i++) |
| 716 | { |
| 717 | paramsf[i] = FixedToFloat(params[i]); |
| 718 | } |
| 719 | |
| 720 | return ValidateMaterialCommon(context, face, pname, paramsf); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 721 | } |
| 722 | |
Lingfeng Yang | 00af463 | 2018-04-02 12:42:24 -0700 | [diff] [blame] | 723 | bool ValidateMatrixMode(Context *context, MatrixType mode) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 724 | { |
Lingfeng Yang | d2488ab | 2018-04-04 09:25:48 -0700 | [diff] [blame] | 725 | ANGLE_VALIDATE_IS_GLES1(context); |
| 726 | switch (mode) |
| 727 | { |
| 728 | case MatrixType::Projection: |
| 729 | case MatrixType::Modelview: |
| 730 | case MatrixType::Texture: |
| 731 | return true; |
| 732 | default: |
| 733 | ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidMatrixMode); |
| 734 | return false; |
| 735 | } |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 736 | } |
| 737 | |
| 738 | bool ValidateMultMatrixf(Context *context, const GLfloat *m) |
| 739 | { |
Lingfeng Yang | 568fc39 | 2018-04-09 07:57:23 -0700 | [diff] [blame] | 740 | ANGLE_VALIDATE_IS_GLES1(context); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 741 | return true; |
| 742 | } |
| 743 | |
| 744 | bool ValidateMultMatrixx(Context *context, const GLfixed *m) |
| 745 | { |
Lingfeng Yang | 568fc39 | 2018-04-09 07:57:23 -0700 | [diff] [blame] | 746 | ANGLE_VALIDATE_IS_GLES1(context); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 747 | return true; |
| 748 | } |
| 749 | |
| 750 | bool ValidateMultiTexCoord4f(Context *context, |
| 751 | GLenum target, |
| 752 | GLfloat s, |
| 753 | GLfloat t, |
| 754 | GLfloat r, |
| 755 | GLfloat q) |
| 756 | { |
Lingfeng Yang | 038dd53 | 2018-03-29 17:31:52 -0700 | [diff] [blame] | 757 | ANGLE_VALIDATE_IS_GLES1(context); |
| 758 | return ValidateMultitextureUnit(context, target); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 759 | } |
| 760 | |
| 761 | bool ValidateMultiTexCoord4x(Context *context, |
Lingfeng Yang | 038dd53 | 2018-03-29 17:31:52 -0700 | [diff] [blame] | 762 | GLenum target, |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 763 | GLfixed s, |
| 764 | GLfixed t, |
| 765 | GLfixed r, |
| 766 | GLfixed q) |
| 767 | { |
Lingfeng Yang | 038dd53 | 2018-03-29 17:31:52 -0700 | [diff] [blame] | 768 | ANGLE_VALIDATE_IS_GLES1(context); |
| 769 | return ValidateMultitextureUnit(context, target); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 770 | } |
| 771 | |
| 772 | bool ValidateNormal3f(Context *context, GLfloat nx, GLfloat ny, GLfloat nz) |
| 773 | { |
Lingfeng Yang | 5a7e61b | 2018-03-29 16:50:32 -0700 | [diff] [blame] | 774 | ANGLE_VALIDATE_IS_GLES1(context); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 775 | return true; |
| 776 | } |
| 777 | |
| 778 | bool ValidateNormal3x(Context *context, GLfixed nx, GLfixed ny, GLfixed nz) |
| 779 | { |
Lingfeng Yang | 5a7e61b | 2018-03-29 16:50:32 -0700 | [diff] [blame] | 780 | ANGLE_VALIDATE_IS_GLES1(context); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 781 | return true; |
| 782 | } |
| 783 | |
| 784 | bool ValidateNormalPointer(Context *context, GLenum type, GLsizei stride, const void *pointer) |
| 785 | { |
Lingfeng Yang | abb09f1 | 2018-04-16 10:43:53 -0700 | [diff] [blame] | 786 | return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::Normal, 3, type, |
| 787 | stride, pointer); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 788 | } |
| 789 | |
| 790 | bool ValidateOrthof(Context *context, |
| 791 | GLfloat l, |
| 792 | GLfloat r, |
| 793 | GLfloat b, |
| 794 | GLfloat t, |
| 795 | GLfloat n, |
| 796 | GLfloat f) |
| 797 | { |
Lingfeng Yang | bb5ce5c | 2018-04-09 08:08:46 -0700 | [diff] [blame] | 798 | ANGLE_VALIDATE_IS_GLES1(context); |
| 799 | if (l == r || b == t || n == f || n <= 0.0f || f <= 0.0f) |
| 800 | { |
| 801 | ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidProjectionMatrix); |
| 802 | } |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 803 | return true; |
| 804 | } |
| 805 | |
| 806 | bool ValidateOrthox(Context *context, |
| 807 | GLfixed l, |
| 808 | GLfixed r, |
| 809 | GLfixed b, |
| 810 | GLfixed t, |
| 811 | GLfixed n, |
| 812 | GLfixed f) |
| 813 | { |
Lingfeng Yang | bb5ce5c | 2018-04-09 08:08:46 -0700 | [diff] [blame] | 814 | ANGLE_VALIDATE_IS_GLES1(context); |
| 815 | if (l == r || b == t || n == f || n <= 0 || f <= 0) |
| 816 | { |
| 817 | ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidProjectionMatrix); |
| 818 | } |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 819 | return true; |
| 820 | } |
| 821 | |
| 822 | bool ValidatePointParameterf(Context *context, GLenum pname, GLfloat param) |
| 823 | { |
| 824 | UNIMPLEMENTED(); |
| 825 | return true; |
| 826 | } |
| 827 | |
| 828 | bool ValidatePointParameterfv(Context *context, GLenum pname, const GLfloat *params) |
| 829 | { |
| 830 | UNIMPLEMENTED(); |
| 831 | return true; |
| 832 | } |
| 833 | |
| 834 | bool ValidatePointParameterx(Context *context, GLenum pname, GLfixed param) |
| 835 | { |
| 836 | UNIMPLEMENTED(); |
| 837 | return true; |
| 838 | } |
| 839 | |
| 840 | bool ValidatePointParameterxv(Context *context, GLenum pname, const GLfixed *params) |
| 841 | { |
| 842 | UNIMPLEMENTED(); |
| 843 | return true; |
| 844 | } |
| 845 | |
| 846 | bool ValidatePointSize(Context *context, GLfloat size) |
| 847 | { |
| 848 | UNIMPLEMENTED(); |
| 849 | return true; |
| 850 | } |
| 851 | |
| 852 | bool ValidatePointSizex(Context *context, GLfixed size) |
| 853 | { |
| 854 | UNIMPLEMENTED(); |
| 855 | return true; |
| 856 | } |
| 857 | |
| 858 | bool ValidatePolygonOffsetx(Context *context, GLfixed factor, GLfixed units) |
| 859 | { |
| 860 | UNIMPLEMENTED(); |
| 861 | return true; |
| 862 | } |
| 863 | |
| 864 | bool ValidatePopMatrix(Context *context) |
| 865 | { |
Lingfeng Yang | e547aac | 2018-04-05 09:39:20 -0700 | [diff] [blame] | 866 | ANGLE_VALIDATE_IS_GLES1(context); |
| 867 | const auto &stack = context->getGLState().gles1().currentMatrixStack(); |
| 868 | if (stack.size() == 1) |
| 869 | { |
| 870 | ANGLE_VALIDATION_ERR(context, StackUnderflow(), MatrixStackUnderflow); |
| 871 | return false; |
| 872 | } |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 873 | return true; |
| 874 | } |
| 875 | |
| 876 | bool ValidatePushMatrix(Context *context) |
| 877 | { |
Lingfeng Yang | e547aac | 2018-04-05 09:39:20 -0700 | [diff] [blame] | 878 | ANGLE_VALIDATE_IS_GLES1(context); |
| 879 | const auto &stack = context->getGLState().gles1().currentMatrixStack(); |
| 880 | if (stack.size() == stack.max_size()) |
| 881 | { |
| 882 | ANGLE_VALIDATION_ERR(context, StackOverflow(), MatrixStackOverflow); |
| 883 | return false; |
| 884 | } |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 885 | return true; |
| 886 | } |
| 887 | |
| 888 | bool ValidateRotatef(Context *context, GLfloat angle, GLfloat x, GLfloat y, GLfloat z) |
| 889 | { |
Lingfeng Yang | bb5ce5c | 2018-04-09 08:08:46 -0700 | [diff] [blame] | 890 | ANGLE_VALIDATE_IS_GLES1(context); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 891 | return true; |
| 892 | } |
| 893 | |
| 894 | bool ValidateRotatex(Context *context, GLfixed angle, GLfixed x, GLfixed y, GLfixed z) |
| 895 | { |
Lingfeng Yang | bb5ce5c | 2018-04-09 08:08:46 -0700 | [diff] [blame] | 896 | ANGLE_VALIDATE_IS_GLES1(context); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 897 | return true; |
| 898 | } |
| 899 | |
| 900 | bool ValidateSampleCoveragex(Context *context, GLclampx value, GLboolean invert) |
| 901 | { |
| 902 | UNIMPLEMENTED(); |
| 903 | return true; |
| 904 | } |
| 905 | |
| 906 | bool ValidateScalef(Context *context, GLfloat x, GLfloat y, GLfloat z) |
| 907 | { |
Lingfeng Yang | bb5ce5c | 2018-04-09 08:08:46 -0700 | [diff] [blame] | 908 | ANGLE_VALIDATE_IS_GLES1(context); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 909 | return true; |
| 910 | } |
| 911 | |
| 912 | bool ValidateScalex(Context *context, GLfixed x, GLfixed y, GLfixed z) |
| 913 | { |
Lingfeng Yang | bb5ce5c | 2018-04-09 08:08:46 -0700 | [diff] [blame] | 914 | ANGLE_VALIDATE_IS_GLES1(context); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 915 | return true; |
| 916 | } |
| 917 | |
Lingfeng Yang | a0cfa87 | 2018-05-30 21:12:17 -0700 | [diff] [blame] | 918 | bool ValidateShadeModel(Context *context, ShadingModel mode) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 919 | { |
Lingfeng Yang | a0cfa87 | 2018-05-30 21:12:17 -0700 | [diff] [blame] | 920 | ANGLE_VALIDATE_IS_GLES1(context); |
| 921 | switch (mode) |
| 922 | { |
| 923 | case ShadingModel::Flat: |
| 924 | case ShadingModel::Smooth: |
| 925 | return true; |
| 926 | default: |
| 927 | ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidShadingModel); |
| 928 | return false; |
| 929 | } |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 930 | } |
| 931 | |
| 932 | bool ValidateTexCoordPointer(Context *context, |
| 933 | GLint size, |
| 934 | GLenum type, |
| 935 | GLsizei stride, |
| 936 | const void *pointer) |
| 937 | { |
Lingfeng Yang | abb09f1 | 2018-04-16 10:43:53 -0700 | [diff] [blame] | 938 | return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::TextureCoord, size, |
| 939 | type, stride, pointer); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 940 | } |
| 941 | |
| 942 | bool ValidateTexEnvf(Context *context, GLenum target, GLenum pname, GLfloat param) |
| 943 | { |
| 944 | UNIMPLEMENTED(); |
| 945 | return true; |
| 946 | } |
| 947 | |
| 948 | bool ValidateTexEnvfv(Context *context, GLenum target, GLenum pname, const GLfloat *params) |
| 949 | { |
| 950 | UNIMPLEMENTED(); |
| 951 | return true; |
| 952 | } |
| 953 | |
| 954 | bool ValidateTexEnvi(Context *context, GLenum target, GLenum pname, GLint param) |
| 955 | { |
| 956 | UNIMPLEMENTED(); |
| 957 | return true; |
| 958 | } |
| 959 | |
| 960 | bool ValidateTexEnviv(Context *context, GLenum target, GLenum pname, const GLint *params) |
| 961 | { |
| 962 | UNIMPLEMENTED(); |
| 963 | return true; |
| 964 | } |
| 965 | |
| 966 | bool ValidateTexEnvx(Context *context, GLenum target, GLenum pname, GLfixed param) |
| 967 | { |
| 968 | UNIMPLEMENTED(); |
| 969 | return true; |
| 970 | } |
| 971 | |
| 972 | bool ValidateTexEnvxv(Context *context, GLenum target, GLenum pname, const GLfixed *params) |
| 973 | { |
| 974 | UNIMPLEMENTED(); |
| 975 | return true; |
| 976 | } |
| 977 | |
Corentin Wallez | f0e89be | 2017-11-08 14:00:32 -0800 | [diff] [blame] | 978 | bool ValidateTexParameterx(Context *context, TextureType target, GLenum pname, GLfixed param) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 979 | { |
| 980 | UNIMPLEMENTED(); |
| 981 | return true; |
| 982 | } |
| 983 | |
Corentin Wallez | f0e89be | 2017-11-08 14:00:32 -0800 | [diff] [blame] | 984 | bool ValidateTexParameterxv(Context *context, |
| 985 | TextureType target, |
| 986 | GLenum pname, |
| 987 | const GLfixed *params) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 988 | { |
| 989 | UNIMPLEMENTED(); |
| 990 | return true; |
| 991 | } |
| 992 | |
| 993 | bool ValidateTranslatef(Context *context, GLfloat x, GLfloat y, GLfloat z) |
| 994 | { |
Lingfeng Yang | bb5ce5c | 2018-04-09 08:08:46 -0700 | [diff] [blame] | 995 | ANGLE_VALIDATE_IS_GLES1(context); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 996 | return true; |
| 997 | } |
| 998 | |
| 999 | bool ValidateTranslatex(Context *context, GLfixed x, GLfixed y, GLfixed z) |
| 1000 | { |
Lingfeng Yang | bb5ce5c | 2018-04-09 08:08:46 -0700 | [diff] [blame] | 1001 | ANGLE_VALIDATE_IS_GLES1(context); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1002 | return true; |
| 1003 | } |
| 1004 | |
| 1005 | bool ValidateVertexPointer(Context *context, |
| 1006 | GLint size, |
| 1007 | GLenum type, |
| 1008 | GLsizei stride, |
| 1009 | const void *pointer) |
| 1010 | { |
Lingfeng Yang | abb09f1 | 2018-04-16 10:43:53 -0700 | [diff] [blame] | 1011 | return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::Vertex, size, type, |
| 1012 | stride, pointer); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1013 | } |
| 1014 | |
| 1015 | bool ValidateDrawTexfOES(Context *context, |
| 1016 | GLfloat x, |
| 1017 | GLfloat y, |
| 1018 | GLfloat z, |
| 1019 | GLfloat width, |
| 1020 | GLfloat height) |
| 1021 | { |
| 1022 | UNIMPLEMENTED(); |
| 1023 | return true; |
| 1024 | } |
| 1025 | |
| 1026 | bool ValidateDrawTexfvOES(Context *context, const GLfloat *coords) |
| 1027 | { |
| 1028 | UNIMPLEMENTED(); |
| 1029 | return true; |
| 1030 | } |
| 1031 | |
| 1032 | bool ValidateDrawTexiOES(Context *context, GLint x, GLint y, GLint z, GLint width, GLint height) |
| 1033 | { |
| 1034 | UNIMPLEMENTED(); |
| 1035 | return true; |
| 1036 | } |
| 1037 | |
| 1038 | bool ValidateDrawTexivOES(Context *context, const GLint *coords) |
| 1039 | { |
| 1040 | UNIMPLEMENTED(); |
| 1041 | return true; |
| 1042 | } |
| 1043 | |
| 1044 | bool ValidateDrawTexsOES(Context *context, |
| 1045 | GLshort x, |
| 1046 | GLshort y, |
| 1047 | GLshort z, |
| 1048 | GLshort width, |
| 1049 | GLshort height) |
| 1050 | { |
| 1051 | UNIMPLEMENTED(); |
| 1052 | return true; |
| 1053 | } |
| 1054 | |
| 1055 | bool ValidateDrawTexsvOES(Context *context, const GLshort *coords) |
| 1056 | { |
| 1057 | UNIMPLEMENTED(); |
| 1058 | return true; |
| 1059 | } |
| 1060 | |
| 1061 | bool ValidateDrawTexxOES(Context *context, |
| 1062 | GLfixed x, |
| 1063 | GLfixed y, |
| 1064 | GLfixed z, |
| 1065 | GLfixed width, |
| 1066 | GLfixed height) |
| 1067 | { |
| 1068 | UNIMPLEMENTED(); |
| 1069 | return true; |
| 1070 | } |
| 1071 | |
| 1072 | bool ValidateDrawTexxvOES(Context *context, const GLfixed *coords) |
| 1073 | { |
| 1074 | UNIMPLEMENTED(); |
| 1075 | return true; |
| 1076 | } |
| 1077 | |
| 1078 | bool ValidateCurrentPaletteMatrixOES(Context *context, GLuint matrixpaletteindex) |
| 1079 | { |
| 1080 | UNIMPLEMENTED(); |
| 1081 | return true; |
| 1082 | } |
| 1083 | |
| 1084 | bool ValidateLoadPaletteFromModelViewMatrixOES(Context *context) |
| 1085 | { |
| 1086 | UNIMPLEMENTED(); |
| 1087 | return true; |
| 1088 | } |
| 1089 | |
| 1090 | bool ValidateMatrixIndexPointerOES(Context *context, |
| 1091 | GLint size, |
| 1092 | GLenum type, |
| 1093 | GLsizei stride, |
| 1094 | const void *pointer) |
| 1095 | { |
| 1096 | UNIMPLEMENTED(); |
| 1097 | return true; |
| 1098 | } |
| 1099 | |
| 1100 | bool ValidateWeightPointerOES(Context *context, |
| 1101 | GLint size, |
| 1102 | GLenum type, |
| 1103 | GLsizei stride, |
| 1104 | const void *pointer) |
| 1105 | { |
| 1106 | UNIMPLEMENTED(); |
| 1107 | return true; |
| 1108 | } |
| 1109 | |
| 1110 | bool ValidatePointSizePointerOES(Context *context, GLenum type, GLsizei stride, const void *pointer) |
| 1111 | { |
Lingfeng Yang | abb09f1 | 2018-04-16 10:43:53 -0700 | [diff] [blame] | 1112 | return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::PointSize, 1, type, |
| 1113 | stride, pointer); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1114 | } |
| 1115 | |
| 1116 | bool ValidateQueryMatrixxOES(Context *context, GLfixed *mantissa, GLint *exponent) |
| 1117 | { |
| 1118 | UNIMPLEMENTED(); |
| 1119 | return true; |
| 1120 | } |
Lingfeng Yang | a064878 | 2018-03-12 14:45:25 -0700 | [diff] [blame] | 1121 | |
| 1122 | bool ValidateGenFramebuffersOES(Context *context, GLsizei n, GLuint *framebuffers) |
| 1123 | { |
| 1124 | UNIMPLEMENTED(); |
| 1125 | return true; |
| 1126 | } |
| 1127 | |
| 1128 | bool ValidateDeleteFramebuffersOES(Context *context, GLsizei n, const GLuint *framebuffers) |
| 1129 | { |
| 1130 | UNIMPLEMENTED(); |
| 1131 | return true; |
| 1132 | } |
| 1133 | |
| 1134 | bool ValidateGenRenderbuffersOES(Context *context, GLsizei n, GLuint *renderbuffers) |
| 1135 | { |
| 1136 | UNIMPLEMENTED(); |
| 1137 | return true; |
| 1138 | } |
| 1139 | |
| 1140 | bool ValidateDeleteRenderbuffersOES(Context *context, GLsizei n, const GLuint *renderbuffers) |
| 1141 | { |
| 1142 | UNIMPLEMENTED(); |
| 1143 | return true; |
| 1144 | } |
| 1145 | |
| 1146 | bool ValidateBindFramebufferOES(Context *context, GLenum target, GLuint framebuffer) |
| 1147 | { |
| 1148 | UNIMPLEMENTED(); |
| 1149 | return true; |
| 1150 | } |
| 1151 | |
| 1152 | bool ValidateBindRenderbufferOES(Context *context, GLenum target, GLuint renderbuffer) |
| 1153 | { |
| 1154 | UNIMPLEMENTED(); |
| 1155 | return true; |
| 1156 | } |
| 1157 | |
| 1158 | bool ValidateCheckFramebufferStatusOES(Context *context, GLenum target) |
| 1159 | { |
| 1160 | UNIMPLEMENTED(); |
| 1161 | return true; |
| 1162 | } |
| 1163 | |
| 1164 | bool ValidateFramebufferRenderbufferOES(Context *context, |
| 1165 | GLenum target, |
| 1166 | GLenum attachment, |
| 1167 | GLenum rbtarget, |
| 1168 | GLuint renderbuffer) |
| 1169 | { |
| 1170 | UNIMPLEMENTED(); |
| 1171 | return true; |
| 1172 | } |
| 1173 | |
| 1174 | bool ValidateFramebufferTexture2DOES(Context *context, |
| 1175 | GLenum target, |
| 1176 | GLenum attachment, |
| 1177 | TextureTarget textarget, |
| 1178 | GLuint texture, |
| 1179 | GLint level) |
| 1180 | { |
| 1181 | UNIMPLEMENTED(); |
| 1182 | return true; |
| 1183 | } |
| 1184 | |
| 1185 | bool ValidateGenerateMipmapOES(Context *context, TextureType target) |
| 1186 | { |
| 1187 | UNIMPLEMENTED(); |
| 1188 | return true; |
| 1189 | } |
| 1190 | |
| 1191 | bool ValidateGetFramebufferAttachmentParameterivOES(Context *context, |
| 1192 | GLenum target, |
| 1193 | GLenum attachment, |
| 1194 | GLenum pname, |
| 1195 | GLint *params) |
| 1196 | { |
| 1197 | UNIMPLEMENTED(); |
| 1198 | return true; |
| 1199 | } |
| 1200 | |
| 1201 | bool ValidateGetRenderbufferParameterivOES(Context *context, |
| 1202 | GLenum target, |
| 1203 | GLenum pname, |
| 1204 | GLint *params) |
| 1205 | { |
| 1206 | UNIMPLEMENTED(); |
| 1207 | return true; |
| 1208 | } |
| 1209 | |
| 1210 | bool ValidateIsFramebufferOES(Context *context, GLuint framebuffer) |
| 1211 | { |
| 1212 | UNIMPLEMENTED(); |
| 1213 | return true; |
| 1214 | } |
| 1215 | |
| 1216 | bool ValidateIsRenderbufferOES(Context *context, GLuint renderbuffer) |
| 1217 | { |
| 1218 | UNIMPLEMENTED(); |
| 1219 | return true; |
| 1220 | } |
| 1221 | |
| 1222 | bool ValidateRenderbufferStorageOES(Context *context, |
| 1223 | GLenum target, |
| 1224 | GLint internalformat, |
| 1225 | GLsizei width, |
| 1226 | GLsizei height) |
| 1227 | { |
| 1228 | UNIMPLEMENTED(); |
| 1229 | return true; |
| 1230 | } |
| 1231 | |
| 1232 | // GL_OES_texture_cube_map |
| 1233 | |
| 1234 | bool ValidateGetTexGenfvOES(Context *context, GLenum coord, GLenum pname, GLfloat *params) |
| 1235 | { |
| 1236 | UNIMPLEMENTED(); |
| 1237 | return true; |
| 1238 | } |
| 1239 | |
| 1240 | bool ValidateGetTexGenivOES(Context *context, GLenum coord, GLenum pname, int *params) |
| 1241 | { |
| 1242 | UNIMPLEMENTED(); |
| 1243 | return true; |
| 1244 | } |
| 1245 | |
| 1246 | bool ValidateGetTexGenxvOES(Context *context, GLenum coord, GLenum pname, GLfixed *params) |
| 1247 | { |
| 1248 | UNIMPLEMENTED(); |
| 1249 | return true; |
| 1250 | } |
| 1251 | |
| 1252 | bool ValidateTexGenfvOES(Context *context, GLenum coord, GLenum pname, const GLfloat *params) |
| 1253 | { |
| 1254 | UNIMPLEMENTED(); |
| 1255 | return true; |
| 1256 | } |
| 1257 | |
| 1258 | bool ValidateTexGenivOES(Context *context, GLenum coord, GLenum pname, const GLint *param) |
| 1259 | { |
| 1260 | UNIMPLEMENTED(); |
| 1261 | return true; |
| 1262 | } |
| 1263 | |
| 1264 | bool ValidateTexGenxvOES(Context *context, GLenum coord, GLenum pname, const GLint *param) |
| 1265 | { |
| 1266 | UNIMPLEMENTED(); |
| 1267 | return true; |
| 1268 | } |
| 1269 | |
| 1270 | bool ValidateTexGenfOES(Context *context, GLenum coord, GLenum pname, GLfloat param) |
| 1271 | { |
| 1272 | UNIMPLEMENTED(); |
| 1273 | return true; |
| 1274 | } |
| 1275 | |
| 1276 | bool ValidateTexGeniOES(Context *context, GLenum coord, GLenum pname, GLint param) |
| 1277 | { |
| 1278 | UNIMPLEMENTED(); |
| 1279 | return true; |
| 1280 | } |
| 1281 | |
| 1282 | bool ValidateTexGenxOES(Context *context, GLenum coord, GLenum pname, GLfixed param) |
| 1283 | { |
| 1284 | UNIMPLEMENTED(); |
| 1285 | return true; |
| 1286 | } |
Lingfeng Yang | 0107443 | 2018-04-16 10:19:51 -0700 | [diff] [blame] | 1287 | |
| 1288 | } // namespace gl |