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

Unified Diff: cc/trees/layer_tree_host_common_perftest.cc

Issue 998023002: Revert of Splitting of layers for correct intersections (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_common_perftest.cc
diff --git a/cc/trees/layer_tree_host_common_perftest.cc b/cc/trees/layer_tree_host_common_perftest.cc
index 1732e5588981f89d175935ae9d984b6cd5c05ad1..73d5c1d0d413db93dddcdee3f1194d5167967ac4 100644
--- a/cc/trees/layer_tree_host_common_perftest.cc
+++ b/cc/trees/layer_tree_host_common_perftest.cc
@@ -25,6 +25,7 @@
#include "cc/test/layer_tree_json_parser.h"
#include "cc/test/layer_tree_test.h"
#include "cc/test/paths.h"
+#include "cc/trees/layer_sorter.h"
#include "cc/trees/layer_tree_impl.h"
#include "testing/perf/perf_test.h"
@@ -161,7 +162,55 @@
}
};
-class BspTreePerfTest : public CalcDrawPropsImplTest {
+class LayerSorterMainTest : public CalcDrawPropsImplTest {
+ public:
+ void RunSortLayers() { RunTest(false, false, false); }
+
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
+
+ void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
+ LayerTreeImpl* active_tree = host_impl->active_tree();
+ // First build the tree and then we'll start running tests on layersorter
+ // itself
+ bool can_render_to_separate_surface = true;
+ int max_texture_size = 8096;
+ DoCalcDrawPropertiesImpl(can_render_to_separate_surface,
+ max_texture_size,
+ active_tree,
+ host_impl);
+
+ // Behaviour of this test is different from that of sorting in practice.
+ // In this case, all layers that exist in any 3D context are put into a list
+ // and are sorted as one big 3D context instead of several smaller ones.
+ BuildLayerImplList(active_tree->root_layer(), &base_list_);
+ timer_.Reset();
+ do {
+ // Here we'll move the layers into a LayerImpl list of their own to be
+ // sorted so we don't have a sorted list for every run after the first
+ LayerImplList test_list = base_list_;
+ layer_sorter_.Sort(test_list.begin(), test_list.end());
+ timer_.NextLap();
+ } while (!timer_.HasTimeLimitExpired());
+
+ EndTest();
+ }
+
+ void BuildLayerImplList(LayerImpl* layer, LayerImplList* list) {
+ if (layer->Is3dSorted()) {
+ list->push_back(layer);
+ }
+
+ for (size_t i = 0; i < layer->children().size(); i++) {
+ BuildLayerImplList(layer->children()[i], list);
+ }
+ }
+
+ private:
+ LayerImplList base_list_;
+ LayerSorter layer_sorter_;
+};
+
+class BspTreePerfTest : public LayerSorterMainTest {
public:
void RunSortLayers() { RunTest(false, false, false); }
@@ -212,18 +261,7 @@
EndTest();
}
- void BuildLayerImplList(LayerImpl* layer, LayerImplList* list) {
- if (layer->Is3dSorted()) {
- list->push_back(layer);
- }
-
- for (size_t i = 0; i < layer->children().size(); i++) {
- BuildLayerImplList(layer->children()[i], list);
- }
- }
-
private:
- LayerImplList base_list_;
int num_duplicates_;
};
@@ -275,13 +313,13 @@
RunCalcDrawProps();
}
-TEST_F(BspTreePerfTest, LayerSorterCubes) {
+TEST_F(LayerSorterMainTest, LayerSorterCubes) {
SetTestName("layer_sort_cubes");
ReadTestFile("layer_sort_cubes");
RunSortLayers();
}
-TEST_F(BspTreePerfTest, LayerSorterRubik) {
+TEST_F(LayerSorterMainTest, LayerSorterRubik) {
SetTestName("layer_sort_rubik");
ReadTestFile("layer_sort_rubik");
// TODO(vollick): Remove verify_property_trees setting after
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698