Martin Radev | 66fb820 | 2016-07-28 11:45:20 +0300 | [diff] [blame] | 1 | // |
| 2 | // Copyright (c) 2016 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 | // validationES31.cpp: Validation functions for OpenGL ES 3.1 entry point parameters |
| 8 | |
Martin Radev | 66fb820 | 2016-07-28 11:45:20 +0300 | [diff] [blame] | 9 | #include "libANGLE/validationES31.h" |
| 10 | |
| 11 | #include "libANGLE/Context.h" |
Brandon Jones | afa7515 | 2017-07-21 13:11:29 -0700 | [diff] [blame] | 12 | #include "libANGLE/ErrorStrings.h" |
JiangYizhou | f7bbc8a | 2016-11-16 09:57:22 +0800 | [diff] [blame] | 13 | #include "libANGLE/Framebuffer.h" |
Jamie Madill | 231c7f5 | 2017-04-26 13:45:37 -0400 | [diff] [blame] | 14 | #include "libANGLE/VertexArray.h" |
Geoff Lang | 2e43dbb | 2016-10-14 12:27:35 -0400 | [diff] [blame] | 15 | #include "libANGLE/validationES.h" |
Yunchao He | a336b90 | 2017-08-02 16:05:21 +0800 | [diff] [blame] | 16 | #include "libANGLE/validationES2.h" |
Geoff Lang | 2e43dbb | 2016-10-14 12:27:35 -0400 | [diff] [blame] | 17 | #include "libANGLE/validationES3.h" |
Martin Radev | 66fb820 | 2016-07-28 11:45:20 +0300 | [diff] [blame] | 18 | |
He Yunchao | 11b038b | 2016-11-22 21:24:04 +0800 | [diff] [blame] | 19 | #include "common/utilities.h" |
| 20 | |
Martin Radev | 66fb820 | 2016-07-28 11:45:20 +0300 | [diff] [blame] | 21 | using namespace angle; |
| 22 | |
| 23 | namespace gl |
| 24 | { |
| 25 | |
jchen10 | 15015f7 | 2017-03-16 13:54:21 +0800 | [diff] [blame] | 26 | namespace |
| 27 | { |
| 28 | |
| 29 | bool ValidateNamedProgramInterface(GLenum programInterface) |
| 30 | { |
| 31 | switch (programInterface) |
| 32 | { |
| 33 | case GL_UNIFORM: |
| 34 | case GL_UNIFORM_BLOCK: |
| 35 | case GL_PROGRAM_INPUT: |
| 36 | case GL_PROGRAM_OUTPUT: |
| 37 | case GL_TRANSFORM_FEEDBACK_VARYING: |
| 38 | case GL_BUFFER_VARIABLE: |
| 39 | case GL_SHADER_STORAGE_BLOCK: |
| 40 | return true; |
| 41 | default: |
| 42 | return false; |
| 43 | } |
| 44 | } |
| 45 | |
jchen10 | 191381f | 2017-04-11 13:59:04 +0800 | [diff] [blame] | 46 | bool ValidateLocationProgramInterface(GLenum programInterface) |
| 47 | { |
| 48 | switch (programInterface) |
| 49 | { |
| 50 | case GL_UNIFORM: |
| 51 | case GL_PROGRAM_INPUT: |
| 52 | case GL_PROGRAM_OUTPUT: |
| 53 | return true; |
| 54 | default: |
| 55 | return false; |
| 56 | } |
| 57 | } |
| 58 | |
jchen10 | 880683b | 2017-04-12 16:21:55 +0800 | [diff] [blame] | 59 | bool ValidateProgramInterface(GLenum programInterface) |
| 60 | { |
| 61 | return (programInterface == GL_ATOMIC_COUNTER_BUFFER || |
| 62 | ValidateNamedProgramInterface(programInterface)); |
| 63 | } |
| 64 | |
| 65 | bool ValidateProgramResourceProperty(GLenum prop) |
| 66 | { |
| 67 | switch (prop) |
| 68 | { |
| 69 | case GL_ACTIVE_VARIABLES: |
| 70 | case GL_BUFFER_BINDING: |
| 71 | case GL_NUM_ACTIVE_VARIABLES: |
| 72 | |
| 73 | case GL_ARRAY_SIZE: |
| 74 | |
| 75 | case GL_ARRAY_STRIDE: |
| 76 | case GL_BLOCK_INDEX: |
| 77 | case GL_IS_ROW_MAJOR: |
| 78 | case GL_MATRIX_STRIDE: |
| 79 | |
| 80 | case GL_ATOMIC_COUNTER_BUFFER_INDEX: |
| 81 | |
| 82 | case GL_BUFFER_DATA_SIZE: |
| 83 | |
| 84 | case GL_LOCATION: |
| 85 | |
| 86 | case GL_NAME_LENGTH: |
| 87 | |
| 88 | case GL_OFFSET: |
| 89 | |
| 90 | case GL_REFERENCED_BY_VERTEX_SHADER: |
| 91 | case GL_REFERENCED_BY_FRAGMENT_SHADER: |
| 92 | case GL_REFERENCED_BY_COMPUTE_SHADER: |
| 93 | |
| 94 | case GL_TOP_LEVEL_ARRAY_SIZE: |
| 95 | case GL_TOP_LEVEL_ARRAY_STRIDE: |
| 96 | |
| 97 | case GL_TYPE: |
| 98 | return true; |
| 99 | |
| 100 | default: |
| 101 | return false; |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | // GLES 3.10 spec: Page 82 -- Table 7.2 |
| 106 | bool ValidateProgramResourcePropertyByInterface(GLenum prop, GLenum programInterface) |
| 107 | { |
| 108 | switch (prop) |
| 109 | { |
| 110 | case GL_ACTIVE_VARIABLES: |
| 111 | case GL_BUFFER_BINDING: |
| 112 | case GL_NUM_ACTIVE_VARIABLES: |
| 113 | { |
| 114 | switch (programInterface) |
| 115 | { |
| 116 | case GL_ATOMIC_COUNTER_BUFFER: |
| 117 | case GL_SHADER_STORAGE_BLOCK: |
| 118 | case GL_UNIFORM_BLOCK: |
| 119 | return true; |
| 120 | default: |
| 121 | return false; |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | case GL_ARRAY_SIZE: |
| 126 | { |
| 127 | switch (programInterface) |
| 128 | { |
| 129 | case GL_BUFFER_VARIABLE: |
| 130 | case GL_PROGRAM_INPUT: |
| 131 | case GL_PROGRAM_OUTPUT: |
| 132 | case GL_TRANSFORM_FEEDBACK_VARYING: |
| 133 | case GL_UNIFORM: |
| 134 | return true; |
| 135 | default: |
| 136 | return false; |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | case GL_ARRAY_STRIDE: |
| 141 | case GL_BLOCK_INDEX: |
| 142 | case GL_IS_ROW_MAJOR: |
| 143 | case GL_MATRIX_STRIDE: |
| 144 | { |
| 145 | switch (programInterface) |
| 146 | { |
| 147 | case GL_BUFFER_VARIABLE: |
| 148 | case GL_UNIFORM: |
| 149 | return true; |
| 150 | default: |
| 151 | return false; |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | case GL_ATOMIC_COUNTER_BUFFER_INDEX: |
| 156 | { |
| 157 | if (programInterface == GL_UNIFORM) |
| 158 | { |
| 159 | return true; |
| 160 | } |
| 161 | return false; |
| 162 | } |
| 163 | |
| 164 | case GL_BUFFER_DATA_SIZE: |
| 165 | { |
| 166 | switch (programInterface) |
| 167 | { |
| 168 | case GL_ATOMIC_COUNTER_BUFFER: |
| 169 | case GL_SHADER_STORAGE_BLOCK: |
| 170 | case GL_UNIFORM_BLOCK: |
| 171 | return true; |
| 172 | default: |
| 173 | return false; |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | case GL_LOCATION: |
| 178 | { |
| 179 | return ValidateLocationProgramInterface(programInterface); |
| 180 | } |
| 181 | |
| 182 | case GL_NAME_LENGTH: |
| 183 | { |
| 184 | return ValidateNamedProgramInterface(programInterface); |
| 185 | } |
| 186 | |
| 187 | case GL_OFFSET: |
| 188 | { |
| 189 | switch (programInterface) |
| 190 | { |
| 191 | case GL_BUFFER_VARIABLE: |
| 192 | case GL_UNIFORM: |
| 193 | return true; |
| 194 | default: |
| 195 | return false; |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | case GL_REFERENCED_BY_VERTEX_SHADER: |
| 200 | case GL_REFERENCED_BY_FRAGMENT_SHADER: |
| 201 | case GL_REFERENCED_BY_COMPUTE_SHADER: |
| 202 | { |
| 203 | switch (programInterface) |
| 204 | { |
| 205 | case GL_ATOMIC_COUNTER_BUFFER: |
| 206 | case GL_BUFFER_VARIABLE: |
| 207 | case GL_PROGRAM_INPUT: |
| 208 | case GL_PROGRAM_OUTPUT: |
| 209 | case GL_SHADER_STORAGE_BLOCK: |
| 210 | case GL_UNIFORM: |
| 211 | case GL_UNIFORM_BLOCK: |
| 212 | return true; |
| 213 | default: |
| 214 | return false; |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | case GL_TOP_LEVEL_ARRAY_SIZE: |
| 219 | case GL_TOP_LEVEL_ARRAY_STRIDE: |
| 220 | { |
| 221 | if (programInterface == GL_BUFFER_VARIABLE) |
| 222 | { |
| 223 | return true; |
| 224 | } |
| 225 | return false; |
| 226 | } |
| 227 | |
| 228 | case GL_TYPE: |
| 229 | { |
| 230 | switch (programInterface) |
| 231 | { |
| 232 | case GL_BUFFER_VARIABLE: |
| 233 | case GL_PROGRAM_INPUT: |
| 234 | case GL_PROGRAM_OUTPUT: |
| 235 | case GL_TRANSFORM_FEEDBACK_VARYING: |
| 236 | case GL_UNIFORM: |
| 237 | return true; |
| 238 | default: |
| 239 | return false; |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | default: |
| 244 | return false; |
| 245 | } |
| 246 | } |
| 247 | |
jchen10 | fd7c3b5 | 2017-03-21 15:36:03 +0800 | [diff] [blame] | 248 | bool ValidateProgramResourceIndex(const Program *programObject, |
| 249 | GLenum programInterface, |
| 250 | GLuint index) |
| 251 | { |
| 252 | switch (programInterface) |
| 253 | { |
| 254 | case GL_PROGRAM_INPUT: |
| 255 | return (index < static_cast<GLuint>(programObject->getActiveAttributeCount())); |
| 256 | |
| 257 | case GL_PROGRAM_OUTPUT: |
| 258 | return (index < static_cast<GLuint>(programObject->getOutputResourceCount())); |
| 259 | |
jchen10 | fd7c3b5 | 2017-03-21 15:36:03 +0800 | [diff] [blame] | 260 | case GL_UNIFORM: |
jchen10 | baf5d94 | 2017-08-28 20:45:48 +0800 | [diff] [blame] | 261 | return (index < static_cast<GLuint>(programObject->getActiveUniformCount())); |
| 262 | |
| 263 | // TODO(jie.a.chen@intel.com): more interfaces. |
jchen10 | fd7c3b5 | 2017-03-21 15:36:03 +0800 | [diff] [blame] | 264 | case GL_UNIFORM_BLOCK: |
| 265 | case GL_TRANSFORM_FEEDBACK_VARYING: |
| 266 | case GL_BUFFER_VARIABLE: |
| 267 | case GL_SHADER_STORAGE_BLOCK: |
jchen10 | 880683b | 2017-04-12 16:21:55 +0800 | [diff] [blame] | 268 | case GL_ATOMIC_COUNTER_BUFFER: |
jchen10 | fd7c3b5 | 2017-03-21 15:36:03 +0800 | [diff] [blame] | 269 | UNIMPLEMENTED(); |
| 270 | return false; |
| 271 | |
| 272 | default: |
| 273 | UNREACHABLE(); |
| 274 | return false; |
| 275 | } |
| 276 | } |
| 277 | |
jchen10 | 15015f7 | 2017-03-16 13:54:21 +0800 | [diff] [blame] | 278 | } // anonymous namespace |
| 279 | |
Martin Radev | 66fb820 | 2016-07-28 11:45:20 +0300 | [diff] [blame] | 280 | bool ValidateGetBooleani_v(Context *context, GLenum target, GLuint index, GLboolean *data) |
| 281 | { |
Geoff Lang | eb66a6e | 2016-10-31 13:06:12 -0400 | [diff] [blame] | 282 | if (context->getClientVersion() < ES_3_1) |
Martin Radev | 66fb820 | 2016-07-28 11:45:20 +0300 | [diff] [blame] | 283 | { |
Brandon Jones | afa7515 | 2017-07-21 13:11:29 -0700 | [diff] [blame] | 284 | ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); |
Martin Radev | 66fb820 | 2016-07-28 11:45:20 +0300 | [diff] [blame] | 285 | return false; |
| 286 | } |
| 287 | |
Geoff Lang | 2e43dbb | 2016-10-14 12:27:35 -0400 | [diff] [blame] | 288 | if (!ValidateIndexedStateQuery(context, target, index, nullptr)) |
| 289 | { |
| 290 | return false; |
| 291 | } |
| 292 | |
| 293 | return true; |
| 294 | } |
| 295 | |
| 296 | bool ValidateGetBooleani_vRobustANGLE(Context *context, |
| 297 | GLenum target, |
| 298 | GLuint index, |
| 299 | GLsizei bufSize, |
| 300 | GLsizei *length, |
| 301 | GLboolean *data) |
| 302 | { |
Geoff Lang | eb66a6e | 2016-10-31 13:06:12 -0400 | [diff] [blame] | 303 | if (context->getClientVersion() < ES_3_1) |
Geoff Lang | 2e43dbb | 2016-10-14 12:27:35 -0400 | [diff] [blame] | 304 | { |
Brandon Jones | afa7515 | 2017-07-21 13:11:29 -0700 | [diff] [blame] | 305 | ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); |
Geoff Lang | 2e43dbb | 2016-10-14 12:27:35 -0400 | [diff] [blame] | 306 | return false; |
| 307 | } |
| 308 | |
| 309 | if (!ValidateRobustEntryPoint(context, bufSize)) |
| 310 | { |
| 311 | return false; |
| 312 | } |
| 313 | |
| 314 | if (!ValidateIndexedStateQuery(context, target, index, length)) |
| 315 | { |
| 316 | return false; |
| 317 | } |
| 318 | |
| 319 | if (!ValidateRobustBufferSize(context, bufSize, *length)) |
Martin Radev | 66fb820 | 2016-07-28 11:45:20 +0300 | [diff] [blame] | 320 | { |
| 321 | return false; |
| 322 | } |
| 323 | |
| 324 | return true; |
| 325 | } |
| 326 | |
Jamie Madill | 876429b | 2017-04-20 15:46:24 -0400 | [diff] [blame] | 327 | bool ValidateDrawIndirectBase(Context *context, GLenum mode, const void *indirect) |
Jiajia Qin | d967122 | 2016-11-29 16:30:31 +0800 | [diff] [blame] | 328 | { |
| 329 | if (context->getClientVersion() < ES_3_1) |
| 330 | { |
Brandon Jones | afa7515 | 2017-07-21 13:11:29 -0700 | [diff] [blame] | 331 | ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); |
Jiajia Qin | d967122 | 2016-11-29 16:30:31 +0800 | [diff] [blame] | 332 | return false; |
| 333 | } |
| 334 | |
| 335 | // Here the third parameter 1 is only to pass the count validation. |
| 336 | if (!ValidateDrawBase(context, mode, 1)) |
| 337 | { |
| 338 | return false; |
| 339 | } |
| 340 | |
| 341 | const State &state = context->getGLState(); |
| 342 | |
| 343 | // An INVALID_OPERATION error is generated if zero is bound to VERTEX_ARRAY_BINDING, |
| 344 | // DRAW_INDIRECT_BUFFER or to any enabled vertex array. |
| 345 | if (!state.getVertexArrayId()) |
| 346 | { |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 347 | context->handleError(InvalidOperation() << "zero is bound to VERTEX_ARRAY_BINDING"); |
Jiajia Qin | d967122 | 2016-11-29 16:30:31 +0800 | [diff] [blame] | 348 | return false; |
| 349 | } |
| 350 | |
| 351 | gl::Buffer *drawIndirectBuffer = state.getDrawIndirectBuffer(); |
| 352 | if (!drawIndirectBuffer) |
| 353 | { |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 354 | context->handleError(InvalidOperation() << "zero is bound to DRAW_INDIRECT_BUFFER"); |
Jiajia Qin | d967122 | 2016-11-29 16:30:31 +0800 | [diff] [blame] | 355 | return false; |
| 356 | } |
| 357 | |
| 358 | // An INVALID_VALUE error is generated if indirect is not a multiple of the size, in basic |
| 359 | // machine units, of uint. |
| 360 | GLint64 offset = reinterpret_cast<GLint64>(indirect); |
| 361 | if ((static_cast<GLuint>(offset) % sizeof(GLuint)) != 0) |
| 362 | { |
| 363 | context->handleError( |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 364 | InvalidValue() |
| 365 | << "indirect is not a multiple of the size, in basic machine units, of uint"); |
Jiajia Qin | d967122 | 2016-11-29 16:30:31 +0800 | [diff] [blame] | 366 | return false; |
| 367 | } |
| 368 | |
Martin Radev | 14a26ae | 2017-07-24 15:56:29 +0300 | [diff] [blame] | 369 | // ANGLE_multiview spec, revision 1: |
| 370 | // An INVALID_OPERATION is generated by DrawArraysIndirect and DrawElementsIndirect if the |
| 371 | // number of views in the draw framebuffer is greater than 1. |
| 372 | const Framebuffer *drawFramebuffer = context->getGLState().getDrawFramebuffer(); |
| 373 | ASSERT(drawFramebuffer != nullptr); |
| 374 | if (drawFramebuffer->getNumViews() > 1) |
| 375 | { |
| 376 | context->handleError( |
| 377 | InvalidOperation() |
| 378 | << "The number of views in the active draw framebuffer is greater than 1."); |
| 379 | return false; |
| 380 | } |
| 381 | |
Jiajia Qin | d967122 | 2016-11-29 16:30:31 +0800 | [diff] [blame] | 382 | return true; |
| 383 | } |
| 384 | |
Jamie Madill | 876429b | 2017-04-20 15:46:24 -0400 | [diff] [blame] | 385 | bool ValidateDrawArraysIndirect(Context *context, GLenum mode, const void *indirect) |
Jiajia Qin | d967122 | 2016-11-29 16:30:31 +0800 | [diff] [blame] | 386 | { |
| 387 | const State &state = context->getGLState(); |
| 388 | gl::TransformFeedback *curTransformFeedback = state.getCurrentTransformFeedback(); |
| 389 | if (curTransformFeedback && curTransformFeedback->isActive() && |
| 390 | !curTransformFeedback->isPaused()) |
| 391 | { |
| 392 | // An INVALID_OPERATION error is generated if transform feedback is active and not paused. |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 393 | context->handleError(InvalidOperation() << "transform feedback is active and not paused."); |
Jiajia Qin | d967122 | 2016-11-29 16:30:31 +0800 | [diff] [blame] | 394 | return false; |
| 395 | } |
| 396 | |
| 397 | if (!ValidateDrawIndirectBase(context, mode, indirect)) |
| 398 | return false; |
| 399 | |
| 400 | gl::Buffer *drawIndirectBuffer = state.getDrawIndirectBuffer(); |
| 401 | CheckedNumeric<size_t> checkedOffset(reinterpret_cast<size_t>(indirect)); |
| 402 | // In OpenGL ES3.1 spec, session 10.5, it defines the struct of DrawArraysIndirectCommand |
| 403 | // which's size is 4 * sizeof(uint). |
| 404 | auto checkedSum = checkedOffset + 4 * sizeof(GLuint); |
| 405 | if (!checkedSum.IsValid() || |
| 406 | checkedSum.ValueOrDie() > static_cast<size_t>(drawIndirectBuffer->getSize())) |
| 407 | { |
| 408 | context->handleError( |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 409 | InvalidOperation() |
| 410 | << "the command would source data beyond the end of the buffer object."); |
Jiajia Qin | d967122 | 2016-11-29 16:30:31 +0800 | [diff] [blame] | 411 | return false; |
| 412 | } |
| 413 | |
| 414 | return true; |
| 415 | } |
| 416 | |
Jamie Madill | 876429b | 2017-04-20 15:46:24 -0400 | [diff] [blame] | 417 | bool ValidateDrawElementsIndirect(Context *context, GLenum mode, GLenum type, const void *indirect) |
Jiajia Qin | d967122 | 2016-11-29 16:30:31 +0800 | [diff] [blame] | 418 | { |
| 419 | if (!ValidateDrawElementsBase(context, type)) |
| 420 | return false; |
| 421 | |
| 422 | const State &state = context->getGLState(); |
| 423 | const VertexArray *vao = state.getVertexArray(); |
| 424 | gl::Buffer *elementArrayBuffer = vao->getElementArrayBuffer().get(); |
| 425 | if (!elementArrayBuffer) |
| 426 | { |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 427 | context->handleError(InvalidOperation() << "zero is bound to ELEMENT_ARRAY_BUFFER"); |
Jiajia Qin | d967122 | 2016-11-29 16:30:31 +0800 | [diff] [blame] | 428 | return false; |
| 429 | } |
| 430 | |
| 431 | if (!ValidateDrawIndirectBase(context, mode, indirect)) |
| 432 | return false; |
| 433 | |
| 434 | gl::Buffer *drawIndirectBuffer = state.getDrawIndirectBuffer(); |
| 435 | CheckedNumeric<size_t> checkedOffset(reinterpret_cast<size_t>(indirect)); |
| 436 | // In OpenGL ES3.1 spec, session 10.5, it defines the struct of DrawElementsIndirectCommand |
| 437 | // which's size is 5 * sizeof(uint). |
| 438 | auto checkedSum = checkedOffset + 5 * sizeof(GLuint); |
| 439 | if (!checkedSum.IsValid() || |
| 440 | checkedSum.ValueOrDie() > static_cast<size_t>(drawIndirectBuffer->getSize())) |
| 441 | { |
| 442 | context->handleError( |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 443 | InvalidOperation() |
| 444 | << "the command would source data beyond the end of the buffer object."); |
Jiajia Qin | d967122 | 2016-11-29 16:30:31 +0800 | [diff] [blame] | 445 | return false; |
| 446 | } |
| 447 | |
| 448 | return true; |
| 449 | } |
| 450 | |
He Yunchao | 11b038b | 2016-11-22 21:24:04 +0800 | [diff] [blame] | 451 | bool ValidateGetTexLevelParameterBase(Context *context, |
| 452 | GLenum target, |
| 453 | GLint level, |
| 454 | GLenum pname, |
| 455 | GLsizei *length) |
| 456 | { |
| 457 | if (context->getClientVersion() < ES_3_1) |
| 458 | { |
Brandon Jones | afa7515 | 2017-07-21 13:11:29 -0700 | [diff] [blame] | 459 | ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); |
He Yunchao | 11b038b | 2016-11-22 21:24:04 +0800 | [diff] [blame] | 460 | return false; |
| 461 | } |
| 462 | |
| 463 | if (length) |
| 464 | { |
| 465 | *length = 0; |
| 466 | } |
| 467 | |
| 468 | if (!ValidTexLevelDestinationTarget(context, target)) |
| 469 | { |
Brandon Jones | afa7515 | 2017-07-21 13:11:29 -0700 | [diff] [blame] | 470 | ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTextureTarget); |
He Yunchao | 11b038b | 2016-11-22 21:24:04 +0800 | [diff] [blame] | 471 | return false; |
| 472 | } |
| 473 | |
| 474 | if (context->getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target) == |
| 475 | nullptr) |
| 476 | { |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 477 | context->handleError(InvalidEnum() << "No texture bound."); |
He Yunchao | 11b038b | 2016-11-22 21:24:04 +0800 | [diff] [blame] | 478 | return false; |
| 479 | } |
| 480 | |
| 481 | if (!ValidMipLevel(context, target, level)) |
| 482 | { |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 483 | context->handleError(InvalidValue()); |
He Yunchao | 11b038b | 2016-11-22 21:24:04 +0800 | [diff] [blame] | 484 | return false; |
| 485 | } |
| 486 | |
| 487 | switch (pname) |
| 488 | { |
| 489 | case GL_TEXTURE_RED_TYPE: |
| 490 | case GL_TEXTURE_GREEN_TYPE: |
| 491 | case GL_TEXTURE_BLUE_TYPE: |
| 492 | case GL_TEXTURE_ALPHA_TYPE: |
| 493 | case GL_TEXTURE_DEPTH_TYPE: |
| 494 | break; |
| 495 | case GL_TEXTURE_RED_SIZE: |
| 496 | case GL_TEXTURE_GREEN_SIZE: |
| 497 | case GL_TEXTURE_BLUE_SIZE: |
| 498 | case GL_TEXTURE_ALPHA_SIZE: |
| 499 | case GL_TEXTURE_DEPTH_SIZE: |
| 500 | case GL_TEXTURE_STENCIL_SIZE: |
| 501 | case GL_TEXTURE_SHARED_SIZE: |
| 502 | break; |
| 503 | case GL_TEXTURE_INTERNAL_FORMAT: |
| 504 | case GL_TEXTURE_WIDTH: |
| 505 | case GL_TEXTURE_HEIGHT: |
| 506 | case GL_TEXTURE_DEPTH: |
| 507 | break; |
| 508 | case GL_TEXTURE_SAMPLES: |
| 509 | case GL_TEXTURE_FIXED_SAMPLE_LOCATIONS: |
| 510 | break; |
| 511 | case GL_TEXTURE_COMPRESSED: |
| 512 | break; |
| 513 | default: |
Brandon Jones | afa7515 | 2017-07-21 13:11:29 -0700 | [diff] [blame] | 514 | ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPname); |
He Yunchao | 11b038b | 2016-11-22 21:24:04 +0800 | [diff] [blame] | 515 | return false; |
| 516 | } |
| 517 | |
| 518 | if (length) |
| 519 | { |
| 520 | *length = 1; |
| 521 | } |
| 522 | return true; |
| 523 | } |
| 524 | |
| 525 | bool ValidateGetTexLevelParameterfv(Context *context, |
| 526 | GLenum target, |
| 527 | GLint level, |
| 528 | GLenum pname, |
| 529 | GLfloat *params) |
| 530 | { |
| 531 | return ValidateGetTexLevelParameterBase(context, target, level, pname, nullptr); |
| 532 | } |
| 533 | |
| 534 | bool ValidateGetTexLevelParameteriv(Context *context, |
| 535 | GLenum target, |
| 536 | GLint level, |
| 537 | GLenum pname, |
| 538 | GLint *params) |
| 539 | { |
| 540 | return ValidateGetTexLevelParameterBase(context, target, level, pname, nullptr); |
| 541 | } |
| 542 | |
JiangYizhou | bddc46b | 2016-12-09 09:50:51 +0800 | [diff] [blame] | 543 | bool ValidateTexStorage2DMultiSample(Context *context, |
| 544 | GLenum target, |
| 545 | GLsizei samples, |
| 546 | GLint internalFormat, |
| 547 | GLsizei width, |
| 548 | GLsizei height, |
| 549 | GLboolean fixedSampleLocations) |
| 550 | { |
| 551 | if (context->getClientVersion() < ES_3_1) |
| 552 | { |
Brandon Jones | afa7515 | 2017-07-21 13:11:29 -0700 | [diff] [blame] | 553 | ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); |
JiangYizhou | bddc46b | 2016-12-09 09:50:51 +0800 | [diff] [blame] | 554 | return false; |
| 555 | } |
| 556 | |
| 557 | if (target != GL_TEXTURE_2D_MULTISAMPLE) |
| 558 | { |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 559 | context->handleError(InvalidEnum() << "Target must be TEXTURE_2D_MULTISAMPLE."); |
JiangYizhou | bddc46b | 2016-12-09 09:50:51 +0800 | [diff] [blame] | 560 | return false; |
| 561 | } |
| 562 | |
| 563 | if (width < 1 || height < 1) |
| 564 | { |
Brandon Jones | afa7515 | 2017-07-21 13:11:29 -0700 | [diff] [blame] | 565 | ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeSize); |
JiangYizhou | bddc46b | 2016-12-09 09:50:51 +0800 | [diff] [blame] | 566 | return false; |
| 567 | } |
| 568 | |
| 569 | const Caps &caps = context->getCaps(); |
| 570 | if (static_cast<GLuint>(width) > caps.max2DTextureSize || |
| 571 | static_cast<GLuint>(height) > caps.max2DTextureSize) |
| 572 | { |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 573 | context |
| 574 | ->handleError(InvalidValue() |
| 575 | << "Width and height must be less than or equal to GL_MAX_TEXTURE_SIZE."); |
JiangYizhou | bddc46b | 2016-12-09 09:50:51 +0800 | [diff] [blame] | 576 | return false; |
| 577 | } |
| 578 | |
| 579 | if (samples == 0) |
| 580 | { |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 581 | context->handleError(InvalidValue() << "Samples may not be zero."); |
JiangYizhou | bddc46b | 2016-12-09 09:50:51 +0800 | [diff] [blame] | 582 | return false; |
| 583 | } |
| 584 | |
| 585 | const TextureCaps &formatCaps = context->getTextureCaps().get(internalFormat); |
| 586 | if (!formatCaps.renderable) |
| 587 | { |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 588 | context->handleError(InvalidEnum() << "SizedInternalformat must be color-renderable, " |
| 589 | "depth-renderable, or stencil-renderable."); |
JiangYizhou | bddc46b | 2016-12-09 09:50:51 +0800 | [diff] [blame] | 590 | return false; |
| 591 | } |
| 592 | |
| 593 | // The ES3.1 spec(section 8.8) states that an INVALID_ENUM error is generated if internalformat |
| 594 | // is one of the unsized base internalformats listed in table 8.11. |
Geoff Lang | ca27139 | 2017-04-05 12:30:00 -0400 | [diff] [blame] | 595 | const InternalFormat &formatInfo = GetSizedInternalFormatInfo(internalFormat); |
| 596 | if (formatInfo.internalFormat == GL_NONE) |
JiangYizhou | bddc46b | 2016-12-09 09:50:51 +0800 | [diff] [blame] | 597 | { |
| 598 | context->handleError( |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 599 | InvalidEnum() |
| 600 | << "Internalformat is one of the unsupported unsized base internalformats."); |
JiangYizhou | bddc46b | 2016-12-09 09:50:51 +0800 | [diff] [blame] | 601 | return false; |
| 602 | } |
| 603 | |
| 604 | if (static_cast<GLuint>(samples) > formatCaps.getMaxSamples()) |
| 605 | { |
| 606 | context->handleError( |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 607 | InvalidOperation() |
| 608 | << "Samples must not be greater than maximum supported value for the format."); |
JiangYizhou | bddc46b | 2016-12-09 09:50:51 +0800 | [diff] [blame] | 609 | return false; |
| 610 | } |
| 611 | |
| 612 | Texture *texture = context->getTargetTexture(target); |
| 613 | if (!texture || texture->id() == 0) |
| 614 | { |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 615 | context->handleError(InvalidOperation() << "Zero is bound to target."); |
JiangYizhou | bddc46b | 2016-12-09 09:50:51 +0800 | [diff] [blame] | 616 | return false; |
| 617 | } |
| 618 | |
| 619 | if (texture->getImmutableFormat()) |
| 620 | { |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 621 | context->handleError(InvalidOperation() << "The value of TEXTURE_IMMUTABLE_FORMAT for " |
| 622 | "the texture currently bound to target on " |
| 623 | "the active texture unit is true."); |
JiangYizhou | bddc46b | 2016-12-09 09:50:51 +0800 | [diff] [blame] | 624 | return false; |
| 625 | } |
| 626 | |
| 627 | return true; |
| 628 | } |
| 629 | |
| 630 | bool ValidateGetMultisamplefv(Context *context, GLenum pname, GLuint index, GLfloat *val) |
| 631 | { |
| 632 | if (context->getClientVersion() < ES_3_1) |
| 633 | { |
Brandon Jones | afa7515 | 2017-07-21 13:11:29 -0700 | [diff] [blame] | 634 | ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); |
JiangYizhou | bddc46b | 2016-12-09 09:50:51 +0800 | [diff] [blame] | 635 | return false; |
| 636 | } |
| 637 | |
| 638 | if (pname != GL_SAMPLE_POSITION) |
| 639 | { |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 640 | context->handleError(InvalidEnum() << "Pname must be SAMPLE_POSITION."); |
JiangYizhou | bddc46b | 2016-12-09 09:50:51 +0800 | [diff] [blame] | 641 | return false; |
| 642 | } |
| 643 | |
JiangYizhou | 5b03f47 | 2017-01-09 10:22:53 +0800 | [diff] [blame] | 644 | Framebuffer *framebuffer = context->getGLState().getDrawFramebuffer(); |
| 645 | |
| 646 | if (index >= static_cast<GLuint>(framebuffer->getSamples(context))) |
JiangYizhou | bddc46b | 2016-12-09 09:50:51 +0800 | [diff] [blame] | 647 | { |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 648 | context->handleError(InvalidValue() << "Index must be less than the value of SAMPLES."); |
JiangYizhou | bddc46b | 2016-12-09 09:50:51 +0800 | [diff] [blame] | 649 | return false; |
| 650 | } |
| 651 | |
| 652 | return true; |
| 653 | } |
JiangYizhou | f7bbc8a | 2016-11-16 09:57:22 +0800 | [diff] [blame] | 654 | |
| 655 | bool ValidationFramebufferParameteri(Context *context, GLenum target, GLenum pname, GLint param) |
| 656 | { |
| 657 | if (context->getClientVersion() < ES_3_1) |
| 658 | { |
Brandon Jones | afa7515 | 2017-07-21 13:11:29 -0700 | [diff] [blame] | 659 | ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); |
JiangYizhou | f7bbc8a | 2016-11-16 09:57:22 +0800 | [diff] [blame] | 660 | return false; |
| 661 | } |
| 662 | |
| 663 | if (!ValidFramebufferTarget(target)) |
| 664 | { |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 665 | context->handleError(InvalidEnum() << "Invalid framebuffer target."); |
JiangYizhou | f7bbc8a | 2016-11-16 09:57:22 +0800 | [diff] [blame] | 666 | return false; |
| 667 | } |
| 668 | |
| 669 | switch (pname) |
| 670 | { |
| 671 | case GL_FRAMEBUFFER_DEFAULT_WIDTH: |
| 672 | { |
| 673 | GLint maxWidth = context->getCaps().maxFramebufferWidth; |
| 674 | if (param < 0 || param > maxWidth) |
| 675 | { |
| 676 | context->handleError( |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 677 | InvalidValue() |
| 678 | << "Params less than 0 or greater than GL_MAX_FRAMEBUFFER_WIDTH."); |
JiangYizhou | f7bbc8a | 2016-11-16 09:57:22 +0800 | [diff] [blame] | 679 | return false; |
| 680 | } |
| 681 | break; |
| 682 | } |
| 683 | case GL_FRAMEBUFFER_DEFAULT_HEIGHT: |
| 684 | { |
| 685 | GLint maxHeight = context->getCaps().maxFramebufferHeight; |
| 686 | if (param < 0 || param > maxHeight) |
| 687 | { |
| 688 | context->handleError( |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 689 | InvalidValue() |
| 690 | << "Params less than 0 or greater than GL_MAX_FRAMEBUFFER_HEIGHT."); |
JiangYizhou | f7bbc8a | 2016-11-16 09:57:22 +0800 | [diff] [blame] | 691 | return false; |
| 692 | } |
| 693 | break; |
| 694 | } |
| 695 | case GL_FRAMEBUFFER_DEFAULT_SAMPLES: |
| 696 | { |
| 697 | GLint maxSamples = context->getCaps().maxFramebufferSamples; |
| 698 | if (param < 0 || param > maxSamples) |
| 699 | { |
| 700 | context->handleError( |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 701 | InvalidValue() |
| 702 | << "Params less than 0 or greater than GL_MAX_FRAMEBUFFER_SAMPLES."); |
JiangYizhou | f7bbc8a | 2016-11-16 09:57:22 +0800 | [diff] [blame] | 703 | return false; |
| 704 | } |
| 705 | break; |
| 706 | } |
| 707 | case GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS: |
| 708 | { |
| 709 | break; |
| 710 | } |
| 711 | default: |
| 712 | { |
Brandon Jones | afa7515 | 2017-07-21 13:11:29 -0700 | [diff] [blame] | 713 | ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPname); |
JiangYizhou | f7bbc8a | 2016-11-16 09:57:22 +0800 | [diff] [blame] | 714 | return false; |
| 715 | } |
| 716 | } |
| 717 | |
| 718 | const Framebuffer *framebuffer = context->getGLState().getTargetFramebuffer(target); |
| 719 | ASSERT(framebuffer); |
| 720 | if (framebuffer->id() == 0) |
| 721 | { |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 722 | context->handleError(InvalidOperation() << "Default framebuffer is bound to target."); |
JiangYizhou | f7bbc8a | 2016-11-16 09:57:22 +0800 | [diff] [blame] | 723 | return false; |
| 724 | } |
| 725 | return true; |
| 726 | } |
| 727 | |
| 728 | bool ValidationGetFramebufferParameteri(Context *context, |
| 729 | GLenum target, |
| 730 | GLenum pname, |
| 731 | GLint *params) |
| 732 | { |
| 733 | if (context->getClientVersion() < ES_3_1) |
| 734 | { |
Brandon Jones | afa7515 | 2017-07-21 13:11:29 -0700 | [diff] [blame] | 735 | ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); |
JiangYizhou | f7bbc8a | 2016-11-16 09:57:22 +0800 | [diff] [blame] | 736 | return false; |
| 737 | } |
| 738 | |
| 739 | if (!ValidFramebufferTarget(target)) |
| 740 | { |
Brandon Jones | afa7515 | 2017-07-21 13:11:29 -0700 | [diff] [blame] | 741 | ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidFramebufferTarget); |
JiangYizhou | f7bbc8a | 2016-11-16 09:57:22 +0800 | [diff] [blame] | 742 | return false; |
| 743 | } |
| 744 | |
| 745 | switch (pname) |
| 746 | { |
| 747 | case GL_FRAMEBUFFER_DEFAULT_WIDTH: |
| 748 | case GL_FRAMEBUFFER_DEFAULT_HEIGHT: |
| 749 | case GL_FRAMEBUFFER_DEFAULT_SAMPLES: |
| 750 | case GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS: |
| 751 | break; |
| 752 | default: |
Brandon Jones | afa7515 | 2017-07-21 13:11:29 -0700 | [diff] [blame] | 753 | ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPname); |
JiangYizhou | f7bbc8a | 2016-11-16 09:57:22 +0800 | [diff] [blame] | 754 | return false; |
| 755 | } |
| 756 | |
| 757 | const Framebuffer *framebuffer = context->getGLState().getTargetFramebuffer(target); |
| 758 | ASSERT(framebuffer); |
| 759 | |
| 760 | if (framebuffer->id() == 0) |
| 761 | { |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 762 | context->handleError(InvalidOperation() << "Default framebuffer is bound to target."); |
JiangYizhou | f7bbc8a | 2016-11-16 09:57:22 +0800 | [diff] [blame] | 763 | return false; |
| 764 | } |
| 765 | return true; |
| 766 | } |
| 767 | |
jchen10 | 15015f7 | 2017-03-16 13:54:21 +0800 | [diff] [blame] | 768 | bool ValidateGetProgramResourceIndex(Context *context, |
| 769 | GLuint program, |
| 770 | GLenum programInterface, |
| 771 | const GLchar *name) |
| 772 | { |
| 773 | if (context->getClientVersion() < ES_3_1) |
| 774 | { |
Brandon Jones | afa7515 | 2017-07-21 13:11:29 -0700 | [diff] [blame] | 775 | ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); |
jchen10 | 15015f7 | 2017-03-16 13:54:21 +0800 | [diff] [blame] | 776 | return false; |
| 777 | } |
| 778 | |
| 779 | Program *programObject = GetValidProgram(context, program); |
| 780 | if (programObject == nullptr) |
| 781 | { |
| 782 | return false; |
| 783 | } |
| 784 | |
| 785 | if (!ValidateNamedProgramInterface(programInterface)) |
| 786 | { |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 787 | context->handleError(InvalidEnum() << "Invalid program interface: 0x" << std::hex |
| 788 | << std::uppercase << programInterface); |
jchen10 | 15015f7 | 2017-03-16 13:54:21 +0800 | [diff] [blame] | 789 | return false; |
| 790 | } |
Shao | 80957d9 | 2017-02-20 21:25:59 +0800 | [diff] [blame] | 791 | |
| 792 | return true; |
| 793 | } |
| 794 | |
| 795 | bool ValidateBindVertexBuffer(ValidationContext *context, |
| 796 | GLuint bindingIndex, |
| 797 | GLuint buffer, |
| 798 | GLintptr offset, |
| 799 | GLsizei stride) |
| 800 | { |
| 801 | if (context->getClientVersion() < ES_3_1) |
| 802 | { |
Brandon Jones | afa7515 | 2017-07-21 13:11:29 -0700 | [diff] [blame] | 803 | ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); |
Shao | 80957d9 | 2017-02-20 21:25:59 +0800 | [diff] [blame] | 804 | return false; |
| 805 | } |
| 806 | |
| 807 | if (!context->isBufferGenerated(buffer)) |
| 808 | { |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 809 | context->handleError(InvalidOperation() << "Buffer is not generated."); |
Shao | 80957d9 | 2017-02-20 21:25:59 +0800 | [diff] [blame] | 810 | return false; |
| 811 | } |
| 812 | |
| 813 | const Caps &caps = context->getCaps(); |
| 814 | if (bindingIndex >= caps.maxVertexAttribBindings) |
| 815 | { |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 816 | context->handleError(InvalidValue() |
| 817 | << "bindingindex must be smaller than MAX_VERTEX_ATTRIB_BINDINGS."); |
Shao | 80957d9 | 2017-02-20 21:25:59 +0800 | [diff] [blame] | 818 | return false; |
| 819 | } |
| 820 | |
| 821 | if (offset < 0) |
| 822 | { |
Brandon Jones | afa7515 | 2017-07-21 13:11:29 -0700 | [diff] [blame] | 823 | ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeOffset); |
Shao | 80957d9 | 2017-02-20 21:25:59 +0800 | [diff] [blame] | 824 | return false; |
| 825 | } |
| 826 | |
| 827 | if (stride < 0 || stride > caps.maxVertexAttribStride) |
| 828 | { |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 829 | context->handleError(InvalidValue() |
| 830 | << "stride must be between 0 and MAX_VERTEX_ATTRIB_STRIDE."); |
Shao | 80957d9 | 2017-02-20 21:25:59 +0800 | [diff] [blame] | 831 | return false; |
| 832 | } |
| 833 | |
| 834 | // [OpenGL ES 3.1] Section 10.3.1 page 244: |
| 835 | // An INVALID_OPERATION error is generated if the default vertex array object is bound. |
| 836 | if (context->getGLState().getVertexArrayId() == 0) |
| 837 | { |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 838 | context->handleError(InvalidOperation() << "Default vertex array buffer is bound."); |
Shao | 80957d9 | 2017-02-20 21:25:59 +0800 | [diff] [blame] | 839 | return false; |
| 840 | } |
| 841 | |
| 842 | return true; |
| 843 | } |
| 844 | |
| 845 | bool ValidateVertexBindingDivisor(ValidationContext *context, GLuint bindingIndex, GLuint divisor) |
| 846 | { |
| 847 | if (context->getClientVersion() < ES_3_1) |
| 848 | { |
Brandon Jones | afa7515 | 2017-07-21 13:11:29 -0700 | [diff] [blame] | 849 | ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); |
Shao | 80957d9 | 2017-02-20 21:25:59 +0800 | [diff] [blame] | 850 | return false; |
| 851 | } |
| 852 | |
| 853 | const Caps &caps = context->getCaps(); |
| 854 | if (bindingIndex >= caps.maxVertexAttribBindings) |
| 855 | { |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 856 | context->handleError(InvalidValue() |
| 857 | << "bindingindex must be smaller than MAX_VERTEX_ATTRIB_BINDINGS."); |
Shao | 80957d9 | 2017-02-20 21:25:59 +0800 | [diff] [blame] | 858 | return false; |
| 859 | } |
| 860 | |
| 861 | // [OpenGL ES 3.1] Section 10.3.1 page 243: |
| 862 | // An INVALID_OPERATION error is generated if the default vertex array object is bound. |
| 863 | if (context->getGLState().getVertexArrayId() == 0) |
| 864 | { |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 865 | context->handleError(InvalidOperation() << "Default vertex array object is bound."); |
Shao | 80957d9 | 2017-02-20 21:25:59 +0800 | [diff] [blame] | 866 | return false; |
| 867 | } |
| 868 | |
| 869 | return true; |
| 870 | } |
| 871 | |
| 872 | bool ValidateVertexAttribFormat(ValidationContext *context, |
| 873 | GLuint attribIndex, |
| 874 | GLint size, |
| 875 | GLenum type, |
| 876 | GLuint relativeOffset, |
| 877 | GLboolean pureInteger) |
| 878 | { |
| 879 | if (context->getClientVersion() < ES_3_1) |
| 880 | { |
Brandon Jones | afa7515 | 2017-07-21 13:11:29 -0700 | [diff] [blame] | 881 | ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); |
Shao | 80957d9 | 2017-02-20 21:25:59 +0800 | [diff] [blame] | 882 | return false; |
| 883 | } |
| 884 | |
| 885 | const Caps &caps = context->getCaps(); |
| 886 | if (relativeOffset > static_cast<GLuint>(caps.maxVertexAttribRelativeOffset)) |
| 887 | { |
| 888 | context->handleError( |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 889 | InvalidValue() |
| 890 | << "relativeOffset cannot be greater than MAX_VERTEX_ATTRIB_RELATIVE_OFFSET."); |
Shao | 80957d9 | 2017-02-20 21:25:59 +0800 | [diff] [blame] | 891 | return false; |
| 892 | } |
| 893 | |
| 894 | // [OpenGL ES 3.1] Section 10.3.1 page 243: |
| 895 | // An INVALID_OPERATION error is generated if the default vertex array object is bound. |
| 896 | if (context->getGLState().getVertexArrayId() == 0) |
| 897 | { |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 898 | context->handleError(InvalidOperation() << "Default vertex array object is bound."); |
Shao | 80957d9 | 2017-02-20 21:25:59 +0800 | [diff] [blame] | 899 | return false; |
| 900 | } |
| 901 | |
| 902 | return ValidateVertexFormatBase(context, attribIndex, size, type, pureInteger); |
| 903 | } |
| 904 | |
| 905 | bool ValidateVertexAttribBinding(ValidationContext *context, |
| 906 | GLuint attribIndex, |
| 907 | GLuint bindingIndex) |
| 908 | { |
| 909 | if (context->getClientVersion() < ES_3_1) |
| 910 | { |
Brandon Jones | afa7515 | 2017-07-21 13:11:29 -0700 | [diff] [blame] | 911 | ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); |
Shao | 80957d9 | 2017-02-20 21:25:59 +0800 | [diff] [blame] | 912 | return false; |
| 913 | } |
| 914 | |
| 915 | // [OpenGL ES 3.1] Section 10.3.1 page 243: |
| 916 | // An INVALID_OPERATION error is generated if the default vertex array object is bound. |
| 917 | if (context->getGLState().getVertexArrayId() == 0) |
| 918 | { |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 919 | context->handleError(InvalidOperation() << "Default vertex array object is bound."); |
Shao | 80957d9 | 2017-02-20 21:25:59 +0800 | [diff] [blame] | 920 | return false; |
| 921 | } |
| 922 | |
| 923 | const Caps &caps = context->getCaps(); |
| 924 | if (attribIndex >= caps.maxVertexAttributes) |
| 925 | { |
Brandon Jones | afa7515 | 2017-07-21 13:11:29 -0700 | [diff] [blame] | 926 | ANGLE_VALIDATION_ERR(context, InvalidValue(), IndexExceedsMaxVertexAttribute); |
Shao | 80957d9 | 2017-02-20 21:25:59 +0800 | [diff] [blame] | 927 | return false; |
| 928 | } |
| 929 | |
| 930 | if (bindingIndex >= caps.maxVertexAttribBindings) |
| 931 | { |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 932 | context->handleError(InvalidValue() |
| 933 | << "bindingindex must be smaller than MAX_VERTEX_ATTRIB_BINDINGS"); |
Shao | 80957d9 | 2017-02-20 21:25:59 +0800 | [diff] [blame] | 934 | return false; |
| 935 | } |
| 936 | |
jchen10 | 15015f7 | 2017-03-16 13:54:21 +0800 | [diff] [blame] | 937 | return true; |
| 938 | } |
| 939 | |
jchen10 | fd7c3b5 | 2017-03-21 15:36:03 +0800 | [diff] [blame] | 940 | bool ValidateGetProgramResourceName(Context *context, |
| 941 | GLuint program, |
| 942 | GLenum programInterface, |
| 943 | GLuint index, |
| 944 | GLsizei bufSize, |
| 945 | GLsizei *length, |
| 946 | GLchar *name) |
| 947 | { |
| 948 | if (context->getClientVersion() < ES_3_1) |
| 949 | { |
Brandon Jones | afa7515 | 2017-07-21 13:11:29 -0700 | [diff] [blame] | 950 | ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); |
jchen10 | fd7c3b5 | 2017-03-21 15:36:03 +0800 | [diff] [blame] | 951 | return false; |
| 952 | } |
| 953 | |
| 954 | Program *programObject = GetValidProgram(context, program); |
| 955 | if (programObject == nullptr) |
| 956 | { |
| 957 | return false; |
| 958 | } |
| 959 | |
| 960 | if (!ValidateNamedProgramInterface(programInterface)) |
| 961 | { |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 962 | context->handleError(InvalidEnum() << "Invalid program interface: 0x" << std::hex |
| 963 | << std::uppercase << programInterface); |
jchen10 | fd7c3b5 | 2017-03-21 15:36:03 +0800 | [diff] [blame] | 964 | return false; |
| 965 | } |
| 966 | |
| 967 | if (!ValidateProgramResourceIndex(programObject, programInterface, index)) |
| 968 | { |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 969 | context->handleError(InvalidValue() << "Invalid index: " << index); |
jchen10 | fd7c3b5 | 2017-03-21 15:36:03 +0800 | [diff] [blame] | 970 | return false; |
| 971 | } |
| 972 | |
| 973 | if (bufSize < 0) |
| 974 | { |
Brandon Jones | afa7515 | 2017-07-21 13:11:29 -0700 | [diff] [blame] | 975 | ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeBufferSize); |
jchen10 | fd7c3b5 | 2017-03-21 15:36:03 +0800 | [diff] [blame] | 976 | return false; |
| 977 | } |
| 978 | |
| 979 | return true; |
| 980 | } |
| 981 | |
Xinghua Cao | 2b39659 | 2017-03-29 15:36:04 +0800 | [diff] [blame] | 982 | bool ValidateDispatchCompute(Context *context, |
| 983 | GLuint numGroupsX, |
| 984 | GLuint numGroupsY, |
| 985 | GLuint numGroupsZ) |
| 986 | { |
| 987 | if (context->getClientVersion() < ES_3_1) |
| 988 | { |
Brandon Jones | afa7515 | 2017-07-21 13:11:29 -0700 | [diff] [blame] | 989 | ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); |
Xinghua Cao | 2b39659 | 2017-03-29 15:36:04 +0800 | [diff] [blame] | 990 | return false; |
| 991 | } |
| 992 | |
| 993 | const State &state = context->getGLState(); |
| 994 | Program *program = state.getProgram(); |
| 995 | |
| 996 | if (program == nullptr) |
| 997 | { |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 998 | context->handleError(InvalidOperation() |
| 999 | << "No active program object for the compute shader stage."); |
Xinghua Cao | 2b39659 | 2017-03-29 15:36:04 +0800 | [diff] [blame] | 1000 | return false; |
| 1001 | } |
| 1002 | |
| 1003 | if (program->isLinked() == false || program->getAttachedComputeShader() == nullptr) |
| 1004 | { |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 1005 | context->handleError( |
| 1006 | InvalidOperation() |
| 1007 | << "Program has not been successfully linked, or program contains no compute shaders."); |
Xinghua Cao | 2b39659 | 2017-03-29 15:36:04 +0800 | [diff] [blame] | 1008 | return false; |
| 1009 | } |
| 1010 | |
| 1011 | const Caps &caps = context->getCaps(); |
| 1012 | if (numGroupsX > caps.maxComputeWorkGroupCount[0]) |
| 1013 | { |
| 1014 | context->handleError( |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 1015 | InvalidValue() << "num_groups_x cannot be greater than MAX_COMPUTE_WORK_GROUP_COUNT[0]=" |
| 1016 | << caps.maxComputeWorkGroupCount[0]); |
Xinghua Cao | 2b39659 | 2017-03-29 15:36:04 +0800 | [diff] [blame] | 1017 | return false; |
| 1018 | } |
| 1019 | if (numGroupsY > caps.maxComputeWorkGroupCount[1]) |
| 1020 | { |
| 1021 | context->handleError( |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 1022 | InvalidValue() << "num_groups_y cannot be greater than MAX_COMPUTE_WORK_GROUP_COUNT[1]=" |
| 1023 | << caps.maxComputeWorkGroupCount[1]); |
Xinghua Cao | 2b39659 | 2017-03-29 15:36:04 +0800 | [diff] [blame] | 1024 | return false; |
| 1025 | } |
| 1026 | if (numGroupsZ > caps.maxComputeWorkGroupCount[2]) |
| 1027 | { |
| 1028 | context->handleError( |
Yuly Novikov | c4d18aa | 2017-03-09 18:45:02 -0500 | [diff] [blame] | 1029 | InvalidValue() << "num_groups_z cannot be greater than MAX_COMPUTE_WORK_GROUP_COUNT[2]=" |
| 1030 | << caps.maxComputeWorkGroupCount[2]); |
Xinghua Cao | 2b39659 | 2017-03-29 15:36:04 +0800 | [diff] [blame] | 1031 | return false; |
| 1032 | } |
| 1033 | |
| 1034 | return true; |
| 1035 | } |
| 1036 | |
Xinghua Cao | 65ec0b2 | 2017-03-28 16:10:52 +0800 | [diff] [blame] | 1037 | bool ValidateBindImageTexture(Context *context, |
| 1038 | GLuint unit, |
| 1039 | GLuint texture, |
| 1040 | GLint level, |
| 1041 | GLboolean layered, |
| 1042 | GLint layer, |
| 1043 | GLenum access, |
| 1044 | GLenum format) |
| 1045 | { |
| 1046 | GLuint maxImageUnits = context->getCaps().maxImageUnits; |
| 1047 | if (unit >= maxImageUnits) |
| 1048 | { |
| 1049 | context->handleError(InvalidValue() |
| 1050 | << "unit cannot be greater than or equal than MAX_IMAGE_UNITS = " |
| 1051 | << maxImageUnits); |
| 1052 | return false; |
| 1053 | } |
| 1054 | |
| 1055 | if (level < 0) |
| 1056 | { |
| 1057 | context->handleError(InvalidValue() << "level is negative."); |
| 1058 | return false; |
| 1059 | } |
| 1060 | |
| 1061 | if (layer < 0) |
| 1062 | { |
| 1063 | context->handleError(InvalidValue() << "layer is negative."); |
| 1064 | return false; |
| 1065 | } |
| 1066 | |
| 1067 | if (access != GL_READ_ONLY && access != GL_WRITE_ONLY && access != GL_READ_WRITE) |
| 1068 | { |
| 1069 | context->handleError(InvalidEnum() << "access is not one of the supported tokens."); |
| 1070 | return false; |
| 1071 | } |
| 1072 | |
| 1073 | switch (format) |
| 1074 | { |
| 1075 | case GL_RGBA32F: |
| 1076 | case GL_RGBA16F: |
| 1077 | case GL_R32F: |
| 1078 | case GL_RGBA32UI: |
| 1079 | case GL_RGBA16UI: |
| 1080 | case GL_RGBA8UI: |
| 1081 | case GL_R32UI: |
| 1082 | case GL_RGBA32I: |
| 1083 | case GL_RGBA16I: |
| 1084 | case GL_RGBA8I: |
| 1085 | case GL_R32I: |
| 1086 | case GL_RGBA8: |
| 1087 | case GL_RGBA8_SNORM: |
| 1088 | break; |
| 1089 | default: |
| 1090 | context->handleError(InvalidValue() |
| 1091 | << "format is not one of supported image unit formats."); |
| 1092 | return false; |
| 1093 | } |
| 1094 | |
| 1095 | if (texture != 0) |
| 1096 | { |
| 1097 | Texture *tex = context->getTexture(texture); |
| 1098 | |
| 1099 | if (tex == nullptr) |
| 1100 | { |
| 1101 | context->handleError(InvalidValue() |
| 1102 | << "texture is not the name of an existing texture object."); |
| 1103 | return false; |
| 1104 | } |
| 1105 | |
| 1106 | if (!tex->getImmutableFormat()) |
| 1107 | { |
| 1108 | context->handleError(InvalidOperation() |
| 1109 | << "texture is not the name of an immutable texture object."); |
| 1110 | return false; |
| 1111 | } |
| 1112 | } |
| 1113 | |
| 1114 | return true; |
| 1115 | } |
jchen10 | 191381f | 2017-04-11 13:59:04 +0800 | [diff] [blame] | 1116 | |
| 1117 | bool ValidateGetProgramResourceLocation(Context *context, |
| 1118 | GLuint program, |
| 1119 | GLenum programInterface, |
| 1120 | const GLchar *name) |
| 1121 | { |
| 1122 | if (context->getClientVersion() < ES_3_1) |
| 1123 | { |
Brandon Jones | afa7515 | 2017-07-21 13:11:29 -0700 | [diff] [blame] | 1124 | ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); |
jchen10 | 191381f | 2017-04-11 13:59:04 +0800 | [diff] [blame] | 1125 | return false; |
| 1126 | } |
| 1127 | |
| 1128 | Program *programObject = GetValidProgram(context, program); |
| 1129 | if (programObject == nullptr) |
| 1130 | { |
| 1131 | return false; |
| 1132 | } |
| 1133 | |
| 1134 | if (!programObject->isLinked()) |
| 1135 | { |
| 1136 | context->handleError(InvalidOperation() << "Program is not successfully linked."); |
| 1137 | return false; |
| 1138 | } |
| 1139 | |
| 1140 | if (!ValidateLocationProgramInterface(programInterface)) |
| 1141 | { |
| 1142 | context->handleError(InvalidEnum() << "Invalid program interface."); |
| 1143 | return false; |
| 1144 | } |
| 1145 | return true; |
| 1146 | } |
| 1147 | |
jchen10 | 880683b | 2017-04-12 16:21:55 +0800 | [diff] [blame] | 1148 | bool ValidateGetProgramResourceiv(Context *context, |
| 1149 | GLuint program, |
| 1150 | GLenum programInterface, |
| 1151 | GLuint index, |
| 1152 | GLsizei propCount, |
| 1153 | const GLenum *props, |
| 1154 | GLsizei bufSize, |
| 1155 | GLsizei *length, |
| 1156 | GLint *params) |
| 1157 | { |
| 1158 | if (context->getClientVersion() < ES_3_1) |
| 1159 | { |
jchen10 | d9cd7b7 | 2017-08-30 15:04:25 +0800 | [diff] [blame] | 1160 | ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); |
jchen10 | 880683b | 2017-04-12 16:21:55 +0800 | [diff] [blame] | 1161 | return false; |
| 1162 | } |
| 1163 | |
| 1164 | Program *programObject = GetValidProgram(context, program); |
| 1165 | if (programObject == nullptr) |
| 1166 | { |
| 1167 | return false; |
| 1168 | } |
| 1169 | if (!ValidateProgramInterface(programInterface)) |
| 1170 | { |
| 1171 | context->handleError(InvalidEnum() << "Invalid program interface."); |
| 1172 | return false; |
| 1173 | } |
| 1174 | if (propCount <= 0) |
| 1175 | { |
| 1176 | context->handleError(InvalidValue() << "Invalid propCount."); |
| 1177 | return false; |
| 1178 | } |
| 1179 | if (bufSize < 0) |
| 1180 | { |
| 1181 | context->handleError(InvalidValue() << "Invalid bufSize."); |
| 1182 | return false; |
| 1183 | } |
| 1184 | if (!ValidateProgramResourceIndex(programObject, programInterface, index)) |
| 1185 | { |
| 1186 | context->handleError(InvalidValue() << "Invalid index: " << index); |
| 1187 | return false; |
| 1188 | } |
| 1189 | for (GLsizei i = 0; i < propCount; i++) |
| 1190 | { |
| 1191 | if (!ValidateProgramResourceProperty(props[i])) |
| 1192 | { |
| 1193 | context->handleError(InvalidEnum() << "Invalid prop."); |
| 1194 | return false; |
| 1195 | } |
| 1196 | if (!ValidateProgramResourcePropertyByInterface(props[i], programInterface)) |
| 1197 | { |
| 1198 | context->handleError(InvalidOperation() << "Not an allowed prop for interface"); |
| 1199 | return false; |
| 1200 | } |
| 1201 | } |
| 1202 | return true; |
| 1203 | } |
| 1204 | |
jchen10 | d9cd7b7 | 2017-08-30 15:04:25 +0800 | [diff] [blame] | 1205 | bool ValidateGetProgramInterfaceiv(Context *context, |
| 1206 | GLuint program, |
| 1207 | GLenum programInterface, |
| 1208 | GLenum pname, |
| 1209 | GLint *params) |
| 1210 | { |
| 1211 | if (context->getClientVersion() < ES_3_1) |
| 1212 | { |
| 1213 | ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); |
| 1214 | return false; |
| 1215 | } |
| 1216 | |
| 1217 | Program *programObject = GetValidProgram(context, program); |
| 1218 | if (programObject == nullptr) |
| 1219 | { |
| 1220 | return false; |
| 1221 | } |
| 1222 | |
| 1223 | if (!ValidateProgramInterface(programInterface)) |
| 1224 | { |
| 1225 | context->handleError(InvalidEnum() << "Invalid program interface."); |
| 1226 | return false; |
| 1227 | } |
| 1228 | |
| 1229 | switch (pname) |
| 1230 | { |
| 1231 | case GL_ACTIVE_RESOURCES: |
| 1232 | case GL_MAX_NAME_LENGTH: |
| 1233 | case GL_MAX_NUM_ACTIVE_VARIABLES: |
| 1234 | break; |
| 1235 | |
| 1236 | default: |
| 1237 | context->handleError(InvalidEnum() << "Unknown property of program interface."); |
| 1238 | return false; |
| 1239 | } |
| 1240 | |
| 1241 | if (pname == GL_MAX_NAME_LENGTH && programInterface == GL_ATOMIC_COUNTER_BUFFER) |
| 1242 | { |
| 1243 | context->handleError(InvalidOperation() |
| 1244 | << "Active atomic counter resources are not assigned name strings."); |
| 1245 | return false; |
| 1246 | } |
| 1247 | |
| 1248 | if (pname == GL_MAX_NUM_ACTIVE_VARIABLES) |
| 1249 | { |
| 1250 | switch (programInterface) |
| 1251 | { |
| 1252 | case GL_ATOMIC_COUNTER_BUFFER: |
| 1253 | case GL_SHADER_STORAGE_BLOCK: |
| 1254 | case GL_UNIFORM_BLOCK: |
| 1255 | break; |
| 1256 | |
| 1257 | default: |
| 1258 | context->handleError( |
| 1259 | InvalidOperation() |
| 1260 | << "MAX_NUM_ACTIVE_VARIABLES requires a buffer or block interface."); |
| 1261 | return false; |
| 1262 | } |
| 1263 | } |
| 1264 | |
| 1265 | return true; |
| 1266 | } |
| 1267 | |
Yunchao He | a336b90 | 2017-08-02 16:05:21 +0800 | [diff] [blame] | 1268 | static bool ValidateGenOrDeleteES31(Context *context, GLint n) |
| 1269 | { |
| 1270 | if (context->getClientVersion() < ES_3_1) |
| 1271 | { |
| 1272 | ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); |
| 1273 | return false; |
| 1274 | } |
| 1275 | |
| 1276 | return ValidateGenOrDelete(context, n); |
| 1277 | } |
| 1278 | |
| 1279 | bool ValidateGenProgramPipelines(Context *context, GLint n, GLuint *) |
| 1280 | { |
| 1281 | return ValidateGenOrDeleteES31(context, n); |
| 1282 | } |
| 1283 | |
| 1284 | bool ValidateDeleteProgramPipelines(Context *context, GLint n, const GLuint *) |
| 1285 | { |
| 1286 | return ValidateGenOrDeleteES31(context, n); |
| 1287 | } |
| 1288 | |
| 1289 | bool ValidateBindProgramPipeline(Context *context, GLuint pipeline) |
| 1290 | { |
| 1291 | if (context->getClientVersion() < ES_3_1) |
| 1292 | { |
| 1293 | ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); |
| 1294 | return false; |
| 1295 | } |
| 1296 | |
| 1297 | if (!context->isProgramPipelineGenerated(pipeline)) |
| 1298 | { |
| 1299 | ANGLE_VALIDATION_ERR(context, InvalidOperation(), ObjectNotGenerated); |
| 1300 | return false; |
| 1301 | } |
| 1302 | |
| 1303 | return true; |
| 1304 | } |
| 1305 | |
| 1306 | bool ValidateIsProgramPipeline(Context *context, GLuint pipeline) |
| 1307 | { |
| 1308 | if (context->getClientVersion() < ES_3_1) |
| 1309 | { |
| 1310 | ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); |
| 1311 | return false; |
| 1312 | } |
| 1313 | |
| 1314 | return true; |
| 1315 | } |
| 1316 | |
Jiawei Shao | db34227 | 2017-09-27 10:21:45 +0800 | [diff] [blame] | 1317 | bool ValidateSampleMaski(Context *context, GLuint maskNumber) |
| 1318 | { |
| 1319 | if (context->getClientVersion() < ES_3_1) |
| 1320 | { |
| 1321 | ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); |
| 1322 | return false; |
| 1323 | } |
| 1324 | |
| 1325 | if (maskNumber >= context->getCaps().maxSampleMaskWords) |
| 1326 | { |
| 1327 | ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidSampleMaskNumber); |
| 1328 | return false; |
| 1329 | } |
| 1330 | |
| 1331 | return true; |
| 1332 | } |
| 1333 | |
Martin Radev | 66fb820 | 2016-07-28 11:45:20 +0300 | [diff] [blame] | 1334 | } // namespace gl |