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

Side by Side Diff: gpu/command_buffer/tests/gl_manager.cc

Issue 20017005: gpu: Refactor GpuMemoryBuffer framework for multi-process support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Include proper internalformat support.[D Created 7 years, 4 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/tests/gl_manager.h" 5 #include "gpu/command_buffer/tests/gl_manager.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/at_exit.h" 9 #include "base/at_exit.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 20 matching lines...) Expand all
31 scoped_refptr<gfx::GLSurface>* GLManager::base_surface_; 31 scoped_refptr<gfx::GLSurface>* GLManager::base_surface_;
32 scoped_refptr<gfx::GLContext>* GLManager::base_context_; 32 scoped_refptr<gfx::GLContext>* GLManager::base_context_;
33 33
34 GLManager::Options::Options() 34 GLManager::Options::Options()
35 : size(4, 4), 35 : size(4, 4),
36 share_group_manager(NULL), 36 share_group_manager(NULL),
37 share_mailbox_manager(NULL), 37 share_mailbox_manager(NULL),
38 virtual_manager(NULL), 38 virtual_manager(NULL),
39 bind_generates_resource(false), 39 bind_generates_resource(false),
40 context_lost_allowed(false), 40 context_lost_allowed(false),
41 image_manager(NULL), 41 image_manager(NULL) {
42 image_factory(NULL) {
43 } 42 }
44 43
45 GLManager::GLManager() 44 GLManager::GLManager()
46 : context_lost_allowed_(false) { 45 : context_lost_allowed_(false) {
47 SetupBaseContext(); 46 SetupBaseContext();
48 } 47 }
49 48
50 GLManager::~GLManager() { 49 GLManager::~GLManager() {
51 --use_count_; 50 --use_count_;
52 if (!use_count_) { 51 if (!use_count_) {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 if (!context_group) { 130 if (!context_group) {
132 context_group = new gles2::ContextGroup(mailbox_manager_.get(), 131 context_group = new gles2::ContextGroup(mailbox_manager_.get(),
133 options.image_manager, 132 options.image_manager,
134 NULL, 133 NULL,
135 NULL, 134 NULL,
136 options.bind_generates_resource); 135 options.bind_generates_resource);
137 } 136 }
138 137
139 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group)); 138 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group));
140 139
141 command_buffer_.reset(new CommandBufferService( 140 command_buffer_.reset(
142 decoder_->GetContextGroup()->transfer_buffer_manager())); 141 new CommandBufferService(
142 decoder_->GetContextGroup()->transfer_buffer_manager(),
143 decoder_->GetContextGroup()->image_manager(),
144 options.gpu_memory_buffer_factory));
143 ASSERT_TRUE(command_buffer_->Initialize()) 145 ASSERT_TRUE(command_buffer_->Initialize())
144 << "could not create command buffer service"; 146 << "could not create command buffer service";
145 147
146 gpu_scheduler_.reset(new GpuScheduler(command_buffer_.get(), 148 gpu_scheduler_.reset(new GpuScheduler(command_buffer_.get(),
147 decoder_.get(), 149 decoder_.get(),
148 decoder_.get())); 150 decoder_.get()));
149 151
150 decoder_->set_engine(gpu_scheduler_.get()); 152 decoder_->set_engine(gpu_scheduler_.get());
151 153
152 surface_ = gfx::GLSurface::CreateOffscreenGLSurface(options.size); 154 surface_ = gfx::GLSurface::CreateOffscreenGLSurface(options.size);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 ASSERT_TRUE(gles2_helper_->Initialize(kCommandBufferSize)); 194 ASSERT_TRUE(gles2_helper_->Initialize(kCommandBufferSize));
193 195
194 // Create a transfer buffer. 196 // Create a transfer buffer.
195 transfer_buffer_.reset(new TransferBuffer(gles2_helper_.get())); 197 transfer_buffer_.reset(new TransferBuffer(gles2_helper_.get()));
196 198
197 // Create the object exposing the OpenGL API. 199 // Create the object exposing the OpenGL API.
198 gles2_implementation_.reset(new gles2::GLES2Implementation( 200 gles2_implementation_.reset(new gles2::GLES2Implementation(
199 gles2_helper_.get(), 201 gles2_helper_.get(),
200 client_share_group, 202 client_share_group,
201 transfer_buffer_.get(), 203 transfer_buffer_.get(),
202 options.bind_generates_resource, 204 options.bind_generates_resource));
203 options.image_factory));
204 205
205 ASSERT_TRUE(gles2_implementation_->Initialize( 206 ASSERT_TRUE(gles2_implementation_->Initialize(
206 kStartTransferBufferSize, 207 kStartTransferBufferSize,
207 kMinTransferBufferSize, 208 kMinTransferBufferSize,
208 kMaxTransferBufferSize)) << "Could not init GLES2Implementation"; 209 kMaxTransferBufferSize)) << "Could not init GLES2Implementation";
209 210
210 MakeCurrent(); 211 MakeCurrent();
211 } 212 }
212 213
213 void GLManager::SetupBaseContext() { 214 void GLManager::SetupBaseContext() {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 if (!context_lost_allowed_) { 265 if (!context_lost_allowed_) {
265 ASSERT_EQ(::gpu::error::kNoError, state.error); 266 ASSERT_EQ(::gpu::error::kNoError, state.error);
266 } 267 }
267 } 268 }
268 269
269 bool GLManager::GetBufferChanged(int32 transfer_buffer_id) { 270 bool GLManager::GetBufferChanged(int32 transfer_buffer_id) {
270 return gpu_scheduler_->SetGetBuffer(transfer_buffer_id); 271 return gpu_scheduler_->SetGetBuffer(transfer_buffer_id);
271 } 272 }
272 273
273 } // namespace gpu 274 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698