| 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/vertex_attrib_manager.h" | 5 #include "gpu/command_buffer/service/vertex_attrib_manager.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 | 10 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 // The number of elements that can be accessed. | 82 // The number of elements that can be accessed. |
| 83 GLsizeiptr buffer_size = buffer_->size(); | 83 GLsizeiptr buffer_size = buffer_->size(); |
| 84 if (offset_ > buffer_size || real_stride_ == 0) { | 84 if (offset_ > buffer_size || real_stride_ == 0) { |
| 85 return false; | 85 return false; |
| 86 } | 86 } |
| 87 | 87 |
| 88 uint32_t usable_size = buffer_size - offset_; | 88 uint32_t usable_size = buffer_size - offset_; |
| 89 GLuint num_elements = usable_size / real_stride_ + | 89 GLuint num_elements = usable_size / real_stride_ + |
| 90 ((usable_size % real_stride_) >= | 90 ((usable_size % real_stride_) >= |
| 91 (GLES2Util::GetGLTypeSizeForTexturesAndBuffers(type_) * size_) ? 1 : 0); | 91 (GLES2Util::GetGroupSizeForBufferType(size_, type_)) ? 1 : 0); |
| 92 return index < num_elements; | 92 return index < num_elements; |
| 93 } | 93 } |
| 94 | 94 |
| 95 VertexAttribManager::VertexAttribManager() | 95 VertexAttribManager::VertexAttribManager() |
| 96 : num_fixed_attribs_(0), | 96 : num_fixed_attribs_(0), |
| 97 element_array_buffer_(NULL), | 97 element_array_buffer_(NULL), |
| 98 manager_(NULL), | 98 manager_(NULL), |
| 99 deleted_(false), | 99 deleted_(false), |
| 100 service_id_(0) { | 100 service_id_(0) { |
| 101 } | 101 } |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 if (current_buffer_id != kInitialBufferId) { | 274 if (current_buffer_id != kInitialBufferId) { |
| 275 // Restore the buffer binding. | 275 // Restore the buffer binding. |
| 276 decoder->RestoreBufferBindings(); | 276 decoder->RestoreBufferBindings(); |
| 277 } | 277 } |
| 278 | 278 |
| 279 return true; | 279 return true; |
| 280 } | 280 } |
| 281 | 281 |
| 282 } // namespace gles2 | 282 } // namespace gles2 |
| 283 } // namespace gpu | 283 } // namespace gpu |
| OLD | NEW |