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 "content/renderer/pepper/ppb_graphics_3d_impl.h" | 5 #include "content/renderer/pepper/ppb_graphics_3d_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 return false; | 220 return false; |
221 | 221 |
222 scoped_refptr<gpu::GpuChannelHost> channel = | 222 scoped_refptr<gpu::GpuChannelHost> channel = |
223 render_thread->EstablishGpuChannelSync( | 223 render_thread->EstablishGpuChannelSync( |
224 CAUSE_FOR_GPU_LAUNCH_PEPPERPLATFORMCONTEXT3DIMPL_INITIALIZE); | 224 CAUSE_FOR_GPU_LAUNCH_PEPPERPLATFORMCONTEXT3DIMPL_INITIALIZE); |
225 if (!channel) | 225 if (!channel) |
226 return false; | 226 return false; |
227 | 227 |
228 gfx::Size surface_size; | 228 gfx::Size surface_size; |
229 std::vector<int32_t> attribs; | 229 std::vector<int32_t> attribs; |
230 gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; | 230 gl::GpuPreference gpu_preference = gl::PreferDiscreteGpu; |
231 // TODO(alokp): Change CommandBufferProxyImpl::Create() | 231 // TODO(alokp): Change CommandBufferProxyImpl::Create() |
232 // interface to accept width and height in the attrib_list so that | 232 // interface to accept width and height in the attrib_list so that |
233 // we do not need to filter for width and height here. | 233 // we do not need to filter for width and height here. |
234 if (attrib_list) { | 234 if (attrib_list) { |
235 for (const int32_t* attr = attrib_list; attr[0] != PP_GRAPHICS3DATTRIB_NONE; | 235 for (const int32_t* attr = attrib_list; attr[0] != PP_GRAPHICS3DATTRIB_NONE; |
236 attr += 2) { | 236 attr += 2) { |
237 switch (attr[0]) { | 237 switch (attr[0]) { |
238 case PP_GRAPHICS3DATTRIB_WIDTH: | 238 case PP_GRAPHICS3DATTRIB_WIDTH: |
239 surface_size.set_width(attr[1]); | 239 surface_size.set_width(attr[1]); |
240 break; | 240 break; |
241 case PP_GRAPHICS3DATTRIB_HEIGHT: | 241 case PP_GRAPHICS3DATTRIB_HEIGHT: |
242 surface_size.set_height(attr[1]); | 242 surface_size.set_height(attr[1]); |
243 break; | 243 break; |
244 case PP_GRAPHICS3DATTRIB_GPU_PREFERENCE: | 244 case PP_GRAPHICS3DATTRIB_GPU_PREFERENCE: |
245 gpu_preference = | 245 gpu_preference = |
246 (attr[1] == PP_GRAPHICS3DATTRIB_GPU_PREFERENCE_LOW_POWER) | 246 (attr[1] == PP_GRAPHICS3DATTRIB_GPU_PREFERENCE_LOW_POWER) |
247 ? gfx::PreferIntegratedGpu | 247 ? gl::PreferIntegratedGpu |
248 : gfx::PreferDiscreteGpu; | 248 : gl::PreferDiscreteGpu; |
249 break; | 249 break; |
250 case PP_GRAPHICS3DATTRIB_ALPHA_SIZE: | 250 case PP_GRAPHICS3DATTRIB_ALPHA_SIZE: |
251 has_alpha_ = attr[1] > 0; | 251 has_alpha_ = attr[1] > 0; |
252 // fall-through | 252 // fall-through |
253 default: | 253 default: |
254 attribs.push_back(attr[0]); | 254 attribs.push_back(attr[0]); |
255 attribs.push_back(attr[1]); | 255 attribs.push_back(attr[1]); |
256 break; | 256 break; |
257 } | 257 } |
258 } | 258 } |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 if (!mailboxes_to_reuse_.empty()) { | 367 if (!mailboxes_to_reuse_.empty()) { |
368 gpu::Mailbox mailbox = mailboxes_to_reuse_.back(); | 368 gpu::Mailbox mailbox = mailboxes_to_reuse_.back(); |
369 mailboxes_to_reuse_.pop_back(); | 369 mailboxes_to_reuse_.pop_back(); |
370 return mailbox; | 370 return mailbox; |
371 } | 371 } |
372 | 372 |
373 return gpu::Mailbox::Generate(); | 373 return gpu::Mailbox::Generate(); |
374 } | 374 } |
375 | 375 |
376 } // namespace content | 376 } // namespace content |
OLD | NEW |