| OLD | NEW |
| 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 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| (...skipping 8986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8997 GL_INVALID_VALUE, "glVertexAttribPointer", "stride > 255"); | 8997 GL_INVALID_VALUE, "glVertexAttribPointer", "stride > 255"); |
| 8998 return error::kNoError; | 8998 return error::kNoError; |
| 8999 } | 8999 } |
| 9000 if (offset < 0) { | 9000 if (offset < 0) { |
| 9001 LOCAL_SET_GL_ERROR( | 9001 LOCAL_SET_GL_ERROR( |
| 9002 GL_INVALID_VALUE, "glVertexAttribPointer", "offset < 0"); | 9002 GL_INVALID_VALUE, "glVertexAttribPointer", "offset < 0"); |
| 9003 return error::kNoError; | 9003 return error::kNoError; |
| 9004 } | 9004 } |
| 9005 GLsizei component_size = | 9005 GLsizei component_size = |
| 9006 GLES2Util::GetGLTypeSizeForTexturesAndBuffers(type); | 9006 GLES2Util::GetGLTypeSizeForTexturesAndBuffers(type); |
| 9007 // component_size must be a power of two to use & as optimized modulo. | 9007 GLsizei data_size = component_size; |
| 9008 DCHECK(GLES2Util::IsPOT(component_size)); | 9008 if (type == GL_INT_2_10_10_10_REV || type == GL_UNSIGNED_INT_2_10_10_10_REV) { |
| 9009 if (offset & (component_size - 1)) { | 9009 // stride/offset should be aligned with group_size for packed types, |
| 9010 // instead of component_size. |
| 9011 data_size = component_size * size; |
| 9012 } |
| 9013 // data_size must be a power of two to use & as optimized modulo. |
| 9014 DCHECK(GLES2Util::IsPOT(data_size)); |
| 9015 if (offset & (data_size - 1)) { |
| 9010 LOCAL_SET_GL_ERROR( | 9016 LOCAL_SET_GL_ERROR( |
| 9011 GL_INVALID_OPERATION, | 9017 GL_INVALID_OPERATION, |
| 9012 "glVertexAttribPointer", "offset not valid for type"); | 9018 "glVertexAttribPointer", "offset not valid for type"); |
| 9013 return error::kNoError; | 9019 return error::kNoError; |
| 9014 } | 9020 } |
| 9015 if (stride & (component_size - 1)) { | 9021 if (stride & (data_size - 1)) { |
| 9016 LOCAL_SET_GL_ERROR( | 9022 LOCAL_SET_GL_ERROR( |
| 9017 GL_INVALID_OPERATION, | 9023 GL_INVALID_OPERATION, |
| 9018 "glVertexAttribPointer", "stride not valid for type"); | 9024 "glVertexAttribPointer", "stride not valid for type"); |
| 9019 return error::kNoError; | 9025 return error::kNoError; |
| 9020 } | 9026 } |
| 9021 state_.vertex_attrib_manager | 9027 state_.vertex_attrib_manager |
| 9022 ->SetAttribInfo(indx, | 9028 ->SetAttribInfo(indx, |
| 9023 state_.bound_array_buffer.get(), | 9029 state_.bound_array_buffer.get(), |
| 9024 size, | 9030 size, |
| 9025 type, | 9031 type, |
| (...skipping 6924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15950 } | 15956 } |
| 15951 | 15957 |
| 15952 // Include the auto-generated part of this file. We split this because it means | 15958 // Include the auto-generated part of this file. We split this because it means |
| 15953 // we can easily edit the non-auto generated parts right here in this file | 15959 // we can easily edit the non-auto generated parts right here in this file |
| 15954 // instead of having to edit some template or the code generator. | 15960 // instead of having to edit some template or the code generator. |
| 15955 #include "base/macros.h" | 15961 #include "base/macros.h" |
| 15956 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 15962 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 15957 | 15963 |
| 15958 } // namespace gles2 | 15964 } // namespace gles2 |
| 15959 } // namespace gpu | 15965 } // namespace gpu |
| OLD | NEW |