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 "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" | 7 #include "webkit/gpu/webgraphicscontext3d_in_process_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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 // a context should not pass this string. | 583 // a context should not pass this string. |
584 static const char* kWebGLPreferredGLExtensions = | 584 static const char* kWebGLPreferredGLExtensions = |
585 "GL_OES_packed_depth_stencil " | 585 "GL_OES_packed_depth_stencil " |
586 "GL_OES_depth24 " | 586 "GL_OES_depth24 " |
587 "GL_CHROMIUM_webglsl"; | 587 "GL_CHROMIUM_webglsl"; |
588 | 588 |
589 bool WebGraphicsContext3DInProcessCommandBufferImpl::initialize( | 589 bool WebGraphicsContext3DInProcessCommandBufferImpl::initialize( |
590 WebGraphicsContext3D::Attributes attributes, | 590 WebGraphicsContext3D::Attributes attributes, |
591 WebKit::WebView* web_view, | 591 WebKit::WebView* web_view, |
592 bool render_directly_to_web_view) { | 592 bool render_directly_to_web_view) { |
593 webkit_glue::BindSkiaToCommandBufferGL(); | |
594 | 593 |
595 // Convert WebGL context creation attributes into GLInProcessContext / EGL | 594 // Convert WebGL context creation attributes into GLInProcessContext / EGL |
596 // size requests. | 595 // size requests. |
597 const int alpha_size = attributes.alpha ? 8 : 0; | 596 const int alpha_size = attributes.alpha ? 8 : 0; |
598 const int depth_size = attributes.depth ? 24 : 0; | 597 const int depth_size = attributes.depth ? 24 : 0; |
599 const int stencil_size = attributes.stencil ? 8 : 0; | 598 const int stencil_size = attributes.stencil ? 8 : 0; |
600 const int samples = attributes.antialias ? 4 : 0; | 599 const int samples = attributes.antialias ? 4 : 0; |
601 const int sample_buffers = attributes.antialias ? 1 : 0; | 600 const int sample_buffers = attributes.antialias ? 1 : 0; |
602 const int32 attribs[] = { | 601 const int32 attribs[] = { |
603 GLInProcessContext::ALPHA_SIZE, alpha_size, | 602 GLInProcessContext::ALPHA_SIZE, alpha_size, |
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1575 WebGraphicsContext3D::WebGraphicsContextLostCallback* cb) | 1574 WebGraphicsContext3D::WebGraphicsContextLostCallback* cb) |
1576 { | 1575 { |
1577 context_lost_callback_ = cb; | 1576 context_lost_callback_ = cb; |
1578 } | 1577 } |
1579 | 1578 |
1580 WGC3Denum WebGraphicsContext3DInProcessCommandBufferImpl:: | 1579 WGC3Denum WebGraphicsContext3DInProcessCommandBufferImpl:: |
1581 getGraphicsResetStatusARB() { | 1580 getGraphicsResetStatusARB() { |
1582 return context_lost_reason_; | 1581 return context_lost_reason_; |
1583 } | 1582 } |
1584 | 1583 |
| 1584 #if WEBKIT_USING_SKIA |
| 1585 GrGLInterface* WebGraphicsContext3DInProcessCommandBufferImpl:: |
| 1586 grGLInterface() { |
| 1587 return webkit_glue::GetCommandBufferSkiaGLBinding(); |
| 1588 } |
| 1589 #endif |
| 1590 |
1585 void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() { | 1591 void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() { |
1586 // TODO(kbr): improve the precision here. | 1592 // TODO(kbr): improve the precision here. |
1587 context_lost_reason_ = GL_UNKNOWN_CONTEXT_RESET_ARB; | 1593 context_lost_reason_ = GL_UNKNOWN_CONTEXT_RESET_ARB; |
1588 if (context_lost_callback_) { | 1594 if (context_lost_callback_) { |
1589 context_lost_callback_->onContextLost(); | 1595 context_lost_callback_->onContextLost(); |
1590 } | 1596 } |
1591 } | 1597 } |
1592 | 1598 |
1593 } // namespace gpu | 1599 } // namespace gpu |
1594 } // namespace webkit | 1600 } // namespace webkit |
1595 | 1601 |
1596 #endif // defined(ENABLE_GPU) | 1602 #endif // defined(ENABLE_GPU) |
OLD | NEW |