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 "content/browser/compositor/gpu_process_transport_factory.h" | 5 #include "content/browser/compositor/gpu_process_transport_factory.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 compositor->vsync_manager())); | 270 compositor->vsync_manager())); |
271 } else { | 271 } else { |
272 DCHECK(context_provider); | 272 DCHECK(context_provider); |
273 ContextProvider::Capabilities capabilities = | 273 ContextProvider::Capabilities capabilities = |
274 context_provider->ContextCapabilities(); | 274 context_provider->ContextCapabilities(); |
275 if (!data->surface_id) { | 275 if (!data->surface_id) { |
276 surface = make_scoped_ptr(new OffscreenBrowserCompositorOutputSurface( | 276 surface = make_scoped_ptr(new OffscreenBrowserCompositorOutputSurface( |
277 context_provider, compositor->vsync_manager(), | 277 context_provider, compositor->vsync_manager(), |
278 scoped_ptr<BrowserCompositorOverlayCandidateValidator>())); | 278 scoped_ptr<BrowserCompositorOverlayCandidateValidator>())); |
279 } else if (capabilities.gpu.surfaceless) { | 279 } else if (capabilities.gpu.surfaceless) { |
| 280 GLenum target = GL_TEXTURE_2D; |
| 281 GLenum format = GL_RGB; |
| 282 #if defined(OS_MACOSX) |
| 283 target = GL_TEXTURE_RECTANGLE_ARB; |
| 284 format = GL_BGRA_EXT; |
| 285 #endif |
280 surface = | 286 surface = |
281 make_scoped_ptr(new GpuSurfacelessBrowserCompositorOutputSurface( | 287 make_scoped_ptr(new GpuSurfacelessBrowserCompositorOutputSurface( |
282 context_provider, data->surface_id, compositor->vsync_manager(), | 288 context_provider, data->surface_id, compositor->vsync_manager(), |
283 CreateOverlayCandidateValidator(compositor->widget()), | 289 CreateOverlayCandidateValidator(compositor->widget()), target, |
284 GL_TEXTURE_2D, GL_RGB, BrowserGpuMemoryBufferManager::current())); | 290 format, BrowserGpuMemoryBufferManager::current())); |
285 } else { | 291 } else { |
286 surface = make_scoped_ptr(new GpuBrowserCompositorOutputSurface( | 292 if (!surface) { |
287 context_provider, compositor->vsync_manager(), | 293 surface = make_scoped_ptr(new GpuBrowserCompositorOutputSurface( |
288 CreateOverlayCandidateValidator(compositor->widget()))); | 294 context_provider, compositor->vsync_manager(), |
| 295 CreateOverlayCandidateValidator(compositor->widget()))); |
| 296 } |
289 } | 297 } |
290 } | 298 } |
291 | 299 |
292 // TODO(piman): Use GpuSurfaceTracker to map ids to surfaces instead of an | 300 // TODO(piman): Use GpuSurfaceTracker to map ids to surfaces instead of an |
293 // output_surface_map_ here. | 301 // output_surface_map_ here. |
294 output_surface_map_.AddWithID(surface.get(), data->surface_id); | 302 output_surface_map_.AddWithID(surface.get(), data->surface_id); |
295 data->surface = surface.get(); | 303 data->surface = surface.get(); |
296 if (data->reflector) | 304 if (data->reflector) |
297 data->reflector->OnSourceSurfaceReady(data->surface); | 305 data->reflector->OnSourceSurfaceReady(data->surface); |
298 | 306 |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, | 595 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, |
588 observer_list_, | 596 observer_list_, |
589 OnLostResources()); | 597 OnLostResources()); |
590 | 598 |
591 // Kill things that use the shared context before killing the shared context. | 599 // Kill things that use the shared context before killing the shared context. |
592 lost_gl_helper.reset(); | 600 lost_gl_helper.reset(); |
593 lost_shared_main_thread_contexts = NULL; | 601 lost_shared_main_thread_contexts = NULL; |
594 } | 602 } |
595 | 603 |
596 } // namespace content | 604 } // namespace content |
OLD | NEW |