Chromium Code Reviews| 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 8901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8912 GL_INVALID_VALUE, "glVertexAttribPointer", "stride > 255"); | 8912 GL_INVALID_VALUE, "glVertexAttribPointer", "stride > 255"); |
| 8913 return error::kNoError; | 8913 return error::kNoError; |
| 8914 } | 8914 } |
| 8915 if (offset < 0) { | 8915 if (offset < 0) { |
| 8916 LOCAL_SET_GL_ERROR( | 8916 LOCAL_SET_GL_ERROR( |
| 8917 GL_INVALID_VALUE, "glVertexAttribPointer", "offset < 0"); | 8917 GL_INVALID_VALUE, "glVertexAttribPointer", "offset < 0"); |
| 8918 return error::kNoError; | 8918 return error::kNoError; |
| 8919 } | 8919 } |
| 8920 GLsizei component_size = | 8920 GLsizei component_size = |
| 8921 GLES2Util::GetGLTypeSizeForTexturesAndBuffers(type); | 8921 GLES2Util::GetGLTypeSizeForTexturesAndBuffers(type); |
| 8922 // component_size must be a power of two to use & as optimized modulo. | 8922 GLsizei data_size = component_size; |
| 8923 DCHECK(GLES2Util::IsPOT(component_size)); | 8923 if (type == GL_INT_2_10_10_10_REV || type == GL_UNSIGNED_INT_2_10_10_10_REV) { |
| 8924 if (offset & (component_size - 1)) { | 8924 data_size = component_size * size; |
| 8925 } | |
| 8926 // data_size must be a power of two to use & as optimized modulo. | |
| 8927 DCHECK(GLES2Util::IsPOT(data_size)); | |
| 8928 if (offset & (data_size - 1)) { | |
| 8925 LOCAL_SET_GL_ERROR( | 8929 LOCAL_SET_GL_ERROR( |
| 8926 GL_INVALID_OPERATION, | 8930 GL_INVALID_OPERATION, |
| 8927 "glVertexAttribPointer", "offset not valid for type"); | 8931 "glVertexAttribPointer", "offset not valid for type"); |
| 8928 return error::kNoError; | 8932 return error::kNoError; |
| 8929 } | 8933 } |
| 8930 if (stride & (component_size - 1)) { | 8934 if (stride & (data_size - 1)) { |
|
yunchao
2016/02/18 14:55:30
The offset and stride should be aligned with the e
| |
| 8931 LOCAL_SET_GL_ERROR( | 8935 LOCAL_SET_GL_ERROR( |
| 8932 GL_INVALID_OPERATION, | 8936 GL_INVALID_OPERATION, |
| 8933 "glVertexAttribPointer", "stride not valid for type"); | 8937 "glVertexAttribPointer", "stride not valid for type"); |
| 8934 return error::kNoError; | 8938 return error::kNoError; |
| 8935 } | 8939 } |
| 8936 state_.vertex_attrib_manager | 8940 state_.vertex_attrib_manager |
| 8937 ->SetAttribInfo(indx, | 8941 ->SetAttribInfo(indx, |
| 8938 state_.bound_array_buffer.get(), | 8942 state_.bound_array_buffer.get(), |
| 8939 size, | 8943 size, |
| 8940 type, | 8944 type, |
| (...skipping 6713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 15654 } | 15658 } |
| 15655 | 15659 |
| 15656 // Include the auto-generated part of this file. We split this because it means | 15660 // Include the auto-generated part of this file. We split this because it means |
| 15657 // we can easily edit the non-auto generated parts right here in this file | 15661 // we can easily edit the non-auto generated parts right here in this file |
| 15658 // instead of having to edit some template or the code generator. | 15662 // instead of having to edit some template or the code generator. |
| 15659 #include "base/macros.h" | 15663 #include "base/macros.h" |
| 15660 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 15664 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 15661 | 15665 |
| 15662 } // namespace gles2 | 15666 } // namespace gles2 |
| 15663 } // namespace gpu | 15667 } // namespace gpu |
| OLD | NEW |