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

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 zmo@'s feedback Created 4 years, 10 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
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 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 return 8; 788 return 8;
789 case GL_FLOAT_MAT3x4: 789 case GL_FLOAT_MAT3x4:
790 case GL_FLOAT_MAT4x3: 790 case GL_FLOAT_MAT4x3:
791 return 12; 791 return 12;
792 792
793 default: 793 default:
794 return 0; 794 return 0;
795 } 795 }
796 } 796 }
797 797
798 size_t GLES2Util::GetGLTypeSizeForTexturesAndBuffers(uint32_t type) { 798 size_t GLES2Util::GetGLTypeSizeForBuffers(uint32_t type) {
799 switch (type) { 799 switch (type) {
800 case GL_BYTE: 800 case GL_BYTE:
801 return sizeof(GLbyte); // NOLINT 801 return sizeof(GLbyte); // NOLINT
802 case GL_UNSIGNED_BYTE: 802 case GL_UNSIGNED_BYTE:
803 return sizeof(GLubyte); // NOLINT 803 return sizeof(GLubyte); // NOLINT
804 case GL_SHORT: 804 case GL_SHORT:
805 return sizeof(GLshort); // NOLINT 805 return sizeof(GLshort); // NOLINT
806 case GL_UNSIGNED_SHORT: 806 case GL_UNSIGNED_SHORT:
807 return sizeof(GLushort); // NOLINT 807 return sizeof(GLushort); // NOLINT
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 case GL_INT_2_10_10_10_REV: 818 case GL_INT_2_10_10_10_REV:
819 return sizeof(GLint); // NOLINT 819 return sizeof(GLint); // NOLINT
820 case GL_UNSIGNED_INT_2_10_10_10_REV: 820 case GL_UNSIGNED_INT_2_10_10_10_REV:
821 return sizeof(GLuint); // NOLINT 821 return sizeof(GLuint); // NOLINT
822 default: 822 default:
823 return 0; 823 return 0;
824 } 824 }
825 } 825 }
826 826
827 size_t GLES2Util::GetGroupSizeForBufferType(uint32_t count, uint32_t type) {
828 size_t type_size = GetGLTypeSizeForBuffers(type);
829 // For packed types, group size equals to the type size.
830 if (type == GL_INT_2_10_10_10_REV || type == GL_UNSIGNED_INT_2_10_10_10_REV)
831 return type_size;
Zhenyao Mo 2016/02/26 04:24:29 nit: please DCHECK_EQ(4u, count) here.
yunchao 2016/02/26 06:45:26 Done.
832 return type_size * count;
833 }
827 size_t GLES2Util::GetComponentCountForGLTransformType(uint32_t type) { 834 size_t GLES2Util::GetComponentCountForGLTransformType(uint32_t type) {
828 switch (type) { 835 switch (type) {
829 case GL_TRANSLATE_X_CHROMIUM: 836 case GL_TRANSLATE_X_CHROMIUM:
830 case GL_TRANSLATE_Y_CHROMIUM: 837 case GL_TRANSLATE_Y_CHROMIUM:
831 return 1; 838 return 1;
832 case GL_TRANSLATE_2D_CHROMIUM: 839 case GL_TRANSLATE_2D_CHROMIUM:
833 return 2; 840 return 2;
834 case GL_TRANSLATE_3D_CHROMIUM: 841 case GL_TRANSLATE_3D_CHROMIUM:
835 return 3; 842 return 3;
836 case GL_AFFINE_2D_CHROMIUM: 843 case GL_AFFINE_2D_CHROMIUM:
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
1517 } 1524 }
1518 1525
1519 return true; 1526 return true;
1520 } 1527 }
1521 1528
1522 #include "gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h" 1529 #include "gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h"
1523 1530
1524 } // namespace gles2 1531 } // namespace gles2
1525 } // namespace gpu 1532 } // namespace gpu
1526 1533
OLDNEW
« no previous file with comments | « gpu/command_buffer/common/gles2_cmd_utils.h ('k') | gpu/command_buffer/service/buffer_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698