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/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 21 matching lines...) Expand all Loading... |
32 scoped_refptr<gfx::GLShareGroup>* GLManager::base_share_group_; | 32 scoped_refptr<gfx::GLShareGroup>* GLManager::base_share_group_; |
33 scoped_refptr<gfx::GLSurface>* GLManager::base_surface_; | 33 scoped_refptr<gfx::GLSurface>* GLManager::base_surface_; |
34 scoped_refptr<gfx::GLContext>* GLManager::base_context_; | 34 scoped_refptr<gfx::GLContext>* GLManager::base_context_; |
35 | 35 |
36 GLManager::Options::Options() | 36 GLManager::Options::Options() |
37 : size(4, 4), | 37 : size(4, 4), |
38 share_group_manager(NULL), | 38 share_group_manager(NULL), |
39 share_mailbox_manager(NULL), | 39 share_mailbox_manager(NULL), |
40 virtual_manager(NULL), | 40 virtual_manager(NULL), |
41 bind_generates_resource(false), | 41 bind_generates_resource(false), |
| 42 lose_context_when_out_of_memory(false), |
42 context_lost_allowed(false), | 43 context_lost_allowed(false), |
43 image_manager(NULL) { | 44 image_manager(NULL) {} |
44 } | |
45 | 45 |
46 GLManager::GLManager() | 46 GLManager::GLManager() |
47 : context_lost_allowed_(false) { | 47 : context_lost_allowed_(false) { |
48 SetupBaseContext(); | 48 SetupBaseContext(); |
49 } | 49 } |
50 | 50 |
51 GLManager::~GLManager() { | 51 GLManager::~GLManager() { |
52 --use_count_; | 52 --use_count_; |
53 if (!use_count_) { | 53 if (!use_count_) { |
54 if (base_share_group_) { | 54 if (base_share_group_) { |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 base::Bind(&GLManager::GetBufferChanged, base::Unretained(this))); | 182 base::Bind(&GLManager::GetBufferChanged, base::Unretained(this))); |
183 | 183 |
184 // Create the GLES2 helper, which writes the command buffer protocol. | 184 // Create the GLES2 helper, which writes the command buffer protocol. |
185 gles2_helper_.reset(new gles2::GLES2CmdHelper(command_buffer_.get())); | 185 gles2_helper_.reset(new gles2::GLES2CmdHelper(command_buffer_.get())); |
186 ASSERT_TRUE(gles2_helper_->Initialize(kCommandBufferSize)); | 186 ASSERT_TRUE(gles2_helper_->Initialize(kCommandBufferSize)); |
187 | 187 |
188 // Create a transfer buffer. | 188 // Create a transfer buffer. |
189 transfer_buffer_.reset(new TransferBuffer(gles2_helper_.get())); | 189 transfer_buffer_.reset(new TransferBuffer(gles2_helper_.get())); |
190 | 190 |
191 // Create the object exposing the OpenGL API. | 191 // Create the object exposing the OpenGL API. |
192 gles2_implementation_.reset(new gles2::GLES2Implementation( | 192 gles2_implementation_.reset( |
193 gles2_helper_.get(), | 193 new gles2::GLES2Implementation(gles2_helper_.get(), |
194 client_share_group, | 194 client_share_group, |
195 transfer_buffer_.get(), | 195 transfer_buffer_.get(), |
196 options.bind_generates_resource, | 196 options.bind_generates_resource, |
197 gpu_control_.get())); | 197 options.lose_context_when_out_of_memory, |
| 198 gpu_control_.get())); |
198 | 199 |
199 ASSERT_TRUE(gles2_implementation_->Initialize( | 200 ASSERT_TRUE(gles2_implementation_->Initialize( |
200 kStartTransferBufferSize, | 201 kStartTransferBufferSize, |
201 kMinTransferBufferSize, | 202 kMinTransferBufferSize, |
202 kMaxTransferBufferSize, | 203 kMaxTransferBufferSize, |
203 gpu::gles2::GLES2Implementation::kNoLimit)) | 204 gpu::gles2::GLES2Implementation::kNoLimit)) |
204 << "Could not init GLES2Implementation"; | 205 << "Could not init GLES2Implementation"; |
205 | 206 |
206 MakeCurrent(); | 207 MakeCurrent(); |
207 } | 208 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 if (!context_lost_allowed_) { | 261 if (!context_lost_allowed_) { |
261 ASSERT_EQ(::gpu::error::kNoError, state.error); | 262 ASSERT_EQ(::gpu::error::kNoError, state.error); |
262 } | 263 } |
263 } | 264 } |
264 | 265 |
265 bool GLManager::GetBufferChanged(int32 transfer_buffer_id) { | 266 bool GLManager::GetBufferChanged(int32 transfer_buffer_id) { |
266 return gpu_scheduler_->SetGetBuffer(transfer_buffer_id); | 267 return gpu_scheduler_->SetGetBuffer(transfer_buffer_id); |
267 } | 268 } |
268 | 269 |
269 } // namespace gpu | 270 } // namespace gpu |
OLD | NEW |