Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: gpu/command_buffer/common/gles2_cmd_utils.cc

Issue 1708983002: Command buffer: Fix bugs for drawing when the type of vertex attrib is a packed type (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed kbr@'s feedback: add some comments to explain the logic Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 797 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 case GL_INT: 808 case GL_INT:
809 return sizeof(GLint); // NOLINT 809 return sizeof(GLint); // NOLINT
810 case GL_UNSIGNED_INT: 810 case GL_UNSIGNED_INT:
811 return sizeof(GLuint); // NOLINT 811 return sizeof(GLuint); // NOLINT
812 case GL_FLOAT: 812 case GL_FLOAT:
813 return sizeof(GLfloat); // NOLINT 813 return sizeof(GLfloat); // NOLINT
814 case GL_FIXED: 814 case GL_FIXED:
815 return sizeof(GLfixed); // NOLINT 815 return sizeof(GLfixed); // NOLINT
816 case GL_HALF_FLOAT: 816 case GL_HALF_FLOAT:
817 return sizeof(GLushort); // NOLINT 817 return sizeof(GLushort); // NOLINT
818 // Packed types need to be handled specially for data_size computation.
819 // See the code in GLES2DecoderImpl::HandleVertexAttribPointer and
820 // VertexAttrib::canAccess: group_size = component_count * component_size.
821 // component_count is assigned by 'size' parameter in vertexAttribPointer,
822 // which is constant 4. component_size is get by this function, so the
823 // size of every component should be 1 for packed types.
818 case GL_INT_2_10_10_10_REV: 824 case GL_INT_2_10_10_10_REV:
819 return sizeof(GLint); // NOLINT 825 return sizeof(GLint) / 4; // NOLINT
Zhenyao Mo 2016/02/25 21:40:43 I still disagree with this. This function calls G
yunchao 2016/02/26 06:45:26 Thanks for your suggestion, Zhenyao. It is a prett
820 case GL_UNSIGNED_INT_2_10_10_10_REV: 826 case GL_UNSIGNED_INT_2_10_10_10_REV:
821 return sizeof(GLuint); // NOLINT 827 return sizeof(GLuint) / 4; // NOLINT
822 default: 828 default:
823 return 0; 829 return 0;
824 } 830 }
825 } 831 }
826 832
827 size_t GLES2Util::GetComponentCountForGLTransformType(uint32_t type) { 833 size_t GLES2Util::GetComponentCountForGLTransformType(uint32_t type) {
828 switch (type) { 834 switch (type) {
829 case GL_TRANSLATE_X_CHROMIUM: 835 case GL_TRANSLATE_X_CHROMIUM:
830 case GL_TRANSLATE_Y_CHROMIUM: 836 case GL_TRANSLATE_Y_CHROMIUM:
831 return 1; 837 return 1;
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
1517 } 1523 }
1518 1524
1519 return true; 1525 return true;
1520 } 1526 }
1521 1527
1522 #include "gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h" 1528 #include "gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h"
1523 1529
1524 } // namespace gles2 1530 } // namespace gles2
1525 } // namespace gpu 1531 } // namespace gpu
1526 1532
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698