| 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 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" | 5 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 } | 100 } |
| 101 AngleDestroyCompilers(); | 101 AngleDestroyCompilers(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 bool WebGraphicsContext3DInProcessImpl::initialize( | 104 bool WebGraphicsContext3DInProcessImpl::initialize( |
| 105 WebGraphicsContext3D::Attributes attributes, | 105 WebGraphicsContext3D::Attributes attributes, |
| 106 WebView* webView, | 106 WebView* webView, |
| 107 bool render_directly_to_web_view) { | 107 bool render_directly_to_web_view) { |
| 108 if (!gfx::GLSurface::InitializeOneOff()) | 108 if (!gfx::GLSurface::InitializeOneOff()) |
| 109 return false; | 109 return false; |
| 110 gfx::BindSkiaToInProcessGL(); | |
| 111 | 110 |
| 112 render_directly_to_web_view_ = render_directly_to_web_view; | 111 render_directly_to_web_view_ = render_directly_to_web_view; |
| 113 gfx::GLShareGroup* share_group = 0; | 112 gfx::GLShareGroup* share_group = 0; |
| 114 | 113 |
| 115 if (!render_directly_to_web_view) { | 114 if (!render_directly_to_web_view) { |
| 116 // Pick up the compositor's context to share resources with. | 115 // Pick up the compositor's context to share resources with. |
| 117 WebGraphicsContext3D* view_context = webView ? | 116 WebGraphicsContext3D* view_context = webView ? |
| 118 webView->graphicsContext3D() : NULL; | 117 webView->graphicsContext3D() : NULL; |
| 119 if (view_context) { | 118 if (view_context) { |
| 120 WebGraphicsContext3DInProcessImpl* contextImpl = | 119 WebGraphicsContext3DInProcessImpl* contextImpl = |
| (...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1545 void WebGraphicsContext3DInProcessImpl::deleteTexture(WebGLId texture) { | 1544 void WebGraphicsContext3DInProcessImpl::deleteTexture(WebGLId texture) { |
| 1546 makeContextCurrent(); | 1545 makeContextCurrent(); |
| 1547 glDeleteTextures(1, &texture); | 1546 glDeleteTextures(1, &texture); |
| 1548 } | 1547 } |
| 1549 | 1548 |
| 1550 WGC3Denum WebGraphicsContext3DInProcessImpl::getGraphicsResetStatusARB() { | 1549 WGC3Denum WebGraphicsContext3DInProcessImpl::getGraphicsResetStatusARB() { |
| 1551 // TODO(kbr): this implementation doesn't support lost contexts yet. | 1550 // TODO(kbr): this implementation doesn't support lost contexts yet. |
| 1552 return GL_NO_ERROR; | 1551 return GL_NO_ERROR; |
| 1553 } | 1552 } |
| 1554 | 1553 |
| 1554 #if WEBKIT_USING_SKIA |
| 1555 GrGLInterface* WebGraphicsContext3DInProcessImpl::grGLInterface() { |
| 1556 return gfx::GetInProcessSkiaGLBinding(); |
| 1557 } |
| 1558 #endif |
| 1559 |
| 1555 bool WebGraphicsContext3DInProcessImpl::AngleCreateCompilers() { | 1560 bool WebGraphicsContext3DInProcessImpl::AngleCreateCompilers() { |
| 1556 if (!ShInitialize()) | 1561 if (!ShInitialize()) |
| 1557 return false; | 1562 return false; |
| 1558 | 1563 |
| 1559 ShBuiltInResources resources; | 1564 ShBuiltInResources resources; |
| 1560 ShInitBuiltInResources(&resources); | 1565 ShInitBuiltInResources(&resources); |
| 1561 getIntegerv(GL_MAX_VERTEX_ATTRIBS, &resources.MaxVertexAttribs); | 1566 getIntegerv(GL_MAX_VERTEX_ATTRIBS, &resources.MaxVertexAttribs); |
| 1562 getIntegerv(MAX_VERTEX_UNIFORM_VECTORS, &resources.MaxVertexUniformVectors); | 1567 getIntegerv(MAX_VERTEX_UNIFORM_VECTORS, &resources.MaxVertexUniformVectors); |
| 1563 getIntegerv(MAX_VARYING_VECTORS, &resources.MaxVaryingVectors); | 1568 getIntegerv(MAX_VARYING_VECTORS, &resources.MaxVaryingVectors); |
| 1564 getIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, | 1569 getIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1625 if (length > 1) { | 1630 if (length > 1) { |
| 1626 entry->translated_source.reset(new char[length]); | 1631 entry->translated_source.reset(new char[length]); |
| 1627 ShGetObjectCode(compiler, entry->translated_source.get()); | 1632 ShGetObjectCode(compiler, entry->translated_source.get()); |
| 1628 } | 1633 } |
| 1629 entry->is_valid = true; | 1634 entry->is_valid = true; |
| 1630 return true; | 1635 return true; |
| 1631 } | 1636 } |
| 1632 | 1637 |
| 1633 } // namespace gpu | 1638 } // namespace gpu |
| 1634 } // namespace webkit | 1639 } // namespace webkit |
| OLD | NEW |