| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/view_manager/gles2/command_buffer_driver.h" | 5 #include "components/view_manager/gles2/command_buffer_driver.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
| 10 #include "components/view_manager/gles2/command_buffer_type_conversions.h" | 10 #include "components/view_manager/gles2/command_buffer_type_conversions.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 89 |
| 90 if (!context_->MakeCurrent(surface_.get())) | 90 if (!context_->MakeCurrent(surface_.get())) |
| 91 return false; | 91 return false; |
| 92 | 92 |
| 93 // TODO(piman): ShaderTranslatorCache is currently per-ContextGroup but | 93 // TODO(piman): ShaderTranslatorCache is currently per-ContextGroup but |
| 94 // only needs to be per-thread. | 94 // only needs to be per-thread. |
| 95 bool bind_generates_resource = false; | 95 bool bind_generates_resource = false; |
| 96 scoped_refptr<gpu::gles2::ContextGroup> context_group = | 96 scoped_refptr<gpu::gles2::ContextGroup> context_group = |
| 97 new gpu::gles2::ContextGroup( | 97 new gpu::gles2::ContextGroup( |
| 98 gpu_state_->mailbox_manager(), new GpuMemoryTracker, | 98 gpu_state_->mailbox_manager(), new GpuMemoryTracker, |
| 99 new gpu::gles2::ShaderTranslatorCache, nullptr, nullptr, nullptr, | 99 new gpu::gles2::ShaderTranslatorCache, |
| 100 bind_generates_resource); | 100 new gpu::gles2::FramebufferCompletenessCache, nullptr, nullptr, |
| 101 nullptr, bind_generates_resource); |
| 101 | 102 |
| 102 command_buffer_.reset( | 103 command_buffer_.reset( |
| 103 new gpu::CommandBufferService(context_group->transfer_buffer_manager())); | 104 new gpu::CommandBufferService(context_group->transfer_buffer_manager())); |
| 104 bool result = command_buffer_->Initialize(); | 105 bool result = command_buffer_->Initialize(); |
| 105 DCHECK(result); | 106 DCHECK(result); |
| 106 | 107 |
| 107 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group.get())); | 108 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group.get())); |
| 108 scheduler_.reset(new gpu::GpuScheduler(command_buffer_.get(), decoder_.get(), | 109 scheduler_.reset(new gpu::GpuScheduler(command_buffer_.get(), decoder_.get(), |
| 109 decoder_.get())); | 110 decoder_.get())); |
| 110 decoder_->set_engine(scheduler_.get()); | 111 decoder_->set_engine(scheduler_.get()); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 | 300 |
| 300 void CommandBufferDriver::DestroyDecoder() { | 301 void CommandBufferDriver::DestroyDecoder() { |
| 301 if (decoder_) { | 302 if (decoder_) { |
| 302 bool have_context = decoder_->MakeCurrent(); | 303 bool have_context = decoder_->MakeCurrent(); |
| 303 decoder_->Destroy(have_context); | 304 decoder_->Destroy(have_context); |
| 304 decoder_.reset(); | 305 decoder_.reset(); |
| 305 } | 306 } |
| 306 } | 307 } |
| 307 | 308 |
| 308 } // namespace gles2 | 309 } // namespace gles2 |
| OLD | NEW |