OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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 #ifndef CC_GL_RENDERER_H_ | 5 #ifndef CC_GL_RENDERER_H_ |
6 #define CC_GL_RENDERER_H_ | 6 #define CC_GL_RENDERER_H_ |
7 | 7 |
8 #include "cc/cc_export.h" | 8 #include "cc/cc_export.h" |
9 #include "cc/checkerboard_draw_quad.h" | 9 #include "cc/checkerboard_draw_quad.h" |
10 #include "cc/debug_border_draw_quad.h" | 10 #include "cc/debug_border_draw_quad.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 class OutputSurface; | 25 class OutputSurface; |
26 class ScopedResource; | 26 class ScopedResource; |
27 class StreamVideoDrawQuad; | 27 class StreamVideoDrawQuad; |
28 class TextureDrawQuad; | 28 class TextureDrawQuad; |
29 class GeometryBinding; | 29 class GeometryBinding; |
30 class ScopedEnsureFramebufferAllocation; | 30 class ScopedEnsureFramebufferAllocation; |
31 | 31 |
32 // Class that handles drawing of composited render layers using GL. | 32 // Class that handles drawing of composited render layers using GL. |
33 class CC_EXPORT GLRenderer : public DirectRenderer, | 33 class CC_EXPORT GLRenderer : public DirectRenderer, |
34 public NON_EXPORTED_BASE(WebKit::WebGraphicsContext
3D::WebGraphicsSwapBuffersCompleteCallbackCHROMIUM), | 34 public NON_EXPORTED_BASE(WebKit::WebGraphicsContext
3D::WebGraphicsMemoryAllocationChangedCallbackCHROMIUM) { |
35 public NON_EXPORTED_BASE(WebKit::WebGraphicsContext
3D::WebGraphicsMemoryAllocationChangedCallbackCHROMIUM), | |
36 public NON_EXPORTED_BASE(WebKit::WebGraphicsContext
3D::WebGraphicsContextLostCallback) { | |
37 public: | 35 public: |
38 static scoped_ptr<GLRenderer> create(RendererClient*, OutputSurface*, Resour
ceProvider*); | 36 static scoped_ptr<GLRenderer> create(RendererClient*, OutputSurface*, Resour
ceProvider*); |
39 | 37 |
40 virtual ~GLRenderer(); | 38 virtual ~GLRenderer(); |
41 | 39 |
42 virtual const RendererCapabilities& capabilities() const OVERRIDE; | 40 virtual const RendererCapabilities& capabilities() const OVERRIDE; |
43 | 41 |
44 WebKit::WebGraphicsContext3D* context(); | 42 WebKit::WebGraphicsContext3D* context(); |
45 | 43 |
46 virtual void viewportChanged() OVERRIDE; | 44 virtual void viewportChanged() OVERRIDE; |
47 | 45 |
48 virtual void receiveCompositorFrameAck(const CompositorFrameAck& ack) OVERRI
DE; | |
49 | |
50 // waits for rendering to finish | 46 // waits for rendering to finish |
51 virtual void finish() OVERRIDE; | 47 virtual void finish() OVERRIDE; |
52 | 48 |
53 virtual void doNoOp() OVERRIDE; | 49 virtual void doNoOp() OVERRIDE; |
54 // puts backbuffer onscreen | 50 // puts backbuffer onscreen |
55 virtual bool swapBuffers() OVERRIDE; | 51 virtual bool swapBuffers() OVERRIDE; |
56 | 52 |
57 virtual void getFramebufferPixels(void *pixels, const gfx::Rect&) OVERRIDE; | 53 virtual void getFramebufferPixels(void *pixels, const gfx::Rect&) OVERRIDE; |
58 | 54 |
59 virtual bool isContextLost() OVERRIDE; | 55 virtual bool isContextLost() OVERRIDE; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 113 |
118 void copyTextureToFramebuffer(const DrawingFrame&, int textureId, const gfx:
:Rect&, const gfx::Transform& drawMatrix); | 114 void copyTextureToFramebuffer(const DrawingFrame&, int textureId, const gfx:
:Rect&, const gfx::Transform& drawMatrix); |
119 | 115 |
120 bool useScopedTexture(DrawingFrame&, const ScopedResource*, const gfx::Rect&
viewportRect); | 116 bool useScopedTexture(DrawingFrame&, const ScopedResource*, const gfx::Rect&
viewportRect); |
121 | 117 |
122 bool makeContextCurrent(); | 118 bool makeContextCurrent(); |
123 | 119 |
124 bool initializeSharedObjects(); | 120 bool initializeSharedObjects(); |
125 void cleanupSharedObjects(); | 121 void cleanupSharedObjects(); |
126 | 122 |
127 // WebKit::WebGraphicsContext3D::WebGraphicsSwapBuffersCompleteCallbackCHROM
IUM implementation. | |
128 virtual void onSwapBuffersComplete() OVERRIDE; | |
129 | |
130 // WebKit::WebGraphicsContext3D::WebGraphicsMemoryAllocationChangedCallbackC
HROMIUM implementation. | 123 // WebKit::WebGraphicsContext3D::WebGraphicsMemoryAllocationChangedCallbackC
HROMIUM implementation. |
131 virtual void onMemoryAllocationChanged(WebKit::WebGraphicsMemoryAllocation)
OVERRIDE; | 124 virtual void onMemoryAllocationChanged(WebKit::WebGraphicsMemoryAllocation)
OVERRIDE; |
132 void discardBackbuffer(); | 125 void discardBackbuffer(); |
133 void ensureBackbuffer(); | 126 void ensureBackbuffer(); |
134 void enforceMemoryPolicy(); | 127 void enforceMemoryPolicy(); |
135 | 128 |
136 // WebGraphicsContext3D::WebGraphicsContextLostCallback implementation. | |
137 virtual void onContextLost() OVERRIDE; | |
138 | |
139 RendererCapabilities m_capabilities; | 129 RendererCapabilities m_capabilities; |
140 | 130 |
141 unsigned m_offscreenFramebufferId; | 131 unsigned m_offscreenFramebufferId; |
142 | 132 |
143 scoped_ptr<GeometryBinding> m_sharedGeometry; | 133 scoped_ptr<GeometryBinding> m_sharedGeometry; |
144 gfx::QuadF m_sharedGeometryQuad; | 134 gfx::QuadF m_sharedGeometryQuad; |
145 | 135 |
146 // This block of bindings defines all of the programs used by the compositor
itself. | 136 // This block of bindings defines all of the programs used by the compositor
itself. |
147 | 137 |
148 // Tiled layer shaders. | 138 // Tiled layer shaders. |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 #if DEBUG_GL_CALLS && !defined(NDEBUG) | 237 #if DEBUG_GL_CALLS && !defined(NDEBUG) |
248 #define GLC(context, x) (x, GLRenderer::debugGLCall(&*context, #x, __FILE__, __L
INE__)) | 238 #define GLC(context, x) (x, GLRenderer::debugGLCall(&*context, #x, __FILE__, __L
INE__)) |
249 #else | 239 #else |
250 #define GLC(context, x) (x) | 240 #define GLC(context, x) (x) |
251 #endif | 241 #endif |
252 | 242 |
253 | 243 |
254 } | 244 } |
255 | 245 |
256 #endif // CC_GL_RENDERER_H_ | 246 #endif // CC_GL_RENDERER_H_ |
OLD | NEW |