OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 16 matching lines...) Expand all Loading... |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 | 31 |
32 #ifndef LayerRendererChromium_h | 32 #ifndef LayerRendererChromium_h |
33 #define LayerRendererChromium_h | 33 #define LayerRendererChromium_h |
34 | 34 |
35 #if USE(ACCELERATED_COMPOSITING) | 35 #if USE(ACCELERATED_COMPOSITING) |
36 | 36 |
| 37 #include "Extensions3DChromium.h" |
37 #include "TextureCopier.h" | 38 #include "TextureCopier.h" |
38 #include "ThrottledTextureUploader.h" | 39 #include "ThrottledTextureUploader.h" |
39 #include "TrackingTextureAllocator.h" | 40 #include "TrackingTextureAllocator.h" |
40 #include "cc/CCRenderer.h" | 41 #include "cc/CCRenderer.h" |
41 #include <wtf/PassOwnPtr.h> | 42 #include <wtf/PassOwnPtr.h> |
42 | 43 |
43 namespace WebCore { | 44 namespace WebCore { |
44 | 45 |
45 class CCCheckerboardDrawQuad; | 46 class CCCheckerboardDrawQuad; |
46 class CCDebugBorderDrawQuad; | 47 class CCDebugBorderDrawQuad; |
47 class CCDrawQuad; | 48 class CCDrawQuad; |
48 class CCIOSurfaceDrawQuad; | 49 class CCIOSurfaceDrawQuad; |
49 class CCRenderPassDrawQuad; | 50 class CCRenderPassDrawQuad; |
50 class CCSolidColorDrawQuad; | 51 class CCSolidColorDrawQuad; |
51 class CCStreamVideoDrawQuad; | 52 class CCStreamVideoDrawQuad; |
52 class CCTextureDrawQuad; | 53 class CCTextureDrawQuad; |
53 class CCTileDrawQuad; | 54 class CCTileDrawQuad; |
54 class CCYUVVideoDrawQuad; | 55 class CCYUVVideoDrawQuad; |
55 class GeometryBinding; | 56 class GeometryBinding; |
56 class GraphicsContext3D; | 57 class GraphicsContext3D; |
57 class LayerRendererGpuMemoryAllocationChangedCallbackAdapter; | |
58 class LayerRendererSwapBuffersCompleteCallbackAdapter; | 58 class LayerRendererSwapBuffersCompleteCallbackAdapter; |
59 class ScopedEnsureFramebufferAllocation; | 59 class ScopedEnsureFramebufferAllocation; |
60 | 60 |
61 enum TextureUploaderOption { ThrottledUploader, UnthrottledUploader }; | 61 enum TextureUploaderOption { ThrottledUploader, UnthrottledUploader }; |
62 | 62 |
63 // Class that handles drawing of composited render layers using GL. | 63 // Class that handles drawing of composited render layers using GL. |
64 class LayerRendererChromium : public CCRenderer { | 64 class LayerRendererChromium : public CCRenderer { |
65 WTF_MAKE_NONCOPYABLE(LayerRendererChromium); | 65 WTF_MAKE_NONCOPYABLE(LayerRendererChromium); |
66 public: | 66 public: |
67 static PassOwnPtr<LayerRendererChromium> create(CCRendererClient*, PassRefPt
r<GraphicsContext3D>, TextureUploaderOption); | 67 static PassOwnPtr<LayerRendererChromium> create(CCRendererClient*, PassRefPt
r<GraphicsContext3D>, TextureUploaderOption); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 virtual void setScissorToRect(const IntRect&) OVERRIDE; | 105 virtual void setScissorToRect(const IntRect&) OVERRIDE; |
106 | 106 |
107 virtual bool isContextLost() OVERRIDE; | 107 virtual bool isContextLost() OVERRIDE; |
108 | 108 |
109 virtual void setVisible(bool) OVERRIDE; | 109 virtual void setVisible(bool) OVERRIDE; |
110 | 110 |
111 void drawTexturedQuad(const WebKit::WebTransformationMatrix& layerMatrix, | 111 void drawTexturedQuad(const WebKit::WebTransformationMatrix& layerMatrix, |
112 float width, float height, float opacity, const FloatQ
uad&, | 112 float width, float height, float opacity, const FloatQ
uad&, |
113 int matrixLocation, int alphaLocation, int quadLocatio
n); | 113 int matrixLocation, int alphaLocation, int quadLocatio
n); |
114 void copyTextureToFramebuffer(int textureId, const IntSize& bounds, const We
bKit::WebTransformationMatrix& drawMatrix); | 114 void copyTextureToFramebuffer(int textureId, const IntSize& bounds, const We
bKit::WebTransformationMatrix& drawMatrix); |
| 115 void setGpuMemoryAllocation(Extensions3DChromium::GpuMemoryAllocationCHROMIU
M); |
115 | 116 |
116 protected: | 117 protected: |
117 friend class LayerRendererGpuMemoryAllocationChangedCallbackAdapter; | |
118 void discardFramebuffer(); | 118 void discardFramebuffer(); |
119 void ensureFramebuffer(); | 119 void ensureFramebuffer(); |
120 bool isFramebufferDiscarded() const { return m_isFramebufferDiscarded; } | 120 bool isFramebufferDiscarded() const { return m_isFramebufferDiscarded; } |
121 | 121 |
122 LayerRendererChromium(CCRendererClient*, PassRefPtr<GraphicsContext3D>, Text
ureUploaderOption); | 122 LayerRendererChromium(CCRendererClient*, PassRefPtr<GraphicsContext3D>, Text
ureUploaderOption); |
123 bool initialize(); | 123 bool initialize(); |
124 | 124 |
125 private: | 125 private: |
126 static void toGLMatrix(float*, const WebKit::WebTransformationMatrix&); | 126 static void toGLMatrix(float*, const WebKit::WebTransformationMatrix&); |
127 | 127 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 OwnPtr<TextureUploader> m_textureUploader; | 252 OwnPtr<TextureUploader> m_textureUploader; |
253 OwnPtr<TrackingTextureAllocator> m_contentsTextureAllocator; | 253 OwnPtr<TrackingTextureAllocator> m_contentsTextureAllocator; |
254 OwnPtr<TrackingTextureAllocator> m_implTextureAllocator; | 254 OwnPtr<TrackingTextureAllocator> m_implTextureAllocator; |
255 | 255 |
256 RefPtr<GraphicsContext3D> m_context; | 256 RefPtr<GraphicsContext3D> m_context; |
257 | 257 |
258 const CCRenderPass* m_defaultRenderPass; | 258 const CCRenderPass* m_defaultRenderPass; |
259 | 259 |
260 bool m_isViewportChanged; | 260 bool m_isViewportChanged; |
261 bool m_isFramebufferDiscarded; | 261 bool m_isFramebufferDiscarded; |
| 262 bool m_visible; |
262 TextureUploaderOption m_textureUploaderSetting; | 263 TextureUploaderOption m_textureUploaderSetting; |
263 }; | 264 }; |
264 | 265 |
265 | 266 |
266 // Setting DEBUG_GL_CALLS to 1 will call glGetError() after almost every GL | 267 // Setting DEBUG_GL_CALLS to 1 will call glGetError() after almost every GL |
267 // call made by the compositor. Useful for debugging rendering issues but | 268 // call made by the compositor. Useful for debugging rendering issues but |
268 // will significantly degrade performance. | 269 // will significantly degrade performance. |
269 #define DEBUG_GL_CALLS 0 | 270 #define DEBUG_GL_CALLS 0 |
270 | 271 |
271 #if DEBUG_GL_CALLS && !defined ( NDEBUG ) | 272 #if DEBUG_GL_CALLS && !defined ( NDEBUG ) |
272 #define GLC(context, x) (x, LayerRendererChromium::debugGLCall(&*context, #x, __
FILE__, __LINE__)) | 273 #define GLC(context, x) (x, LayerRendererChromium::debugGLCall(&*context, #x, __
FILE__, __LINE__)) |
273 #else | 274 #else |
274 #define GLC(context, x) (x) | 275 #define GLC(context, x) (x) |
275 #endif | 276 #endif |
276 | 277 |
277 | 278 |
278 } | 279 } |
279 | 280 |
280 #endif // USE(ACCELERATED_COMPOSITING) | 281 #endif // USE(ACCELERATED_COMPOSITING) |
281 | 282 |
282 #endif | 283 #endif |
OLD | NEW |