Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1348)

Side by Side Diff: cc/output/direct_renderer.h

Issue 1960543002: Optimize render passes with single quads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix context menus Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | cc/output/direct_renderer.cc » ('j') | cc/output/direct_renderer.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <unordered_map> 8 #include <unordered_map>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "cc/base/cc_export.h" 12 #include "cc/base/cc_export.h"
13 #include "cc/output/ca_layer_overlay.h" 13 #include "cc/output/ca_layer_overlay.h"
14 #include "cc/output/overlay_processor.h" 14 #include "cc/output/overlay_processor.h"
15 #include "cc/output/renderer.h" 15 #include "cc/output/renderer.h"
16 #include "cc/quads/tile_draw_quad.h"
16 #include "cc/raster/task_graph_runner.h" 17 #include "cc/raster/task_graph_runner.h"
17 #include "cc/resources/resource_provider.h" 18 #include "cc/resources/resource_provider.h"
18 #include "cc/resources/scoped_resource.h" 19 #include "cc/resources/scoped_resource.h"
19 #include "ui/gfx/geometry/quad_f.h" 20 #include "ui/gfx/geometry/quad_f.h"
20 21
21 namespace cc { 22 namespace cc {
22 class DrawPolygon; 23 class DrawPolygon;
23 class ResourceProvider; 24 class ResourceProvider;
24 25
25 // This is the base class for code shared between the GL and software 26 // This is the base class for code shared between the GL and software
26 // renderer implementations. "Direct" refers to the fact that it does not 27 // renderer implementations. "Direct" refers to the fact that it does not
27 // delegate rendering to another compositor. 28 // delegate rendering to another compositor.
28 class CC_EXPORT DirectRenderer : public Renderer { 29 class CC_EXPORT DirectRenderer : public Renderer {
29 public: 30 public:
30 ~DirectRenderer() override; 31 ~DirectRenderer() override;
31 32
32 void DecideRenderPassAllocationsForFrame( 33 void DecideRenderPassAllocationsForFrame(
33 const RenderPassList& render_passes_in_draw_order) override; 34 const RenderPassList& render_passes_in_draw_order) override;
34 bool HasAllocatedResourcesForTesting(RenderPassId id) const override; 35 bool HasAllocatedResourcesForTesting(RenderPassId id) const override;
35 void DrawFrame(RenderPassList* render_passes_in_draw_order, 36 void DrawFrame(RenderPassList* render_passes_in_draw_order,
36 float device_scale_factor, 37 float device_scale_factor,
37 const gfx::Rect& device_viewport_rect, 38 const gfx::Rect& device_viewport_rect,
38 const gfx::Rect& device_clip_rect, 39 const gfx::Rect& device_clip_rect,
39 bool disable_picture_quad_image_filtering) override; 40 bool disable_picture_quad_image_filtering) override;
40 virtual void SwapBuffersComplete() {} 41 virtual void SwapBuffersComplete() {}
41 42
43 // If a pass contains a single tile draw quad and can be drawn without
44 // a render pass (e.g. applying a filter directly to the tile quad)
45 // return that quad, otherwise return null.
46 virtual const TileDrawQuad* CanPassBeDrawnDirectly(const RenderPass* pass);
47
42 struct CC_EXPORT DrawingFrame { 48 struct CC_EXPORT DrawingFrame {
43 DrawingFrame(); 49 DrawingFrame();
44 ~DrawingFrame(); 50 ~DrawingFrame();
45 51
46 const RenderPassList* render_passes_in_draw_order; 52 const RenderPassList* render_passes_in_draw_order;
47 const RenderPass* root_render_pass; 53 const RenderPass* root_render_pass;
48 const RenderPass* current_render_pass; 54 const RenderPass* current_render_pass;
49 const ScopedResource* current_texture; 55 const ScopedResource* current_texture;
50 56
51 gfx::Rect root_damage_rect; 57 gfx::Rect root_damage_rect;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 151
146 virtual void CopyCurrentRenderPassToBitmap( 152 virtual void CopyCurrentRenderPassToBitmap(
147 DrawingFrame* frame, 153 DrawingFrame* frame,
148 std::unique_ptr<CopyOutputRequest> request) = 0; 154 std::unique_ptr<CopyOutputRequest> request) = 0;
149 155
150 // TODO(danakj): Just use a vector of pairs here? Hash map is way overkill. 156 // TODO(danakj): Just use a vector of pairs here? Hash map is way overkill.
151 std::unordered_map<RenderPassId, 157 std::unordered_map<RenderPassId,
152 std::unique_ptr<ScopedResource>, 158 std::unique_ptr<ScopedResource>,
153 RenderPassIdHash> 159 RenderPassIdHash>
154 render_pass_textures_; 160 render_pass_textures_;
161 std::unordered_map<RenderPassId, TileDrawQuad, RenderPassIdHash>
162 render_pass_bypass_quads_;
155 OutputSurface* output_surface_; 163 OutputSurface* output_surface_;
156 ResourceProvider* resource_provider_; 164 ResourceProvider* resource_provider_;
157 std::unique_ptr<OverlayProcessor> overlay_processor_; 165 std::unique_ptr<OverlayProcessor> overlay_processor_;
158 166
159 // For use in coordinate conversion, this stores the output rect, viewport 167 // For use in coordinate conversion, this stores the output rect, viewport
160 // rect (= unflipped version of glViewport rect), the size of target 168 // rect (= unflipped version of glViewport rect), the size of target
161 // framebuffer, and the current window space viewport. During a draw, this 169 // framebuffer, and the current window space viewport. During a draw, this
162 // stores the values for the current render pass; in between draws, they 170 // stores the values for the current render pass; in between draws, they
163 // retain the values for the root render pass of the last draw. 171 // retain the values for the root render pass of the last draw.
164 gfx::Rect current_draw_rect_; 172 gfx::Rect current_draw_rect_;
165 gfx::Rect current_viewport_rect_; 173 gfx::Rect current_viewport_rect_;
166 gfx::Size current_surface_size_; 174 gfx::Size current_surface_size_;
167 gfx::Rect current_window_space_viewport_; 175 gfx::Rect current_window_space_viewport_;
168 176
169 private: 177 private:
170 gfx::Size enlarge_pass_texture_amount_; 178 gfx::Size enlarge_pass_texture_amount_;
171 179
172 DISALLOW_COPY_AND_ASSIGN(DirectRenderer); 180 DISALLOW_COPY_AND_ASSIGN(DirectRenderer);
173 }; 181 };
174 182
175 } // namespace cc 183 } // namespace cc
176 184
177 #endif // CC_OUTPUT_DIRECT_RENDERER_H_ 185 #endif // CC_OUTPUT_DIRECT_RENDERER_H_
OLDNEW
« no previous file with comments | « no previous file | cc/output/direct_renderer.cc » ('j') | cc/output/direct_renderer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698