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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 virtual void setVisible(bool) OVERRIDE; | 62 virtual void setVisible(bool) OVERRIDE; |
63 | 63 |
64 virtual void sendManagedMemoryStats(size_t bytesVisible, size_t bytesVisible
AndNearby, size_t bytesAllocated) OVERRIDE; | 64 virtual void sendManagedMemoryStats(size_t bytesVisible, size_t bytesVisible
AndNearby, size_t bytesAllocated) OVERRIDE; |
65 | 65 |
66 protected: | 66 protected: |
67 GLRenderer(RendererClient*, ResourceProvider*); | 67 GLRenderer(RendererClient*, ResourceProvider*); |
68 | 68 |
69 static void debugGLCall(WebKit::WebGraphicsContext3D*, const char* command,
const char* file, int line); | 69 static void debugGLCall(WebKit::WebGraphicsContext3D*, const char* command,
const char* file, int line); |
70 | 70 |
71 bool isFramebufferDiscarded() const { return m_isFramebufferDiscarded; } | 71 bool isBackbufferDiscarded() const { return m_isBackbufferDiscarded; } |
72 bool initialize(); | 72 bool initialize(); |
73 | 73 |
74 const gfx::QuadF& sharedGeometryQuad() const { return m_sharedGeometryQuad;
} | 74 const gfx::QuadF& sharedGeometryQuad() const { return m_sharedGeometryQuad;
} |
75 const GeometryBinding* sharedGeometry() const { return m_sharedGeometry.get(
); } | 75 const GeometryBinding* sharedGeometry() const { return m_sharedGeometry.get(
); } |
76 | 76 |
77 bool getFramebufferTexture(ScopedResource*, const gfx::Rect& deviceRect); | 77 bool getFramebufferTexture(ScopedResource*, const gfx::Rect& deviceRect); |
78 void releaseRenderPassTextures(); | 78 void releaseRenderPassTextures(); |
79 | 79 |
80 virtual void bindFramebufferToOutputSurface(DrawingFrame&) OVERRIDE; | 80 virtual void bindFramebufferToOutputSurface(DrawingFrame&) OVERRIDE; |
81 virtual bool bindFramebufferToTexture(DrawingFrame&, const ScopedResource*,
const gfx::Rect& framebufferRect) OVERRIDE; | 81 virtual bool bindFramebufferToTexture(DrawingFrame&, const ScopedResource*,
const gfx::Rect& framebufferRect) OVERRIDE; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 bool makeContextCurrent(); | 123 bool makeContextCurrent(); |
124 | 124 |
125 bool initializeSharedObjects(); | 125 bool initializeSharedObjects(); |
126 void cleanupSharedObjects(); | 126 void cleanupSharedObjects(); |
127 | 127 |
128 // WebKit::WebGraphicsContext3D::WebGraphicsSwapBuffersCompleteCallbackCHROM
IUM implementation. | 128 // WebKit::WebGraphicsContext3D::WebGraphicsSwapBuffersCompleteCallbackCHROM
IUM implementation. |
129 virtual void onSwapBuffersComplete() OVERRIDE; | 129 virtual void onSwapBuffersComplete() OVERRIDE; |
130 | 130 |
131 // WebKit::WebGraphicsContext3D::WebGraphicsMemoryAllocationChangedCallbackC
HROMIUM implementation. | 131 // WebKit::WebGraphicsContext3D::WebGraphicsMemoryAllocationChangedCallbackC
HROMIUM implementation. |
132 virtual void onMemoryAllocationChanged(WebKit::WebGraphicsMemoryAllocation)
OVERRIDE; | 132 virtual void onMemoryAllocationChanged(WebKit::WebGraphicsMemoryAllocation)
OVERRIDE; |
133 void discardFramebuffer(); | 133 void discardBackbuffer(); |
134 void ensureFramebuffer(); | 134 void ensureBackbuffer(); |
135 void enforceMemoryPolicy(); | 135 void enforceMemoryPolicy(); |
136 | 136 |
137 // WebGraphicsContext3D::WebGraphicsContextLostCallback implementation. | 137 // WebGraphicsContext3D::WebGraphicsContextLostCallback implementation. |
138 virtual void onContextLost() OVERRIDE; | 138 virtual void onContextLost() OVERRIDE; |
139 | 139 |
140 RendererCapabilities m_capabilities; | 140 RendererCapabilities m_capabilities; |
141 | 141 |
142 unsigned m_offscreenFramebufferId; | 142 unsigned m_offscreenFramebufferId; |
143 | 143 |
144 scoped_ptr<GeometryBinding> m_sharedGeometry; | 144 scoped_ptr<GeometryBinding> m_sharedGeometry; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 scoped_ptr<VideoYUVProgram> m_videoYUVProgram; | 215 scoped_ptr<VideoYUVProgram> m_videoYUVProgram; |
216 scoped_ptr<VideoStreamTextureProgram> m_videoStreamTextureProgram; | 216 scoped_ptr<VideoStreamTextureProgram> m_videoStreamTextureProgram; |
217 | 217 |
218 scoped_ptr<SolidColorProgram> m_solidColorProgram; | 218 scoped_ptr<SolidColorProgram> m_solidColorProgram; |
219 | 219 |
220 WebKit::WebGraphicsContext3D* m_context; | 220 WebKit::WebGraphicsContext3D* m_context; |
221 | 221 |
222 gfx::Rect m_swapBufferRect; | 222 gfx::Rect m_swapBufferRect; |
223 gfx::Rect m_scissorRect; | 223 gfx::Rect m_scissorRect; |
224 bool m_isViewportChanged; | 224 bool m_isViewportChanged; |
225 bool m_isFramebufferDiscarded; | 225 bool m_isBackbufferDiscarded; |
226 bool m_discardFramebufferWhenNotVisible; | 226 bool m_discardBackbufferWhenNotVisible; |
227 bool m_isUsingBindUniform; | 227 bool m_isUsingBindUniform; |
228 bool m_visible; | 228 bool m_visible; |
229 bool m_isScissorEnabled; | 229 bool m_isScissorEnabled; |
230 bool m_blendShadow; | 230 bool m_blendShadow; |
231 unsigned m_programShadow; | 231 unsigned m_programShadow; |
232 TexturedQuadDrawCache m_drawCache; | 232 TexturedQuadDrawCache m_drawCache; |
233 | 233 |
234 scoped_ptr<ResourceProvider::ScopedWriteLockGL> m_currentFramebufferLock; | 234 scoped_ptr<ResourceProvider::ScopedWriteLockGL> m_currentFramebufferLock; |
235 | 235 |
236 DISALLOW_COPY_AND_ASSIGN(GLRenderer); | 236 DISALLOW_COPY_AND_ASSIGN(GLRenderer); |
237 }; | 237 }; |
238 | 238 |
239 | 239 |
240 // Setting DEBUG_GL_CALLS to 1 will call glGetError() after almost every GL | 240 // Setting DEBUG_GL_CALLS to 1 will call glGetError() after almost every GL |
241 // call made by the compositor. Useful for debugging rendering issues but | 241 // call made by the compositor. Useful for debugging rendering issues but |
242 // will significantly degrade performance. | 242 // will significantly degrade performance. |
243 #define DEBUG_GL_CALLS 0 | 243 #define DEBUG_GL_CALLS 0 |
244 | 244 |
245 #if DEBUG_GL_CALLS && !defined(NDEBUG) | 245 #if DEBUG_GL_CALLS && !defined(NDEBUG) |
246 #define GLC(context, x) (x, GLRenderer::debugGLCall(&*context, #x, __FILE__, __L
INE__)) | 246 #define GLC(context, x) (x, GLRenderer::debugGLCall(&*context, #x, __FILE__, __L
INE__)) |
247 #else | 247 #else |
248 #define GLC(context, x) (x) | 248 #define GLC(context, x) (x) |
249 #endif | 249 #endif |
250 | 250 |
251 | 251 |
252 } | 252 } |
253 | 253 |
254 #endif // CC_GL_RENDERER_H_ | 254 #endif // CC_GL_RENDERER_H_ |
OLD | NEW |