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 "base/cancelable_callback.h" | 8 #include "base/cancelable_callback.h" |
9 #include "cc/base/cc_export.h" | 9 #include "cc/base/cc_export.h" |
10 #include "cc/base/scoped_ptr_vector.h" | 10 #include "cc/base/scoped_ptr_vector.h" |
11 #include "cc/output/direct_renderer.h" | 11 #include "cc/output/direct_renderer.h" |
12 #include "cc/output/gl_renderer_draw_cache.h" | 12 #include "cc/output/gl_renderer_draw_cache.h" |
13 #include "cc/output/program_binding.h" | 13 #include "cc/output/program_binding.h" |
14 #include "cc/output/renderer.h" | 14 #include "cc/output/renderer.h" |
15 #include "cc/quads/checkerboard_draw_quad.h" | 15 #include "cc/quads/checkerboard_draw_quad.h" |
16 #include "cc/quads/debug_border_draw_quad.h" | 16 #include "cc/quads/debug_border_draw_quad.h" |
17 #include "cc/quads/io_surface_draw_quad.h" | 17 #include "cc/quads/io_surface_draw_quad.h" |
18 #include "cc/quads/render_pass_draw_quad.h" | 18 #include "cc/quads/render_pass_draw_quad.h" |
19 #include "cc/quads/solid_color_draw_quad.h" | 19 #include "cc/quads/solid_color_draw_quad.h" |
20 #include "cc/quads/tile_draw_quad.h" | 20 #include "cc/quads/tile_draw_quad.h" |
21 #include "cc/quads/yuv_video_draw_quad.h" | 21 #include "cc/quads/yuv_video_draw_quad.h" |
22 #include "ui/gfx/quad_f.h" | 22 #include "ui/gfx/quad_f.h" |
23 | 23 |
24 class SkBitmap; | 24 class SkBitmap; |
25 | 25 |
26 namespace WebKit { class WebGraphicsContext3D; } | 26 namespace blink { class WebGraphicsContext3D; } |
27 | 27 |
28 namespace cc { | 28 namespace cc { |
29 | 29 |
30 class GLRendererShaderTest; | 30 class GLRendererShaderTest; |
31 class OutputSurface; | 31 class OutputSurface; |
32 class PictureDrawQuad; | 32 class PictureDrawQuad; |
33 class ScopedResource; | 33 class ScopedResource; |
34 class StreamVideoDrawQuad; | 34 class StreamVideoDrawQuad; |
35 class TextureDrawQuad; | 35 class TextureDrawQuad; |
36 class TextureMailboxDeleter; | 36 class TextureMailboxDeleter; |
37 class GeometryBinding; | 37 class GeometryBinding; |
38 class ScopedEnsureFramebufferAllocation; | 38 class ScopedEnsureFramebufferAllocation; |
39 | 39 |
40 // Class that handles drawing of composited render layers using GL. | 40 // Class that handles drawing of composited render layers using GL. |
41 class CC_EXPORT GLRenderer : public DirectRenderer { | 41 class CC_EXPORT GLRenderer : public DirectRenderer { |
42 public: | 42 public: |
43 static scoped_ptr<GLRenderer> Create( | 43 static scoped_ptr<GLRenderer> Create( |
44 RendererClient* client, | 44 RendererClient* client, |
45 const LayerTreeSettings* settings, | 45 const LayerTreeSettings* settings, |
46 OutputSurface* output_surface, | 46 OutputSurface* output_surface, |
47 ResourceProvider* resource_provider, | 47 ResourceProvider* resource_provider, |
48 TextureMailboxDeleter* texture_mailbox_deleter, | 48 TextureMailboxDeleter* texture_mailbox_deleter, |
49 int highp_threshold_min, | 49 int highp_threshold_min, |
50 bool use_skia_gpu_backend); | 50 bool use_skia_gpu_backend); |
51 | 51 |
52 virtual ~GLRenderer(); | 52 virtual ~GLRenderer(); |
53 | 53 |
54 virtual const RendererCapabilities& Capabilities() const OVERRIDE; | 54 virtual const RendererCapabilities& Capabilities() const OVERRIDE; |
55 | 55 |
56 WebKit::WebGraphicsContext3D* Context(); | 56 blink::WebGraphicsContext3D* Context(); |
57 | 57 |
58 virtual void ViewportChanged() OVERRIDE; | 58 virtual void ViewportChanged() OVERRIDE; |
59 | 59 |
60 // Waits for rendering to finish. | 60 // Waits for rendering to finish. |
61 virtual void Finish() OVERRIDE; | 61 virtual void Finish() OVERRIDE; |
62 | 62 |
63 virtual void DoNoOp() OVERRIDE; | 63 virtual void DoNoOp() OVERRIDE; |
64 virtual void SwapBuffers() OVERRIDE; | 64 virtual void SwapBuffers() OVERRIDE; |
65 | 65 |
66 virtual void GetFramebufferPixels(void* pixels, gfx::Rect rect) OVERRIDE; | 66 virtual void GetFramebufferPixels(void* pixels, gfx::Rect rect) OVERRIDE; |
67 | 67 |
68 virtual bool IsContextLost() OVERRIDE; | 68 virtual bool IsContextLost() OVERRIDE; |
69 | 69 |
70 virtual void SetVisible(bool visible) OVERRIDE; | 70 virtual void SetVisible(bool visible) OVERRIDE; |
71 | 71 |
72 virtual void SendManagedMemoryStats(size_t bytes_visible, | 72 virtual void SendManagedMemoryStats(size_t bytes_visible, |
73 size_t bytes_visible_and_nearby, | 73 size_t bytes_visible_and_nearby, |
74 size_t bytes_allocated) OVERRIDE; | 74 size_t bytes_allocated) OVERRIDE; |
75 | 75 |
76 static void DebugGLCall(WebKit::WebGraphicsContext3D* context, | 76 static void DebugGLCall(blink::WebGraphicsContext3D* context, |
77 const char* command, | 77 const char* command, |
78 const char* file, | 78 const char* file, |
79 int line); | 79 int line); |
80 | 80 |
81 bool CanUseSkiaGPUBackend() const; | 81 bool CanUseSkiaGPUBackend() const; |
82 | 82 |
83 protected: | 83 protected: |
84 GLRenderer(RendererClient* client, | 84 GLRenderer(RendererClient* client, |
85 const LayerTreeSettings* settings, | 85 const LayerTreeSettings* settings, |
86 OutputSurface* output_surface, | 86 OutputSurface* output_surface, |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 VideoStreamTextureProgram video_stream_texture_program_; | 410 VideoStreamTextureProgram video_stream_texture_program_; |
411 | 411 |
412 VideoYUVProgram video_yuv_program_highp_; | 412 VideoYUVProgram video_yuv_program_highp_; |
413 VideoYUVAProgram video_yuva_program_highp_; | 413 VideoYUVAProgram video_yuva_program_highp_; |
414 VideoStreamTextureProgram video_stream_texture_program_highp_; | 414 VideoStreamTextureProgram video_stream_texture_program_highp_; |
415 | 415 |
416 DebugBorderProgram debug_border_program_; | 416 DebugBorderProgram debug_border_program_; |
417 SolidColorProgram solid_color_program_; | 417 SolidColorProgram solid_color_program_; |
418 SolidColorProgramAA solid_color_program_aa_; | 418 SolidColorProgramAA solid_color_program_aa_; |
419 | 419 |
420 WebKit::WebGraphicsContext3D* context_; | 420 blink::WebGraphicsContext3D* context_; |
421 gpu::ContextSupport* context_support_; | 421 gpu::ContextSupport* context_support_; |
422 | 422 |
423 skia::RefPtr<GrContext> gr_context_; | 423 skia::RefPtr<GrContext> gr_context_; |
424 skia::RefPtr<SkCanvas> sk_canvas_; | 424 skia::RefPtr<SkCanvas> sk_canvas_; |
425 | 425 |
426 TextureMailboxDeleter* texture_mailbox_deleter_; | 426 TextureMailboxDeleter* texture_mailbox_deleter_; |
427 | 427 |
428 gfx::Rect swap_buffer_rect_; | 428 gfx::Rect swap_buffer_rect_; |
429 gfx::Rect scissor_rect_; | 429 gfx::Rect scissor_rect_; |
430 gfx::Rect viewport_; | 430 gfx::Rect viewport_; |
(...skipping 29 matching lines...) Expand all Loading... |
460 #if DEBUG_GL_CALLS && !defined(NDEBUG) | 460 #if DEBUG_GL_CALLS && !defined(NDEBUG) |
461 #define GLC(context, x) \ | 461 #define GLC(context, x) \ |
462 (x, GLRenderer::DebugGLCall(&* context, #x, __FILE__, __LINE__)) | 462 (x, GLRenderer::DebugGLCall(&* context, #x, __FILE__, __LINE__)) |
463 #else | 463 #else |
464 #define GLC(context, x) (x) | 464 #define GLC(context, x) (x) |
465 #endif | 465 #endif |
466 | 466 |
467 } // namespace cc | 467 } // namespace cc |
468 | 468 |
469 #endif // CC_OUTPUT_GL_RENDERER_H_ | 469 #endif // CC_OUTPUT_GL_RENDERER_H_ |
OLD | NEW |