| 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 22 matching lines...) Expand all Loading... |
| 33 WebGraphicsContext3DCommandBufferImpl:: | 33 WebGraphicsContext3DCommandBufferImpl:: |
| 34 ~WebGraphicsContext3DCommandBufferImpl() { | 34 ~WebGraphicsContext3DCommandBufferImpl() { |
| 35 if (context_) { | 35 if (context_) { |
| 36 ggl::DestroyContext(context_); | 36 ggl::DestroyContext(context_); |
| 37 } | 37 } |
| 38 } | 38 } |
| 39 | 39 |
| 40 bool WebGraphicsContext3DCommandBufferImpl::initialize( | 40 bool WebGraphicsContext3DCommandBufferImpl::initialize( |
| 41 WebGraphicsContext3D::Attributes attributes, | 41 WebGraphicsContext3D::Attributes attributes, |
| 42 WebKit::WebView* web_view) { | 42 WebKit::WebView* web_view) { |
| 43 bool compositing_enabled = CommandLine::ForCurrentProcess()->HasSwitch( | 43 bool compositing_enabled = !CommandLine::ForCurrentProcess()->HasSwitch( |
| 44 switches::kEnableAcceleratedCompositing); | 44 switches::kDisableAcceleratedCompositing); |
| 45 ggl::Context* parent_context = NULL; | 45 ggl::Context* parent_context = NULL; |
| 46 // If GPU compositing is enabled we need to create a GL context that shares | 46 // If GPU compositing is enabled we need to create a GL context that shares |
| 47 // resources with the compositor's context. | 47 // resources with the compositor's context. |
| 48 if (compositing_enabled) { | 48 if (compositing_enabled) { |
| 49 // Asking for the GLES2Context on the WebView will force one to be created | 49 // Asking for the GLES2Context on the WebView will force one to be created |
| 50 // if it doesn't already exist. When the compositor is created for the view | 50 // if it doesn't already exist. When the compositor is created for the view |
| 51 // it will use the same context. | 51 // it will use the same context. |
| 52 WebKit::WebGLES2Context* view_gles2_context = web_view->gles2Context(); | 52 WebKit::WebGLES2Context* view_gles2_context = web_view->gles2Context(); |
| 53 if (!view_gles2_context) | 53 if (!view_gles2_context) |
| 54 return false; | 54 return false; |
| (...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 889 | 889 |
| 890 void WebGraphicsContext3DCommandBufferImpl::copyTextureToCompositor( | 890 void WebGraphicsContext3DCommandBufferImpl::copyTextureToCompositor( |
| 891 unsigned texture, unsigned parentTexture) { | 891 unsigned texture, unsigned parentTexture) { |
| 892 makeContextCurrent(); | 892 makeContextCurrent(); |
| 893 glCopyTextureToParentTexture(texture, parentTexture); | 893 glCopyTextureToParentTexture(texture, parentTexture); |
| 894 glFlush(); | 894 glFlush(); |
| 895 } | 895 } |
| 896 | 896 |
| 897 #endif // defined(ENABLE_GPU) | 897 #endif // defined(ENABLE_GPU) |
| 898 | 898 |
| OLD | NEW |