| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h" | 7 #include "content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h" |
| 8 | 8 |
| 9 #include "gpu/GLES2/gl2.h" | 9 #include "gpu/GLES2/gl2.h" |
| 10 #ifndef GL_GLEXT_PROTOTYPES | 10 #ifndef GL_GLEXT_PROTOTYPES |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 static const char* kWebGLPreferredGLExtensions = | 64 static const char* kWebGLPreferredGLExtensions = |
| 65 "GL_OES_packed_depth_stencil " | 65 "GL_OES_packed_depth_stencil " |
| 66 "GL_OES_depth24 " | 66 "GL_OES_depth24 " |
| 67 "GL_CHROMIUM_webglsl"; | 67 "GL_CHROMIUM_webglsl"; |
| 68 | 68 |
| 69 bool WebGraphicsContext3DCommandBufferImpl::initialize( | 69 bool WebGraphicsContext3DCommandBufferImpl::initialize( |
| 70 WebGraphicsContext3D::Attributes attributes, | 70 WebGraphicsContext3D::Attributes attributes, |
| 71 WebKit::WebView* web_view, | 71 WebKit::WebView* web_view, |
| 72 bool render_directly_to_web_view) { | 72 bool render_directly_to_web_view) { |
| 73 TRACE_EVENT0("gpu", "WebGfxCtx3DCmdBfrImpl::initialize"); | 73 TRACE_EVENT0("gpu", "WebGfxCtx3DCmdBfrImpl::initialize"); |
| 74 webkit_glue::BindSkiaToCommandBufferGL(); | |
| 75 RenderThread* render_thread = RenderThread::current(); | 74 RenderThread* render_thread = RenderThread::current(); |
| 76 if (!render_thread) | 75 if (!render_thread) |
| 77 return false; | 76 return false; |
| 78 GpuChannelHost* host = render_thread->EstablishGpuChannelSync( | 77 GpuChannelHost* host = render_thread->EstablishGpuChannelSync( |
| 79 content:: | 78 content:: |
| 80 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE); | 79 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE); |
| 81 if (!host) | 80 if (!host) |
| 82 return false; | 81 return false; |
| 83 DCHECK(host->state() == GpuChannelHost::kConnected); | 82 DCHECK(host->state() == GpuChannelHost::kConnected); |
| 84 | 83 |
| (...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1032 | 1031 |
| 1033 return context_lost_reason_; | 1032 return context_lost_reason_; |
| 1034 } | 1033 } |
| 1035 | 1034 |
| 1036 void WebGraphicsContext3DCommandBufferImpl:: | 1035 void WebGraphicsContext3DCommandBufferImpl:: |
| 1037 setSwapBuffersCompleteCallbackCHROMIUM( | 1036 setSwapBuffersCompleteCallbackCHROMIUM( |
| 1038 WebGraphicsContext3D::WebGraphicsSwapBuffersCompleteCallbackCHROMIUM* cb) { | 1037 WebGraphicsContext3D::WebGraphicsSwapBuffersCompleteCallbackCHROMIUM* cb) { |
| 1039 swapbuffers_complete_callback_ = cb; | 1038 swapbuffers_complete_callback_ = cb; |
| 1040 } | 1039 } |
| 1041 | 1040 |
| 1041 #if WEBKIT_USING_SKIA |
| 1042 GrGLInterface* WebGraphicsContext3DCommandBufferImpl::grGLInterface() { |
| 1043 return webkit_glue::GetCommandBufferSkiaGLBinding(); |
| 1044 } |
| 1045 #endif |
| 1046 |
| 1042 namespace { | 1047 namespace { |
| 1043 | 1048 |
| 1044 WGC3Denum convertReason(RendererGLContext::ContextLostReason reason) { | 1049 WGC3Denum convertReason(RendererGLContext::ContextLostReason reason) { |
| 1045 switch (reason) { | 1050 switch (reason) { |
| 1046 case RendererGLContext::kGuilty: | 1051 case RendererGLContext::kGuilty: |
| 1047 return GL_GUILTY_CONTEXT_RESET_ARB; | 1052 return GL_GUILTY_CONTEXT_RESET_ARB; |
| 1048 case RendererGLContext::kInnocent: | 1053 case RendererGLContext::kInnocent: |
| 1049 return GL_INNOCENT_CONTEXT_RESET_ARB; | 1054 return GL_INNOCENT_CONTEXT_RESET_ARB; |
| 1050 case RendererGLContext::kUnknown: | 1055 case RendererGLContext::kUnknown: |
| 1051 return GL_UNKNOWN_CONTEXT_RESET_ARB; | 1056 return GL_UNKNOWN_CONTEXT_RESET_ARB; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1065 } | 1070 } |
| 1066 #ifndef WTF_USE_THREADED_COMPOSITING | 1071 #ifndef WTF_USE_THREADED_COMPOSITING |
| 1067 RenderView* renderview = | 1072 RenderView* renderview = |
| 1068 web_view_ ? RenderView::FromWebView(web_view_) : NULL; | 1073 web_view_ ? RenderView::FromWebView(web_view_) : NULL; |
| 1069 if (renderview) | 1074 if (renderview) |
| 1070 renderview->OnViewContextSwapBuffersAborted(); | 1075 renderview->OnViewContextSwapBuffersAborted(); |
| 1071 #endif | 1076 #endif |
| 1072 } | 1077 } |
| 1073 | 1078 |
| 1074 #endif // defined(ENABLE_GPU) | 1079 #endif // defined(ENABLE_GPU) |
| OLD | NEW |