| 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 11 matching lines...) Expand all Loading... |
| 22 #include "ui/gl/gl_share_group.h" | 22 #include "ui/gl/gl_share_group.h" |
| 23 #include "ui/gl/gl_surface.h" | 23 #include "ui/gl/gl_surface.h" |
| 24 | 24 |
| 25 namespace gpu { | 25 namespace gpu { |
| 26 | 26 |
| 27 GLManager::Options::Options() | 27 GLManager::Options::Options() |
| 28 : size(4, 4), | 28 : size(4, 4), |
| 29 share_group_manager(NULL), | 29 share_group_manager(NULL), |
| 30 share_mailbox_manager(NULL), | 30 share_mailbox_manager(NULL), |
| 31 virtual_manager(NULL), | 31 virtual_manager(NULL), |
| 32 bind_generates_resource(false) { | 32 bind_generates_resource(false), |
| 33 context_lost_allowed(false) { |
| 33 } | 34 } |
| 34 | 35 |
| 35 GLManager::GLManager() { | 36 GLManager::GLManager() |
| 37 : context_lost_allowed_(false) { |
| 36 } | 38 } |
| 37 | 39 |
| 38 GLManager::~GLManager() { | 40 GLManager::~GLManager() { |
| 39 } | 41 } |
| 40 | 42 |
| 41 void GLManager::Initialize(const GLManager::Options& options) { | 43 void GLManager::Initialize(const GLManager::Options& options) { |
| 42 const int32 kCommandBufferSize = 1024 * 1024; | 44 const int32 kCommandBufferSize = 1024 * 1024; |
| 43 const size_t kStartTransferBufferSize = 4 * 1024 * 1024; | 45 const size_t kStartTransferBufferSize = 4 * 1024 * 1024; |
| 44 const size_t kMinTransferBufferSize = 1 * 256 * 1024; | 46 const size_t kMinTransferBufferSize = 1 * 256 * 1024; |
| 45 const size_t kMaxTransferBufferSize = 16 * 1024 * 1024; | 47 const size_t kMaxTransferBufferSize = 16 * 1024 * 1024; |
| 46 const bool kShareResources = true; | 48 const bool kShareResources = true; |
| 47 | 49 |
| 50 context_lost_allowed_ = options.context_lost_allowed; |
| 51 |
| 48 gles2::MailboxManager* mailbox_manager = NULL; | 52 gles2::MailboxManager* mailbox_manager = NULL; |
| 49 if (options.share_mailbox_manager) { | 53 if (options.share_mailbox_manager) { |
| 50 mailbox_manager = options.share_mailbox_manager->mailbox_manager(); | 54 mailbox_manager = options.share_mailbox_manager->mailbox_manager(); |
| 51 } else if (options.share_group_manager) { | 55 } else if (options.share_group_manager) { |
| 52 mailbox_manager = options.share_group_manager->mailbox_manager(); | 56 mailbox_manager = options.share_group_manager->mailbox_manager(); |
| 53 } | 57 } |
| 54 | 58 |
| 55 gfx::GLShareGroup* share_group = NULL; | 59 gfx::GLShareGroup* share_group = NULL; |
| 56 if (options.share_group_manager) { | 60 if (options.share_group_manager) { |
| 57 share_group = options.share_group_manager->share_group(); | 61 share_group = options.share_group_manager->share_group(); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 if (decoder_.get()) { | 195 if (decoder_.get()) { |
| 192 decoder_->MakeCurrent(); | 196 decoder_->MakeCurrent(); |
| 193 decoder_->Destroy(true); | 197 decoder_->Destroy(true); |
| 194 } | 198 } |
| 195 } | 199 } |
| 196 | 200 |
| 197 void GLManager::PumpCommands() { | 201 void GLManager::PumpCommands() { |
| 198 decoder_->MakeCurrent(); | 202 decoder_->MakeCurrent(); |
| 199 gpu_scheduler_->PutChanged(); | 203 gpu_scheduler_->PutChanged(); |
| 200 ::gpu::CommandBuffer::State state = command_buffer_->GetState(); | 204 ::gpu::CommandBuffer::State state = command_buffer_->GetState(); |
| 201 ASSERT_EQ(::gpu::error::kNoError, state.error); | 205 if (!context_lost_allowed_) { |
| 206 ASSERT_EQ(::gpu::error::kNoError, state.error); |
| 207 } |
| 202 } | 208 } |
| 203 | 209 |
| 204 bool GLManager::GetBufferChanged(int32 transfer_buffer_id) { | 210 bool GLManager::GetBufferChanged(int32 transfer_buffer_id) { |
| 205 return gpu_scheduler_->SetGetBuffer(transfer_buffer_id); | 211 return gpu_scheduler_->SetGetBuffer(transfer_buffer_id); |
| 206 } | 212 } |
| 207 | 213 |
| 208 } // namespace gpu | 214 } // namespace gpu |
| OLD | NEW |