Index: gpu/command_buffer/common/gles2_cmd_utils.cc |
diff --git a/gpu/command_buffer/common/gles2_cmd_utils.cc b/gpu/command_buffer/common/gles2_cmd_utils.cc |
index 817efc124367008ba1f9efdd241d5a69f192076d..de4a2e3dbd3b5027bc13cec51de70873f7bf2114 100644 |
--- a/gpu/command_buffer/common/gles2_cmd_utils.cc |
+++ b/gpu/command_buffer/common/gles2_cmd_utils.cc |
@@ -475,8 +475,39 @@ int GLES2Util::GLGetNumValuesReturned(int id) const { |
namespace { |
+// Return the number of bytes per element, based on the element type. |
+int BytesPerElement(int type) { |
+ switch (type) { |
+ case GL_FLOAT_32_UNSIGNED_INT_24_8_REV: |
+ return 8; |
+ case GL_FLOAT: |
+ case GL_UNSIGNED_INT_24_8_OES: |
+ case GL_UNSIGNED_INT: |
+ case GL_INT: |
+ case GL_UNSIGNED_INT_2_10_10_10_REV: |
+ case GL_UNSIGNED_INT_10F_11F_11F_REV: |
+ case GL_UNSIGNED_INT_5_9_9_9_REV: |
+ return 4; |
+ case GL_HALF_FLOAT: |
+ case GL_HALF_FLOAT_OES: |
+ case GL_UNSIGNED_SHORT: |
+ case GL_SHORT: |
+ case GL_UNSIGNED_SHORT_5_6_5: |
+ case GL_UNSIGNED_SHORT_4_4_4_4: |
+ case GL_UNSIGNED_SHORT_5_5_5_1: |
+ return 2; |
+ case GL_UNSIGNED_BYTE: |
+ case GL_BYTE: |
+ return 1; |
+ default: |
+ return 0; |
+ } |
+} |
+ |
+} // anonymous namespace |
+ |
// Return the number of elements per group of a specified format. |
-int ElementsPerGroup(int format, int type) { |
+int GLES2Util::ElementsPerGroup(int format, int type) { |
switch (type) { |
case GL_UNSIGNED_SHORT_5_6_5: |
case GL_UNSIGNED_SHORT_4_4_4_4: |
@@ -521,37 +552,6 @@ int ElementsPerGroup(int format, int type) { |
} |
} |
-// Return the number of bytes per element, based on the element type. |
-int BytesPerElement(int type) { |
- switch (type) { |
- case GL_FLOAT_32_UNSIGNED_INT_24_8_REV: |
- return 8; |
- case GL_FLOAT: |
- case GL_UNSIGNED_INT_24_8_OES: |
- case GL_UNSIGNED_INT: |
- case GL_INT: |
- case GL_UNSIGNED_INT_2_10_10_10_REV: |
- case GL_UNSIGNED_INT_10F_11F_11F_REV: |
- case GL_UNSIGNED_INT_5_9_9_9_REV: |
- return 4; |
- case GL_HALF_FLOAT: |
- case GL_HALF_FLOAT_OES: |
- case GL_UNSIGNED_SHORT: |
- case GL_SHORT: |
- case GL_UNSIGNED_SHORT_5_6_5: |
- case GL_UNSIGNED_SHORT_4_4_4_4: |
- case GL_UNSIGNED_SHORT_5_5_5_1: |
- return 2; |
- case GL_UNSIGNED_BYTE: |
- case GL_BYTE: |
- return 1; |
- default: |
- return 0; |
- } |
-} |
- |
-} // anonymous namespace |
- |
uint32_t GLES2Util::ComputeImageGroupSize(int format, int type) { |
int bytes_per_element = BytesPerElement(type); |
DCHECK_GE(8, bytes_per_element); |