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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 /*opaque=*/true, /*root=*/true); | 109 /*opaque=*/true, /*root=*/true); |
110 view_id = static_cast<gfx::NativeViewId>(plugin_handle_); | 110 view_id = static_cast<gfx::NativeViewId>(plugin_handle_); |
111 #endif | 111 #endif |
112 web_view_ = web_view; | 112 web_view_ = web_view; |
113 context_ = ggl::CreateViewContext( | 113 context_ = ggl::CreateViewContext( |
114 host, | 114 host, |
115 view_id, | 115 view_id, |
116 renderview->routing_id(), | 116 renderview->routing_id(), |
117 kWebGraphicsContext3DPerferredGLExtensions, | 117 kWebGraphicsContext3DPerferredGLExtensions, |
118 attribs); | 118 attribs); |
| 119 if (context_) { |
| 120 ggl::SetSwapBuffersCallback( |
| 121 context_, |
| 122 NewCallback(renderview, &RenderView::DidFlushPaint)); |
| 123 } |
119 } else { | 124 } else { |
120 bool compositing_enabled = !CommandLine::ForCurrentProcess()->HasSwitch( | 125 bool compositing_enabled = !CommandLine::ForCurrentProcess()->HasSwitch( |
121 switches::kDisableAcceleratedCompositing); | 126 switches::kDisableAcceleratedCompositing); |
122 ggl::Context* parent_context = NULL; | 127 ggl::Context* parent_context = NULL; |
123 // If GPU compositing is enabled we need to create a GL context that shares | 128 // If GPU compositing is enabled we need to create a GL context that shares |
124 // resources with the compositor's context. | 129 // resources with the compositor's context. |
125 if (compositing_enabled) { | 130 if (compositing_enabled) { |
126 // Asking for the WebGraphicsContext3D on the WebView will force one to | 131 // Asking for the WebGraphicsContext3D on the WebView will force one to |
127 // be created if it doesn't already exist. When the compositor is created | 132 // be created if it doesn't already exist. When the compositor is created |
128 // for the view it will use the same context. | 133 // for the view it will use the same context. |
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1022 } | 1027 } |
1023 | 1028 |
1024 void WebGraphicsContext3DCommandBufferImpl::copyTextureToCompositor( | 1029 void WebGraphicsContext3DCommandBufferImpl::copyTextureToCompositor( |
1025 unsigned texture, unsigned parentTexture) { | 1030 unsigned texture, unsigned parentTexture) { |
1026 makeContextCurrent(); | 1031 makeContextCurrent(); |
1027 glCopyTextureToParentTextureCHROMIUM(texture, parentTexture); | 1032 glCopyTextureToParentTextureCHROMIUM(texture, parentTexture); |
1028 glFlush(); | 1033 glFlush(); |
1029 } | 1034 } |
1030 | 1035 |
1031 #endif // defined(ENABLE_GPU) | 1036 #endif // defined(ENABLE_GPU) |
OLD | NEW |