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 "components/mus/public/cpp/gles2_context.h" | 5 #include "components/mus/public/cpp/gles2_context.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <utility> | 10 #include <utility> |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 } else { | 47 } else { |
48 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host = | 48 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host = |
49 GpuService::GetInstance()->EstablishGpuChannelSync(); | 49 GpuService::GetInstance()->EstablishGpuChannelSync(); |
50 if (!gpu_channel_host) | 50 if (!gpu_channel_host) |
51 return false; | 51 return false; |
52 gpu::SurfaceHandle surface_handle = gfx::kNullAcceleratedWidget; | 52 gpu::SurfaceHandle surface_handle = gfx::kNullAcceleratedWidget; |
53 // TODO(penghuang): support shared group. | 53 // TODO(penghuang): support shared group. |
54 gpu::CommandBufferProxyImpl* shared_command_buffer = nullptr; | 54 gpu::CommandBufferProxyImpl* shared_command_buffer = nullptr; |
55 gpu::GpuStreamId stream_id = gpu::GpuStreamId::GPU_STREAM_DEFAULT; | 55 gpu::GpuStreamId stream_id = gpu::GpuStreamId::GPU_STREAM_DEFAULT; |
56 gpu::GpuStreamPriority stream_priority = gpu::GpuStreamPriority::NORMAL; | 56 gpu::GpuStreamPriority stream_priority = gpu::GpuStreamPriority::NORMAL; |
57 gl::GpuPreference gpu_preference = gl::PreferIntegratedGpu; | |
58 gpu::gles2::ContextCreationAttribHelper attributes; | 57 gpu::gles2::ContextCreationAttribHelper attributes; |
59 // TODO(penghuang): figure a useful active_url. | 58 // TODO(penghuang): figure a useful active_url. |
60 GURL active_url; | 59 GURL active_url; |
61 scoped_refptr<base::SingleThreadTaskRunner> task_runner = | 60 scoped_refptr<base::SingleThreadTaskRunner> task_runner = |
62 base::ThreadTaskRunnerHandle::Get(); | 61 base::ThreadTaskRunnerHandle::Get(); |
63 if (!attributes.Parse(attribs)) | 62 if (!attributes.Parse(attribs)) |
64 return false; | 63 return false; |
65 command_buffer_proxy_impl_ = gpu::CommandBufferProxyImpl::Create( | 64 command_buffer_proxy_impl_ = gpu::CommandBufferProxyImpl::Create( |
66 std::move(gpu_channel_host), surface_handle, gfx::Size(), | 65 std::move(gpu_channel_host), surface_handle, shared_command_buffer, |
67 shared_command_buffer, stream_id, stream_priority, attributes, | 66 stream_id, stream_priority, attributes, active_url, |
68 active_url, gpu_preference, std::move(task_runner)); | 67 std::move(task_runner)); |
69 if (!command_buffer_proxy_impl_) | 68 if (!command_buffer_proxy_impl_) |
70 return false; | 69 return false; |
71 command_buffer = command_buffer_proxy_impl_.get(); | 70 command_buffer = command_buffer_proxy_impl_.get(); |
72 gpu_control = command_buffer_proxy_impl_.get(); | 71 gpu_control = command_buffer_proxy_impl_.get(); |
73 } | 72 } |
74 | 73 |
75 constexpr gpu::SharedMemoryLimits default_limits; | 74 constexpr gpu::SharedMemoryLimits default_limits; |
76 gles2_helper_.reset(new gpu::gles2::GLES2CmdHelper(command_buffer)); | 75 gles2_helper_.reset(new gpu::gles2::GLES2CmdHelper(command_buffer)); |
77 if (!gles2_helper_->Initialize(default_limits.command_buffer_size)) | 76 if (!gles2_helper_->Initialize(default_limits.command_buffer_size)) |
78 return false; | 77 return false; |
(...skipping 22 matching lines...) Expand all Loading... |
101 std::unique_ptr<GLES2Context> GLES2Context::CreateOffscreenContext( | 100 std::unique_ptr<GLES2Context> GLES2Context::CreateOffscreenContext( |
102 const std::vector<int32_t>& attribs, | 101 const std::vector<int32_t>& attribs, |
103 shell::Connector* connector) { | 102 shell::Connector* connector) { |
104 std::unique_ptr<GLES2Context> gles2_context(new GLES2Context); | 103 std::unique_ptr<GLES2Context> gles2_context(new GLES2Context); |
105 if (!gles2_context->Initialize(attribs, connector)) | 104 if (!gles2_context->Initialize(attribs, connector)) |
106 gles2_context.reset(); | 105 gles2_context.reset(); |
107 return gles2_context; | 106 return gles2_context; |
108 } | 107 } |
109 | 108 |
110 } // namespace mus | 109 } // namespace mus |
OLD | NEW |