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

Side by Side Diff: cc/output/bsp_tree_perftest.cc

Issue 2693703010: cc: Remove support for disabling non-root render surfaces. (Closed)
Patch Set: softwaredraw-remove-no-surfaces: rebase Created 3 years, 7 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 | « cc/layers/layer_impl.cc ('k') | cc/trees/draw_property_utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include <stddef.h> 5 #include <stddef.h>
6 6
7 #include <deque> 7 #include <deque>
8 #include <memory> 8 #include <memory>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 base::FilePath json_file = test_data_dir.AppendASCII(name + ".json"); 64 base::FilePath json_file = test_data_dir.AppendASCII(name + ".json");
65 ASSERT_TRUE(base::ReadFileToString(json_file, &json_)); 65 ASSERT_TRUE(base::ReadFileToString(json_file, &json_));
66 } 66 }
67 67
68 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 68 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
69 69
70 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { 70 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
71 LayerTreeImpl* active_tree = host_impl->active_tree(); 71 LayerTreeImpl* active_tree = host_impl->active_tree();
72 // First build the tree and then we'll start running tests on layersorter 72 // First build the tree and then we'll start running tests on layersorter
73 // itself 73 // itself
74 bool can_render_to_separate_surface = true;
75 int max_texture_size = 8096; 74 int max_texture_size = 8096;
76 DoCalcDrawPropertiesImpl(can_render_to_separate_surface, max_texture_size, 75 DoCalcDrawPropertiesImpl(max_texture_size, active_tree, host_impl);
77 active_tree, host_impl);
78 76
79 LayerImplList base_list; 77 LayerImplList base_list;
80 BuildLayerImplList(active_tree->root_layer_for_testing(), &base_list); 78 BuildLayerImplList(active_tree->root_layer_for_testing(), &base_list);
81 79
82 int polygon_counter = 0; 80 int polygon_counter = 0;
83 std::vector<std::unique_ptr<DrawPolygon>> polygon_list; 81 std::vector<std::unique_ptr<DrawPolygon>> polygon_list;
84 for (LayerImplList::iterator it = base_list.begin(); it != base_list.end(); 82 for (LayerImplList::iterator it = base_list.begin(); it != base_list.end();
85 ++it) { 83 ++it) {
86 DrawPolygon* draw_polygon = new DrawPolygon( 84 DrawPolygon* draw_polygon = new DrawPolygon(
87 NULL, gfx::RectF(gfx::SizeF((*it)->bounds())), 85 NULL, gfx::RectF(gfx::SizeF((*it)->bounds())),
88 (*it)->draw_properties().target_space_transform, polygon_counter++); 86 (*it)->draw_properties().target_space_transform, polygon_counter++);
89 polygon_list.push_back(std::unique_ptr<DrawPolygon>(draw_polygon)); 87 polygon_list.push_back(std::unique_ptr<DrawPolygon>(draw_polygon));
90 } 88 }
91 89
92 timer_.Reset(); 90 timer_.Reset();
93 do { 91 do {
94 std::deque<std::unique_ptr<DrawPolygon>> test_list; 92 std::deque<std::unique_ptr<DrawPolygon>> test_list;
95 for (int i = 0; i < num_duplicates_; i++) { 93 for (int i = 0; i < num_duplicates_; i++) {
96 for (size_t i = 0; i < polygon_list.size(); i++) { 94 for (size_t i = 0; i < polygon_list.size(); i++) {
97 test_list.push_back(polygon_list[i]->CreateCopy()); 95 test_list.push_back(polygon_list[i]->CreateCopy());
98 } 96 }
99 } 97 }
100 BspTree bsp_tree(&test_list); 98 BspTree bsp_tree(&test_list);
101 timer_.NextLap(); 99 timer_.NextLap();
102 } while (!timer_.HasTimeLimitExpired()); 100 } while (!timer_.HasTimeLimitExpired());
103 101
104 EndTest(); 102 EndTest();
105 } 103 }
106 104
107 void DoCalcDrawPropertiesImpl(bool can_render_to_separate_surface, 105 void DoCalcDrawPropertiesImpl(int max_texture_size,
108 int max_texture_size,
109 LayerTreeImpl* active_tree, 106 LayerTreeImpl* active_tree,
110 LayerTreeHostImpl* host_impl) { 107 LayerTreeHostImpl* host_impl) {
111 RenderSurfaceList update_list; 108 RenderSurfaceList update_list;
112 LayerTreeHostCommon::CalcDrawPropsImplInputs inputs( 109 LayerTreeHostCommon::CalcDrawPropsImplInputs inputs(
113 active_tree->root_layer_for_testing(), active_tree->DrawViewportSize(), 110 active_tree->root_layer_for_testing(), active_tree->DrawViewportSize(),
114 host_impl->DrawTransform(), active_tree->device_scale_factor(), 111 host_impl->DrawTransform(), active_tree->device_scale_factor(),
115 active_tree->current_page_scale_factor(), 112 active_tree->current_page_scale_factor(),
116 active_tree->InnerViewportContainerLayer(), 113 active_tree->InnerViewportContainerLayer(),
117 active_tree->InnerViewportScrollLayer(), 114 active_tree->InnerViewportScrollLayer(),
118 active_tree->OuterViewportScrollLayer(), 115 active_tree->OuterViewportScrollLayer(),
119 active_tree->elastic_overscroll()->Current(active_tree->IsActiveTree()), 116 active_tree->elastic_overscroll()->Current(active_tree->IsActiveTree()),
120 active_tree->OverscrollElasticityLayer(), max_texture_size, 117 active_tree->OverscrollElasticityLayer(), max_texture_size,
121 can_render_to_separate_surface,
122 host_impl->settings().layer_transforms_should_scale_layer_contents, 118 host_impl->settings().layer_transforms_should_scale_layer_contents,
123 &update_list, active_tree->property_trees()); 119 &update_list, active_tree->property_trees());
124 LayerTreeHostCommon::CalculateDrawProperties(&inputs); 120 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
125 } 121 }
126 122
127 void BuildLayerImplList(LayerImpl* layer, LayerImplList* list) { 123 void BuildLayerImplList(LayerImpl* layer, LayerImplList* list) {
128 for (auto* layer_impl : *layer->layer_tree_impl()) { 124 for (auto* layer_impl : *layer->layer_tree_impl()) {
129 if (layer_impl->Is3dSorted() && !layer_impl->bounds().IsEmpty()) { 125 if (layer_impl->Is3dSorted() && !layer_impl->bounds().IsEmpty()) {
130 list->push_back(layer_impl); 126 list->push_back(layer_impl);
131 } 127 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 178
183 TEST_F(BspTreePerfTest, BspTreeCubes_4) { 179 TEST_F(BspTreePerfTest, BspTreeCubes_4) {
184 SetTestName("bsp_tree_cubes_4"); 180 SetTestName("bsp_tree_cubes_4");
185 SetNumberOfDuplicates(4); 181 SetNumberOfDuplicates(4);
186 ReadTestFile("layer_sort_cubes"); 182 ReadTestFile("layer_sort_cubes");
187 RunTest(CompositorMode::SINGLE_THREADED); 183 RunTest(CompositorMode::SINGLE_THREADED);
188 } 184 }
189 185
190 } // namespace 186 } // namespace
191 } // namespace cc 187 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | cc/trees/draw_property_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698