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

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder.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: 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
Index: gpu/command_buffer/service/gles2_cmd_decoder.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index ae331e5a4a080d4cf275e8cb35d2caf30011a28a..67d05245a7d89848f35afc32c5d382300fa8b2f0 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -8919,15 +8919,19 @@ error::Error GLES2DecoderImpl::HandleVertexAttribPointer(
}
GLsizei component_size =
GLES2Util::GetGLTypeSizeForTexturesAndBuffers(type);
- // component_size must be a power of two to use & as optimized modulo.
- DCHECK(GLES2Util::IsPOT(component_size));
- if (offset & (component_size - 1)) {
+ GLsizei data_size = component_size;
+ if (type == GL_INT_2_10_10_10_REV || type == GL_UNSIGNED_INT_2_10_10_10_REV) {
+ data_size = component_size * size;
+ }
+ // data_size must be a power of two to use & as optimized modulo.
+ DCHECK(GLES2Util::IsPOT(data_size));
+ if (offset & (data_size - 1)) {
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION,
"glVertexAttribPointer", "offset not valid for type");
return error::kNoError;
}
- if (stride & (component_size - 1)) {
+ if (stride & (data_size - 1)) {
yunchao 2016/02/18 14:55:30 The offset and stride should be aligned with the e
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION,
"glVertexAttribPointer", "stride not valid for type");
« gpu/command_buffer/common/gles2_cmd_utils.cc ('K') | « gpu/command_buffer/common/gles2_cmd_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698