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 <list> | 7 #include <list> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 } | 38 } |
39 | 39 |
40 VertexAttribManager::VertexAttribInfo::~VertexAttribInfo() { | 40 VertexAttribManager::VertexAttribInfo::~VertexAttribInfo() { |
41 } | 41 } |
42 | 42 |
43 bool VertexAttribManager::VertexAttribInfo::CanAccess(GLuint index) const { | 43 bool VertexAttribManager::VertexAttribInfo::CanAccess(GLuint index) const { |
44 if (!enabled_) { | 44 if (!enabled_) { |
45 return true; | 45 return true; |
46 } | 46 } |
47 | 47 |
48 if (!buffer_ || buffer_->IsDeleted()) { | 48 if (!buffer_.get() || buffer_->IsDeleted()) { |
49 return false; | 49 return false; |
50 } | 50 } |
51 | 51 |
52 // The number of elements that can be accessed. | 52 // The number of elements that can be accessed. |
53 GLsizeiptr buffer_size = buffer_->size(); | 53 GLsizeiptr buffer_size = buffer_->size(); |
54 if (offset_ > buffer_size || real_stride_ == 0) { | 54 if (offset_ > buffer_size || real_stride_ == 0) { |
55 return false; | 55 return false; |
56 } | 56 } |
57 | 57 |
58 uint32 usable_size = buffer_size - offset_; | 58 uint32 usable_size = buffer_size - offset_; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 } | 118 } |
119 VertexAttribInfo& info = vertex_attrib_infos_[index]; | 119 VertexAttribInfo& info = vertex_attrib_infos_[index]; |
120 if (info.enabled() != enable) { | 120 if (info.enabled() != enable) { |
121 info.set_enabled(enable); | 121 info.set_enabled(enable); |
122 info.SetList(enable ? &enabled_vertex_attribs_ : &disabled_vertex_attribs_); | 122 info.SetList(enable ? &enabled_vertex_attribs_ : &disabled_vertex_attribs_); |
123 } | 123 } |
124 return true; | 124 return true; |
125 } | 125 } |
126 | 126 |
127 void VertexAttribManager::Unbind(BufferManager::BufferInfo* buffer) { | 127 void VertexAttribManager::Unbind(BufferManager::BufferInfo* buffer) { |
128 if (element_array_buffer_ == buffer) { | 128 if (element_array_buffer_.get() == buffer) { |
129 element_array_buffer_ = NULL; | 129 element_array_buffer_ = NULL; |
130 } | 130 } |
131 for (uint32 vv = 0; vv < max_vertex_attribs_; ++vv) { | 131 for (uint32 vv = 0; vv < max_vertex_attribs_; ++vv) { |
132 vertex_attrib_infos_[vv].Unbind(buffer); | 132 vertex_attrib_infos_[vv].Unbind(buffer); |
133 } | 133 } |
134 } | 134 } |
135 | 135 |
136 } // namespace gles2 | 136 } // namespace gles2 |
137 } // namespace gpu | 137 } // namespace gpu |
OLD | NEW |