| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file is here so other GLES2 related files can have a common set of | 5 // This file is here so other GLES2 related files can have a common set of |
| 6 // includes where appropriate. | 6 // includes where appropriate. |
| 7 | 7 |
| 8 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 8 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 9 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 9 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 10 | 10 |
| 11 namespace gpu { | 11 namespace gpu { |
| 12 namespace gles2 { | 12 namespace gles2 { |
| 13 | 13 |
| 14 namespace gl_error_bit { | |
| 15 enum GLErrorBit { | |
| 16 kNoError = 0, | |
| 17 kInvalidEnum = (1 << 0), | |
| 18 kInvalidValue = (1 << 1), | |
| 19 kInvalidOperation = (1 << 2), | |
| 20 kOutOfMemory = (1 << 3), | |
| 21 kInvalidFrameBufferOperation = (1 << 4), | |
| 22 }; | |
| 23 } | |
| 24 | |
| 25 int GLES2Util::GLGetNumValuesReturned(int id) const { | 14 int GLES2Util::GLGetNumValuesReturned(int id) const { |
| 26 switch (id) { | 15 switch (id) { |
| 27 // -- glGetBooleanv, glGetFloatv, glGetIntergerv | 16 // -- glGetBooleanv, glGetFloatv, glGetIntergerv |
| 28 case GL_ACTIVE_TEXTURE: | 17 case GL_ACTIVE_TEXTURE: |
| 29 return 1; | 18 return 1; |
| 30 case GL_ALIASED_LINE_WIDTH_RANGE: | 19 case GL_ALIASED_LINE_WIDTH_RANGE: |
| 31 return 2; | 20 return 2; |
| 32 case GL_ALIASED_POINT_SIZE_RANGE: | 21 case GL_ALIASED_POINT_SIZE_RANGE: |
| 33 return 1; | 22 return 1; |
| 34 case GL_ALPHA_BITS: | 23 case GL_ALPHA_BITS: |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 return sizeof(GLshort); // NOLINT | 394 return sizeof(GLshort); // NOLINT |
| 406 case GL_UNSIGNED_SHORT: | 395 case GL_UNSIGNED_SHORT: |
| 407 return sizeof(GLushort); // NOLINT | 396 return sizeof(GLushort); // NOLINT |
| 408 case GL_FLOAT: | 397 case GL_FLOAT: |
| 409 return sizeof(GLfloat); // NOLINT | 398 return sizeof(GLfloat); // NOLINT |
| 410 default: | 399 default: |
| 411 return 0; | 400 return 0; |
| 412 } | 401 } |
| 413 } | 402 } |
| 414 | 403 |
| 415 uint32 GLES2Util::GLErrorToErrorBit(uint32 error) { | |
| 416 switch (error) { | |
| 417 case GL_INVALID_ENUM: | |
| 418 return gl_error_bit::kInvalidEnum; | |
| 419 case GL_INVALID_VALUE: | |
| 420 return gl_error_bit::kInvalidValue; | |
| 421 case GL_INVALID_OPERATION: | |
| 422 return gl_error_bit::kInvalidOperation; | |
| 423 case GL_OUT_OF_MEMORY: | |
| 424 return gl_error_bit::kOutOfMemory; | |
| 425 case GL_INVALID_FRAMEBUFFER_OPERATION: | |
| 426 return gl_error_bit::kInvalidFrameBufferOperation; | |
| 427 default: | |
| 428 NOTREACHED(); | |
| 429 return gl_error_bit::kNoError; | |
| 430 } | |
| 431 } | |
| 432 | |
| 433 uint32 GLES2Util::GLErrorBitToGLError(uint32 error_bit) { | |
| 434 switch (error_bit) { | |
| 435 case gl_error_bit::kInvalidEnum: | |
| 436 return GL_INVALID_ENUM; | |
| 437 case gl_error_bit::kInvalidValue: | |
| 438 return GL_INVALID_VALUE; | |
| 439 case gl_error_bit::kInvalidOperation: | |
| 440 return GL_INVALID_OPERATION; | |
| 441 case gl_error_bit::kOutOfMemory: | |
| 442 return GL_OUT_OF_MEMORY; | |
| 443 case gl_error_bit::kInvalidFrameBufferOperation: | |
| 444 return GL_INVALID_FRAMEBUFFER_OPERATION; | |
| 445 default: | |
| 446 NOTREACHED(); | |
| 447 return GL_NO_ERROR; | |
| 448 } | |
| 449 } | |
| 450 | 404 |
| 451 } // namespace gles2 | 405 } // namespace gles2 |
| 452 } // namespace gpu | 406 } // namespace gpu |
| 453 | 407 |
| OLD | NEW |