OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "services/gles2/gpu_impl.h" | 5 #include "services/gles2/gpu_impl.h" |
6 | 6 |
7 #include "gpu/command_buffer/service/mailbox_manager.h" | 7 #include "gpu/command_buffer/service/mailbox_manager.h" |
8 #include "gpu/command_buffer/service/mailbox_manager_impl.h" | 8 #include "gpu/command_buffer/service/mailbox_manager_impl.h" |
9 #include "gpu/command_buffer/service/sync_point_manager.h" | 9 #include "gpu/command_buffer/service/sync_point_manager.h" |
10 #include "mojo/converters/geometry/geometry_type_converters.h" | 10 #include "mojo/converters/geometry/geometry_type_converters.h" |
11 #include "services/gles2/command_buffer_driver.h" | 11 #include "services/gles2/command_buffer_driver.h" |
12 #include "services/gles2/command_buffer_impl.h" | 12 #include "services/gles2/command_buffer_impl.h" |
13 #include "ui/gl/gl_share_group.h" | 13 #include "ui/gl/gl_share_group.h" |
14 #include "ui/gl/gl_surface.h" | 14 #include "ui/gl/gl_surface.h" |
15 | 15 |
16 namespace gles2 { | 16 namespace gles2 { |
17 | 17 |
18 GpuImpl::State::State() | |
19 : control_thread_("gpu_command_buffer_control"), | |
20 sync_point_manager_(gpu::SyncPointManager::Create(true)), | |
21 share_group_(new gfx::GLShareGroup), | |
22 mailbox_manager_(new gpu::gles2::MailboxManagerImpl) { | |
23 control_thread_.Start(); | |
24 } | |
25 | |
26 GpuImpl::State::~State() { | |
27 } | |
28 | |
29 GpuImpl::GpuImpl(mojo::InterfaceRequest<Gpu> request, | 18 GpuImpl::GpuImpl(mojo::InterfaceRequest<Gpu> request, |
30 const scoped_refptr<State>& state) | 19 const scoped_refptr<GpuState>& state) |
31 : binding_(this, request.Pass()), state_(state) { | 20 : binding_(this, request.Pass()), state_(state) { |
32 } | 21 } |
33 | 22 |
34 GpuImpl::~GpuImpl() { | 23 GpuImpl::~GpuImpl() { |
35 } | 24 } |
36 | 25 |
37 void GpuImpl::CreateOnscreenGLES2Context( | |
38 uint64_t native_viewport_id, | |
39 mojo::SizePtr size, | |
40 mojo::InterfaceRequest<mojo::CommandBuffer> request, | |
41 mojo::ViewportParameterListenerPtr listener) { | |
42 gfx::AcceleratedWidget widget = bit_cast<gfx::AcceleratedWidget>( | |
43 static_cast<uintptr_t>(native_viewport_id)); | |
44 new CommandBufferImpl( | |
45 request.Pass(), listener.Pass(), state_->control_task_runner(), | |
46 state_->sync_point_manager(), | |
47 make_scoped_ptr(new CommandBufferDriver( | |
48 widget, size.To<gfx::Size>(), state_->share_group(), | |
49 state_->mailbox_manager(), state_->sync_point_manager()))); | |
50 } | |
51 | |
52 void GpuImpl::CreateOffscreenGLES2Context( | 26 void GpuImpl::CreateOffscreenGLES2Context( |
53 mojo::InterfaceRequest<mojo::CommandBuffer> request) { | 27 mojo::InterfaceRequest<mojo::CommandBuffer> request) { |
54 new CommandBufferImpl(request.Pass(), mojo::ViewportParameterListenerPtr(), | 28 new CommandBufferImpl(request.Pass(), mojo::ViewportParameterListenerPtr(), |
55 state_->control_task_runner(), | 29 state_->control_task_runner(), |
56 state_->sync_point_manager(), | 30 state_->sync_point_manager(), |
57 make_scoped_ptr(new CommandBufferDriver( | 31 make_scoped_ptr(new CommandBufferDriver( |
58 state_->share_group(), state_->mailbox_manager(), | 32 state_->share_group(), state_->mailbox_manager(), |
59 state_->sync_point_manager()))); | 33 state_->sync_point_manager()))); |
60 } | 34 } |
61 | 35 |
62 } // namespace gles2 | 36 } // namespace gles2 |
OLD | NEW |