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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 void DrawRenderPassAndExecuteCopyRequests(DrawingFrame* frame, | 132 void DrawRenderPassAndExecuteCopyRequests(DrawingFrame* frame, |
131 RenderPass* render_pass); | 133 RenderPass* render_pass); |
132 void DrawRenderPass(DrawingFrame* frame, const RenderPass* render_pass); | 134 void DrawRenderPass(DrawingFrame* frame, const RenderPass* render_pass); |
133 bool UseRenderPass(DrawingFrame* frame, const RenderPass* render_pass); | 135 bool UseRenderPass(DrawingFrame* frame, const RenderPass* render_pass); |
134 | 136 |
135 void DoDrawPolygon(const DrawPolygon& poly, | 137 void DoDrawPolygon(const DrawPolygon& poly, |
136 DrawingFrame* frame, | 138 DrawingFrame* frame, |
137 const gfx::Rect& render_pass_scissor, | 139 const gfx::Rect& render_pass_scissor, |
138 bool use_render_pass_scissor); | 140 bool use_render_pass_scissor); |
139 | 141 |
| 142 const FilterOperations* FiltersForPass(int render_pass_id) const; |
| 143 const FilterOperations* BackgroundFiltersForPass(int render_pass_id) const; |
| 144 |
140 // Private interface implemented by subclasses for use by DirectRenderer. | 145 // Private interface implemented by subclasses for use by DirectRenderer. |
141 virtual bool CanPartialSwap() = 0; | 146 virtual bool CanPartialSwap() = 0; |
142 virtual void BindFramebufferToOutputSurface(DrawingFrame* frame) = 0; | 147 virtual void BindFramebufferToOutputSurface(DrawingFrame* frame) = 0; |
143 virtual bool BindFramebufferToTexture(DrawingFrame* frame, | 148 virtual bool BindFramebufferToTexture(DrawingFrame* frame, |
144 const ScopedResource* resource) = 0; | 149 const ScopedResource* resource) = 0; |
145 virtual void SetScissorTestRect(const gfx::Rect& scissor_rect) = 0; | 150 virtual void SetScissorTestRect(const gfx::Rect& scissor_rect) = 0; |
146 virtual void PrepareSurfaceForPass( | 151 virtual void PrepareSurfaceForPass( |
147 DrawingFrame* frame, | 152 DrawingFrame* frame, |
148 SurfaceInitializationMode initialization_mode, | 153 SurfaceInitializationMode initialization_mode, |
149 const gfx::Rect& render_pass_scissor) = 0; | 154 const gfx::Rect& render_pass_scissor) = 0; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 // using partial swap. | 187 // using partial swap. |
183 bool allow_empty_swap_; | 188 bool allow_empty_swap_; |
184 // Whether partial swap can be used. | 189 // Whether partial swap can be used. |
185 bool use_partial_swap_; | 190 bool use_partial_swap_; |
186 | 191 |
187 // TODO(danakj): Just use a vector of pairs here? Hash map is way overkill. | 192 // TODO(danakj): Just use a vector of pairs here? Hash map is way overkill. |
188 std::unordered_map<int, std::unique_ptr<ScopedResource>> | 193 std::unordered_map<int, std::unique_ptr<ScopedResource>> |
189 render_pass_textures_; | 194 render_pass_textures_; |
190 std::unordered_map<int, TileDrawQuad> render_pass_bypass_quads_; | 195 std::unordered_map<int, TileDrawQuad> render_pass_bypass_quads_; |
191 | 196 |
| 197 RenderPassFilterList render_pass_filters_; |
| 198 RenderPassFilterList render_pass_background_filters_; |
| 199 |
192 bool visible_ = false; | 200 bool visible_ = false; |
193 | 201 |
194 // For use in coordinate conversion, this stores the output rect, viewport | 202 // For use in coordinate conversion, this stores the output rect, viewport |
195 // rect (= unflipped version of glViewport rect), the size of target | 203 // rect (= unflipped version of glViewport rect), the size of target |
196 // framebuffer, and the current window space viewport. During a draw, this | 204 // framebuffer, and the current window space viewport. During a draw, this |
197 // stores the values for the current render pass; in between draws, they | 205 // stores the values for the current render pass; in between draws, they |
198 // retain the values for the root render pass of the last draw. | 206 // retain the values for the root render pass of the last draw. |
199 gfx::Rect current_draw_rect_; | 207 gfx::Rect current_draw_rect_; |
200 gfx::Rect current_viewport_rect_; | 208 gfx::Rect current_viewport_rect_; |
201 gfx::Size current_surface_size_; | 209 gfx::Size current_surface_size_; |
202 gfx::Rect current_window_space_viewport_; | 210 gfx::Rect current_window_space_viewport_; |
203 | 211 |
204 private: | 212 private: |
205 bool initialized_ = false; | 213 bool initialized_ = false; |
206 gfx::Size enlarge_pass_texture_amount_; | 214 gfx::Size enlarge_pass_texture_amount_; |
207 | 215 |
208 // Cached values given to Reshape(). | 216 // Cached values given to Reshape(). |
209 gfx::Size reshape_surface_size_; | 217 gfx::Size reshape_surface_size_; |
210 float reshape_device_scale_factor_ = 0.f; | 218 float reshape_device_scale_factor_ = 0.f; |
211 gfx::ColorSpace reshape_device_color_space_; | 219 gfx::ColorSpace reshape_device_color_space_; |
212 bool reshape_has_alpha_ = false; | 220 bool reshape_has_alpha_ = false; |
213 | 221 |
214 DISALLOW_COPY_AND_ASSIGN(DirectRenderer); | 222 DISALLOW_COPY_AND_ASSIGN(DirectRenderer); |
215 }; | 223 }; |
216 | 224 |
217 } // namespace cc | 225 } // namespace cc |
218 | 226 |
219 #endif // CC_OUTPUT_DIRECT_RENDERER_H_ | 227 #endif // CC_OUTPUT_DIRECT_RENDERER_H_ |
OLD | NEW |