OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <list> | 10 #include <list> |
(...skipping 4666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4677 GLboolean normalized = c.normalized; | 4677 GLboolean normalized = c.normalized; |
4678 GLsizei stride = c.stride; | 4678 GLsizei stride = c.stride; |
4679 GLsizei offset = c.offset; | 4679 GLsizei offset = c.offset; |
4680 const void* ptr = reinterpret_cast<const void*>(offset); | 4680 const void* ptr = reinterpret_cast<const void*>(offset); |
4681 if (!validators_->vertex_attrib_type.IsValid(type)) { | 4681 if (!validators_->vertex_attrib_type.IsValid(type)) { |
4682 SetGLError(GL_INVALID_ENUM, | 4682 SetGLError(GL_INVALID_ENUM, |
4683 "glVertexAttribPointer: type GL_INVALID_ENUM"); | 4683 "glVertexAttribPointer: type GL_INVALID_ENUM"); |
4684 return error::kNoError; | 4684 return error::kNoError; |
4685 } | 4685 } |
4686 if (!validators_->vertex_attrib_size.IsValid(size)) { | 4686 if (!validators_->vertex_attrib_size.IsValid(size)) { |
4687 SetGLError(GL_INVALID_ENUM, | 4687 SetGLError(GL_INVALID_VALUE, |
4688 "glVertexAttribPointer: size GL_INVALID_VALUE"); | 4688 "glVertexAttribPointer: size GL_INVALID_VALUE"); |
4689 return error::kNoError; | 4689 return error::kNoError; |
4690 } | 4690 } |
4691 if (indx >= group_->max_vertex_attribs()) { | 4691 if (indx >= group_->max_vertex_attribs()) { |
4692 SetGLError(GL_INVALID_VALUE, "glVertexAttribPointer: index out of range"); | 4692 SetGLError(GL_INVALID_VALUE, "glVertexAttribPointer: index out of range"); |
4693 return error::kNoError; | 4693 return error::kNoError; |
4694 } | 4694 } |
4695 if (stride < 0) { | 4695 if (stride < 0) { |
4696 SetGLError(GL_INVALID_VALUE, | 4696 SetGLError(GL_INVALID_VALUE, |
4697 "glVertexAttribPointer: stride < 0"); | 4697 "glVertexAttribPointer: stride < 0"); |
4698 return error::kNoError; | 4698 return error::kNoError; |
4699 } | 4699 } |
4700 if (stride > 255) { | 4700 if (stride > 255) { |
4701 SetGLError(GL_INVALID_VALUE, | 4701 SetGLError(GL_INVALID_VALUE, |
4702 "glVertexAttribPointer: stride > 255"); | 4702 "glVertexAttribPointer: stride > 255"); |
4703 return error::kNoError; | 4703 return error::kNoError; |
4704 } | 4704 } |
4705 if (offset < 0) { | 4705 if (offset < 0) { |
4706 SetGLError(GL_INVALID_VALUE, | 4706 SetGLError(GL_INVALID_VALUE, |
4707 "glVertexAttribPointer: offset < 0"); | 4707 "glVertexAttribPointer: offset < 0"); |
4708 return error::kNoError; | 4708 return error::kNoError; |
4709 } | 4709 } |
4710 GLsizei component_size = | 4710 GLsizei component_size = |
4711 GLES2Util::GetGLTypeSizeForTexturesAndBuffers(type); | 4711 GLES2Util::GetGLTypeSizeForTexturesAndBuffers(type); |
4712 if (offset % component_size > 0) { | 4712 if (offset % component_size > 0) { |
4713 SetGLError(GL_INVALID_VALUE, | 4713 SetGLError(GL_INVALID_OPERATION, |
| 4714 "glVertexAttribPointer: offset not valid for type"); |
| 4715 return error::kNoError; |
| 4716 } |
| 4717 if (stride % component_size > 0) { |
| 4718 SetGLError(GL_INVALID_OPERATION, |
4714 "glVertexAttribPointer: stride not valid for type"); | 4719 "glVertexAttribPointer: stride not valid for type"); |
4715 return error::kNoError; | 4720 return error::kNoError; |
4716 } | 4721 } |
4717 vertex_attrib_manager_.SetAttribInfo( | 4722 vertex_attrib_manager_.SetAttribInfo( |
4718 indx, | 4723 indx, |
4719 bound_array_buffer_, | 4724 bound_array_buffer_, |
4720 size, | 4725 size, |
4721 type, | 4726 type, |
4722 normalized, | 4727 normalized, |
4723 stride, | 4728 stride, |
(...skipping 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6086 return error::kNoError; | 6091 return error::kNoError; |
6087 } | 6092 } |
6088 | 6093 |
6089 // Include the auto-generated part of this file. We split this because it means | 6094 // Include the auto-generated part of this file. We split this because it means |
6090 // we can easily edit the non-auto generated parts right here in this file | 6095 // we can easily edit the non-auto generated parts right here in this file |
6091 // instead of having to edit some template or the code generator. | 6096 // instead of having to edit some template or the code generator. |
6092 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 6097 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
6093 | 6098 |
6094 } // namespace gles2 | 6099 } // namespace gles2 |
6095 } // namespace gpu | 6100 } // namespace gpu |
OLD | NEW |