| 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 class ShaderCache; |
| 27 } |
| 28 |
| 22 namespace egl { | 29 namespace egl { |
| 23 | 30 |
| 24 Display::Display(EGLNativeDisplayType display_id) | 31 Display::Display(EGLNativeDisplayType display_id) |
| 25 : display_id_(display_id), | 32 : display_id_(display_id), |
| 26 is_initialized_(false) { | 33 is_initialized_(false) { |
| 27 } | 34 } |
| 28 | 35 |
| 29 Display::~Display() { | 36 Display::~Display() { |
| 30 gles2::Terminate(); | 37 gles2::Terminate(); |
| 31 } | 38 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 { | 93 { |
| 87 gpu::TransferBufferManager* manager = new gpu::TransferBufferManager(); | 94 gpu::TransferBufferManager* manager = new gpu::TransferBufferManager(); |
| 88 transfer_buffer_manager_.reset(manager); | 95 transfer_buffer_manager_.reset(manager); |
| 89 manager->Initialize(); | 96 manager->Initialize(); |
| 90 } | 97 } |
| 91 scoped_ptr<gpu::CommandBufferService> command_buffer( | 98 scoped_ptr<gpu::CommandBufferService> command_buffer( |
| 92 new gpu::CommandBufferService(transfer_buffer_manager_.get())); | 99 new gpu::CommandBufferService(transfer_buffer_manager_.get())); |
| 93 if (!command_buffer->Initialize()) | 100 if (!command_buffer->Initialize()) |
| 94 return NULL; | 101 return NULL; |
| 95 | 102 |
| 96 gpu::gles2::ContextGroup::Ref group(new gpu::gles2::ContextGroup(NULL, true)); | 103 gpu::gles2::ContextGroup::Ref group(new gpu::gles2::ContextGroup( |
| 104 NULL, |
| 105 true, |
| 106 base::WeakPtr<gpu::ShaderCache>())); |
| 97 | 107 |
| 98 decoder_.reset(gpu::gles2::GLES2Decoder::Create(group.get())); | 108 decoder_.reset(gpu::gles2::GLES2Decoder::Create(group.get())); |
| 99 if (!decoder_.get()) | 109 if (!decoder_.get()) |
| 100 return EGL_NO_SURFACE; | 110 return EGL_NO_SURFACE; |
| 101 | 111 |
| 102 gpu_scheduler_.reset(new gpu::GpuScheduler(command_buffer.get(), | 112 gpu_scheduler_.reset(new gpu::GpuScheduler(command_buffer.get(), |
| 103 decoder_.get(), | 113 decoder_.get(), |
| 104 NULL)); | 114 NULL)); |
| 105 | 115 |
| 106 decoder_->set_engine(gpu_scheduler_.get()); | 116 decoder_->set_engine(gpu_scheduler_.get()); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 } else { | 225 } else { |
| 216 DCHECK(IsValidSurface(draw)); | 226 DCHECK(IsValidSurface(draw)); |
| 217 DCHECK(IsValidSurface(read)); | 227 DCHECK(IsValidSurface(read)); |
| 218 DCHECK(IsValidContext(ctx)); | 228 DCHECK(IsValidContext(ctx)); |
| 219 gles2::SetGLContext(context_.get()); | 229 gles2::SetGLContext(context_.get()); |
| 220 } | 230 } |
| 221 return true; | 231 return true; |
| 222 } | 232 } |
| 223 | 233 |
| 224 } // namespace egl | 234 } // namespace egl |
| OLD | NEW |