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_deque.h" | 10 #include "cc/base/scoped_ptr_deque.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 static scoped_ptr<GLRenderer> Create( | 50 static scoped_ptr<GLRenderer> Create( |
51 RendererClient* client, | 51 RendererClient* client, |
52 const LayerTreeSettings* settings, | 52 const LayerTreeSettings* settings, |
53 OutputSurface* output_surface, | 53 OutputSurface* output_surface, |
54 ResourceProvider* resource_provider, | 54 ResourceProvider* resource_provider, |
55 TextureMailboxDeleter* texture_mailbox_deleter, | 55 TextureMailboxDeleter* texture_mailbox_deleter, |
56 int highp_threshold_min); | 56 int highp_threshold_min); |
57 | 57 |
58 virtual ~GLRenderer(); | 58 virtual ~GLRenderer(); |
59 | 59 |
60 virtual const RendererCapabilitiesImpl& Capabilities() const OVERRIDE; | 60 virtual const RendererCapabilitiesImpl& Capabilities() const override; |
61 | 61 |
62 // Waits for rendering to finish. | 62 // Waits for rendering to finish. |
63 virtual void Finish() OVERRIDE; | 63 virtual void Finish() override; |
64 | 64 |
65 virtual void DoNoOp() OVERRIDE; | 65 virtual void DoNoOp() override; |
66 virtual void SwapBuffers(const CompositorFrameMetadata& metadata) OVERRIDE; | 66 virtual void SwapBuffers(const CompositorFrameMetadata& metadata) override; |
67 | 67 |
68 virtual bool IsContextLost(); | 68 virtual bool IsContextLost(); |
69 | 69 |
70 static void DebugGLCall(gpu::gles2::GLES2Interface* gl, | 70 static void DebugGLCall(gpu::gles2::GLES2Interface* gl, |
71 const char* command, | 71 const char* command, |
72 const char* file, | 72 const char* file, |
73 int line); | 73 int line); |
74 | 74 |
75 protected: | 75 protected: |
76 GLRenderer(RendererClient* client, | 76 GLRenderer(RendererClient* client, |
77 const LayerTreeSettings* settings, | 77 const LayerTreeSettings* settings, |
78 OutputSurface* output_surface, | 78 OutputSurface* output_surface, |
79 ResourceProvider* resource_provider, | 79 ResourceProvider* resource_provider, |
80 TextureMailboxDeleter* texture_mailbox_deleter, | 80 TextureMailboxDeleter* texture_mailbox_deleter, |
81 int highp_threshold_min); | 81 int highp_threshold_min); |
82 | 82 |
83 virtual void DidChangeVisibility() OVERRIDE; | 83 virtual void DidChangeVisibility() override; |
84 | 84 |
85 bool IsBackbufferDiscarded() const { return is_backbuffer_discarded_; } | 85 bool IsBackbufferDiscarded() const { return is_backbuffer_discarded_; } |
86 | 86 |
87 const gfx::QuadF& SharedGeometryQuad() const { return shared_geometry_quad_; } | 87 const gfx::QuadF& SharedGeometryQuad() const { return shared_geometry_quad_; } |
88 const GeometryBinding* SharedGeometry() const { | 88 const GeometryBinding* SharedGeometry() const { |
89 return shared_geometry_.get(); | 89 return shared_geometry_.get(); |
90 } | 90 } |
91 | 91 |
92 void GetFramebufferPixelsAsync(const gfx::Rect& rect, | 92 void GetFramebufferPixelsAsync(const gfx::Rect& rect, |
93 scoped_ptr<CopyOutputRequest> request); | 93 scoped_ptr<CopyOutputRequest> request); |
94 void GetFramebufferTexture(unsigned texture_id, | 94 void GetFramebufferTexture(unsigned texture_id, |
95 ResourceFormat texture_format, | 95 ResourceFormat texture_format, |
96 const gfx::Rect& device_rect); | 96 const gfx::Rect& device_rect); |
97 void ReleaseRenderPassTextures(); | 97 void ReleaseRenderPassTextures(); |
98 | 98 |
99 void SetStencilEnabled(bool enabled); | 99 void SetStencilEnabled(bool enabled); |
100 bool stencil_enabled() const { return stencil_shadow_; } | 100 bool stencil_enabled() const { return stencil_shadow_; } |
101 void SetBlendEnabled(bool enabled); | 101 void SetBlendEnabled(bool enabled); |
102 bool blend_enabled() const { return blend_shadow_; } | 102 bool blend_enabled() const { return blend_shadow_; } |
103 | 103 |
104 virtual void BindFramebufferToOutputSurface(DrawingFrame* frame) OVERRIDE; | 104 virtual void BindFramebufferToOutputSurface(DrawingFrame* frame) override; |
105 virtual bool BindFramebufferToTexture(DrawingFrame* frame, | 105 virtual bool BindFramebufferToTexture(DrawingFrame* frame, |
106 const ScopedResource* resource, | 106 const ScopedResource* resource, |
107 const gfx::Rect& target_rect) OVERRIDE; | 107 const gfx::Rect& target_rect) override; |
108 virtual void SetDrawViewport(const gfx::Rect& window_space_viewport) OVERRIDE; | 108 virtual void SetDrawViewport(const gfx::Rect& window_space_viewport) override; |
109 virtual void SetScissorTestRect(const gfx::Rect& scissor_rect) OVERRIDE; | 109 virtual void SetScissorTestRect(const gfx::Rect& scissor_rect) override; |
110 virtual void DiscardPixels(bool has_external_stencil_test, | 110 virtual void DiscardPixels(bool has_external_stencil_test, |
111 bool draw_rect_covers_full_surface) OVERRIDE; | 111 bool draw_rect_covers_full_surface) override; |
112 virtual void ClearFramebuffer(DrawingFrame* frame, | 112 virtual void ClearFramebuffer(DrawingFrame* frame, |
113 bool has_external_stencil_test) OVERRIDE; | 113 bool has_external_stencil_test) override; |
114 virtual void DoDrawQuad(DrawingFrame* frame, const class DrawQuad*) OVERRIDE; | 114 virtual void DoDrawQuad(DrawingFrame* frame, const class DrawQuad*) override; |
115 virtual void BeginDrawingFrame(DrawingFrame* frame) OVERRIDE; | 115 virtual void BeginDrawingFrame(DrawingFrame* frame) override; |
116 virtual void FinishDrawingFrame(DrawingFrame* frame) OVERRIDE; | 116 virtual void FinishDrawingFrame(DrawingFrame* frame) override; |
117 virtual bool FlippedFramebuffer() const OVERRIDE; | 117 virtual bool FlippedFramebuffer() const override; |
118 virtual void EnsureScissorTestEnabled() OVERRIDE; | 118 virtual void EnsureScissorTestEnabled() override; |
119 virtual void EnsureScissorTestDisabled() OVERRIDE; | 119 virtual void EnsureScissorTestDisabled() override; |
120 virtual void CopyCurrentRenderPassToBitmap( | 120 virtual void CopyCurrentRenderPassToBitmap( |
121 DrawingFrame* frame, | 121 DrawingFrame* frame, |
122 scoped_ptr<CopyOutputRequest> request) OVERRIDE; | 122 scoped_ptr<CopyOutputRequest> request) override; |
123 virtual void FinishDrawingQuadList() OVERRIDE; | 123 virtual void FinishDrawingQuadList() override; |
124 | 124 |
125 // Check if quad needs antialiasing and if so, inflate the quad and | 125 // Check if quad needs antialiasing and if so, inflate the quad and |
126 // fill edge array for fragment shader. local_quad is set to | 126 // fill edge array for fragment shader. local_quad is set to |
127 // inflated quad if antialiasing is required, otherwise it is left | 127 // inflated quad if antialiasing is required, otherwise it is left |
128 // unchanged. edge array is filled with inflated quad's edge data | 128 // unchanged. edge array is filled with inflated quad's edge data |
129 // if antialiasing is required, otherwise it is left unchanged. | 129 // if antialiasing is required, otherwise it is left unchanged. |
130 // Returns true if quad requires antialiasing and false otherwise. | 130 // Returns true if quad requires antialiasing and false otherwise. |
131 static bool SetupQuadForAntialiasing(const gfx::Transform& device_transform, | 131 static bool SetupQuadForAntialiasing(const gfx::Transform& device_transform, |
132 const DrawQuad* quad, | 132 const DrawQuad* quad, |
133 gfx::QuadF* local_quad, | 133 gfx::QuadF* local_quad, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 bool success)> | 198 bool success)> |
199 AsyncGetFramebufferPixelsCleanupCallback; | 199 AsyncGetFramebufferPixelsCleanupCallback; |
200 void FinishedReadback(unsigned source_buffer, | 200 void FinishedReadback(unsigned source_buffer, |
201 unsigned query, | 201 unsigned query, |
202 const gfx::Size& size); | 202 const gfx::Size& size); |
203 | 203 |
204 void ReinitializeGLState(); | 204 void ReinitializeGLState(); |
205 void RestoreGLState(); | 205 void RestoreGLState(); |
206 void RestoreFramebuffer(DrawingFrame* frame); | 206 void RestoreFramebuffer(DrawingFrame* frame); |
207 | 207 |
208 virtual void DiscardBackbuffer() OVERRIDE; | 208 virtual void DiscardBackbuffer() override; |
209 virtual void EnsureBackbuffer() OVERRIDE; | 209 virtual void EnsureBackbuffer() override; |
210 void EnforceMemoryPolicy(); | 210 void EnforceMemoryPolicy(); |
211 | 211 |
212 void ScheduleOverlays(DrawingFrame* frame); | 212 void ScheduleOverlays(DrawingFrame* frame); |
213 | 213 |
214 typedef ScopedPtrVector<ResourceProvider::ScopedReadLockGL> | 214 typedef ScopedPtrVector<ResourceProvider::ScopedReadLockGL> |
215 OverlayResourceLockList; | 215 OverlayResourceLockList; |
216 OverlayResourceLockList pending_overlay_resources_; | 216 OverlayResourceLockList pending_overlay_resources_; |
217 OverlayResourceLockList in_use_overlay_resources_; | 217 OverlayResourceLockList in_use_overlay_resources_; |
218 | 218 |
219 RendererCapabilitiesImpl capabilities_; | 219 RendererCapabilitiesImpl capabilities_; |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 #if DEBUG_GL_CALLS && !defined(NDEBUG) | 436 #if DEBUG_GL_CALLS && !defined(NDEBUG) |
437 #define GLC(context, x) \ | 437 #define GLC(context, x) \ |
438 (x, GLRenderer::DebugGLCall(&* context, #x, __FILE__, __LINE__)) | 438 (x, GLRenderer::DebugGLCall(&* context, #x, __FILE__, __LINE__)) |
439 #else | 439 #else |
440 #define GLC(context, x) (x) | 440 #define GLC(context, x) (x) |
441 #endif | 441 #endif |
442 | 442 |
443 } // namespace cc | 443 } // namespace cc |
444 | 444 |
445 #endif // CC_OUTPUT_GL_RENDERER_H_ | 445 #endif // CC_OUTPUT_GL_RENDERER_H_ |
OLD | NEW |