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 <deque> | 8 #include <deque> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 class StaticGeometryBinding; | 43 class StaticGeometryBinding; |
44 class DynamicGeometryBinding; | 44 class DynamicGeometryBinding; |
45 class ScopedEnsureFramebufferAllocation; | 45 class ScopedEnsureFramebufferAllocation; |
46 | 46 |
47 // Class that handles drawing of composited render layers using GL. | 47 // Class that handles drawing of composited render layers using GL. |
48 class CC_EXPORT GLRenderer : public DirectRenderer { | 48 class CC_EXPORT GLRenderer : public DirectRenderer { |
49 public: | 49 public: |
50 class ScopedUseGrContext; | 50 class ScopedUseGrContext; |
51 | 51 |
52 static std::unique_ptr<GLRenderer> Create( | 52 static std::unique_ptr<GLRenderer> Create( |
53 RendererClient* client, | 53 DirectRendererClient* client, |
54 const RendererSettings* settings, | 54 const RendererSettings* settings, |
55 OutputSurface* output_surface, | 55 OutputSurface* output_surface, |
56 ResourceProvider* resource_provider, | 56 ResourceProvider* resource_provider, |
57 TextureMailboxDeleter* texture_mailbox_deleter, | 57 TextureMailboxDeleter* texture_mailbox_deleter, |
58 int highp_threshold_min); | 58 int highp_threshold_min); |
59 | 59 |
60 ~GLRenderer() override; | 60 ~GLRenderer() override; |
61 | 61 |
62 const RendererCapabilitiesImpl& Capabilities() const override; | 62 const RendererCapabilitiesImpl& Capabilities() const override; |
63 | 63 |
64 // Waits for rendering to finish. | |
65 void Finish() override; | |
66 | |
67 void SwapBuffers(CompositorFrameMetadata metadata) override; | 64 void SwapBuffers(CompositorFrameMetadata metadata) override; |
68 void SwapBuffersComplete() override; | 65 void SwapBuffersComplete() override; |
69 | 66 |
70 void DidReceiveTextureInUseResponses( | 67 void DidReceiveTextureInUseResponses( |
71 const gpu::TextureInUseResponses& responses) override; | 68 const gpu::TextureInUseResponses& responses) override; |
72 | 69 |
73 virtual bool IsContextLost(); | 70 virtual bool IsContextLost(); |
74 | 71 |
75 protected: | 72 protected: |
76 GLRenderer(RendererClient* client, | 73 GLRenderer(DirectRendererClient* client, |
77 const RendererSettings* settings, | 74 const RendererSettings* settings, |
78 OutputSurface* output_surface, | 75 OutputSurface* output_surface, |
79 ResourceProvider* resource_provider, | 76 ResourceProvider* resource_provider, |
80 TextureMailboxDeleter* texture_mailbox_deleter, | 77 TextureMailboxDeleter* texture_mailbox_deleter, |
81 int highp_threshold_min); | 78 int highp_threshold_min); |
82 | 79 |
83 void DidChangeVisibility() override; | |
84 | |
85 bool IsBackbufferDiscarded() const { return is_backbuffer_discarded_; } | |
86 | |
87 const gfx::QuadF& SharedGeometryQuad() const { return shared_geometry_quad_; } | 80 const gfx::QuadF& SharedGeometryQuad() const { return shared_geometry_quad_; } |
88 const StaticGeometryBinding* SharedGeometry() const { | 81 const StaticGeometryBinding* SharedGeometry() const { |
89 return shared_geometry_.get(); | 82 return shared_geometry_.get(); |
90 } | 83 } |
91 | 84 |
92 void GetFramebufferPixelsAsync(const DrawingFrame* frame, | 85 void GetFramebufferPixelsAsync(const DrawingFrame* frame, |
93 const gfx::Rect& rect, | 86 const gfx::Rect& rect, |
94 std::unique_ptr<CopyOutputRequest> request); | 87 std::unique_ptr<CopyOutputRequest> request); |
95 void GetFramebufferTexture(unsigned texture_id, | 88 void GetFramebufferTexture(unsigned texture_id, |
96 const gfx::Rect& device_rect); | 89 const gfx::Rect& device_rect); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 bool success)> | 243 bool success)> |
251 AsyncGetFramebufferPixelsCleanupCallback; | 244 AsyncGetFramebufferPixelsCleanupCallback; |
252 void FinishedReadback(unsigned source_buffer, | 245 void FinishedReadback(unsigned source_buffer, |
253 unsigned query, | 246 unsigned query, |
254 const gfx::Size& size); | 247 const gfx::Size& size); |
255 | 248 |
256 void ReinitializeGLState(); | 249 void ReinitializeGLState(); |
257 void RestoreGLState(); | 250 void RestoreGLState(); |
258 void RestoreFramebuffer(DrawingFrame* frame); | 251 void RestoreFramebuffer(DrawingFrame* frame); |
259 | 252 |
260 void DiscardBackbuffer() override; | |
261 void EnsureBackbuffer() override; | |
262 void EnforceMemoryPolicy(); | |
263 | |
264 void ScheduleCALayers(DrawingFrame* frame); | 253 void ScheduleCALayers(DrawingFrame* frame); |
265 void ScheduleOverlays(DrawingFrame* frame); | 254 void ScheduleOverlays(DrawingFrame* frame); |
266 | 255 |
267 // Copies the contents of the render pass to an overlay resource, returned in | 256 // Copies the contents of the render pass to an overlay resource, returned in |
268 // |resource|. The resource is allocated from |overlay_resource_pool_|. | 257 // |resource|. The resource is allocated from |overlay_resource_pool_|. |
269 void CopyRenderPassToOverlayResource(const RenderPassId& render_pass_id, | 258 void CopyRenderPassToOverlayResource(const RenderPassId& render_pass_id, |
270 Resource** resource); | 259 Resource** resource); |
271 | 260 |
272 using OverlayResourceLock = | 261 using OverlayResourceLock = |
273 std::unique_ptr<ResourceProvider::ScopedReadLockGL>; | 262 std::unique_ptr<ResourceProvider::ScopedReadLockGL>; |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 SolidColorProgram solid_color_program_; | 481 SolidColorProgram solid_color_program_; |
493 SolidColorProgramAA solid_color_program_aa_; | 482 SolidColorProgramAA solid_color_program_aa_; |
494 | 483 |
495 gpu::gles2::GLES2Interface* gl_; | 484 gpu::gles2::GLES2Interface* gl_; |
496 gpu::ContextSupport* context_support_; | 485 gpu::ContextSupport* context_support_; |
497 | 486 |
498 TextureMailboxDeleter* texture_mailbox_deleter_; | 487 TextureMailboxDeleter* texture_mailbox_deleter_; |
499 | 488 |
500 gfx::Rect swap_buffer_rect_; | 489 gfx::Rect swap_buffer_rect_; |
501 gfx::Rect scissor_rect_; | 490 gfx::Rect scissor_rect_; |
502 bool is_backbuffer_discarded_; | |
503 bool is_using_bind_uniform_; | 491 bool is_using_bind_uniform_; |
504 bool is_scissor_enabled_; | 492 bool is_scissor_enabled_; |
505 bool scissor_rect_needs_reset_; | 493 bool scissor_rect_needs_reset_; |
506 bool stencil_shadow_; | 494 bool stencil_shadow_; |
507 bool blend_shadow_; | 495 bool blend_shadow_; |
508 unsigned program_shadow_; | 496 unsigned program_shadow_; |
509 TexturedQuadDrawCache draw_cache_; | 497 TexturedQuadDrawCache draw_cache_; |
510 int highp_threshold_min_; | 498 int highp_threshold_min_; |
511 int highp_threshold_cache_; | 499 int highp_threshold_cache_; |
512 | 500 |
(...skipping 18 matching lines...) Expand all Loading... |
531 // overlay resource. This means the GLRenderer needs its own ResourcePool. | 519 // overlay resource. This means the GLRenderer needs its own ResourcePool. |
532 std::unique_ptr<ResourcePool> overlay_resource_pool_; | 520 std::unique_ptr<ResourcePool> overlay_resource_pool_; |
533 | 521 |
534 BoundGeometry bound_geometry_; | 522 BoundGeometry bound_geometry_; |
535 DISALLOW_COPY_AND_ASSIGN(GLRenderer); | 523 DISALLOW_COPY_AND_ASSIGN(GLRenderer); |
536 }; | 524 }; |
537 | 525 |
538 } // namespace cc | 526 } // namespace cc |
539 | 527 |
540 #endif // CC_OUTPUT_GL_RENDERER_H_ | 528 #endif // CC_OUTPUT_GL_RENDERER_H_ |
OLD | NEW |