OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_DIRECT_RENDERER_H_ | 5 #ifndef CC_OUTPUT_DIRECT_RENDERER_H_ |
6 #define CC_OUTPUT_DIRECT_RENDERER_H_ | 6 #define CC_OUTPUT_DIRECT_RENDERER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <unordered_map> | 9 #include <unordered_map> |
| 10 #include <vector> |
10 | 11 |
11 #include "base/callback.h" | 12 #include "base/callback.h" |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "cc/base/cc_export.h" | 14 #include "cc/base/cc_export.h" |
14 #include "cc/output/ca_layer_overlay.h" | 15 #include "cc/output/ca_layer_overlay.h" |
| 16 #include "cc/output/filter_operations.h" |
15 #include "cc/output/overlay_processor.h" | 17 #include "cc/output/overlay_processor.h" |
16 #include "cc/quads/tile_draw_quad.h" | 18 #include "cc/quads/tile_draw_quad.h" |
17 #include "cc/resources/resource_provider.h" | 19 #include "cc/resources/resource_provider.h" |
18 #include "gpu/command_buffer/common/texture_in_use_response.h" | 20 #include "gpu/command_buffer/common/texture_in_use_response.h" |
19 #include "ui/events/latency_info.h" | 21 #include "ui/events/latency_info.h" |
20 #include "ui/gfx/geometry/quad_f.h" | 22 #include "ui/gfx/geometry/quad_f.h" |
21 #include "ui/gfx/geometry/rect.h" | 23 #include "ui/gfx/geometry/rect.h" |
22 | 24 |
23 namespace gfx { | 25 namespace gfx { |
24 class ColorSpace; | 26 class ColorSpace; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 void DrawRenderPassAndExecuteCopyRequests(DrawingFrame* frame, | 133 void DrawRenderPassAndExecuteCopyRequests(DrawingFrame* frame, |
132 RenderPass* render_pass); | 134 RenderPass* render_pass); |
133 void DrawRenderPass(DrawingFrame* frame, const RenderPass* render_pass); | 135 void DrawRenderPass(DrawingFrame* frame, const RenderPass* render_pass); |
134 bool UseRenderPass(DrawingFrame* frame, const RenderPass* render_pass); | 136 bool UseRenderPass(DrawingFrame* frame, const RenderPass* render_pass); |
135 | 137 |
136 void DoDrawPolygon(const DrawPolygon& poly, | 138 void DoDrawPolygon(const DrawPolygon& poly, |
137 DrawingFrame* frame, | 139 DrawingFrame* frame, |
138 const gfx::Rect& render_pass_scissor, | 140 const gfx::Rect& render_pass_scissor, |
139 bool use_render_pass_scissor); | 141 bool use_render_pass_scissor); |
140 | 142 |
| 143 const FilterOperations* FiltersForPass(RenderPassId id) const; |
| 144 const FilterOperations* BackgroundFiltersForPass(RenderPassId id) const; |
| 145 |
141 // Private interface implemented by subclasses for use by DirectRenderer. | 146 // Private interface implemented by subclasses for use by DirectRenderer. |
142 virtual bool CanPartialSwap() = 0; | 147 virtual bool CanPartialSwap() = 0; |
143 virtual void BindFramebufferToOutputSurface(DrawingFrame* frame) = 0; | 148 virtual void BindFramebufferToOutputSurface(DrawingFrame* frame) = 0; |
144 virtual bool BindFramebufferToTexture(DrawingFrame* frame, | 149 virtual bool BindFramebufferToTexture(DrawingFrame* frame, |
145 const ScopedResource* resource) = 0; | 150 const ScopedResource* resource) = 0; |
146 virtual void SetScissorTestRect(const gfx::Rect& scissor_rect) = 0; | 151 virtual void SetScissorTestRect(const gfx::Rect& scissor_rect) = 0; |
147 virtual void PrepareSurfaceForPass( | 152 virtual void PrepareSurfaceForPass( |
148 DrawingFrame* frame, | 153 DrawingFrame* frame, |
149 SurfaceInitializationMode initialization_mode, | 154 SurfaceInitializationMode initialization_mode, |
150 const gfx::Rect& render_pass_scissor) = 0; | 155 const gfx::Rect& render_pass_scissor) = 0; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 bool use_partial_swap_; | 191 bool use_partial_swap_; |
187 | 192 |
188 // TODO(danakj): Just use a vector of pairs here? Hash map is way overkill. | 193 // TODO(danakj): Just use a vector of pairs here? Hash map is way overkill. |
189 std::unordered_map<RenderPassId, | 194 std::unordered_map<RenderPassId, |
190 std::unique_ptr<ScopedResource>, | 195 std::unique_ptr<ScopedResource>, |
191 RenderPassIdHash> | 196 RenderPassIdHash> |
192 render_pass_textures_; | 197 render_pass_textures_; |
193 std::unordered_map<RenderPassId, TileDrawQuad, RenderPassIdHash> | 198 std::unordered_map<RenderPassId, TileDrawQuad, RenderPassIdHash> |
194 render_pass_bypass_quads_; | 199 render_pass_bypass_quads_; |
195 | 200 |
| 201 RenderPassFilterList render_pass_filters_; |
| 202 RenderPassFilterList render_pass_background_filters_; |
| 203 |
196 bool visible_ = false; | 204 bool visible_ = false; |
197 | 205 |
198 // For use in coordinate conversion, this stores the output rect, viewport | 206 // For use in coordinate conversion, this stores the output rect, viewport |
199 // rect (= unflipped version of glViewport rect), the size of target | 207 // rect (= unflipped version of glViewport rect), the size of target |
200 // framebuffer, and the current window space viewport. During a draw, this | 208 // framebuffer, and the current window space viewport. During a draw, this |
201 // stores the values for the current render pass; in between draws, they | 209 // stores the values for the current render pass; in between draws, they |
202 // retain the values for the root render pass of the last draw. | 210 // retain the values for the root render pass of the last draw. |
203 gfx::Rect current_draw_rect_; | 211 gfx::Rect current_draw_rect_; |
204 gfx::Rect current_viewport_rect_; | 212 gfx::Rect current_viewport_rect_; |
205 gfx::Size current_surface_size_; | 213 gfx::Size current_surface_size_; |
206 gfx::Rect current_window_space_viewport_; | 214 gfx::Rect current_window_space_viewport_; |
207 | 215 |
208 private: | 216 private: |
209 bool initialized_ = false; | 217 bool initialized_ = false; |
210 gfx::Size enlarge_pass_texture_amount_; | 218 gfx::Size enlarge_pass_texture_amount_; |
211 | 219 |
212 // Cached values given to Reshape(). | 220 // Cached values given to Reshape(). |
213 gfx::Size reshape_surface_size_; | 221 gfx::Size reshape_surface_size_; |
214 float reshape_device_scale_factor_ = 0.f; | 222 float reshape_device_scale_factor_ = 0.f; |
215 gfx::ColorSpace reshape_device_color_space_; | 223 gfx::ColorSpace reshape_device_color_space_; |
216 bool reshape_has_alpha_ = false; | 224 bool reshape_has_alpha_ = false; |
217 | 225 |
218 DISALLOW_COPY_AND_ASSIGN(DirectRenderer); | 226 DISALLOW_COPY_AND_ASSIGN(DirectRenderer); |
219 }; | 227 }; |
220 | 228 |
221 } // namespace cc | 229 } // namespace cc |
222 | 230 |
223 #endif // CC_OUTPUT_DIRECT_RENDERER_H_ | 231 #endif // CC_OUTPUT_DIRECT_RENDERER_H_ |
OLD | NEW |