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/render_widget.h" | 5 #include "content/renderer/render_widget.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/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 // Mac OS X essentially always behaves as though it's rendering offscreen. | 569 // Mac OS X essentially always behaves as though it's rendering offscreen. |
570 // Multisampling has a heavy cost especially on devices with relatively low | 570 // Multisampling has a heavy cost especially on devices with relatively low |
571 // fill rate like most notebooks, and the Mac implementation would need to | 571 // fill rate like most notebooks, and the Mac implementation would need to |
572 // be optimized to resolve directly into the IOSurface shared between the | 572 // be optimized to resolve directly into the IOSurface shared between the |
573 // GPU and browser processes. For these reasons and to avoid platform | 573 // GPU and browser processes. For these reasons and to avoid platform |
574 // disparities we explicitly disable antialiasing. | 574 // disparities we explicitly disable antialiasing. |
575 WebKit::WebGraphicsContext3D::Attributes attributes; | 575 WebKit::WebGraphicsContext3D::Attributes attributes; |
576 attributes.antialias = false; | 576 attributes.antialias = false; |
577 attributes.shareResources = true; | 577 attributes.shareResources = true; |
578 attributes.noAutomaticFlushes = true; | 578 attributes.noAutomaticFlushes = true; |
| 579 if (command_line.HasSwitch(cc::switches::kDrawLayersWithGanesh)) |
| 580 attributes.stencil = true; |
579 WebGraphicsContext3DCommandBufferImpl* context = | 581 WebGraphicsContext3DCommandBufferImpl* context = |
580 CreateGraphicsContext3D(attributes); | 582 CreateGraphicsContext3D(attributes); |
581 if (!context) | 583 if (!context) |
582 return scoped_ptr<cc::OutputSurface>(); | 584 return scoped_ptr<cc::OutputSurface>(); |
583 | 585 |
584 bool composite_to_mailbox = | 586 bool composite_to_mailbox = |
585 command_line.HasSwitch(cc::switches::kCompositeToMailbox); | 587 command_line.HasSwitch(cc::switches::kCompositeToMailbox); |
586 DCHECK(!composite_to_mailbox || command_line.HasSwitch( | 588 DCHECK(!composite_to_mailbox || command_line.HasSwitch( |
587 cc::switches::kEnableCompositorFrameMessage)); | 589 cc::switches::kEnableCompositorFrameMessage)); |
588 // No swap throttling yet when compositing on the main thread. | 590 // No swap throttling yet when compositing on the main thread. |
(...skipping 1730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2319 | 2321 |
2320 if (!context->Initialize( | 2322 if (!context->Initialize( |
2321 attributes, | 2323 attributes, |
2322 false /* bind generates resources */, | 2324 false /* bind generates resources */, |
2323 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) | 2325 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) |
2324 return NULL; | 2326 return NULL; |
2325 return context.release(); | 2327 return context.release(); |
2326 } | 2328 } |
2327 | 2329 |
2328 } // namespace content | 2330 } // namespace content |
OLD | NEW |