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