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/buffer_manager.h" | 5 #include "gpu/command_buffer/service/buffer_manager.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 7 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
8 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 8 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
9 | 9 |
10 namespace gpu { | 10 namespace gpu { |
11 namespace gles2 { | 11 namespace gles2 { |
12 | 12 |
13 void BufferManager::CreateBufferInfo(GLuint buffer_id) { | 13 void BufferManager::CreateBufferInfo(GLuint client_id, GLuint service_id) { |
14 std::pair<BufferInfoMap::iterator, bool> result = | 14 std::pair<BufferInfoMap::iterator, bool> result = |
15 buffer_infos_.insert( | 15 buffer_infos_.insert( |
16 std::make_pair(buffer_id, | 16 std::make_pair(client_id, |
17 BufferInfo::Ref(new BufferInfo(buffer_id)))); | 17 BufferInfo::Ref(new BufferInfo(service_id)))); |
18 DCHECK(result.second); | 18 DCHECK(result.second); |
19 } | 19 } |
20 | 20 |
21 BufferManager::BufferInfo* BufferManager::GetBufferInfo( | 21 BufferManager::BufferInfo* BufferManager::GetBufferInfo( |
22 GLuint buffer_id) { | 22 GLuint client_id) { |
23 BufferInfoMap::iterator it = buffer_infos_.find(buffer_id); | 23 BufferInfoMap::iterator it = buffer_infos_.find(client_id); |
24 return it != buffer_infos_.end() ? it->second : NULL; | 24 return it != buffer_infos_.end() ? it->second : NULL; |
25 } | 25 } |
26 | 26 |
27 void BufferManager::RemoveBufferInfo(GLuint buffer_id) { | 27 void BufferManager::RemoveBufferInfo(GLuint client_id) { |
28 BufferInfoMap::iterator it = buffer_infos_.find(buffer_id); | 28 BufferInfoMap::iterator it = buffer_infos_.find(client_id); |
29 if (it != buffer_infos_.end()) { | 29 if (it != buffer_infos_.end()) { |
30 it->second->MarkAsDeleted(); | 30 it->second->MarkAsDeleted(); |
31 buffer_infos_.erase(buffer_id); | 31 buffer_infos_.erase(it); |
32 } | 32 } |
33 } | 33 } |
34 | 34 |
35 void BufferManager::BufferInfo::SetSize(GLsizeiptr size) { | 35 void BufferManager::BufferInfo::SetSize(GLsizeiptr size) { |
36 DCHECK(!IsDeleted()); | 36 DCHECK(!IsDeleted()); |
37 if (size != size_) { | 37 if (size != size_) { |
38 size_ = size; | 38 size_ = size; |
39 ClearCache(); | 39 ClearCache(); |
40 if (target_ == GL_ELEMENT_ARRAY_BUFFER) { | 40 if (target_ == GL_ELEMENT_ARRAY_BUFFER) { |
41 shadow_.reset(new int8[size]); | 41 shadow_.reset(new int8[size]); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 std::pair<RangeToMaxValueMap::iterator, bool> result = | 121 std::pair<RangeToMaxValueMap::iterator, bool> result = |
122 range_set_.insert(std::make_pair(range, max_v)); | 122 range_set_.insert(std::make_pair(range, max_v)); |
123 *max_value = max_v; | 123 *max_value = max_v; |
124 return true; | 124 return true; |
125 } | 125 } |
126 | 126 |
127 } // namespace gles2 | 127 } // namespace gles2 |
128 } // namespace gpu | 128 } // namespace gpu |
129 | 129 |
130 | 130 |
OLD | NEW |