| 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_array_manager.h" | 5 #include "gpu/command_buffer/service/vertex_array_manager.h" |
| 6 #include "base/debug/trace_event.h" | 6 #include "base/debug/trace_event.h" |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 8 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 9 #include "gpu/command_buffer/service/buffer_manager.h" | 9 #include "gpu/command_buffer/service/buffer_manager.h" |
| 10 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 10 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 VertexArrayManager::~VertexArrayManager() { | 21 VertexArrayManager::~VertexArrayManager() { |
| 22 DCHECK(vertex_attrib_managers_.empty()); | 22 DCHECK(vertex_attrib_managers_.empty()); |
| 23 CHECK_EQ(vertex_attrib_manager_count_, 0u); | 23 CHECK_EQ(vertex_attrib_manager_count_, 0u); |
| 24 } | 24 } |
| 25 | 25 |
| 26 void VertexArrayManager::Destroy(bool have_context) { | 26 void VertexArrayManager::Destroy(bool have_context) { |
| 27 have_context_ = have_context; | 27 have_context_ = have_context; |
| 28 vertex_attrib_managers_.clear(); | 28 vertex_attrib_managers_.clear(); |
| 29 } | 29 } |
| 30 | 30 |
| 31 scoped_refptr<VertexAttribManager> | 31 void VertexArrayManager::CreateVertexAttribManager( |
| 32 VertexArrayManager::CreateVertexAttribManager(GLuint client_id, | 32 GLuint client_id, GLuint service_id, uint32 num_vertex_attribs) { |
| 33 GLuint service_id, | |
| 34 uint32 num_vertex_attribs, | |
| 35 bool client_visible) { | |
| 36 scoped_refptr<VertexAttribManager> vertex_attrib_manager( | 33 scoped_refptr<VertexAttribManager> vertex_attrib_manager( |
| 37 new VertexAttribManager(this, service_id, num_vertex_attribs)); | 34 new VertexAttribManager(this, service_id, num_vertex_attribs)); |
| 38 | 35 std::pair<VertexAttribManagerMap::iterator, bool> result = |
| 39 if (client_visible) { | 36 vertex_attrib_managers_.insert( |
| 40 std::pair<VertexAttribManagerMap::iterator, bool> result = | 37 std::make_pair(client_id, vertex_attrib_manager)); |
| 41 vertex_attrib_managers_.insert( | 38 DCHECK(result.second); |
| 42 std::make_pair(client_id, vertex_attrib_manager)); | |
| 43 DCHECK(result.second); | |
| 44 } | |
| 45 | |
| 46 return vertex_attrib_manager; | |
| 47 } | 39 } |
| 48 | 40 |
| 49 VertexAttribManager* VertexArrayManager::GetVertexAttribManager( | 41 VertexAttribManager* VertexArrayManager::GetVertexAttribManager( |
| 50 GLuint client_id) { | 42 GLuint client_id) { |
| 51 VertexAttribManagerMap::iterator it = vertex_attrib_managers_.find(client_id); | 43 VertexAttribManagerMap::iterator it = vertex_attrib_managers_.find(client_id); |
| 52 return it != vertex_attrib_managers_.end() ? it->second.get() : NULL; | 44 return it != vertex_attrib_managers_.end() ? it->second.get() : NULL; |
| 53 } | 45 } |
| 54 | 46 |
| 55 void VertexArrayManager::RemoveVertexAttribManager(GLuint client_id) { | 47 void VertexArrayManager::RemoveVertexAttribManager(GLuint client_id) { |
| 56 VertexAttribManagerMap::iterator it = vertex_attrib_managers_.find(client_id); | 48 VertexAttribManagerMap::iterator it = vertex_attrib_managers_.find(client_id); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 82 return true; | 74 return true; |
| 83 } | 75 } |
| 84 } | 76 } |
| 85 return false; | 77 return false; |
| 86 } | 78 } |
| 87 | 79 |
| 88 } // namespace gles2 | 80 } // namespace gles2 |
| 89 } // namespace gpu | 81 } // namespace gpu |
| 90 | 82 |
| 91 | 83 |
| OLD | NEW |