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(const RenderPassId& id) const; |
| 144 const FilterOperations* BackgroundFiltersForPass( |
| 145 const RenderPassId& id) const; |
| 146 |
141 // Private interface implemented by subclasses for use by DirectRenderer. | 147 // Private interface implemented by subclasses for use by DirectRenderer. |
142 virtual bool CanPartialSwap() = 0; | 148 virtual bool CanPartialSwap() = 0; |
143 virtual void BindFramebufferToOutputSurface(DrawingFrame* frame) = 0; | 149 virtual void BindFramebufferToOutputSurface(DrawingFrame* frame) = 0; |
144 virtual bool BindFramebufferToTexture(DrawingFrame* frame, | 150 virtual bool BindFramebufferToTexture(DrawingFrame* frame, |
145 const ScopedResource* resource) = 0; | 151 const ScopedResource* resource) = 0; |
146 virtual void SetScissorTestRect(const gfx::Rect& scissor_rect) = 0; | 152 virtual void SetScissorTestRect(const gfx::Rect& scissor_rect) = 0; |
147 virtual void PrepareSurfaceForPass( | 153 virtual void PrepareSurfaceForPass( |
148 DrawingFrame* frame, | 154 DrawingFrame* frame, |
149 SurfaceInitializationMode initialization_mode, | 155 SurfaceInitializationMode initialization_mode, |
150 const gfx::Rect& render_pass_scissor) = 0; | 156 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_; | 192 bool use_partial_swap_; |
187 | 193 |
188 // TODO(danakj): Just use a vector of pairs here? Hash map is way overkill. | 194 // TODO(danakj): Just use a vector of pairs here? Hash map is way overkill. |
189 std::unordered_map<RenderPassId, | 195 std::unordered_map<RenderPassId, |
190 std::unique_ptr<ScopedResource>, | 196 std::unique_ptr<ScopedResource>, |
191 RenderPassIdHash> | 197 RenderPassIdHash> |
192 render_pass_textures_; | 198 render_pass_textures_; |
193 std::unordered_map<RenderPassId, TileDrawQuad, RenderPassIdHash> | 199 std::unordered_map<RenderPassId, TileDrawQuad, RenderPassIdHash> |
194 render_pass_bypass_quads_; | 200 render_pass_bypass_quads_; |
195 | 201 |
| 202 RenderPassFilterList render_pass_filters_; |
| 203 RenderPassFilterList render_pass_background_filters_; |
| 204 |
196 bool visible_ = false; | 205 bool visible_ = false; |
197 | 206 |
198 // For use in coordinate conversion, this stores the output rect, viewport | 207 // For use in coordinate conversion, this stores the output rect, viewport |
199 // rect (= unflipped version of glViewport rect), the size of target | 208 // rect (= unflipped version of glViewport rect), the size of target |
200 // framebuffer, and the current window space viewport. During a draw, this | 209 // framebuffer, and the current window space viewport. During a draw, this |
201 // stores the values for the current render pass; in between draws, they | 210 // 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. | 211 // retain the values for the root render pass of the last draw. |
203 gfx::Rect current_draw_rect_; | 212 gfx::Rect current_draw_rect_; |
204 gfx::Rect current_viewport_rect_; | 213 gfx::Rect current_viewport_rect_; |
205 gfx::Size current_surface_size_; | 214 gfx::Size current_surface_size_; |
206 gfx::Rect current_window_space_viewport_; | 215 gfx::Rect current_window_space_viewport_; |
207 | 216 |
208 private: | 217 private: |
209 bool initialized_ = false; | 218 bool initialized_ = false; |
210 gfx::Size enlarge_pass_texture_amount_; | 219 gfx::Size enlarge_pass_texture_amount_; |
211 | 220 |
212 // Cached values given to Reshape(). | 221 // Cached values given to Reshape(). |
213 gfx::Size reshape_surface_size_; | 222 gfx::Size reshape_surface_size_; |
214 float reshape_device_scale_factor_ = 0.f; | 223 float reshape_device_scale_factor_ = 0.f; |
215 gfx::ColorSpace reshape_device_color_space_; | 224 gfx::ColorSpace reshape_device_color_space_; |
216 bool reshape_has_alpha_ = false; | 225 bool reshape_has_alpha_ = false; |
217 | 226 |
218 DISALLOW_COPY_AND_ASSIGN(DirectRenderer); | 227 DISALLOW_COPY_AND_ASSIGN(DirectRenderer); |
219 }; | 228 }; |
220 | 229 |
221 } // namespace cc | 230 } // namespace cc |
222 | 231 |
223 #endif // CC_OUTPUT_DIRECT_RENDERER_H_ | 232 #endif // CC_OUTPUT_DIRECT_RENDERER_H_ |
OLD | NEW |