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 } | |
124 } else { | 119 } else { |
125 bool compositing_enabled = !CommandLine::ForCurrentProcess()->HasSwitch( | 120 bool compositing_enabled = !CommandLine::ForCurrentProcess()->HasSwitch( |
126 switches::kDisableAcceleratedCompositing); | 121 switches::kDisableAcceleratedCompositing); |
127 ggl::Context* parent_context = NULL; | 122 ggl::Context* parent_context = NULL; |
128 // If GPU compositing is enabled we need to create a GL context that shares | 123 // If GPU compositing is enabled we need to create a GL context that shares |
129 // resources with the compositor's context. | 124 // resources with the compositor's context. |
130 if (compositing_enabled) { | 125 if (compositing_enabled) { |
131 // Asking for the WebGraphicsContext3D on the WebView will force one to | 126 // Asking for the WebGraphicsContext3D on the WebView will force one to |
132 // be created if it doesn't already exist. When the compositor is created | 127 // be created if it doesn't already exist. When the compositor is created |
133 // for the view it will use the same context. | 128 // for the view it will use the same context. |
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 } | 1022 } |
1028 | 1023 |
1029 void WebGraphicsContext3DCommandBufferImpl::copyTextureToCompositor( | 1024 void WebGraphicsContext3DCommandBufferImpl::copyTextureToCompositor( |
1030 unsigned texture, unsigned parentTexture) { | 1025 unsigned texture, unsigned parentTexture) { |
1031 makeContextCurrent(); | 1026 makeContextCurrent(); |
1032 glCopyTextureToParentTextureCHROMIUM(texture, parentTexture); | 1027 glCopyTextureToParentTextureCHROMIUM(texture, parentTexture); |
1033 glFlush(); | 1028 glFlush(); |
1034 } | 1029 } |
1035 | 1030 |
1036 #endif // defined(ENABLE_GPU) | 1031 #endif // defined(ENABLE_GPU) |
OLD | NEW |