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 <sstream> | 8 #include <sstream> |
9 #include <GLES2/gl2.h> | 9 #include <GLES2/gl2.h> |
10 #include <GLES2/gl2ext.h> | 10 #include <GLES2/gl2ext.h> |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 } | 446 } |
447 | 447 |
448 // Return the number of bytes per element, based on the element type. | 448 // Return the number of bytes per element, based on the element type. |
449 int BytesPerElement(int type) { | 449 int BytesPerElement(int type) { |
450 switch (type) { | 450 switch (type) { |
451 case GL_FLOAT_32_UNSIGNED_INT_24_8_REV: | 451 case GL_FLOAT_32_UNSIGNED_INT_24_8_REV: |
452 return 8; | 452 return 8; |
453 case GL_FLOAT: | 453 case GL_FLOAT: |
454 case GL_UNSIGNED_INT_24_8_OES: | 454 case GL_UNSIGNED_INT_24_8_OES: |
455 case GL_UNSIGNED_INT: | 455 case GL_UNSIGNED_INT: |
| 456 case GL_INT: |
456 case GL_UNSIGNED_INT_2_10_10_10_REV: | 457 case GL_UNSIGNED_INT_2_10_10_10_REV: |
457 case GL_UNSIGNED_INT_10F_11F_11F_REV: | 458 case GL_UNSIGNED_INT_10F_11F_11F_REV: |
458 case GL_UNSIGNED_INT_5_9_9_9_REV: | 459 case GL_UNSIGNED_INT_5_9_9_9_REV: |
459 return 4; | 460 return 4; |
460 case GL_HALF_FLOAT: | 461 case GL_HALF_FLOAT: |
461 case GL_HALF_FLOAT_OES: | 462 case GL_HALF_FLOAT_OES: |
462 case GL_UNSIGNED_SHORT: | 463 case GL_UNSIGNED_SHORT: |
463 case GL_SHORT: | 464 case GL_SHORT: |
464 case GL_UNSIGNED_SHORT_5_6_5: | 465 case GL_UNSIGNED_SHORT_5_6_5: |
465 case GL_UNSIGNED_SHORT_4_4_4_4: | 466 case GL_UNSIGNED_SHORT_4_4_4_4: |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 return GL_PIXEL_UNPACK_BUFFER_BINDING; | 1079 return GL_PIXEL_UNPACK_BUFFER_BINDING; |
1079 case GL_TRANSFORM_FEEDBACK_BUFFER: | 1080 case GL_TRANSFORM_FEEDBACK_BUFFER: |
1080 return GL_TRANSFORM_FEEDBACK_BUFFER_BINDING; | 1081 return GL_TRANSFORM_FEEDBACK_BUFFER_BINDING; |
1081 case GL_UNIFORM_BUFFER: | 1082 case GL_UNIFORM_BUFFER: |
1082 return GL_UNIFORM_BUFFER_BINDING; | 1083 return GL_UNIFORM_BUFFER_BINDING; |
1083 default: | 1084 default: |
1084 return 0; | 1085 return 0; |
1085 } | 1086 } |
1086 } | 1087 } |
1087 | 1088 |
| 1089 // static |
| 1090 bool GLES2Util::IsUnsignedIntegerFormat(uint32_t internal_format) { |
| 1091 switch (internal_format) { |
| 1092 case GL_R8UI: |
| 1093 case GL_R16UI: |
| 1094 case GL_R32UI: |
| 1095 case GL_RG8UI: |
| 1096 case GL_RG16UI: |
| 1097 case GL_RG32UI: |
| 1098 case GL_RGBA8UI: |
| 1099 case GL_RGB10_A2UI: |
| 1100 case GL_RGBA16UI: |
| 1101 case GL_RGBA32UI: |
| 1102 return true; |
| 1103 default: |
| 1104 return false; |
| 1105 } |
| 1106 } |
| 1107 |
| 1108 // static |
| 1109 bool GLES2Util::IsSignedIntegerFormat(uint32_t internal_format) { |
| 1110 switch (internal_format) { |
| 1111 case GL_R8I: |
| 1112 case GL_R16I: |
| 1113 case GL_R32I: |
| 1114 case GL_RG8I: |
| 1115 case GL_RG16I: |
| 1116 case GL_RG32I: |
| 1117 case GL_RGBA8I: |
| 1118 case GL_RGBA16I: |
| 1119 case GL_RGBA32I: |
| 1120 return true; |
| 1121 default: |
| 1122 return false; |
| 1123 } |
| 1124 } |
| 1125 |
| 1126 // static |
| 1127 bool GLES2Util::IsIntegerFormat(uint32_t internal_format) { |
| 1128 return (IsUnsignedIntegerFormat(internal_format) || |
| 1129 IsSignedIntegerFormat(internal_format)); |
| 1130 } |
| 1131 |
1088 | 1132 |
1089 namespace { | 1133 namespace { |
1090 | 1134 |
1091 // WebGraphicsContext3DCommandBufferImpl configuration attributes. Those in | 1135 // WebGraphicsContext3DCommandBufferImpl configuration attributes. Those in |
1092 // the 16-bit range are the same as used by EGL. Those outside the 16-bit range | 1136 // the 16-bit range are the same as used by EGL. Those outside the 16-bit range |
1093 // are unique to Chromium. Attributes are matched using a closest fit algorithm. | 1137 // are unique to Chromium. Attributes are matched using a closest fit algorithm. |
1094 | 1138 |
1095 // From <EGL/egl.h>. | 1139 // From <EGL/egl.h>. |
1096 const int32 kAlphaSize = 0x3021; // EGL_ALPHA_SIZE | 1140 const int32 kAlphaSize = 0x3021; // EGL_ALPHA_SIZE |
1097 const int32 kBlueSize = 0x3022; // EGL_BLUE_SIZE | 1141 const int32 kBlueSize = 0x3022; // EGL_BLUE_SIZE |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1240 } | 1284 } |
1241 | 1285 |
1242 return true; | 1286 return true; |
1243 } | 1287 } |
1244 | 1288 |
1245 #include "gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h" | 1289 #include "gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h" |
1246 | 1290 |
1247 } // namespace gles2 | 1291 } // namespace gles2 |
1248 } // namespace gpu | 1292 } // namespace gpu |
1249 | 1293 |
OLD | NEW |