| 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/gles2_conform_support/egl/display.h" | 5 #include "gpu/gles2_conform_support/egl/display.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/memory/weak_ptr.h" |
| 10 #include "gpu/command_buffer/client/gles2_lib.h" | 11 #include "gpu/command_buffer/client/gles2_lib.h" |
| 11 #include "gpu/command_buffer/client/transfer_buffer.h" | 12 #include "gpu/command_buffer/client/transfer_buffer.h" |
| 12 #include "gpu/command_buffer/service/context_group.h" | 13 #include "gpu/command_buffer/service/context_group.h" |
| 13 #include "gpu/command_buffer/service/transfer_buffer_manager.h" | 14 #include "gpu/command_buffer/service/transfer_buffer_manager.h" |
| 14 #include "gpu/gles2_conform_support/egl/config.h" | 15 #include "gpu/gles2_conform_support/egl/config.h" |
| 15 #include "gpu/gles2_conform_support/egl/surface.h" | 16 #include "gpu/gles2_conform_support/egl/surface.h" |
| 16 | 17 |
| 18 using base::WeakPtr; |
| 19 |
| 17 namespace { | 20 namespace { |
| 18 const int32 kCommandBufferSize = 1024 * 1024; | 21 const int32 kCommandBufferSize = 1024 * 1024; |
| 19 const int32 kTransferBufferSize = 512 * 1024; | 22 const int32 kTransferBufferSize = 512 * 1024; |
| 20 } | 23 } |
| 21 | 24 |
| 25 namespace gpu { |
| 26 namespace gles2 { |
| 27 class ProgramCache; |
| 28 } |
| 29 } |
| 30 |
| 22 namespace egl { | 31 namespace egl { |
| 23 | 32 |
| 24 Display::Display(EGLNativeDisplayType display_id) | 33 Display::Display(EGLNativeDisplayType display_id) |
| 25 : display_id_(display_id), | 34 : display_id_(display_id), |
| 26 is_initialized_(false) { | 35 is_initialized_(false) { |
| 27 } | 36 } |
| 28 | 37 |
| 29 Display::~Display() { | 38 Display::~Display() { |
| 30 gles2::Terminate(); | 39 gles2::Terminate(); |
| 31 } | 40 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 { | 95 { |
| 87 gpu::TransferBufferManager* manager = new gpu::TransferBufferManager(); | 96 gpu::TransferBufferManager* manager = new gpu::TransferBufferManager(); |
| 88 transfer_buffer_manager_.reset(manager); | 97 transfer_buffer_manager_.reset(manager); |
| 89 manager->Initialize(); | 98 manager->Initialize(); |
| 90 } | 99 } |
| 91 scoped_ptr<gpu::CommandBufferService> command_buffer( | 100 scoped_ptr<gpu::CommandBufferService> command_buffer( |
| 92 new gpu::CommandBufferService(transfer_buffer_manager_.get())); | 101 new gpu::CommandBufferService(transfer_buffer_manager_.get())); |
| 93 if (!command_buffer->Initialize()) | 102 if (!command_buffer->Initialize()) |
| 94 return NULL; | 103 return NULL; |
| 95 | 104 |
| 96 gpu::gles2::ContextGroup::Ref group(new gpu::gles2::ContextGroup(NULL, true)); | 105 gpu::gles2::ContextGroup::Ref group(new gpu::gles2::ContextGroup( |
| 106 NULL, |
| 107 true, |
| 108 base::WeakPtr<gpu::gles2::ProgramCache>())); |
| 97 | 109 |
| 98 decoder_.reset(gpu::gles2::GLES2Decoder::Create(group.get())); | 110 decoder_.reset(gpu::gles2::GLES2Decoder::Create(group.get())); |
| 99 if (!decoder_.get()) | 111 if (!decoder_.get()) |
| 100 return EGL_NO_SURFACE; | 112 return EGL_NO_SURFACE; |
| 101 | 113 |
| 102 gpu_scheduler_.reset(new gpu::GpuScheduler(command_buffer.get(), | 114 gpu_scheduler_.reset(new gpu::GpuScheduler(command_buffer.get(), |
| 103 decoder_.get(), | 115 decoder_.get(), |
| 104 NULL)); | 116 NULL)); |
| 105 | 117 |
| 106 decoder_->set_engine(gpu_scheduler_.get()); | 118 decoder_->set_engine(gpu_scheduler_.get()); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 } else { | 227 } else { |
| 216 DCHECK(IsValidSurface(draw)); | 228 DCHECK(IsValidSurface(draw)); |
| 217 DCHECK(IsValidSurface(read)); | 229 DCHECK(IsValidSurface(read)); |
| 218 DCHECK(IsValidContext(ctx)); | 230 DCHECK(IsValidContext(ctx)); |
| 219 gles2::SetGLContext(context_.get()); | 231 gles2::SetGLContext(context_.get()); |
| 220 } | 232 } |
| 221 return true; | 233 return true; |
| 222 } | 234 } |
| 223 | 235 |
| 224 } // namespace egl | 236 } // namespace egl |
| OLD | NEW |