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 |
14 int GLES2Util::GLGetNumValuesReturned(int id) const { | 25 int GLES2Util::GLGetNumValuesReturned(int id) const { |
15 switch (id) { | 26 switch (id) { |
16 // -- glGetBooleanv, glGetFloatv, glGetIntergerv | 27 // -- glGetBooleanv, glGetFloatv, glGetIntergerv |
17 case GL_ACTIVE_TEXTURE: | 28 case GL_ACTIVE_TEXTURE: |
18 return 1; | 29 return 1; |
19 case GL_ALIASED_LINE_WIDTH_RANGE: | 30 case GL_ALIASED_LINE_WIDTH_RANGE: |
20 return 2; | 31 return 2; |
21 case GL_ALIASED_POINT_SIZE_RANGE: | 32 case GL_ALIASED_POINT_SIZE_RANGE: |
22 return 1; | 33 return 1; |
23 case GL_ALPHA_BITS: | 34 case GL_ALPHA_BITS: |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 return sizeof(GLshort); // NOLINT | 405 return sizeof(GLshort); // NOLINT |
395 case GL_UNSIGNED_SHORT: | 406 case GL_UNSIGNED_SHORT: |
396 return sizeof(GLushort); // NOLINT | 407 return sizeof(GLushort); // NOLINT |
397 case GL_FLOAT: | 408 case GL_FLOAT: |
398 return sizeof(GLfloat); // NOLINT | 409 return sizeof(GLfloat); // NOLINT |
399 default: | 410 default: |
400 return 0; | 411 return 0; |
401 } | 412 } |
402 } | 413 } |
403 | 414 |
| 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 } |
404 | 450 |
405 } // namespace gles2 | 451 } // namespace gles2 |
406 } // namespace gpu | 452 } // namespace gpu |
407 | 453 |
OLD | NEW |