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 | |
Jamie Madill | 778bf09 | 2018-11-14 09:54:36 -0500 | [diff] [blame] | 9 | #include "libANGLE/validationES1_autogen.h" |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 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" |
Lingfeng Yang | 45b5a87 | 2018-06-07 11:33:25 -0700 | [diff] [blame] | 15 | #include "libANGLE/queryconversions.h" |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 16 | #include "libANGLE/queryutils.h" |
Lingfeng Yang | 038dd53 | 2018-03-29 17:31:52 -0700 | [diff] [blame] | 17 | #include "libANGLE/validationES.h" |
Lingfeng Yang | 13b708f | 2018-03-21 12:14:10 -0700 | [diff] [blame] | 18 | |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 19 | #define ANGLE_VALIDATE_IS_GLES1(context) \ |
| 20 | if (context->getClientMajorVersion() > 1) \ |
| 21 | { \ |
| 22 | context->validationError(GL_INVALID_OPERATION, kGLES1Only); \ |
| 23 | return false; \ |
Lingfeng Yang | 13b708f | 2018-03-21 12:14:10 -0700 | [diff] [blame] | 24 | } |
| 25 | |
Lingfeng Yang | 0107443 | 2018-04-16 10:19:51 -0700 | [diff] [blame] | 26 | namespace gl |
Lingfeng Yang | 13b708f | 2018-03-21 12:14:10 -0700 | [diff] [blame] | 27 | { |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 28 | using namespace err; |
Lingfeng Yang | 13b708f | 2018-03-21 12:14:10 -0700 | [diff] [blame] | 29 | |
Lingfeng Yang | abb09f1 | 2018-04-16 10:43:53 -0700 | [diff] [blame] | 30 | bool ValidateAlphaFuncCommon(Context *context, AlphaTestFunc func) |
Lingfeng Yang | 13b708f | 2018-03-21 12:14:10 -0700 | [diff] [blame] | 31 | { |
| 32 | switch (func) |
| 33 | { |
Lingfeng Yang | abb09f1 | 2018-04-16 10:43:53 -0700 | [diff] [blame] | 34 | case AlphaTestFunc::AlwaysPass: |
| 35 | case AlphaTestFunc::Equal: |
| 36 | case AlphaTestFunc::Gequal: |
| 37 | case AlphaTestFunc::Greater: |
| 38 | case AlphaTestFunc::Lequal: |
| 39 | case AlphaTestFunc::Less: |
| 40 | case AlphaTestFunc::Never: |
| 41 | case AlphaTestFunc::NotEqual: |
Lingfeng Yang | 13b708f | 2018-03-21 12:14:10 -0700 | [diff] [blame] | 42 | return true; |
| 43 | default: |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 44 | context->validationError(GL_INVALID_ENUM, kEnumNotSupported); |
Lingfeng Yang | 13b708f | 2018-03-21 12:14:10 -0700 | [diff] [blame] | 45 | return false; |
| 46 | } |
| 47 | } |
| 48 | |
Lingfeng Yang | abb09f1 | 2018-04-16 10:43:53 -0700 | [diff] [blame] | 49 | bool ValidateClientStateCommon(Context *context, ClientVertexArrayType arrayType) |
Lingfeng Yang | 0107443 | 2018-04-16 10:19:51 -0700 | [diff] [blame] | 50 | { |
| 51 | ANGLE_VALIDATE_IS_GLES1(context); |
| 52 | switch (arrayType) |
| 53 | { |
Lingfeng Yang | abb09f1 | 2018-04-16 10:43:53 -0700 | [diff] [blame] | 54 | case ClientVertexArrayType::Vertex: |
| 55 | case ClientVertexArrayType::Normal: |
| 56 | case ClientVertexArrayType::Color: |
| 57 | case ClientVertexArrayType::TextureCoord: |
Lingfeng Yang | 0107443 | 2018-04-16 10:19:51 -0700 | [diff] [blame] | 58 | return true; |
Lingfeng Yang | abb09f1 | 2018-04-16 10:43:53 -0700 | [diff] [blame] | 59 | case ClientVertexArrayType::PointSize: |
Lingfeng Yang | 0107443 | 2018-04-16 10:19:51 -0700 | [diff] [blame] | 60 | if (!context->getExtensions().pointSizeArray) |
| 61 | { |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 62 | context->validationError(GL_INVALID_ENUM, kPointSizeArrayExtensionNotEnabled); |
Lingfeng Yang | 0107443 | 2018-04-16 10:19:51 -0700 | [diff] [blame] | 63 | return false; |
| 64 | } |
| 65 | return true; |
| 66 | default: |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 67 | context->validationError(GL_INVALID_ENUM, kInvalidClientState); |
Lingfeng Yang | 0107443 | 2018-04-16 10:19:51 -0700 | [diff] [blame] | 68 | return false; |
| 69 | } |
| 70 | } |
| 71 | |
Lingfeng Yang | abb09f1 | 2018-04-16 10:43:53 -0700 | [diff] [blame] | 72 | bool ValidateBuiltinVertexAttributeCommon(Context *context, |
| 73 | ClientVertexArrayType arrayType, |
| 74 | GLint size, |
| 75 | GLenum type, |
| 76 | GLsizei stride, |
| 77 | const void *pointer) |
| 78 | { |
| 79 | ANGLE_VALIDATE_IS_GLES1(context); |
| 80 | |
| 81 | if (stride < 0) |
| 82 | { |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 83 | context->validationError(GL_INVALID_VALUE, kInvalidVertexPointerStride); |
Lingfeng Yang | abb09f1 | 2018-04-16 10:43:53 -0700 | [diff] [blame] | 84 | return false; |
| 85 | } |
| 86 | |
| 87 | int minSize = 1; |
| 88 | int maxSize = 4; |
| 89 | |
| 90 | switch (arrayType) |
| 91 | { |
| 92 | case ClientVertexArrayType::Vertex: |
| 93 | case ClientVertexArrayType::TextureCoord: |
| 94 | minSize = 2; |
| 95 | maxSize = 4; |
| 96 | break; |
| 97 | case ClientVertexArrayType::Normal: |
| 98 | minSize = 3; |
| 99 | maxSize = 3; |
| 100 | break; |
| 101 | case ClientVertexArrayType::Color: |
| 102 | minSize = 4; |
| 103 | maxSize = 4; |
| 104 | break; |
| 105 | case ClientVertexArrayType::PointSize: |
| 106 | if (!context->getExtensions().pointSizeArray) |
| 107 | { |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 108 | context->validationError(GL_INVALID_ENUM, kPointSizeArrayExtensionNotEnabled); |
Lingfeng Yang | abb09f1 | 2018-04-16 10:43:53 -0700 | [diff] [blame] | 109 | return false; |
| 110 | } |
| 111 | |
| 112 | minSize = 1; |
| 113 | maxSize = 1; |
| 114 | break; |
| 115 | default: |
| 116 | UNREACHABLE(); |
| 117 | return false; |
| 118 | } |
| 119 | |
| 120 | if (size < minSize || size > maxSize) |
| 121 | { |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 122 | context->validationError(GL_INVALID_VALUE, kInvalidVertexPointerSize); |
Lingfeng Yang | abb09f1 | 2018-04-16 10:43:53 -0700 | [diff] [blame] | 123 | return false; |
| 124 | } |
| 125 | |
| 126 | switch (type) |
| 127 | { |
| 128 | case GL_BYTE: |
| 129 | if (arrayType == ClientVertexArrayType::PointSize) |
| 130 | { |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 131 | context->validationError(GL_INVALID_ENUM, kInvalidVertexPointerType); |
Lingfeng Yang | abb09f1 | 2018-04-16 10:43:53 -0700 | [diff] [blame] | 132 | return false; |
| 133 | } |
| 134 | break; |
| 135 | case GL_SHORT: |
| 136 | if (arrayType == ClientVertexArrayType::PointSize || |
| 137 | arrayType == ClientVertexArrayType::Color) |
| 138 | { |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 139 | context->validationError(GL_INVALID_ENUM, kInvalidVertexPointerType); |
Lingfeng Yang | abb09f1 | 2018-04-16 10:43:53 -0700 | [diff] [blame] | 140 | return false; |
| 141 | } |
| 142 | break; |
| 143 | case GL_FIXED: |
| 144 | case GL_FLOAT: |
| 145 | break; |
| 146 | default: |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 147 | context->validationError(GL_INVALID_ENUM, kInvalidVertexPointerType); |
Lingfeng Yang | abb09f1 | 2018-04-16 10:43:53 -0700 | [diff] [blame] | 148 | return false; |
| 149 | } |
| 150 | |
| 151 | return true; |
| 152 | } |
| 153 | |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 154 | bool ValidateLightCaps(Context *context, GLenum light) |
| 155 | { |
| 156 | if (light < GL_LIGHT0 || light >= GL_LIGHT0 + context->getCaps().maxLights) |
| 157 | { |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 158 | context->validationError(GL_INVALID_ENUM, kInvalidLight); |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 159 | return false; |
| 160 | } |
| 161 | |
| 162 | return true; |
| 163 | } |
| 164 | |
| 165 | bool ValidateLightCommon(Context *context, |
| 166 | GLenum light, |
| 167 | LightParameter pname, |
| 168 | const GLfloat *params) |
| 169 | { |
| 170 | |
| 171 | ANGLE_VALIDATE_IS_GLES1(context); |
| 172 | |
| 173 | if (!ValidateLightCaps(context, light)) |
| 174 | { |
| 175 | return false; |
| 176 | } |
| 177 | |
| 178 | switch (pname) |
| 179 | { |
| 180 | case LightParameter::Ambient: |
| 181 | case LightParameter::Diffuse: |
| 182 | case LightParameter::Specular: |
| 183 | case LightParameter::Position: |
| 184 | case LightParameter::SpotDirection: |
| 185 | return true; |
| 186 | case LightParameter::SpotExponent: |
| 187 | if (params[0] < 0.0f || params[0] > 128.0f) |
| 188 | { |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 189 | context->validationError(GL_INVALID_VALUE, kLightParameterOutOfRange); |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 190 | return false; |
| 191 | } |
| 192 | return true; |
| 193 | case LightParameter::SpotCutoff: |
| 194 | if (params[0] == 180.0f) |
| 195 | { |
| 196 | return true; |
| 197 | } |
| 198 | if (params[0] < 0.0f || params[0] > 90.0f) |
| 199 | { |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 200 | context->validationError(GL_INVALID_VALUE, kLightParameterOutOfRange); |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 201 | return false; |
| 202 | } |
| 203 | return true; |
| 204 | case LightParameter::ConstantAttenuation: |
| 205 | case LightParameter::LinearAttenuation: |
| 206 | case LightParameter::QuadraticAttenuation: |
| 207 | if (params[0] < 0.0f) |
| 208 | { |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 209 | context->validationError(GL_INVALID_VALUE, kLightParameterOutOfRange); |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 210 | return false; |
| 211 | } |
| 212 | return true; |
| 213 | default: |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 214 | context->validationError(GL_INVALID_ENUM, kInvalidLightParameter); |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 215 | return false; |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | bool ValidateLightSingleComponent(Context *context, |
| 220 | GLenum light, |
| 221 | LightParameter pname, |
| 222 | GLfloat param) |
| 223 | { |
| 224 | if (!ValidateLightCommon(context, light, pname, ¶m)) |
| 225 | { |
| 226 | return false; |
| 227 | } |
| 228 | |
| 229 | if (GetLightParameterCount(pname) > 1) |
| 230 | { |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 231 | context->validationError(GL_INVALID_ENUM, kInvalidLightParameter); |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 232 | return false; |
| 233 | } |
| 234 | |
| 235 | return true; |
| 236 | } |
| 237 | |
| 238 | bool ValidateMaterialCommon(Context *context, |
| 239 | GLenum face, |
| 240 | MaterialParameter pname, |
| 241 | const GLfloat *params) |
| 242 | { |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 243 | switch (pname) |
| 244 | { |
| 245 | case MaterialParameter::Ambient: |
| 246 | case MaterialParameter::Diffuse: |
| 247 | case MaterialParameter::Specular: |
| 248 | case MaterialParameter::Emission: |
| 249 | return true; |
| 250 | case MaterialParameter::Shininess: |
| 251 | if (params[0] < 0.0f || params[0] > 128.0f) |
| 252 | { |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 253 | context->validationError(GL_INVALID_VALUE, kMaterialParameterOutOfRange); |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 254 | return false; |
| 255 | } |
| 256 | return true; |
| 257 | default: |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 258 | context->validationError(GL_INVALID_ENUM, kInvalidMaterialParameter); |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 259 | return false; |
| 260 | } |
| 261 | } |
| 262 | |
Lingfeng Yang | 6e5bf36 | 2018-08-15 09:53:17 -0700 | [diff] [blame] | 263 | bool ValidateMaterialSetting(Context *context, |
| 264 | GLenum face, |
| 265 | MaterialParameter pname, |
| 266 | const GLfloat *params) |
| 267 | { |
| 268 | ANGLE_VALIDATE_IS_GLES1(context); |
| 269 | |
| 270 | if (face != GL_FRONT_AND_BACK) |
| 271 | { |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 272 | context->validationError(GL_INVALID_ENUM, kInvalidMaterialFace); |
Lingfeng Yang | 6e5bf36 | 2018-08-15 09:53:17 -0700 | [diff] [blame] | 273 | return false; |
| 274 | } |
| 275 | |
| 276 | return ValidateMaterialCommon(context, face, pname, params); |
| 277 | } |
| 278 | |
| 279 | bool ValidateMaterialQuery(Context *context, GLenum face, MaterialParameter pname) |
| 280 | { |
| 281 | ANGLE_VALIDATE_IS_GLES1(context); |
| 282 | |
| 283 | if (face != GL_FRONT && face != GL_BACK) |
| 284 | { |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 285 | context->validationError(GL_INVALID_ENUM, kInvalidMaterialFace); |
Lingfeng Yang | 6e5bf36 | 2018-08-15 09:53:17 -0700 | [diff] [blame] | 286 | return false; |
| 287 | } |
| 288 | |
| 289 | GLfloat dummyParams[4] = {0.0f, 0.0f, 0.0f, 0.0f}; |
| 290 | |
| 291 | return ValidateMaterialCommon(context, face, pname, dummyParams); |
| 292 | } |
| 293 | |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 294 | bool ValidateMaterialSingleComponent(Context *context, |
| 295 | GLenum face, |
| 296 | MaterialParameter pname, |
| 297 | GLfloat param) |
| 298 | { |
Lingfeng Yang | 6e5bf36 | 2018-08-15 09:53:17 -0700 | [diff] [blame] | 299 | if (!ValidateMaterialSetting(context, face, pname, ¶m)) |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 300 | { |
| 301 | return false; |
| 302 | } |
| 303 | |
| 304 | if (GetMaterialParameterCount(pname) > 1) |
| 305 | { |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 306 | context->validationError(GL_INVALID_ENUM, kInvalidMaterialParameter); |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 307 | return false; |
| 308 | } |
| 309 | |
| 310 | return true; |
| 311 | } |
| 312 | |
| 313 | bool ValidateLightModelCommon(Context *context, GLenum pname) |
| 314 | { |
| 315 | ANGLE_VALIDATE_IS_GLES1(context); |
| 316 | switch (pname) |
| 317 | { |
| 318 | case GL_LIGHT_MODEL_AMBIENT: |
| 319 | case GL_LIGHT_MODEL_TWO_SIDE: |
| 320 | return true; |
| 321 | default: |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 322 | context->validationError(GL_INVALID_ENUM, kInvalidLightModelParameter); |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 323 | return false; |
| 324 | } |
| 325 | } |
| 326 | |
| 327 | bool ValidateLightModelSingleComponent(Context *context, GLenum pname) |
| 328 | { |
| 329 | if (!ValidateLightModelCommon(context, pname)) |
| 330 | { |
| 331 | return false; |
| 332 | } |
| 333 | |
| 334 | switch (pname) |
| 335 | { |
| 336 | case GL_LIGHT_MODEL_TWO_SIDE: |
| 337 | return true; |
| 338 | default: |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 339 | context->validationError(GL_INVALID_ENUM, kInvalidLightModelParameter); |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 340 | return false; |
| 341 | } |
| 342 | } |
| 343 | |
Lingfeng Yang | 060088a | 2018-05-30 20:40:57 -0700 | [diff] [blame] | 344 | bool ValidateClipPlaneCommon(Context *context, GLenum plane) |
| 345 | { |
| 346 | ANGLE_VALIDATE_IS_GLES1(context); |
| 347 | |
| 348 | if (plane < GL_CLIP_PLANE0 || plane >= GL_CLIP_PLANE0 + context->getCaps().maxClipPlanes) |
| 349 | { |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 350 | context->validationError(GL_INVALID_ENUM, kInvalidClipPlane); |
Lingfeng Yang | 060088a | 2018-05-30 20:40:57 -0700 | [diff] [blame] | 351 | return false; |
| 352 | } |
| 353 | |
| 354 | return true; |
| 355 | } |
| 356 | |
Lingfeng Yang | 7ba3f42 | 2018-06-01 09:43:04 -0700 | [diff] [blame] | 357 | bool ValidateFogCommon(Context *context, GLenum pname, const GLfloat *params) |
| 358 | { |
| 359 | ANGLE_VALIDATE_IS_GLES1(context); |
| 360 | |
| 361 | switch (pname) |
| 362 | { |
| 363 | case GL_FOG_MODE: |
| 364 | { |
| 365 | GLenum modeParam = static_cast<GLenum>(params[0]); |
| 366 | switch (modeParam) |
| 367 | { |
| 368 | case GL_EXP: |
| 369 | case GL_EXP2: |
| 370 | case GL_LINEAR: |
| 371 | return true; |
| 372 | default: |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 373 | context->validationError(GL_INVALID_VALUE, kInvalidFogMode); |
Lingfeng Yang | 7ba3f42 | 2018-06-01 09:43:04 -0700 | [diff] [blame] | 374 | return false; |
| 375 | } |
| 376 | } |
| 377 | break; |
| 378 | case GL_FOG_START: |
| 379 | case GL_FOG_END: |
| 380 | case GL_FOG_COLOR: |
| 381 | break; |
| 382 | case GL_FOG_DENSITY: |
| 383 | if (params[0] < 0.0f) |
| 384 | { |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 385 | context->validationError(GL_INVALID_VALUE, kInvalidFogDensity); |
Lingfeng Yang | 7ba3f42 | 2018-06-01 09:43:04 -0700 | [diff] [blame] | 386 | return false; |
| 387 | } |
| 388 | break; |
| 389 | default: |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 390 | context->validationError(GL_INVALID_ENUM, kInvalidFogParameter); |
Lingfeng Yang | 7ba3f42 | 2018-06-01 09:43:04 -0700 | [diff] [blame] | 391 | return false; |
| 392 | } |
| 393 | return true; |
| 394 | } |
| 395 | |
Lingfeng Yang | 45b5a87 | 2018-06-07 11:33:25 -0700 | [diff] [blame] | 396 | bool ValidateTexEnvCommon(Context *context, |
| 397 | TextureEnvTarget target, |
| 398 | TextureEnvParameter pname, |
| 399 | const GLfloat *params) |
| 400 | { |
| 401 | ANGLE_VALIDATE_IS_GLES1(context); |
| 402 | |
Lingfeng Yang | 9c4c092 | 2018-06-13 09:29:00 -0700 | [diff] [blame] | 403 | switch (target) |
Lingfeng Yang | 45b5a87 | 2018-06-07 11:33:25 -0700 | [diff] [blame] | 404 | { |
Lingfeng Yang | 9c4c092 | 2018-06-13 09:29:00 -0700 | [diff] [blame] | 405 | case TextureEnvTarget::Env: |
| 406 | switch (pname) |
Lingfeng Yang | 45b5a87 | 2018-06-07 11:33:25 -0700 | [diff] [blame] | 407 | { |
Lingfeng Yang | 9c4c092 | 2018-06-13 09:29:00 -0700 | [diff] [blame] | 408 | case TextureEnvParameter::Mode: |
| 409 | { |
| 410 | TextureEnvMode mode = FromGLenum<TextureEnvMode>(ConvertToGLenum(params[0])); |
| 411 | switch (mode) |
Lingfeng Yang | 4004ae0 | 2018-06-13 09:29:00 -0700 | [diff] [blame] | 412 | { |
Lingfeng Yang | 9c4c092 | 2018-06-13 09:29:00 -0700 | [diff] [blame] | 413 | case TextureEnvMode::Add: |
| 414 | case TextureEnvMode::Blend: |
| 415 | case TextureEnvMode::Combine: |
| 416 | case TextureEnvMode::Decal: |
| 417 | case TextureEnvMode::Modulate: |
| 418 | case TextureEnvMode::Replace: |
| 419 | break; |
| 420 | default: |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 421 | context->validationError(GL_INVALID_VALUE, kInvalidTextureEnvMode); |
Lingfeng Yang | 9c4c092 | 2018-06-13 09:29:00 -0700 | [diff] [blame] | 422 | return false; |
| 423 | } |
| 424 | break; |
| 425 | } |
| 426 | case TextureEnvParameter::CombineRgb: |
| 427 | case TextureEnvParameter::CombineAlpha: |
| 428 | { |
| 429 | TextureCombine combine = FromGLenum<TextureCombine>(ConvertToGLenum(params[0])); |
| 430 | switch (combine) |
| 431 | { |
| 432 | case TextureCombine::Add: |
| 433 | case TextureCombine::AddSigned: |
| 434 | case TextureCombine::Interpolate: |
| 435 | case TextureCombine::Modulate: |
| 436 | case TextureCombine::Replace: |
| 437 | case TextureCombine::Subtract: |
| 438 | break; |
| 439 | case TextureCombine::Dot3Rgb: |
| 440 | case TextureCombine::Dot3Rgba: |
| 441 | if (pname == TextureEnvParameter::CombineAlpha) |
| 442 | { |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 443 | context->validationError(GL_INVALID_VALUE, kInvalidTextureCombine); |
Lingfeng Yang | 9c4c092 | 2018-06-13 09:29:00 -0700 | [diff] [blame] | 444 | return false; |
| 445 | } |
| 446 | break; |
| 447 | default: |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 448 | context->validationError(GL_INVALID_VALUE, kInvalidTextureCombine); |
Lingfeng Yang | 9c4c092 | 2018-06-13 09:29:00 -0700 | [diff] [blame] | 449 | return false; |
| 450 | } |
| 451 | break; |
| 452 | } |
| 453 | case TextureEnvParameter::Src0Rgb: |
| 454 | case TextureEnvParameter::Src1Rgb: |
| 455 | case TextureEnvParameter::Src2Rgb: |
| 456 | case TextureEnvParameter::Src0Alpha: |
| 457 | case TextureEnvParameter::Src1Alpha: |
| 458 | case TextureEnvParameter::Src2Alpha: |
| 459 | { |
| 460 | TextureSrc combine = FromGLenum<TextureSrc>(ConvertToGLenum(params[0])); |
| 461 | switch (combine) |
| 462 | { |
| 463 | case TextureSrc::Constant: |
| 464 | case TextureSrc::Previous: |
| 465 | case TextureSrc::PrimaryColor: |
| 466 | case TextureSrc::Texture: |
| 467 | break; |
| 468 | default: |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 469 | context->validationError(GL_INVALID_VALUE, kInvalidTextureCombineSrc); |
Lingfeng Yang | 9c4c092 | 2018-06-13 09:29:00 -0700 | [diff] [blame] | 470 | return false; |
| 471 | } |
| 472 | break; |
| 473 | } |
| 474 | case TextureEnvParameter::Op0Rgb: |
| 475 | case TextureEnvParameter::Op1Rgb: |
| 476 | case TextureEnvParameter::Op2Rgb: |
| 477 | case TextureEnvParameter::Op0Alpha: |
| 478 | case TextureEnvParameter::Op1Alpha: |
| 479 | case TextureEnvParameter::Op2Alpha: |
| 480 | { |
| 481 | TextureOp operand = FromGLenum<TextureOp>(ConvertToGLenum(params[0])); |
| 482 | switch (operand) |
| 483 | { |
| 484 | case TextureOp::SrcAlpha: |
| 485 | case TextureOp::OneMinusSrcAlpha: |
| 486 | break; |
| 487 | case TextureOp::SrcColor: |
| 488 | case TextureOp::OneMinusSrcColor: |
| 489 | if (pname == TextureEnvParameter::Op0Alpha || |
| 490 | pname == TextureEnvParameter::Op1Alpha || |
| 491 | pname == TextureEnvParameter::Op2Alpha) |
| 492 | { |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 493 | context->validationError(GL_INVALID_VALUE, kInvalidTextureCombine); |
Lingfeng Yang | 9c4c092 | 2018-06-13 09:29:00 -0700 | [diff] [blame] | 494 | return false; |
| 495 | } |
| 496 | break; |
| 497 | default: |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 498 | context->validationError(GL_INVALID_VALUE, kInvalidTextureCombineOp); |
Lingfeng Yang | 9c4c092 | 2018-06-13 09:29:00 -0700 | [diff] [blame] | 499 | return false; |
| 500 | } |
| 501 | break; |
| 502 | } |
| 503 | case TextureEnvParameter::RgbScale: |
| 504 | case TextureEnvParameter::AlphaScale: |
| 505 | if (params[0] != 1.0f && params[0] != 2.0f && params[0] != 4.0f) |
| 506 | { |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 507 | context->validationError(GL_INVALID_VALUE, kInvalidTextureEnvScale); |
Lingfeng Yang | 45b5a87 | 2018-06-07 11:33:25 -0700 | [diff] [blame] | 508 | return false; |
| 509 | } |
| 510 | break; |
Lingfeng Yang | 9c4c092 | 2018-06-13 09:29:00 -0700 | [diff] [blame] | 511 | case TextureEnvParameter::Color: |
| 512 | break; |
Lingfeng Yang | 45b5a87 | 2018-06-07 11:33:25 -0700 | [diff] [blame] | 513 | default: |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 514 | context->validationError(GL_INVALID_ENUM, kInvalidTextureEnvParameter); |
Lingfeng Yang | 45b5a87 | 2018-06-07 11:33:25 -0700 | [diff] [blame] | 515 | return false; |
| 516 | } |
| 517 | break; |
Lingfeng Yang | 9c4c092 | 2018-06-13 09:29:00 -0700 | [diff] [blame] | 518 | case TextureEnvTarget::PointSprite: |
| 519 | if (!context->getExtensions().pointSprite) |
Lingfeng Yang | 45b5a87 | 2018-06-07 11:33:25 -0700 | [diff] [blame] | 520 | { |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 521 | context->validationError(GL_INVALID_ENUM, kInvalidTextureEnvTarget); |
Lingfeng Yang | 45b5a87 | 2018-06-07 11:33:25 -0700 | [diff] [blame] | 522 | return false; |
| 523 | } |
Lingfeng Yang | 9c4c092 | 2018-06-13 09:29:00 -0700 | [diff] [blame] | 524 | switch (pname) |
| 525 | { |
| 526 | case TextureEnvParameter::PointCoordReplace: |
| 527 | break; |
| 528 | default: |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 529 | context->validationError(GL_INVALID_ENUM, kInvalidTextureEnvParameter); |
Lingfeng Yang | 9c4c092 | 2018-06-13 09:29:00 -0700 | [diff] [blame] | 530 | return false; |
| 531 | } |
Lingfeng Yang | 45b5a87 | 2018-06-07 11:33:25 -0700 | [diff] [blame] | 532 | break; |
| 533 | default: |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 534 | context->validationError(GL_INVALID_ENUM, kInvalidTextureEnvTarget); |
Lingfeng Yang | 45b5a87 | 2018-06-07 11:33:25 -0700 | [diff] [blame] | 535 | return false; |
| 536 | } |
| 537 | return true; |
| 538 | } |
| 539 | |
| 540 | bool ValidateGetTexEnvCommon(Context *context, TextureEnvTarget target, TextureEnvParameter pname) |
| 541 | { |
| 542 | GLfloat dummy[4] = {}; |
| 543 | switch (pname) |
| 544 | { |
| 545 | case TextureEnvParameter::Mode: |
| 546 | ConvertPackedEnum(TextureEnvMode::Add, dummy); |
| 547 | break; |
| 548 | case TextureEnvParameter::CombineRgb: |
| 549 | case TextureEnvParameter::CombineAlpha: |
| 550 | ConvertPackedEnum(TextureCombine::Add, dummy); |
| 551 | break; |
| 552 | case TextureEnvParameter::Src0Rgb: |
| 553 | case TextureEnvParameter::Src1Rgb: |
| 554 | case TextureEnvParameter::Src2Rgb: |
| 555 | case TextureEnvParameter::Src0Alpha: |
| 556 | case TextureEnvParameter::Src1Alpha: |
| 557 | case TextureEnvParameter::Src2Alpha: |
| 558 | ConvertPackedEnum(TextureSrc::Constant, dummy); |
| 559 | break; |
| 560 | case TextureEnvParameter::Op0Rgb: |
| 561 | case TextureEnvParameter::Op1Rgb: |
| 562 | case TextureEnvParameter::Op2Rgb: |
| 563 | case TextureEnvParameter::Op0Alpha: |
| 564 | case TextureEnvParameter::Op1Alpha: |
| 565 | case TextureEnvParameter::Op2Alpha: |
| 566 | ConvertPackedEnum(TextureOp::SrcAlpha, dummy); |
| 567 | break; |
| 568 | case TextureEnvParameter::RgbScale: |
| 569 | case TextureEnvParameter::AlphaScale: |
Lingfeng Yang | 9c4c092 | 2018-06-13 09:29:00 -0700 | [diff] [blame] | 570 | case TextureEnvParameter::PointCoordReplace: |
Lingfeng Yang | 45b5a87 | 2018-06-07 11:33:25 -0700 | [diff] [blame] | 571 | dummy[0] = 1.0f; |
| 572 | break; |
| 573 | default: |
| 574 | break; |
| 575 | } |
| 576 | |
| 577 | return ValidateTexEnvCommon(context, target, pname, dummy); |
| 578 | } |
| 579 | |
Lingfeng Yang | 9c4c092 | 2018-06-13 09:29:00 -0700 | [diff] [blame] | 580 | bool ValidatePointParameterCommon(Context *context, PointParameter pname, const GLfloat *params) |
| 581 | { |
| 582 | ANGLE_VALIDATE_IS_GLES1(context); |
| 583 | |
| 584 | switch (pname) |
| 585 | { |
| 586 | case PointParameter::PointSizeMin: |
| 587 | case PointParameter::PointSizeMax: |
| 588 | case PointParameter::PointFadeThresholdSize: |
| 589 | case PointParameter::PointDistanceAttenuation: |
| 590 | for (unsigned int i = 0; i < GetPointParameterCount(pname); i++) |
| 591 | { |
| 592 | if (params[i] < 0.0f) |
| 593 | { |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 594 | context->validationError(GL_INVALID_VALUE, kInvalidPointParameterValue); |
Lingfeng Yang | 9c4c092 | 2018-06-13 09:29:00 -0700 | [diff] [blame] | 595 | return false; |
| 596 | } |
| 597 | } |
| 598 | break; |
| 599 | default: |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 600 | context->validationError(GL_INVALID_ENUM, kInvalidPointParameter); |
Lingfeng Yang | 9c4c092 | 2018-06-13 09:29:00 -0700 | [diff] [blame] | 601 | return false; |
| 602 | } |
| 603 | |
| 604 | return true; |
| 605 | } |
| 606 | |
| 607 | bool ValidatePointSizeCommon(Context *context, GLfloat size) |
| 608 | { |
| 609 | ANGLE_VALIDATE_IS_GLES1(context); |
| 610 | |
| 611 | if (size <= 0.0f) |
| 612 | { |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 613 | context->validationError(GL_INVALID_VALUE, kInvalidPointSizeValue); |
Lingfeng Yang | 9c4c092 | 2018-06-13 09:29:00 -0700 | [diff] [blame] | 614 | return false; |
| 615 | } |
| 616 | |
| 617 | return true; |
| 618 | } |
| 619 | |
Lingfeng Yang | 0df813c | 2018-07-12 12:52:06 -0700 | [diff] [blame] | 620 | bool ValidateDrawTexCommon(Context *context, float width, float height) |
| 621 | { |
| 622 | ANGLE_VALIDATE_IS_GLES1(context); |
| 623 | |
| 624 | if (width <= 0.0f || height <= 0.0f) |
| 625 | { |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 626 | context->validationError(GL_INVALID_VALUE, kNonPositiveDrawTextureDimension); |
Lingfeng Yang | 0df813c | 2018-07-12 12:52:06 -0700 | [diff] [blame] | 627 | return false; |
| 628 | } |
| 629 | |
| 630 | return true; |
| 631 | } |
| 632 | |
Lingfeng Yang | 0107443 | 2018-04-16 10:19:51 -0700 | [diff] [blame] | 633 | } // namespace gl |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 634 | |
| 635 | namespace gl |
| 636 | { |
| 637 | |
Lingfeng Yang | 13b708f | 2018-03-21 12:14:10 -0700 | [diff] [blame] | 638 | bool ValidateAlphaFunc(Context *context, AlphaTestFunc func, GLfloat ref) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 639 | { |
Lingfeng Yang | 13b708f | 2018-03-21 12:14:10 -0700 | [diff] [blame] | 640 | ANGLE_VALIDATE_IS_GLES1(context); |
| 641 | return ValidateAlphaFuncCommon(context, func); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 642 | } |
| 643 | |
Lingfeng Yang | 13b708f | 2018-03-21 12:14:10 -0700 | [diff] [blame] | 644 | bool ValidateAlphaFuncx(Context *context, AlphaTestFunc func, GLfixed ref) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 645 | { |
Lingfeng Yang | 13b708f | 2018-03-21 12:14:10 -0700 | [diff] [blame] | 646 | ANGLE_VALIDATE_IS_GLES1(context); |
| 647 | return ValidateAlphaFuncCommon(context, func); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 648 | } |
| 649 | |
| 650 | bool ValidateClearColorx(Context *context, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) |
| 651 | { |
| 652 | UNIMPLEMENTED(); |
| 653 | return true; |
| 654 | } |
| 655 | |
| 656 | bool ValidateClearDepthx(Context *context, GLfixed depth) |
| 657 | { |
| 658 | UNIMPLEMENTED(); |
| 659 | return true; |
| 660 | } |
| 661 | |
| 662 | bool ValidateClientActiveTexture(Context *context, GLenum texture) |
| 663 | { |
Lingfeng Yang | 96310cd | 2018-03-28 11:56:28 -0700 | [diff] [blame] | 664 | ANGLE_VALIDATE_IS_GLES1(context); |
Lingfeng Yang | 038dd53 | 2018-03-29 17:31:52 -0700 | [diff] [blame] | 665 | return ValidateMultitextureUnit(context, texture); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 666 | } |
| 667 | |
Lingfeng Yang | 060088a | 2018-05-30 20:40:57 -0700 | [diff] [blame] | 668 | bool ValidateClipPlanef(Context *context, GLenum plane, const GLfloat *eqn) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 669 | { |
Lingfeng Yang | 060088a | 2018-05-30 20:40:57 -0700 | [diff] [blame] | 670 | return ValidateClipPlaneCommon(context, plane); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 671 | } |
| 672 | |
| 673 | bool ValidateClipPlanex(Context *context, GLenum plane, const GLfixed *equation) |
| 674 | { |
Lingfeng Yang | 060088a | 2018-05-30 20:40:57 -0700 | [diff] [blame] | 675 | return ValidateClipPlaneCommon(context, plane); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 676 | } |
| 677 | |
| 678 | bool ValidateColor4f(Context *context, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) |
| 679 | { |
Lingfeng Yang | a43994c | 2018-03-29 07:21:41 -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 ValidateColor4ub(Context *context, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) |
| 685 | { |
Lingfeng Yang | a43994c | 2018-03-29 07:21:41 -0700 | [diff] [blame] | 686 | ANGLE_VALIDATE_IS_GLES1(context); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 687 | return true; |
| 688 | } |
| 689 | |
| 690 | bool ValidateColor4x(Context *context, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) |
| 691 | { |
Lingfeng Yang | a43994c | 2018-03-29 07:21:41 -0700 | [diff] [blame] | 692 | ANGLE_VALIDATE_IS_GLES1(context); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 693 | return true; |
| 694 | } |
| 695 | |
| 696 | bool ValidateColorPointer(Context *context, |
| 697 | GLint size, |
| 698 | GLenum type, |
| 699 | GLsizei stride, |
| 700 | const void *pointer) |
| 701 | { |
Lingfeng Yang | abb09f1 | 2018-04-16 10:43:53 -0700 | [diff] [blame] | 702 | return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::Color, size, type, |
| 703 | stride, pointer); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 704 | } |
| 705 | |
| 706 | bool ValidateCullFace(Context *context, GLenum mode) |
| 707 | { |
| 708 | UNIMPLEMENTED(); |
| 709 | return true; |
| 710 | } |
| 711 | |
| 712 | bool ValidateDepthRangex(Context *context, GLfixed n, GLfixed f) |
| 713 | { |
| 714 | UNIMPLEMENTED(); |
| 715 | return true; |
| 716 | } |
| 717 | |
Lingfeng Yang | 0107443 | 2018-04-16 10:19:51 -0700 | [diff] [blame] | 718 | bool ValidateDisableClientState(Context *context, ClientVertexArrayType arrayType) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 719 | { |
Lingfeng Yang | 0107443 | 2018-04-16 10:19:51 -0700 | [diff] [blame] | 720 | return ValidateClientStateCommon(context, arrayType); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 721 | } |
| 722 | |
Lingfeng Yang | 0107443 | 2018-04-16 10:19:51 -0700 | [diff] [blame] | 723 | bool ValidateEnableClientState(Context *context, ClientVertexArrayType arrayType) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 724 | { |
Lingfeng Yang | 0107443 | 2018-04-16 10:19:51 -0700 | [diff] [blame] | 725 | return ValidateClientStateCommon(context, arrayType); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 726 | } |
| 727 | |
| 728 | bool ValidateFogf(Context *context, GLenum pname, GLfloat param) |
| 729 | { |
Lingfeng Yang | 7ba3f42 | 2018-06-01 09:43:04 -0700 | [diff] [blame] | 730 | return ValidateFogCommon(context, pname, ¶m); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 731 | } |
| 732 | |
| 733 | bool ValidateFogfv(Context *context, GLenum pname, const GLfloat *params) |
| 734 | { |
Lingfeng Yang | 7ba3f42 | 2018-06-01 09:43:04 -0700 | [diff] [blame] | 735 | return ValidateFogCommon(context, pname, params); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 736 | } |
| 737 | |
| 738 | bool ValidateFogx(Context *context, GLenum pname, GLfixed param) |
| 739 | { |
Lingfeng Yang | 7ba3f42 | 2018-06-01 09:43:04 -0700 | [diff] [blame] | 740 | GLfloat asFloat = FixedToFloat(param); |
| 741 | return ValidateFogCommon(context, pname, &asFloat); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 742 | } |
| 743 | |
Lingfeng Yang | 7ba3f42 | 2018-06-01 09:43:04 -0700 | [diff] [blame] | 744 | bool ValidateFogxv(Context *context, GLenum pname, const GLfixed *params) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 745 | { |
Lingfeng Yang | 7ba3f42 | 2018-06-01 09:43:04 -0700 | [diff] [blame] | 746 | unsigned int paramCount = GetFogParameterCount(pname); |
| 747 | GLfloat paramsf[4] = {}; |
| 748 | |
| 749 | for (unsigned int i = 0; i < paramCount; i++) |
| 750 | { |
| 751 | paramsf[i] = FixedToFloat(params[i]); |
| 752 | } |
| 753 | |
| 754 | return ValidateFogCommon(context, pname, paramsf); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 755 | } |
| 756 | |
| 757 | bool ValidateFrustumf(Context *context, |
| 758 | GLfloat l, |
| 759 | GLfloat r, |
| 760 | GLfloat b, |
| 761 | GLfloat t, |
| 762 | GLfloat n, |
| 763 | GLfloat f) |
| 764 | { |
Lingfeng Yang | bb5ce5c | 2018-04-09 08:08:46 -0700 | [diff] [blame] | 765 | ANGLE_VALIDATE_IS_GLES1(context); |
| 766 | if (l == r || b == t || n == f || n <= 0.0f || f <= 0.0f) |
| 767 | { |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 768 | context->validationError(GL_INVALID_VALUE, kInvalidProjectionMatrix); |
Lingfeng Yang | bb5ce5c | 2018-04-09 08:08:46 -0700 | [diff] [blame] | 769 | } |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 770 | return true; |
| 771 | } |
| 772 | |
| 773 | bool ValidateFrustumx(Context *context, |
| 774 | GLfixed l, |
| 775 | GLfixed r, |
| 776 | GLfixed b, |
| 777 | GLfixed t, |
| 778 | GLfixed n, |
| 779 | GLfixed f) |
| 780 | { |
Lingfeng Yang | bb5ce5c | 2018-04-09 08:08:46 -0700 | [diff] [blame] | 781 | ANGLE_VALIDATE_IS_GLES1(context); |
| 782 | if (l == r || b == t || n == f || n <= 0 || f <= 0) |
| 783 | { |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 784 | context->validationError(GL_INVALID_VALUE, kInvalidProjectionMatrix); |
Lingfeng Yang | bb5ce5c | 2018-04-09 08:08:46 -0700 | [diff] [blame] | 785 | } |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 786 | return true; |
| 787 | } |
| 788 | |
| 789 | bool ValidateGetBufferParameteriv(Context *context, GLenum target, GLenum pname, GLint *params) |
| 790 | { |
| 791 | UNIMPLEMENTED(); |
| 792 | return true; |
| 793 | } |
| 794 | |
| 795 | bool ValidateGetClipPlanef(Context *context, GLenum plane, GLfloat *equation) |
| 796 | { |
Lingfeng Yang | 060088a | 2018-05-30 20:40:57 -0700 | [diff] [blame] | 797 | return ValidateClipPlaneCommon(context, plane); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 798 | } |
| 799 | |
| 800 | bool ValidateGetClipPlanex(Context *context, GLenum plane, GLfixed *equation) |
| 801 | { |
Lingfeng Yang | 060088a | 2018-05-30 20:40:57 -0700 | [diff] [blame] | 802 | return ValidateClipPlaneCommon(context, plane); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 803 | } |
| 804 | |
| 805 | bool ValidateGetFixedv(Context *context, GLenum pname, GLfixed *params) |
| 806 | { |
| 807 | UNIMPLEMENTED(); |
| 808 | return true; |
| 809 | } |
| 810 | |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 811 | bool ValidateGetLightfv(Context *context, GLenum light, LightParameter pname, GLfloat *params) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 812 | { |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 813 | GLfloat dummyParams[4] = {0.0f, 0.0f, 0.0f, 0.0f}; |
| 814 | return ValidateLightCommon(context, light, pname, dummyParams); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 815 | } |
| 816 | |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 817 | bool ValidateGetLightxv(Context *context, GLenum light, LightParameter pname, GLfixed *params) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 818 | { |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 819 | GLfloat dummyParams[4] = {0.0f, 0.0f, 0.0f, 0.0f}; |
| 820 | return ValidateLightCommon(context, light, pname, dummyParams); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 821 | } |
| 822 | |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 823 | bool ValidateGetMaterialfv(Context *context, GLenum face, MaterialParameter pname, GLfloat *params) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 824 | { |
Lingfeng Yang | 6e5bf36 | 2018-08-15 09:53:17 -0700 | [diff] [blame] | 825 | return ValidateMaterialQuery(context, face, pname); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 826 | } |
| 827 | |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 828 | bool ValidateGetMaterialxv(Context *context, GLenum face, MaterialParameter pname, GLfixed *params) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 829 | { |
Lingfeng Yang | 6e5bf36 | 2018-08-15 09:53:17 -0700 | [diff] [blame] | 830 | return ValidateMaterialQuery(context, face, pname); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 831 | } |
| 832 | |
| 833 | bool ValidateGetPointerv(Context *context, GLenum pname, void **params) |
| 834 | { |
Lingfeng Yang | abb09f1 | 2018-04-16 10:43:53 -0700 | [diff] [blame] | 835 | ANGLE_VALIDATE_IS_GLES1(context); |
| 836 | switch (pname) |
| 837 | { |
| 838 | case GL_VERTEX_ARRAY_POINTER: |
| 839 | case GL_NORMAL_ARRAY_POINTER: |
| 840 | case GL_COLOR_ARRAY_POINTER: |
| 841 | case GL_TEXTURE_COORD_ARRAY_POINTER: |
| 842 | case GL_POINT_SIZE_ARRAY_POINTER_OES: |
| 843 | return true; |
| 844 | default: |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 845 | context->validationError(GL_INVALID_ENUM, kInvalidPointerQuery); |
Lingfeng Yang | abb09f1 | 2018-04-16 10:43:53 -0700 | [diff] [blame] | 846 | return false; |
| 847 | } |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 848 | } |
| 849 | |
Lingfeng Yang | 74be296 | 2018-06-07 09:13:38 -0700 | [diff] [blame] | 850 | bool ValidateGetTexEnvfv(Context *context, |
| 851 | TextureEnvTarget target, |
| 852 | TextureEnvParameter pname, |
| 853 | GLfloat *params) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 854 | { |
Lingfeng Yang | 45b5a87 | 2018-06-07 11:33:25 -0700 | [diff] [blame] | 855 | return ValidateGetTexEnvCommon(context, target, pname); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 856 | } |
| 857 | |
Lingfeng Yang | 74be296 | 2018-06-07 09:13:38 -0700 | [diff] [blame] | 858 | bool ValidateGetTexEnviv(Context *context, |
| 859 | TextureEnvTarget target, |
| 860 | TextureEnvParameter pname, |
| 861 | GLint *params) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 862 | { |
Lingfeng Yang | 45b5a87 | 2018-06-07 11:33:25 -0700 | [diff] [blame] | 863 | return ValidateGetTexEnvCommon(context, target, pname); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 864 | } |
| 865 | |
Lingfeng Yang | 74be296 | 2018-06-07 09:13:38 -0700 | [diff] [blame] | 866 | bool ValidateGetTexEnvxv(Context *context, |
| 867 | TextureEnvTarget target, |
| 868 | TextureEnvParameter pname, |
| 869 | GLfixed *params) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 870 | { |
Lingfeng Yang | 45b5a87 | 2018-06-07 11:33:25 -0700 | [diff] [blame] | 871 | return ValidateGetTexEnvCommon(context, target, pname); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 872 | } |
| 873 | |
Corentin Wallez | f0e89be | 2017-11-08 14:00:32 -0800 | [diff] [blame] | 874 | bool ValidateGetTexParameterxv(Context *context, TextureType target, GLenum pname, GLfixed *params) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 875 | { |
Lingfeng Yang | f97641c | 2018-06-21 19:22:45 -0700 | [diff] [blame] | 876 | ANGLE_VALIDATE_IS_GLES1(context); |
| 877 | |
| 878 | if (!ValidateGetTexParameterBase(context, target, pname, nullptr)) |
| 879 | { |
| 880 | return false; |
| 881 | } |
| 882 | |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 883 | return true; |
| 884 | } |
| 885 | |
| 886 | bool ValidateLightModelf(Context *context, GLenum pname, GLfloat param) |
| 887 | { |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 888 | return ValidateLightModelSingleComponent(context, pname); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 889 | } |
| 890 | |
| 891 | bool ValidateLightModelfv(Context *context, GLenum pname, const GLfloat *params) |
| 892 | { |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 893 | return ValidateLightModelCommon(context, pname); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 894 | } |
| 895 | |
| 896 | bool ValidateLightModelx(Context *context, GLenum pname, GLfixed param) |
| 897 | { |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 898 | return ValidateLightModelSingleComponent(context, pname); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 899 | } |
| 900 | |
| 901 | bool ValidateLightModelxv(Context *context, GLenum pname, const GLfixed *param) |
| 902 | { |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 903 | return ValidateLightModelCommon(context, pname); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 904 | } |
| 905 | |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 906 | bool ValidateLightf(Context *context, GLenum light, LightParameter pname, GLfloat param) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 907 | { |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 908 | return ValidateLightSingleComponent(context, light, pname, param); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 909 | } |
| 910 | |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 911 | bool ValidateLightfv(Context *context, GLenum light, LightParameter pname, const GLfloat *params) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 912 | { |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 913 | return ValidateLightCommon(context, light, pname, params); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 914 | } |
| 915 | |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 916 | bool ValidateLightx(Context *context, GLenum light, LightParameter pname, GLfixed param) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 917 | { |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 918 | return ValidateLightSingleComponent(context, light, pname, FixedToFloat(param)); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 919 | } |
| 920 | |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 921 | bool ValidateLightxv(Context *context, GLenum light, LightParameter pname, const GLfixed *params) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 922 | { |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 923 | GLfloat paramsf[4]; |
| 924 | for (unsigned int i = 0; i < GetLightParameterCount(pname); i++) |
| 925 | { |
| 926 | paramsf[i] = FixedToFloat(params[i]); |
| 927 | } |
| 928 | |
| 929 | return ValidateLightCommon(context, light, pname, paramsf); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 930 | } |
| 931 | |
| 932 | bool ValidateLineWidthx(Context *context, GLfixed width) |
| 933 | { |
| 934 | UNIMPLEMENTED(); |
| 935 | return true; |
| 936 | } |
| 937 | |
| 938 | bool ValidateLoadIdentity(Context *context) |
| 939 | { |
Lingfeng Yang | 3a41af6 | 2018-04-09 07:28:56 -0700 | [diff] [blame] | 940 | ANGLE_VALIDATE_IS_GLES1(context); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 941 | return true; |
| 942 | } |
| 943 | |
| 944 | bool ValidateLoadMatrixf(Context *context, const GLfloat *m) |
| 945 | { |
Lingfeng Yang | 3a41af6 | 2018-04-09 07:28:56 -0700 | [diff] [blame] | 946 | ANGLE_VALIDATE_IS_GLES1(context); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 947 | return true; |
| 948 | } |
| 949 | |
| 950 | bool ValidateLoadMatrixx(Context *context, const GLfixed *m) |
| 951 | { |
Lingfeng Yang | 3a41af6 | 2018-04-09 07:28:56 -0700 | [diff] [blame] | 952 | ANGLE_VALIDATE_IS_GLES1(context); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 953 | return true; |
| 954 | } |
| 955 | |
Lingfeng Yang | 6e5bf36 | 2018-08-15 09:53:17 -0700 | [diff] [blame] | 956 | bool ValidateLogicOp(Context *context, LogicalOperation opcode) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 957 | { |
Lingfeng Yang | 6e5bf36 | 2018-08-15 09:53:17 -0700 | [diff] [blame] | 958 | ANGLE_VALIDATE_IS_GLES1(context); |
| 959 | switch (opcode) |
| 960 | { |
| 961 | case LogicalOperation::And: |
| 962 | case LogicalOperation::AndInverted: |
| 963 | case LogicalOperation::AndReverse: |
| 964 | case LogicalOperation::Clear: |
| 965 | case LogicalOperation::Copy: |
| 966 | case LogicalOperation::CopyInverted: |
| 967 | case LogicalOperation::Equiv: |
| 968 | case LogicalOperation::Invert: |
| 969 | case LogicalOperation::Nand: |
| 970 | case LogicalOperation::Noop: |
| 971 | case LogicalOperation::Nor: |
| 972 | case LogicalOperation::Or: |
| 973 | case LogicalOperation::OrInverted: |
| 974 | case LogicalOperation::OrReverse: |
| 975 | case LogicalOperation::Set: |
| 976 | case LogicalOperation::Xor: |
| 977 | return true; |
| 978 | default: |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 979 | context->validationError(GL_INVALID_ENUM, kInvalidLogicOp); |
Lingfeng Yang | 6e5bf36 | 2018-08-15 09:53:17 -0700 | [diff] [blame] | 980 | return false; |
| 981 | } |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 982 | } |
| 983 | |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 984 | bool ValidateMaterialf(Context *context, GLenum face, MaterialParameter pname, GLfloat param) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 985 | { |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 986 | return ValidateMaterialSingleComponent(context, face, pname, param); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 987 | } |
| 988 | |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 989 | bool ValidateMaterialfv(Context *context, |
| 990 | GLenum face, |
| 991 | MaterialParameter pname, |
| 992 | const GLfloat *params) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 993 | { |
Lingfeng Yang | 6e5bf36 | 2018-08-15 09:53:17 -0700 | [diff] [blame] | 994 | return ValidateMaterialSetting(context, face, pname, params); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 995 | } |
| 996 | |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 997 | bool ValidateMaterialx(Context *context, GLenum face, MaterialParameter pname, GLfixed param) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 998 | { |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 999 | return ValidateMaterialSingleComponent(context, face, pname, FixedToFloat(param)); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1000 | } |
| 1001 | |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 1002 | bool ValidateMaterialxv(Context *context, |
| 1003 | GLenum face, |
| 1004 | MaterialParameter pname, |
| 1005 | const GLfixed *params) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1006 | { |
Lingfeng Yang | d0febe7 | 2018-05-17 22:36:52 -0700 | [diff] [blame] | 1007 | GLfloat paramsf[4]; |
| 1008 | |
| 1009 | for (unsigned int i = 0; i < GetMaterialParameterCount(pname); i++) |
| 1010 | { |
| 1011 | paramsf[i] = FixedToFloat(params[i]); |
| 1012 | } |
| 1013 | |
Lingfeng Yang | 6e5bf36 | 2018-08-15 09:53:17 -0700 | [diff] [blame] | 1014 | return ValidateMaterialSetting(context, face, pname, paramsf); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1015 | } |
| 1016 | |
Lingfeng Yang | 00af463 | 2018-04-02 12:42:24 -0700 | [diff] [blame] | 1017 | bool ValidateMatrixMode(Context *context, MatrixType mode) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1018 | { |
Lingfeng Yang | d2488ab | 2018-04-04 09:25:48 -0700 | [diff] [blame] | 1019 | ANGLE_VALIDATE_IS_GLES1(context); |
| 1020 | switch (mode) |
| 1021 | { |
| 1022 | case MatrixType::Projection: |
| 1023 | case MatrixType::Modelview: |
| 1024 | case MatrixType::Texture: |
| 1025 | return true; |
| 1026 | default: |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 1027 | context->validationError(GL_INVALID_ENUM, kInvalidMatrixMode); |
Lingfeng Yang | d2488ab | 2018-04-04 09:25:48 -0700 | [diff] [blame] | 1028 | return false; |
| 1029 | } |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1030 | } |
| 1031 | |
| 1032 | bool ValidateMultMatrixf(Context *context, const GLfloat *m) |
| 1033 | { |
Lingfeng Yang | 568fc39 | 2018-04-09 07:57:23 -0700 | [diff] [blame] | 1034 | ANGLE_VALIDATE_IS_GLES1(context); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1035 | return true; |
| 1036 | } |
| 1037 | |
| 1038 | bool ValidateMultMatrixx(Context *context, const GLfixed *m) |
| 1039 | { |
Lingfeng Yang | 568fc39 | 2018-04-09 07:57:23 -0700 | [diff] [blame] | 1040 | ANGLE_VALIDATE_IS_GLES1(context); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1041 | return true; |
| 1042 | } |
| 1043 | |
| 1044 | bool ValidateMultiTexCoord4f(Context *context, |
| 1045 | GLenum target, |
| 1046 | GLfloat s, |
| 1047 | GLfloat t, |
| 1048 | GLfloat r, |
| 1049 | GLfloat q) |
| 1050 | { |
Lingfeng Yang | 038dd53 | 2018-03-29 17:31:52 -0700 | [diff] [blame] | 1051 | ANGLE_VALIDATE_IS_GLES1(context); |
| 1052 | return ValidateMultitextureUnit(context, target); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1053 | } |
| 1054 | |
| 1055 | bool ValidateMultiTexCoord4x(Context *context, |
Lingfeng Yang | 038dd53 | 2018-03-29 17:31:52 -0700 | [diff] [blame] | 1056 | GLenum target, |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1057 | GLfixed s, |
| 1058 | GLfixed t, |
| 1059 | GLfixed r, |
| 1060 | GLfixed q) |
| 1061 | { |
Lingfeng Yang | 038dd53 | 2018-03-29 17:31:52 -0700 | [diff] [blame] | 1062 | ANGLE_VALIDATE_IS_GLES1(context); |
| 1063 | return ValidateMultitextureUnit(context, target); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1064 | } |
| 1065 | |
| 1066 | bool ValidateNormal3f(Context *context, GLfloat nx, GLfloat ny, GLfloat nz) |
| 1067 | { |
Lingfeng Yang | 5a7e61b | 2018-03-29 16:50:32 -0700 | [diff] [blame] | 1068 | ANGLE_VALIDATE_IS_GLES1(context); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1069 | return true; |
| 1070 | } |
| 1071 | |
| 1072 | bool ValidateNormal3x(Context *context, GLfixed nx, GLfixed ny, GLfixed nz) |
| 1073 | { |
Lingfeng Yang | 5a7e61b | 2018-03-29 16:50:32 -0700 | [diff] [blame] | 1074 | ANGLE_VALIDATE_IS_GLES1(context); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1075 | return true; |
| 1076 | } |
| 1077 | |
| 1078 | bool ValidateNormalPointer(Context *context, GLenum type, GLsizei stride, const void *pointer) |
| 1079 | { |
Lingfeng Yang | abb09f1 | 2018-04-16 10:43:53 -0700 | [diff] [blame] | 1080 | return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::Normal, 3, type, |
| 1081 | stride, pointer); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1082 | } |
| 1083 | |
| 1084 | bool ValidateOrthof(Context *context, |
| 1085 | GLfloat l, |
| 1086 | GLfloat r, |
| 1087 | GLfloat b, |
| 1088 | GLfloat t, |
| 1089 | GLfloat n, |
| 1090 | GLfloat f) |
| 1091 | { |
Lingfeng Yang | bb5ce5c | 2018-04-09 08:08:46 -0700 | [diff] [blame] | 1092 | ANGLE_VALIDATE_IS_GLES1(context); |
| 1093 | if (l == r || b == t || n == f || n <= 0.0f || f <= 0.0f) |
| 1094 | { |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 1095 | context->validationError(GL_INVALID_VALUE, kInvalidProjectionMatrix); |
Lingfeng Yang | bb5ce5c | 2018-04-09 08:08:46 -0700 | [diff] [blame] | 1096 | } |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1097 | return true; |
| 1098 | } |
| 1099 | |
| 1100 | bool ValidateOrthox(Context *context, |
| 1101 | GLfixed l, |
| 1102 | GLfixed r, |
| 1103 | GLfixed b, |
| 1104 | GLfixed t, |
| 1105 | GLfixed n, |
| 1106 | GLfixed f) |
| 1107 | { |
Lingfeng Yang | bb5ce5c | 2018-04-09 08:08:46 -0700 | [diff] [blame] | 1108 | ANGLE_VALIDATE_IS_GLES1(context); |
| 1109 | if (l == r || b == t || n == f || n <= 0 || f <= 0) |
| 1110 | { |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 1111 | context->validationError(GL_INVALID_VALUE, kInvalidProjectionMatrix); |
Lingfeng Yang | bb5ce5c | 2018-04-09 08:08:46 -0700 | [diff] [blame] | 1112 | } |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1113 | return true; |
| 1114 | } |
| 1115 | |
Lingfeng Yang | 9c4c092 | 2018-06-13 09:29:00 -0700 | [diff] [blame] | 1116 | bool ValidatePointParameterf(Context *context, PointParameter pname, GLfloat param) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1117 | { |
Lingfeng Yang | 9c4c092 | 2018-06-13 09:29:00 -0700 | [diff] [blame] | 1118 | unsigned int paramCount = GetPointParameterCount(pname); |
| 1119 | if (paramCount != 1) |
| 1120 | { |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 1121 | context->validationError(GL_INVALID_ENUM, kInvalidPointParameter); |
Lingfeng Yang | 9c4c092 | 2018-06-13 09:29:00 -0700 | [diff] [blame] | 1122 | return false; |
| 1123 | } |
| 1124 | |
| 1125 | return ValidatePointParameterCommon(context, pname, ¶m); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1126 | } |
| 1127 | |
Lingfeng Yang | 9c4c092 | 2018-06-13 09:29:00 -0700 | [diff] [blame] | 1128 | bool ValidatePointParameterfv(Context *context, PointParameter pname, const GLfloat *params) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1129 | { |
Lingfeng Yang | 9c4c092 | 2018-06-13 09:29:00 -0700 | [diff] [blame] | 1130 | return ValidatePointParameterCommon(context, pname, params); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1131 | } |
| 1132 | |
Lingfeng Yang | 9c4c092 | 2018-06-13 09:29:00 -0700 | [diff] [blame] | 1133 | bool ValidatePointParameterx(Context *context, PointParameter pname, GLfixed param) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1134 | { |
Lingfeng Yang | 9c4c092 | 2018-06-13 09:29:00 -0700 | [diff] [blame] | 1135 | unsigned int paramCount = GetPointParameterCount(pname); |
| 1136 | if (paramCount != 1) |
| 1137 | { |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 1138 | context->validationError(GL_INVALID_ENUM, kInvalidPointParameter); |
Lingfeng Yang | 9c4c092 | 2018-06-13 09:29:00 -0700 | [diff] [blame] | 1139 | return false; |
| 1140 | } |
| 1141 | |
| 1142 | GLfloat paramf = FixedToFloat(param); |
| 1143 | return ValidatePointParameterCommon(context, pname, ¶mf); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1144 | } |
| 1145 | |
Lingfeng Yang | 9c4c092 | 2018-06-13 09:29:00 -0700 | [diff] [blame] | 1146 | bool ValidatePointParameterxv(Context *context, PointParameter pname, const GLfixed *params) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1147 | { |
Lingfeng Yang | 9c4c092 | 2018-06-13 09:29:00 -0700 | [diff] [blame] | 1148 | GLfloat paramsf[4] = {}; |
| 1149 | for (unsigned int i = 0; i < GetPointParameterCount(pname); i++) |
| 1150 | { |
| 1151 | paramsf[i] = FixedToFloat(params[i]); |
| 1152 | } |
| 1153 | return ValidatePointParameterCommon(context, pname, paramsf); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1154 | } |
| 1155 | |
| 1156 | bool ValidatePointSize(Context *context, GLfloat size) |
| 1157 | { |
Lingfeng Yang | 9c4c092 | 2018-06-13 09:29:00 -0700 | [diff] [blame] | 1158 | return ValidatePointSizeCommon(context, size); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1159 | } |
| 1160 | |
| 1161 | bool ValidatePointSizex(Context *context, GLfixed size) |
| 1162 | { |
Lingfeng Yang | 9c4c092 | 2018-06-13 09:29:00 -0700 | [diff] [blame] | 1163 | return ValidatePointSizeCommon(context, FixedToFloat(size)); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1164 | } |
| 1165 | |
| 1166 | bool ValidatePolygonOffsetx(Context *context, GLfixed factor, GLfixed units) |
| 1167 | { |
| 1168 | UNIMPLEMENTED(); |
| 1169 | return true; |
| 1170 | } |
| 1171 | |
| 1172 | bool ValidatePopMatrix(Context *context) |
| 1173 | { |
Lingfeng Yang | e547aac | 2018-04-05 09:39:20 -0700 | [diff] [blame] | 1174 | ANGLE_VALIDATE_IS_GLES1(context); |
| 1175 | const auto &stack = context->getGLState().gles1().currentMatrixStack(); |
| 1176 | if (stack.size() == 1) |
| 1177 | { |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 1178 | context->validationError(GL_STACK_UNDERFLOW, kMatrixStackUnderflow); |
Lingfeng Yang | e547aac | 2018-04-05 09:39:20 -0700 | [diff] [blame] | 1179 | return false; |
| 1180 | } |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1181 | return true; |
| 1182 | } |
| 1183 | |
| 1184 | bool ValidatePushMatrix(Context *context) |
| 1185 | { |
Lingfeng Yang | e547aac | 2018-04-05 09:39:20 -0700 | [diff] [blame] | 1186 | ANGLE_VALIDATE_IS_GLES1(context); |
| 1187 | const auto &stack = context->getGLState().gles1().currentMatrixStack(); |
| 1188 | if (stack.size() == stack.max_size()) |
| 1189 | { |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 1190 | context->validationError(GL_STACK_OVERFLOW, kMatrixStackOverflow); |
Lingfeng Yang | e547aac | 2018-04-05 09:39:20 -0700 | [diff] [blame] | 1191 | return false; |
| 1192 | } |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1193 | return true; |
| 1194 | } |
| 1195 | |
| 1196 | bool ValidateRotatef(Context *context, GLfloat angle, GLfloat x, GLfloat y, GLfloat z) |
| 1197 | { |
Lingfeng Yang | bb5ce5c | 2018-04-09 08:08:46 -0700 | [diff] [blame] | 1198 | ANGLE_VALIDATE_IS_GLES1(context); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1199 | return true; |
| 1200 | } |
| 1201 | |
| 1202 | bool ValidateRotatex(Context *context, GLfixed angle, GLfixed x, GLfixed y, GLfixed z) |
| 1203 | { |
Lingfeng Yang | bb5ce5c | 2018-04-09 08:08:46 -0700 | [diff] [blame] | 1204 | ANGLE_VALIDATE_IS_GLES1(context); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1205 | return true; |
| 1206 | } |
| 1207 | |
| 1208 | bool ValidateSampleCoveragex(Context *context, GLclampx value, GLboolean invert) |
| 1209 | { |
| 1210 | UNIMPLEMENTED(); |
| 1211 | return true; |
| 1212 | } |
| 1213 | |
| 1214 | bool ValidateScalef(Context *context, GLfloat x, GLfloat y, GLfloat z) |
| 1215 | { |
Lingfeng Yang | bb5ce5c | 2018-04-09 08:08:46 -0700 | [diff] [blame] | 1216 | ANGLE_VALIDATE_IS_GLES1(context); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1217 | return true; |
| 1218 | } |
| 1219 | |
| 1220 | bool ValidateScalex(Context *context, GLfixed x, GLfixed y, GLfixed z) |
| 1221 | { |
Lingfeng Yang | bb5ce5c | 2018-04-09 08:08:46 -0700 | [diff] [blame] | 1222 | ANGLE_VALIDATE_IS_GLES1(context); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1223 | return true; |
| 1224 | } |
| 1225 | |
Lingfeng Yang | a0cfa87 | 2018-05-30 21:12:17 -0700 | [diff] [blame] | 1226 | bool ValidateShadeModel(Context *context, ShadingModel mode) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1227 | { |
Lingfeng Yang | a0cfa87 | 2018-05-30 21:12:17 -0700 | [diff] [blame] | 1228 | ANGLE_VALIDATE_IS_GLES1(context); |
| 1229 | switch (mode) |
| 1230 | { |
| 1231 | case ShadingModel::Flat: |
| 1232 | case ShadingModel::Smooth: |
| 1233 | return true; |
| 1234 | default: |
Jamie Madill | e0472f3 | 2018-11-27 16:32:45 -0500 | [diff] [blame^] | 1235 | context->validationError(GL_INVALID_ENUM, kInvalidShadingModel); |
Lingfeng Yang | a0cfa87 | 2018-05-30 21:12:17 -0700 | [diff] [blame] | 1236 | return false; |
| 1237 | } |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1238 | } |
| 1239 | |
| 1240 | bool ValidateTexCoordPointer(Context *context, |
| 1241 | GLint size, |
| 1242 | GLenum type, |
| 1243 | GLsizei stride, |
| 1244 | const void *pointer) |
| 1245 | { |
Lingfeng Yang | abb09f1 | 2018-04-16 10:43:53 -0700 | [diff] [blame] | 1246 | return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::TextureCoord, size, |
| 1247 | type, stride, pointer); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1248 | } |
| 1249 | |
Lingfeng Yang | 74be296 | 2018-06-07 09:13:38 -0700 | [diff] [blame] | 1250 | bool ValidateTexEnvf(Context *context, |
| 1251 | TextureEnvTarget target, |
| 1252 | TextureEnvParameter pname, |
| 1253 | GLfloat param) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1254 | { |
Lingfeng Yang | 45b5a87 | 2018-06-07 11:33:25 -0700 | [diff] [blame] | 1255 | return ValidateTexEnvCommon(context, target, pname, ¶m); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1256 | } |
| 1257 | |
Lingfeng Yang | 74be296 | 2018-06-07 09:13:38 -0700 | [diff] [blame] | 1258 | bool ValidateTexEnvfv(Context *context, |
| 1259 | TextureEnvTarget target, |
| 1260 | TextureEnvParameter pname, |
| 1261 | const GLfloat *params) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1262 | { |
Lingfeng Yang | 45b5a87 | 2018-06-07 11:33:25 -0700 | [diff] [blame] | 1263 | return ValidateTexEnvCommon(context, target, pname, params); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1264 | } |
| 1265 | |
Lingfeng Yang | 74be296 | 2018-06-07 09:13:38 -0700 | [diff] [blame] | 1266 | bool ValidateTexEnvi(Context *context, |
| 1267 | TextureEnvTarget target, |
| 1268 | TextureEnvParameter pname, |
| 1269 | GLint param) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1270 | { |
Lingfeng Yang | 45b5a87 | 2018-06-07 11:33:25 -0700 | [diff] [blame] | 1271 | GLfloat paramf = static_cast<GLfloat>(param); |
| 1272 | return ValidateTexEnvCommon(context, target, pname, ¶mf); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1273 | } |
| 1274 | |
Lingfeng Yang | 74be296 | 2018-06-07 09:13:38 -0700 | [diff] [blame] | 1275 | bool ValidateTexEnviv(Context *context, |
| 1276 | TextureEnvTarget target, |
| 1277 | TextureEnvParameter pname, |
| 1278 | const GLint *params) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1279 | { |
Lingfeng Yang | 45b5a87 | 2018-06-07 11:33:25 -0700 | [diff] [blame] | 1280 | GLfloat paramsf[4]; |
| 1281 | for (unsigned int i = 0; i < GetTextureEnvParameterCount(pname); i++) |
| 1282 | { |
| 1283 | paramsf[i] = static_cast<GLfloat>(params[i]); |
| 1284 | } |
| 1285 | return ValidateTexEnvCommon(context, target, pname, paramsf); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1286 | } |
| 1287 | |
Lingfeng Yang | 74be296 | 2018-06-07 09:13:38 -0700 | [diff] [blame] | 1288 | bool ValidateTexEnvx(Context *context, |
| 1289 | TextureEnvTarget target, |
| 1290 | TextureEnvParameter pname, |
| 1291 | GLfixed param) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1292 | { |
Lingfeng Yang | 45b5a87 | 2018-06-07 11:33:25 -0700 | [diff] [blame] | 1293 | GLfloat paramf = static_cast<GLfloat>(param); |
| 1294 | return ValidateTexEnvCommon(context, target, pname, ¶mf); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1295 | } |
| 1296 | |
Lingfeng Yang | 74be296 | 2018-06-07 09:13:38 -0700 | [diff] [blame] | 1297 | bool ValidateTexEnvxv(Context *context, |
| 1298 | TextureEnvTarget target, |
| 1299 | TextureEnvParameter pname, |
| 1300 | const GLfixed *params) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1301 | { |
Lingfeng Yang | 45b5a87 | 2018-06-07 11:33:25 -0700 | [diff] [blame] | 1302 | GLfloat paramsf[4]; |
| 1303 | for (unsigned int i = 0; i < GetTextureEnvParameterCount(pname); i++) |
| 1304 | { |
| 1305 | paramsf[i] = static_cast<GLfloat>(params[i]); |
| 1306 | } |
| 1307 | return ValidateTexEnvCommon(context, target, pname, paramsf); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1308 | } |
| 1309 | |
Corentin Wallez | f0e89be | 2017-11-08 14:00:32 -0800 | [diff] [blame] | 1310 | bool ValidateTexParameterx(Context *context, TextureType target, GLenum pname, GLfixed param) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1311 | { |
Lingfeng Yang | f97641c | 2018-06-21 19:22:45 -0700 | [diff] [blame] | 1312 | ANGLE_VALIDATE_IS_GLES1(context); |
| 1313 | GLfloat paramf = FixedToFloat(param); |
Till Rathmann | b854363 | 2018-10-02 19:46:14 +0200 | [diff] [blame] | 1314 | return ValidateTexParameterBase(context, target, pname, -1, false, ¶mf); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1315 | } |
| 1316 | |
Corentin Wallez | f0e89be | 2017-11-08 14:00:32 -0800 | [diff] [blame] | 1317 | bool ValidateTexParameterxv(Context *context, |
| 1318 | TextureType target, |
| 1319 | GLenum pname, |
| 1320 | const GLfixed *params) |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1321 | { |
Lingfeng Yang | f97641c | 2018-06-21 19:22:45 -0700 | [diff] [blame] | 1322 | ANGLE_VALIDATE_IS_GLES1(context); |
| 1323 | GLfloat paramsf[4] = {}; |
| 1324 | for (unsigned int i = 0; i < GetTexParameterCount(pname); i++) |
| 1325 | { |
| 1326 | paramsf[i] = FixedToFloat(params[i]); |
| 1327 | } |
Till Rathmann | b854363 | 2018-10-02 19:46:14 +0200 | [diff] [blame] | 1328 | return ValidateTexParameterBase(context, target, pname, -1, true, paramsf); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1329 | } |
| 1330 | |
| 1331 | bool ValidateTranslatef(Context *context, GLfloat x, GLfloat y, GLfloat z) |
| 1332 | { |
Lingfeng Yang | bb5ce5c | 2018-04-09 08:08:46 -0700 | [diff] [blame] | 1333 | ANGLE_VALIDATE_IS_GLES1(context); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1334 | return true; |
| 1335 | } |
| 1336 | |
| 1337 | bool ValidateTranslatex(Context *context, GLfixed x, GLfixed y, GLfixed z) |
| 1338 | { |
Lingfeng Yang | bb5ce5c | 2018-04-09 08:08:46 -0700 | [diff] [blame] | 1339 | ANGLE_VALIDATE_IS_GLES1(context); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1340 | return true; |
| 1341 | } |
| 1342 | |
| 1343 | bool ValidateVertexPointer(Context *context, |
| 1344 | GLint size, |
| 1345 | GLenum type, |
| 1346 | GLsizei stride, |
| 1347 | const void *pointer) |
| 1348 | { |
Lingfeng Yang | abb09f1 | 2018-04-16 10:43:53 -0700 | [diff] [blame] | 1349 | return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::Vertex, size, type, |
| 1350 | stride, pointer); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1351 | } |
| 1352 | |
| 1353 | bool ValidateDrawTexfOES(Context *context, |
| 1354 | GLfloat x, |
| 1355 | GLfloat y, |
| 1356 | GLfloat z, |
| 1357 | GLfloat width, |
| 1358 | GLfloat height) |
| 1359 | { |
Lingfeng Yang | 0df813c | 2018-07-12 12:52:06 -0700 | [diff] [blame] | 1360 | return ValidateDrawTexCommon(context, width, height); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1361 | } |
| 1362 | |
| 1363 | bool ValidateDrawTexfvOES(Context *context, const GLfloat *coords) |
| 1364 | { |
Lingfeng Yang | 0df813c | 2018-07-12 12:52:06 -0700 | [diff] [blame] | 1365 | return ValidateDrawTexCommon(context, coords[3], coords[4]); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1366 | } |
| 1367 | |
| 1368 | bool ValidateDrawTexiOES(Context *context, GLint x, GLint y, GLint z, GLint width, GLint height) |
| 1369 | { |
Lingfeng Yang | 0df813c | 2018-07-12 12:52:06 -0700 | [diff] [blame] | 1370 | return ValidateDrawTexCommon(context, static_cast<GLfloat>(width), |
| 1371 | static_cast<GLfloat>(height)); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1372 | } |
| 1373 | |
| 1374 | bool ValidateDrawTexivOES(Context *context, const GLint *coords) |
| 1375 | { |
Lingfeng Yang | 0df813c | 2018-07-12 12:52:06 -0700 | [diff] [blame] | 1376 | return ValidateDrawTexCommon(context, static_cast<GLfloat>(coords[3]), |
| 1377 | static_cast<GLfloat>(coords[4])); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1378 | } |
| 1379 | |
| 1380 | bool ValidateDrawTexsOES(Context *context, |
| 1381 | GLshort x, |
| 1382 | GLshort y, |
| 1383 | GLshort z, |
| 1384 | GLshort width, |
| 1385 | GLshort height) |
| 1386 | { |
Lingfeng Yang | 0df813c | 2018-07-12 12:52:06 -0700 | [diff] [blame] | 1387 | return ValidateDrawTexCommon(context, static_cast<GLfloat>(width), |
| 1388 | static_cast<GLfloat>(height)); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1389 | } |
| 1390 | |
| 1391 | bool ValidateDrawTexsvOES(Context *context, const GLshort *coords) |
| 1392 | { |
Lingfeng Yang | 0df813c | 2018-07-12 12:52:06 -0700 | [diff] [blame] | 1393 | return ValidateDrawTexCommon(context, static_cast<GLfloat>(coords[3]), |
| 1394 | static_cast<GLfloat>(coords[4])); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1395 | } |
| 1396 | |
| 1397 | bool ValidateDrawTexxOES(Context *context, |
| 1398 | GLfixed x, |
| 1399 | GLfixed y, |
| 1400 | GLfixed z, |
| 1401 | GLfixed width, |
| 1402 | GLfixed height) |
| 1403 | { |
Lingfeng Yang | 0df813c | 2018-07-12 12:52:06 -0700 | [diff] [blame] | 1404 | return ValidateDrawTexCommon(context, FixedToFloat(width), FixedToFloat(height)); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1405 | } |
| 1406 | |
| 1407 | bool ValidateDrawTexxvOES(Context *context, const GLfixed *coords) |
| 1408 | { |
Lingfeng Yang | 0df813c | 2018-07-12 12:52:06 -0700 | [diff] [blame] | 1409 | return ValidateDrawTexCommon(context, FixedToFloat(coords[3]), FixedToFloat(coords[4])); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1410 | } |
| 1411 | |
| 1412 | bool ValidateCurrentPaletteMatrixOES(Context *context, GLuint matrixpaletteindex) |
| 1413 | { |
| 1414 | UNIMPLEMENTED(); |
| 1415 | return true; |
| 1416 | } |
| 1417 | |
| 1418 | bool ValidateLoadPaletteFromModelViewMatrixOES(Context *context) |
| 1419 | { |
| 1420 | UNIMPLEMENTED(); |
| 1421 | return true; |
| 1422 | } |
| 1423 | |
| 1424 | bool ValidateMatrixIndexPointerOES(Context *context, |
| 1425 | GLint size, |
| 1426 | GLenum type, |
| 1427 | GLsizei stride, |
| 1428 | const void *pointer) |
| 1429 | { |
| 1430 | UNIMPLEMENTED(); |
| 1431 | return true; |
| 1432 | } |
| 1433 | |
| 1434 | bool ValidateWeightPointerOES(Context *context, |
| 1435 | GLint size, |
| 1436 | GLenum type, |
| 1437 | GLsizei stride, |
| 1438 | const void *pointer) |
| 1439 | { |
| 1440 | UNIMPLEMENTED(); |
| 1441 | return true; |
| 1442 | } |
| 1443 | |
| 1444 | bool ValidatePointSizePointerOES(Context *context, GLenum type, GLsizei stride, const void *pointer) |
| 1445 | { |
Lingfeng Yang | abb09f1 | 2018-04-16 10:43:53 -0700 | [diff] [blame] | 1446 | return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::PointSize, 1, type, |
| 1447 | stride, pointer); |
Geoff Lang | 2aaa7b4 | 2018-01-12 17:17:27 -0500 | [diff] [blame] | 1448 | } |
| 1449 | |
| 1450 | bool ValidateQueryMatrixxOES(Context *context, GLfixed *mantissa, GLint *exponent) |
| 1451 | { |
| 1452 | UNIMPLEMENTED(); |
| 1453 | return true; |
| 1454 | } |
Lingfeng Yang | a064878 | 2018-03-12 14:45:25 -0700 | [diff] [blame] | 1455 | |
| 1456 | bool ValidateGenFramebuffersOES(Context *context, GLsizei n, GLuint *framebuffers) |
| 1457 | { |
| 1458 | UNIMPLEMENTED(); |
| 1459 | return true; |
| 1460 | } |
| 1461 | |
| 1462 | bool ValidateDeleteFramebuffersOES(Context *context, GLsizei n, const GLuint *framebuffers) |
| 1463 | { |
| 1464 | UNIMPLEMENTED(); |
| 1465 | return true; |
| 1466 | } |
| 1467 | |
| 1468 | bool ValidateGenRenderbuffersOES(Context *context, GLsizei n, GLuint *renderbuffers) |
| 1469 | { |
| 1470 | UNIMPLEMENTED(); |
| 1471 | return true; |
| 1472 | } |
| 1473 | |
| 1474 | bool ValidateDeleteRenderbuffersOES(Context *context, GLsizei n, const GLuint *renderbuffers) |
| 1475 | { |
| 1476 | UNIMPLEMENTED(); |
| 1477 | return true; |
| 1478 | } |
| 1479 | |
| 1480 | bool ValidateBindFramebufferOES(Context *context, GLenum target, GLuint framebuffer) |
| 1481 | { |
| 1482 | UNIMPLEMENTED(); |
| 1483 | return true; |
| 1484 | } |
| 1485 | |
| 1486 | bool ValidateBindRenderbufferOES(Context *context, GLenum target, GLuint renderbuffer) |
| 1487 | { |
| 1488 | UNIMPLEMENTED(); |
| 1489 | return true; |
| 1490 | } |
| 1491 | |
| 1492 | bool ValidateCheckFramebufferStatusOES(Context *context, GLenum target) |
| 1493 | { |
| 1494 | UNIMPLEMENTED(); |
| 1495 | return true; |
| 1496 | } |
| 1497 | |
| 1498 | bool ValidateFramebufferRenderbufferOES(Context *context, |
| 1499 | GLenum target, |
| 1500 | GLenum attachment, |
| 1501 | GLenum rbtarget, |
| 1502 | GLuint renderbuffer) |
| 1503 | { |
| 1504 | UNIMPLEMENTED(); |
| 1505 | return true; |
| 1506 | } |
| 1507 | |
| 1508 | bool ValidateFramebufferTexture2DOES(Context *context, |
| 1509 | GLenum target, |
| 1510 | GLenum attachment, |
| 1511 | TextureTarget textarget, |
| 1512 | GLuint texture, |
| 1513 | GLint level) |
| 1514 | { |
| 1515 | UNIMPLEMENTED(); |
| 1516 | return true; |
| 1517 | } |
| 1518 | |
| 1519 | bool ValidateGenerateMipmapOES(Context *context, TextureType target) |
| 1520 | { |
| 1521 | UNIMPLEMENTED(); |
| 1522 | return true; |
| 1523 | } |
| 1524 | |
| 1525 | bool ValidateGetFramebufferAttachmentParameterivOES(Context *context, |
| 1526 | GLenum target, |
| 1527 | GLenum attachment, |
| 1528 | GLenum pname, |
| 1529 | GLint *params) |
| 1530 | { |
| 1531 | UNIMPLEMENTED(); |
| 1532 | return true; |
| 1533 | } |
| 1534 | |
| 1535 | bool ValidateGetRenderbufferParameterivOES(Context *context, |
| 1536 | GLenum target, |
| 1537 | GLenum pname, |
| 1538 | GLint *params) |
| 1539 | { |
| 1540 | UNIMPLEMENTED(); |
| 1541 | return true; |
| 1542 | } |
| 1543 | |
| 1544 | bool ValidateIsFramebufferOES(Context *context, GLuint framebuffer) |
| 1545 | { |
| 1546 | UNIMPLEMENTED(); |
| 1547 | return true; |
| 1548 | } |
| 1549 | |
| 1550 | bool ValidateIsRenderbufferOES(Context *context, GLuint renderbuffer) |
| 1551 | { |
| 1552 | UNIMPLEMENTED(); |
| 1553 | return true; |
| 1554 | } |
| 1555 | |
| 1556 | bool ValidateRenderbufferStorageOES(Context *context, |
| 1557 | GLenum target, |
Jamie Madill | 778bf09 | 2018-11-14 09:54:36 -0500 | [diff] [blame] | 1558 | GLenum internalformat, |
Lingfeng Yang | a064878 | 2018-03-12 14:45:25 -0700 | [diff] [blame] | 1559 | GLsizei width, |
| 1560 | GLsizei height) |
| 1561 | { |
| 1562 | UNIMPLEMENTED(); |
| 1563 | return true; |
| 1564 | } |
| 1565 | |
| 1566 | // GL_OES_texture_cube_map |
| 1567 | |
| 1568 | bool ValidateGetTexGenfvOES(Context *context, GLenum coord, GLenum pname, GLfloat *params) |
| 1569 | { |
| 1570 | UNIMPLEMENTED(); |
| 1571 | return true; |
| 1572 | } |
| 1573 | |
| 1574 | bool ValidateGetTexGenivOES(Context *context, GLenum coord, GLenum pname, int *params) |
| 1575 | { |
| 1576 | UNIMPLEMENTED(); |
| 1577 | return true; |
| 1578 | } |
| 1579 | |
| 1580 | bool ValidateGetTexGenxvOES(Context *context, GLenum coord, GLenum pname, GLfixed *params) |
| 1581 | { |
| 1582 | UNIMPLEMENTED(); |
| 1583 | return true; |
| 1584 | } |
| 1585 | |
| 1586 | bool ValidateTexGenfvOES(Context *context, GLenum coord, GLenum pname, const GLfloat *params) |
| 1587 | { |
| 1588 | UNIMPLEMENTED(); |
| 1589 | return true; |
| 1590 | } |
| 1591 | |
| 1592 | bool ValidateTexGenivOES(Context *context, GLenum coord, GLenum pname, const GLint *param) |
| 1593 | { |
| 1594 | UNIMPLEMENTED(); |
| 1595 | return true; |
| 1596 | } |
| 1597 | |
| 1598 | bool ValidateTexGenxvOES(Context *context, GLenum coord, GLenum pname, const GLint *param) |
| 1599 | { |
| 1600 | UNIMPLEMENTED(); |
| 1601 | return true; |
| 1602 | } |
| 1603 | |
| 1604 | bool ValidateTexGenfOES(Context *context, GLenum coord, GLenum pname, GLfloat param) |
| 1605 | { |
| 1606 | UNIMPLEMENTED(); |
| 1607 | return true; |
| 1608 | } |
| 1609 | |
| 1610 | bool ValidateTexGeniOES(Context *context, GLenum coord, GLenum pname, GLint param) |
| 1611 | { |
| 1612 | UNIMPLEMENTED(); |
| 1613 | return true; |
| 1614 | } |
| 1615 | |
| 1616 | bool ValidateTexGenxOES(Context *context, GLenum coord, GLenum pname, GLfixed param) |
| 1617 | { |
| 1618 | UNIMPLEMENTED(); |
| 1619 | return true; |
| 1620 | } |
Lingfeng Yang | 0107443 | 2018-04-16 10:19:51 -0700 | [diff] [blame] | 1621 | |
| 1622 | } // namespace gl |