OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #if defined(ENABLE_GPU) | 5 #if defined(ENABLE_GPU) |
6 | 6 |
7 #include "chrome/renderer/webgraphicscontext3d_command_buffer_impl.h" | 7 #include "chrome/renderer/webgraphicscontext3d_command_buffer_impl.h" |
8 | 8 |
9 #include <GLES2/gl2.h> | 9 #include <GLES2/gl2.h> |
10 #ifndef GL_GLEXT_PROTOTYPES | 10 #ifndef GL_GLEXT_PROTOTYPES |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 /*opaque=*/true, /*root=*/true); | 90 /*opaque=*/true, /*root=*/true); |
91 view_id = static_cast<gfx::NativeViewId>(plugin_handle_); | 91 view_id = static_cast<gfx::NativeViewId>(plugin_handle_); |
92 #endif | 92 #endif |
93 web_view_ = web_view; | 93 web_view_ = web_view; |
94 context_ = ggl::CreateViewContext( | 94 context_ = ggl::CreateViewContext( |
95 host, | 95 host, |
96 view_id, | 96 view_id, |
97 renderview->routing_id(), | 97 renderview->routing_id(), |
98 attribs); | 98 attribs); |
99 } else { | 99 } else { |
100 bool compositing_enabled = !CommandLine::ForCurrentProcess()->HasSwitch( | 100 bool compositing_enabled = CommandLine::ForCurrentProcess()->HasSwitch( |
101 switches::kDisableAcceleratedCompositing); | 101 switches::kEnableAcceleratedCompositing); |
102 ggl::Context* parent_context = NULL; | 102 ggl::Context* parent_context = NULL; |
103 // If GPU compositing is enabled we need to create a GL context that shares | 103 // If GPU compositing is enabled we need to create a GL context that shares |
104 // resources with the compositor's context. | 104 // resources with the compositor's context. |
105 if (compositing_enabled) { | 105 if (compositing_enabled) { |
106 // Asking for the WebGraphicsContext3D on the WebView will force one to | 106 // Asking for the WebGraphicsContext3D on the WebView will force one to |
107 // be created if it doesn't already exist. When the compositor is created | 107 // be created if it doesn't already exist. When the compositor is created |
108 // for the view it will use the same context. | 108 // for the view it will use the same context. |
109 WebKit::WebGraphicsContext3D* view_context = | 109 WebKit::WebGraphicsContext3D* view_context = |
110 web_view->graphicsContext3D(); | 110 web_view->graphicsContext3D(); |
111 if (view_context) { | 111 if (view_context) { |
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1013 } | 1013 } |
1014 | 1014 |
1015 void WebGraphicsContext3DCommandBufferImpl::copyTextureToCompositor( | 1015 void WebGraphicsContext3DCommandBufferImpl::copyTextureToCompositor( |
1016 unsigned texture, unsigned parentTexture) { | 1016 unsigned texture, unsigned parentTexture) { |
1017 makeContextCurrent(); | 1017 makeContextCurrent(); |
1018 glCopyTextureToParentTexture(texture, parentTexture); | 1018 glCopyTextureToParentTexture(texture, parentTexture); |
1019 glFlush(); | 1019 glFlush(); |
1020 } | 1020 } |
1021 | 1021 |
1022 #endif // defined(ENABLE_GPU) | 1022 #endif // defined(ENABLE_GPU) |
OLD | NEW |