| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 9 |
| 10 #include <GLES2/gl2.h> | 10 #include <GLES2/gl2.h> |
| 11 #include <GLES2/gl2ext.h> | 11 #include <GLES2/gl2ext.h> |
| 12 #include <GLES2/gl2extchromium.h> | 12 #include <GLES2/gl2extchromium.h> |
| 13 #include <GLES3/gl3.h> | 13 #include <GLES3/gl3.h> |
| 14 | 14 |
| 15 #include <sstream> | 15 #include <sstream> |
| 16 | 16 |
| 17 #include "base/numerics/safe_math.h" | 17 #include "base/numerics/safe_math.h" |
| 18 | 18 |
| 19 namespace gpu { | 19 namespace gpu { |
| 20 namespace gles2 { | 20 namespace gles2 { |
| 21 | 21 |
| 22 namespace gl_error_bit { | 22 namespace gl_error_bit { |
| 23 enum GLErrorBit { | 23 enum GLErrorBit { |
| 24 kNoError = 0, | 24 kNoError = 0, |
| 25 kInvalidEnum = (1 << 0), | 25 kInvalidEnum = (1 << 0), |
| 26 kInvalidValue = (1 << 1), | 26 kInvalidValue = (1 << 1), |
| 27 kInvalidOperation = (1 << 2), | 27 kInvalidOperation = (1 << 2), |
| 28 kOutOfMemory = (1 << 3), | 28 kOutOfMemory = (1 << 3), |
| 29 kInvalidFrameBufferOperation = (1 << 4), | 29 kInvalidFramebufferOperation = (1 << 4), |
| 30 kContextLost = (1 << 5) | 30 kContextLost = (1 << 5) |
| 31 }; | 31 }; |
| 32 } // namespace gl_error_bit | 32 } // namespace gl_error_bit |
| 33 | 33 |
| 34 int GLES2Util::GLGetNumValuesReturned(int id) const { | 34 int GLES2Util::GLGetNumValuesReturned(int id) const { |
| 35 switch (id) { | 35 switch (id) { |
| 36 // -- glGetBooleanv, glGetFloatv, glGetIntergerv | 36 // -- glGetBooleanv, glGetFloatv, glGetIntergerv |
| 37 case GL_ACTIVE_TEXTURE: | 37 case GL_ACTIVE_TEXTURE: |
| 38 return 1; | 38 return 1; |
| 39 case GL_ALIASED_LINE_WIDTH_RANGE: | 39 case GL_ALIASED_LINE_WIDTH_RANGE: |
| (...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 switch (error) { | 914 switch (error) { |
| 915 case GL_INVALID_ENUM: | 915 case GL_INVALID_ENUM: |
| 916 return gl_error_bit::kInvalidEnum; | 916 return gl_error_bit::kInvalidEnum; |
| 917 case GL_INVALID_VALUE: | 917 case GL_INVALID_VALUE: |
| 918 return gl_error_bit::kInvalidValue; | 918 return gl_error_bit::kInvalidValue; |
| 919 case GL_INVALID_OPERATION: | 919 case GL_INVALID_OPERATION: |
| 920 return gl_error_bit::kInvalidOperation; | 920 return gl_error_bit::kInvalidOperation; |
| 921 case GL_OUT_OF_MEMORY: | 921 case GL_OUT_OF_MEMORY: |
| 922 return gl_error_bit::kOutOfMemory; | 922 return gl_error_bit::kOutOfMemory; |
| 923 case GL_INVALID_FRAMEBUFFER_OPERATION: | 923 case GL_INVALID_FRAMEBUFFER_OPERATION: |
| 924 return gl_error_bit::kInvalidFrameBufferOperation; | 924 return gl_error_bit::kInvalidFramebufferOperation; |
| 925 case GL_CONTEXT_LOST_KHR: | 925 case GL_CONTEXT_LOST_KHR: |
| 926 return gl_error_bit::kContextLost; | 926 return gl_error_bit::kContextLost; |
| 927 default: | 927 default: |
| 928 NOTREACHED(); | 928 NOTREACHED(); |
| 929 return gl_error_bit::kNoError; | 929 return gl_error_bit::kNoError; |
| 930 } | 930 } |
| 931 } | 931 } |
| 932 | 932 |
| 933 uint32_t GLES2Util::GLErrorBitToGLError(uint32_t error_bit) { | 933 uint32_t GLES2Util::GLErrorBitToGLError(uint32_t error_bit) { |
| 934 switch (error_bit) { | 934 switch (error_bit) { |
| 935 case gl_error_bit::kInvalidEnum: | 935 case gl_error_bit::kInvalidEnum: |
| 936 return GL_INVALID_ENUM; | 936 return GL_INVALID_ENUM; |
| 937 case gl_error_bit::kInvalidValue: | 937 case gl_error_bit::kInvalidValue: |
| 938 return GL_INVALID_VALUE; | 938 return GL_INVALID_VALUE; |
| 939 case gl_error_bit::kInvalidOperation: | 939 case gl_error_bit::kInvalidOperation: |
| 940 return GL_INVALID_OPERATION; | 940 return GL_INVALID_OPERATION; |
| 941 case gl_error_bit::kOutOfMemory: | 941 case gl_error_bit::kOutOfMemory: |
| 942 return GL_OUT_OF_MEMORY; | 942 return GL_OUT_OF_MEMORY; |
| 943 case gl_error_bit::kInvalidFrameBufferOperation: | 943 case gl_error_bit::kInvalidFramebufferOperation: |
| 944 return GL_INVALID_FRAMEBUFFER_OPERATION; | 944 return GL_INVALID_FRAMEBUFFER_OPERATION; |
| 945 case gl_error_bit::kContextLost: | 945 case gl_error_bit::kContextLost: |
| 946 return GL_CONTEXT_LOST_KHR; | 946 return GL_CONTEXT_LOST_KHR; |
| 947 default: | 947 default: |
| 948 NOTREACHED(); | 948 NOTREACHED(); |
| 949 return GL_NO_ERROR; | 949 return GL_NO_ERROR; |
| 950 } | 950 } |
| 951 } | 951 } |
| 952 | 952 |
| 953 uint32_t GLES2Util::IndexToGLFaceTarget(int index) { | 953 uint32_t GLES2Util::IndexToGLFaceTarget(int index) { |
| (...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1876 } | 1876 } |
| 1877 | 1877 |
| 1878 return true; | 1878 return true; |
| 1879 } | 1879 } |
| 1880 | 1880 |
| 1881 #include "gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h" | 1881 #include "gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h" |
| 1882 | 1882 |
| 1883 } // namespace gles2 | 1883 } // namespace gles2 |
| 1884 } // namespace gpu | 1884 } // namespace gpu |
| 1885 | 1885 |
| OLD | NEW |