Chromium Code Reviews| 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"); |