OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "CCIOSurfaceLayerImpl.h" | 7 #include "CCIOSurfaceLayerImpl.h" |
8 | 8 |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "third_party/khronos/GLES2/gl2ext.h" |
10 #include "CCGraphicsContext.h" | 11 #include "CCGraphicsContext.h" |
11 #include "CCIOSurfaceDrawQuad.h" | 12 #include "CCIOSurfaceDrawQuad.h" |
12 #include "CCLayerTreeHostImpl.h" | 13 #include "CCLayerTreeHostImpl.h" |
13 #include "CCQuadSink.h" | 14 #include "CCQuadSink.h" |
14 #include "CCRendererGL.h" // For the GLC() macro. | 15 #include "CCRendererGL.h" // For the GLC() macro. |
15 #include "Extensions3D.h" | |
16 #include <public/WebGraphicsContext3D.h> | 16 #include <public/WebGraphicsContext3D.h> |
17 | 17 |
18 namespace cc { | 18 namespace cc { |
19 | 19 |
20 CCIOSurfaceLayerImpl::CCIOSurfaceLayerImpl(int id) | 20 CCIOSurfaceLayerImpl::CCIOSurfaceLayerImpl(int id) |
21 : CCLayerImpl(id) | 21 : CCLayerImpl(id) |
22 , m_ioSurfaceId(0) | 22 , m_ioSurfaceId(0) |
23 , m_ioSurfaceChanged(false) | 23 , m_ioSurfaceChanged(false) |
24 , m_ioSurfaceTextureId(0) | 24 , m_ioSurfaceTextureId(0) |
25 { | 25 { |
(...skipping 19 matching lines...) Expand all Loading... |
45 WebKit::WebGraphicsContext3D* context3d = resourceProvider->graphicsCont
ext3D(); | 45 WebKit::WebGraphicsContext3D* context3d = resourceProvider->graphicsCont
ext3D(); |
46 if (!context3d) { | 46 if (!context3d) { |
47 // FIXME: Implement this path for software compositing. | 47 // FIXME: Implement this path for software compositing. |
48 return; | 48 return; |
49 } | 49 } |
50 | 50 |
51 // FIXME: Do this in a way that we can track memory usage. | 51 // FIXME: Do this in a way that we can track memory usage. |
52 if (!m_ioSurfaceTextureId) | 52 if (!m_ioSurfaceTextureId) |
53 m_ioSurfaceTextureId = context3d->createTexture(); | 53 m_ioSurfaceTextureId = context3d->createTexture(); |
54 | 54 |
55 GLC(context3d, context3d->activeTexture(GraphicsContext3D::TEXTURE0)); | 55 GLC(context3d, context3d->activeTexture(GL_TEXTURE0)); |
56 GLC(context3d, context3d->bindTexture(Extensions3D::TEXTURE_RECTANGLE_AR
B, m_ioSurfaceTextureId)); | 56 GLC(context3d, context3d->bindTexture(GL_TEXTURE_RECTANGLE_ARB, m_ioSurf
aceTextureId)); |
57 GLC(context3d, context3d->texParameteri(Extensions3D::TEXTURE_RECTANGLE_
ARB, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR)); | 57 GLC(context3d, context3d->texParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEX
TURE_MIN_FILTER, GL_LINEAR)); |
58 GLC(context3d, context3d->texParameteri(Extensions3D::TEXTURE_RECTANGLE_
ARB, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR)); | 58 GLC(context3d, context3d->texParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEX
TURE_MAG_FILTER, GL_LINEAR)); |
59 GLC(context3d, context3d->texParameteri(Extensions3D::TEXTURE_RECTANGLE_
ARB, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE)); | 59 GLC(context3d, context3d->texParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEX
TURE_WRAP_S, GL_CLAMP_TO_EDGE)); |
60 GLC(context3d, context3d->texParameteri(Extensions3D::TEXTURE_RECTANGLE_
ARB, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE)); | 60 GLC(context3d, context3d->texParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEX
TURE_WRAP_T, GL_CLAMP_TO_EDGE)); |
61 context3d->texImageIOSurface2DCHROMIUM(Extensions3D::TEXTURE_RECTANGLE_A
RB, | 61 context3d->texImageIOSurface2DCHROMIUM(GL_TEXTURE_RECTANGLE_ARB, |
62 m_ioSurfaceSize.width(), | 62 m_ioSurfaceSize.width(), |
63 m_ioSurfaceSize.height(), | 63 m_ioSurfaceSize.height(), |
64 m_ioSurfaceId, | 64 m_ioSurfaceId, |
65 0); | 65 0); |
66 // Do not check for error conditions. texImageIOSurface2DCHROMIUM is sup
posed to hold on to | 66 // Do not check for error conditions. texImageIOSurface2DCHROMIUM is sup
posed to hold on to |
67 // the last good IOSurface if the new one is already closed. This is onl
y a possibility | 67 // the last good IOSurface if the new one is already closed. This is onl
y a possibility |
68 // during live resizing of plugins. However, it seems that this is not s
ufficient to | 68 // during live resizing of plugins. However, it seems that this is not s
ufficient to |
69 // completely guard against garbage being drawn. If this is found to be
a significant issue, | 69 // completely guard against garbage being drawn. If this is found to be
a significant issue, |
70 // it may be necessary to explicitly tell the embedder when to free the
surfaces it has | 70 // it may be necessary to explicitly tell the embedder when to free the
surfaces it has |
71 // allocated. | 71 // allocated. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 m_ioSurfaceId = ioSurfaceId; | 105 m_ioSurfaceId = ioSurfaceId; |
106 m_ioSurfaceSize = size; | 106 m_ioSurfaceSize = size; |
107 } | 107 } |
108 | 108 |
109 const char* CCIOSurfaceLayerImpl::layerTypeAsString() const | 109 const char* CCIOSurfaceLayerImpl::layerTypeAsString() const |
110 { | 110 { |
111 return "IOSurfaceLayer"; | 111 return "IOSurfaceLayer"; |
112 } | 112 } |
113 | 113 |
114 } | 114 } |
OLD | NEW |