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

Unified 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, 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 0011053ad2d63e0892e809baf6c74e1feb57d83b..67a390faeb085b16c23682e46fb8e8bbffd8c9df 100644
--- a/gpu/command_buffer/common/gles2_cmd_utils.cc
+++ b/gpu/command_buffer/common/gles2_cmd_utils.cc
@@ -815,10 +815,16 @@ size_t GLES2Util::GetGLTypeSizeForTexturesAndBuffers(uint32_t type) {
return sizeof(GLfixed); // NOLINT
case GL_HALF_FLOAT:
return sizeof(GLushort); // NOLINT
+ // Packed types need to be handled specially for data_size computation.
+ // See the code in GLES2DecoderImpl::HandleVertexAttribPointer and
+ // VertexAttrib::canAccess: group_size = component_count * component_size.
+ // component_count is assigned by 'size' parameter in vertexAttribPointer,
+ // which is constant 4. component_size is get by this function, so the
+ // size of every component should be 1 for packed types.
case GL_INT_2_10_10_10_REV:
- return sizeof(GLint); // NOLINT
+ 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
case GL_UNSIGNED_INT_2_10_10_10_REV:
- return sizeof(GLuint); // NOLINT
+ return sizeof(GLuint) / 4; // NOLINT
default:
return 0;
}
« 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