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 |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 BytesPerElement(type) * ElementsPerGroup(format, type); | 336 BytesPerElement(type) * ElementsPerGroup(format, type); |
337 uint32 row_size = width * bytes_per_group; | 337 uint32 row_size = width * bytes_per_group; |
338 if (height > 1) { | 338 if (height > 1) { |
339 uint32 padded_row_size = ((row_size + unpack_alignment - 1) / | 339 uint32 padded_row_size = ((row_size + unpack_alignment - 1) / |
340 unpack_alignment) * unpack_alignment; | 340 unpack_alignment) * unpack_alignment; |
341 return (height - 1) * padded_row_size + row_size; | 341 return (height - 1) * padded_row_size + row_size; |
342 } | 342 } |
343 return height * row_size; | 343 return height * row_size; |
344 } | 344 } |
345 | 345 |
| 346 uint32 GLES2Util::GetGLDataTypeSize(int type) { |
| 347 switch (type) { |
| 348 case GL_FLOAT: |
| 349 return sizeof(GLfloat); // NOLINT |
| 350 case GL_FLOAT_VEC2: |
| 351 return sizeof(GLfloat) * 2; // NOLINT |
| 352 case GL_FLOAT_VEC3: |
| 353 return sizeof(GLfloat) * 3; // NOLINT |
| 354 case GL_FLOAT_VEC4: |
| 355 return sizeof(GLfloat) * 4; // NOLINT |
| 356 case GL_INT: |
| 357 return sizeof(GLint); // NOLINT |
| 358 case GL_INT_VEC2: |
| 359 return sizeof(GLint) * 2; // NOLINT |
| 360 case GL_INT_VEC3: |
| 361 return sizeof(GLint) * 3; // NOLINT |
| 362 case GL_INT_VEC4: |
| 363 return sizeof(GLint) * 4; // NOLINT |
| 364 case GL_BOOL: |
| 365 return sizeof(GLint); // NOLINT |
| 366 case GL_BOOL_VEC2: |
| 367 return sizeof(GLint) * 1; // NOLINT |
| 368 case GL_BOOL_VEC3: |
| 369 return sizeof(GLint) * 2; // NOLINT |
| 370 case GL_BOOL_VEC4: |
| 371 return sizeof(GLint) * 3; // NOLINT |
| 372 case GL_FLOAT_MAT2: |
| 373 return sizeof(GLfloat) * 2 * 2; // NOLINT |
| 374 case GL_FLOAT_MAT3: |
| 375 return sizeof(GLfloat) * 3 * 3; // NOLINT |
| 376 case GL_FLOAT_MAT4: |
| 377 return sizeof(GLfloat) * 4 * 4; // NOLINT |
| 378 case GL_SAMPLER_2D: |
| 379 return sizeof(GLint); // NOLINT |
| 380 case GL_SAMPLER_CUBE: |
| 381 return sizeof(GLint); // NOLINT |
| 382 default: |
| 383 return 0; |
| 384 } |
| 385 } |
| 386 |
346 } // namespace gles2 | 387 } // namespace gles2 |
347 } // namespace gpu | 388 } // namespace gpu |
348 | 389 |
OLD | NEW |