| 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 | 6 |
| 7 #include <stdint.h> |
| 8 |
| 7 #include "base/logging.h" | 9 #include "base/logging.h" |
| 8 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| 9 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 11 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 10 #include "gpu/command_buffer/service/buffer_manager.h" | 12 #include "gpu/command_buffer/service/buffer_manager.h" |
| 11 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 13 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 12 #include "gpu/command_buffer/service/vertex_attrib_manager.h" | 14 #include "gpu/command_buffer/service/vertex_attrib_manager.h" |
| 13 | 15 |
| 14 namespace gpu { | 16 namespace gpu { |
| 15 namespace gles2 { | 17 namespace gles2 { |
| 16 | 18 |
| 17 VertexArrayManager::VertexArrayManager() | 19 VertexArrayManager::VertexArrayManager() |
| 18 : vertex_attrib_manager_count_(0), | 20 : vertex_attrib_manager_count_(0), |
| 19 have_context_(true) { | 21 have_context_(true) { |
| 20 } | 22 } |
| 21 | 23 |
| 22 VertexArrayManager::~VertexArrayManager() { | 24 VertexArrayManager::~VertexArrayManager() { |
| 23 DCHECK(vertex_attrib_managers_.empty()); | 25 DCHECK(vertex_attrib_managers_.empty()); |
| 24 CHECK_EQ(vertex_attrib_manager_count_, 0u); | 26 CHECK_EQ(vertex_attrib_manager_count_, 0u); |
| 25 } | 27 } |
| 26 | 28 |
| 27 void VertexArrayManager::Destroy(bool have_context) { | 29 void VertexArrayManager::Destroy(bool have_context) { |
| 28 have_context_ = have_context; | 30 have_context_ = have_context; |
| 29 vertex_attrib_managers_.clear(); | 31 vertex_attrib_managers_.clear(); |
| 30 } | 32 } |
| 31 | 33 |
| 32 scoped_refptr<VertexAttribManager> | 34 scoped_refptr<VertexAttribManager> |
| 33 VertexArrayManager::CreateVertexAttribManager(GLuint client_id, | 35 VertexArrayManager::CreateVertexAttribManager(GLuint client_id, |
| 34 GLuint service_id, | 36 GLuint service_id, |
| 35 uint32 num_vertex_attribs, | 37 uint32_t num_vertex_attribs, |
| 36 bool client_visible) { | 38 bool client_visible) { |
| 37 scoped_refptr<VertexAttribManager> vertex_attrib_manager( | 39 scoped_refptr<VertexAttribManager> vertex_attrib_manager( |
| 38 new VertexAttribManager(this, service_id, num_vertex_attribs)); | 40 new VertexAttribManager(this, service_id, num_vertex_attribs)); |
| 39 | 41 |
| 40 if (client_visible) { | 42 if (client_visible) { |
| 41 std::pair<VertexAttribManagerMap::iterator, bool> result = | 43 std::pair<VertexAttribManagerMap::iterator, bool> result = |
| 42 vertex_attrib_managers_.insert( | 44 vertex_attrib_managers_.insert( |
| 43 std::make_pair(client_id, vertex_attrib_manager)); | 45 std::make_pair(client_id, vertex_attrib_manager)); |
| 44 DCHECK(result.second); | 46 DCHECK(result.second); |
| 45 } | 47 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 return true; | 85 return true; |
| 84 } | 86 } |
| 85 } | 87 } |
| 86 return false; | 88 return false; |
| 87 } | 89 } |
| 88 | 90 |
| 89 } // namespace gles2 | 91 } // namespace gles2 |
| 90 } // namespace gpu | 92 } // namespace gpu |
| 91 | 93 |
| 92 | 94 |
| OLD | NEW |