| 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_OUTPUT_GL_RENDERER_H_ | 5 #ifndef CC_OUTPUT_GL_RENDERER_H_ |
| 6 #define CC_OUTPUT_GL_RENDERER_H_ | 6 #define CC_OUTPUT_GL_RENDERER_H_ |
| 7 | 7 |
| 8 #include "cc/base/cc_export.h" | 8 #include "cc/base/cc_export.h" |
| 9 #include "cc/output/direct_renderer.h" | 9 #include "cc/output/direct_renderer.h" |
| 10 #include "cc/output/gl_renderer_draw_cache.h" | 10 #include "cc/output/gl_renderer_draw_cache.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 class StreamVideoDrawQuad; | 28 class StreamVideoDrawQuad; |
| 29 class TextureDrawQuad; | 29 class TextureDrawQuad; |
| 30 class GeometryBinding; | 30 class GeometryBinding; |
| 31 class ScopedEnsureFramebufferAllocation; | 31 class ScopedEnsureFramebufferAllocation; |
| 32 | 32 |
| 33 // Class that handles drawing of composited render layers using GL. | 33 // Class that handles drawing of composited render layers using GL. |
| 34 class CC_EXPORT GLRenderer : | 34 class CC_EXPORT GLRenderer : |
| 35 public DirectRenderer, | 35 public DirectRenderer, |
| 36 public NON_EXPORTED_BASE( | 36 public NON_EXPORTED_BASE( |
| 37 WebKit::WebGraphicsContext3D:: | 37 WebKit::WebGraphicsContext3D:: |
| 38 WebGraphicsSwapBuffersCompleteCallbackCHROMIUM), | 38 WebGraphicsMemoryAllocationChangedCallbackCHROMIUM) { |
| 39 public NON_EXPORTED_BASE( | |
| 40 WebKit::WebGraphicsContext3D:: | |
| 41 WebGraphicsMemoryAllocationChangedCallbackCHROMIUM), | |
| 42 public NON_EXPORTED_BASE( | |
| 43 WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback) { | |
| 44 public: | 39 public: |
| 45 static scoped_ptr<GLRenderer> Create(RendererClient* client, | 40 static scoped_ptr<GLRenderer> Create(RendererClient* client, |
| 46 OutputSurface* output_surface, | 41 OutputSurface* output_surface, |
| 47 ResourceProvider* resource_provider); | 42 ResourceProvider* resource_provider); |
| 48 | 43 |
| 49 virtual ~GLRenderer(); | 44 virtual ~GLRenderer(); |
| 50 | 45 |
| 51 virtual const RendererCapabilities& Capabilities() const OVERRIDE; | 46 virtual const RendererCapabilities& Capabilities() const OVERRIDE; |
| 52 | 47 |
| 53 WebKit::WebGraphicsContext3D* Context(); | 48 WebKit::WebGraphicsContext3D* Context(); |
| 54 | 49 |
| 55 virtual void ViewportChanged() OVERRIDE; | 50 virtual void ViewportChanged() OVERRIDE; |
| 56 | 51 |
| 57 virtual void ReceiveCompositorFrameAck(const CompositorFrameAck& ack) | |
| 58 OVERRIDE; | |
| 59 | |
| 60 // Waits for rendering to finish. | 52 // Waits for rendering to finish. |
| 61 virtual void Finish() OVERRIDE; | 53 virtual void Finish() OVERRIDE; |
| 62 | 54 |
| 63 virtual void DoNoOp() OVERRIDE; | 55 virtual void DoNoOp() OVERRIDE; |
| 64 // Puts backbuffer onscreen. | 56 // Puts backbuffer onscreen. |
| 65 virtual bool SwapBuffers() OVERRIDE; | 57 virtual bool SwapBuffers() OVERRIDE; |
| 66 | 58 |
| 67 virtual void GetFramebufferPixels(void* pixels, gfx::Rect rect) OVERRIDE; | 59 virtual void GetFramebufferPixels(void* pixels, gfx::Rect rect) OVERRIDE; |
| 68 | 60 |
| 69 virtual bool IsContextLost() OVERRIDE; | 61 virtual bool IsContextLost() OVERRIDE; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 bool UseScopedTexture(DrawingFrame& frame, | 161 bool UseScopedTexture(DrawingFrame& frame, |
| 170 const ScopedResource* resource, | 162 const ScopedResource* resource, |
| 171 gfx::Rect viewport_rect); | 163 gfx::Rect viewport_rect); |
| 172 | 164 |
| 173 bool MakeContextCurrent(); | 165 bool MakeContextCurrent(); |
| 174 | 166 |
| 175 bool InitializeSharedObjects(); | 167 bool InitializeSharedObjects(); |
| 176 void CleanupSharedObjects(); | 168 void CleanupSharedObjects(); |
| 177 | 169 |
| 178 // WebKit:: | 170 // WebKit:: |
| 179 // WebGraphicsContext3D::WebGraphicsSwapBuffersCompleteCallbackCHROMIUM | |
| 180 // implementation. | |
| 181 virtual void onSwapBuffersComplete() OVERRIDE; | |
| 182 | |
| 183 // WebKit:: | |
| 184 // WebGraphicsContext3D::WebGraphicsMemoryAllocationChangedCallbackCHROMIUM | 171 // WebGraphicsContext3D::WebGraphicsMemoryAllocationChangedCallbackCHROMIUM |
| 185 // implementation. | 172 // implementation. |
| 186 virtual void onMemoryAllocationChanged( | 173 virtual void onMemoryAllocationChanged( |
| 187 WebKit::WebGraphicsMemoryAllocation allocation) OVERRIDE; | 174 WebKit::WebGraphicsMemoryAllocation allocation) OVERRIDE; |
| 188 void DiscardBackbuffer(); | 175 void DiscardBackbuffer(); |
| 189 void EnsureBackbuffer(); | 176 void EnsureBackbuffer(); |
| 190 void EnforceMemoryPolicy(); | 177 void EnforceMemoryPolicy(); |
| 191 | 178 |
| 192 // WebGraphicsContext3D::WebGraphicsContextLostCallback implementation. | |
| 193 virtual void onContextLost() OVERRIDE; | |
| 194 | |
| 195 RendererCapabilities capabilities_; | 179 RendererCapabilities capabilities_; |
| 196 | 180 |
| 197 unsigned offscreen_framebuffer_id_; | 181 unsigned offscreen_framebuffer_id_; |
| 198 | 182 |
| 199 scoped_ptr<GeometryBinding> shared_geometry_; | 183 scoped_ptr<GeometryBinding> shared_geometry_; |
| 200 gfx::QuadF shared_geometry_quad_; | 184 gfx::QuadF shared_geometry_quad_; |
| 201 | 185 |
| 202 // This block of bindings defines all of the programs used by the compositor | 186 // This block of bindings defines all of the programs used by the compositor |
| 203 // itself. Add any new programs here to GLRendererShaderTest. | 187 // itself. Add any new programs here to GLRendererShaderTest. |
| 204 | 188 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 #if DEBUG_GL_CALLS && !defined(NDEBUG) | 315 #if DEBUG_GL_CALLS && !defined(NDEBUG) |
| 332 #define GLC(context, x) \ | 316 #define GLC(context, x) \ |
| 333 (x, GLRenderer::DebugGLCall (&* context, #x, __FILE__, __LINE__)) | 317 (x, GLRenderer::DebugGLCall (&* context, #x, __FILE__, __LINE__)) |
| 334 #else | 318 #else |
| 335 #define GLC(context, x) (x) | 319 #define GLC(context, x) (x) |
| 336 #endif | 320 #endif |
| 337 | 321 |
| 338 } | 322 } |
| 339 | 323 |
| 340 #endif // CC_OUTPUT_GL_RENDERER_H_ | 324 #endif // CC_OUTPUT_GL_RENDERER_H_ |
| OLD | NEW |