Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(470)

Side by Side Diff: gpu/command_buffer/service/context_group.cc

Issue 10106015: Allow textures to be moved from one GL context group to another. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/context_group.h" 5 #include "gpu/command_buffer/service/context_group.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "gpu/command_buffer/common/id_allocator.h" 10 #include "gpu/command_buffer/common/id_allocator.h"
11 #include "gpu/command_buffer/service/buffer_manager.h" 11 #include "gpu/command_buffer/service/buffer_manager.h"
12 #include "gpu/command_buffer/service/display.h"
12 #include "gpu/command_buffer/service/framebuffer_manager.h" 13 #include "gpu/command_buffer/service/framebuffer_manager.h"
13 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 14 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
14 #include "gpu/command_buffer/service/program_manager.h" 15 #include "gpu/command_buffer/service/program_manager.h"
15 #include "gpu/command_buffer/service/renderbuffer_manager.h" 16 #include "gpu/command_buffer/service/renderbuffer_manager.h"
16 #include "gpu/command_buffer/service/shader_manager.h" 17 #include "gpu/command_buffer/service/shader_manager.h"
17 #include "gpu/command_buffer/service/texture_manager.h" 18 #include "gpu/command_buffer/service/texture_manager.h"
18 #include "ui/gfx/gl/gl_implementation.h" 19 #include "ui/gfx/gl/gl_implementation.h"
19 20
20 namespace gpu { 21 namespace gpu {
21 namespace gles2 { 22 namespace gles2 {
22 23
23 ContextGroup::ContextGroup(bool bind_generates_resource) 24 ContextGroup::ContextGroup(Display* display, bool bind_generates_resource)
24 : num_contexts_(0), 25 : display_(display ? display : new Display),
26 num_contexts_(0),
25 bind_generates_resource_(bind_generates_resource), 27 bind_generates_resource_(bind_generates_resource),
26 max_vertex_attribs_(0u), 28 max_vertex_attribs_(0u),
27 max_texture_units_(0u), 29 max_texture_units_(0u),
28 max_texture_image_units_(0u), 30 max_texture_image_units_(0u),
29 max_vertex_texture_image_units_(0u), 31 max_vertex_texture_image_units_(0u),
30 max_fragment_uniform_vectors_(0u), 32 max_fragment_uniform_vectors_(0u),
31 max_varying_vectors_(0u), 33 max_varying_vectors_(0u),
32 max_vertex_uniform_vectors_(0u), 34 max_vertex_uniform_vectors_(0u),
33 feature_info_(new FeatureInfo()) { 35 feature_info_(new FeatureInfo()) {
34 id_namespaces_[id_namespaces::kBuffers].reset(new IdAllocator); 36 id_namespaces_[id_namespaces::kBuffers].reset(new IdAllocator);
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 if (framebuffer_manager_ != NULL) { 165 if (framebuffer_manager_ != NULL) {
164 framebuffer_manager_->Destroy(have_context); 166 framebuffer_manager_->Destroy(have_context);
165 framebuffer_manager_.reset(); 167 framebuffer_manager_.reset();
166 } 168 }
167 169
168 if (renderbuffer_manager_ != NULL) { 170 if (renderbuffer_manager_ != NULL) {
169 renderbuffer_manager_->Destroy(have_context); 171 renderbuffer_manager_->Destroy(have_context);
170 renderbuffer_manager_.reset(); 172 renderbuffer_manager_.reset();
171 } 173 }
172 174
175 display_->DestroyOwnedTextures(texture_manager_.get(), have_context);
176
173 if (texture_manager_ != NULL) { 177 if (texture_manager_ != NULL) {
174 texture_manager_->Destroy(have_context); 178 texture_manager_->Destroy(have_context);
175 texture_manager_.reset(); 179 texture_manager_.reset();
176 } 180 }
177 181
178 if (program_manager_ != NULL) { 182 if (program_manager_ != NULL) {
179 program_manager_->Destroy(have_context); 183 program_manager_->Destroy(have_context);
180 program_manager_.reset(); 184 program_manager_.reset();
181 } 185 }
182 186
183 if (shader_manager_ != NULL) { 187 if (shader_manager_ != NULL) {
184 shader_manager_->Destroy(have_context); 188 shader_manager_->Destroy(have_context);
185 shader_manager_.reset(); 189 shader_manager_.reset();
186 } 190 }
187 } 191 }
188 192
189 IdAllocatorInterface* ContextGroup::GetIdAllocator(unsigned namespace_id) { 193 IdAllocatorInterface* ContextGroup::GetIdAllocator(unsigned namespace_id) {
190 if (namespace_id >= arraysize(id_namespaces_)) 194 if (namespace_id >= arraysize(id_namespaces_))
191 return NULL; 195 return NULL;
192 196
193 return id_namespaces_[namespace_id].get(); 197 return id_namespaces_[namespace_id].get();
194 } 198 }
195 199
196 } // namespace gles2 200 } // namespace gles2
197 } // namespace gpu 201 } // namespace gpu
198 202
199 203
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698