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

Unified Diff: cc/trees/layer_tree_host_common_perftest.cc

Issue 416273002: BSP Tree perf tests to match LayerSorter perf tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased with BSP patch Created 6 years, 5 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
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 02b0770495b4c42c789c13ad427200318a2aae86..ae0d7b4420ab6ee2f84ecb1a9ae0dd11f2218721 100644
--- a/cc/trees/layer_tree_host_common_perftest.cc
+++ b/cc/trees/layer_tree_host_common_perftest.cc
@@ -8,12 +8,18 @@
#include "base/file_util.h"
#include "base/files/file_path.h"
+#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
#include "base/strings/string_piece.h"
#include "base/threading/thread.h"
#include "base/time/time.h"
+#include "cc/base/scoped_ptr_vector.h"
#include "cc/debug/lap_timer.h"
#include "cc/layers/layer.h"
+#include "cc/output/bsp_controller.h"
+#include "cc/output/bsp_tree.h"
+#include "cc/quads/draw_polygon.h"
+#include "cc/quads/draw_quad.h"
#include "cc/test/fake_content_layer_client.h"
#include "cc/test/fake_layer_tree_host_client.h"
#include "cc/test/layer_tree_json_parser.h"
@@ -21,6 +27,7 @@
#include "cc/test/paths.h"
#include "cc/trees/layer_sorter.h"
#include "cc/trees/layer_tree_impl.h"
+#include "cc/trees/single_thread_proxy.h"
#include "testing/perf/perf_test.h"
namespace cc {
@@ -207,6 +214,62 @@ class LayerSorterMainTest : public CalcDrawPropsImplTest {
LayerSorter layer_sorter_;
};
+class BspTreePerfTest : public LayerSorterMainTest {
+ public:
+ void RunSortLayers() { RunTest(false, false, false); }
+
+ virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+
+ virtual 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);
+
+ LayerImplList base_list;
+ BuildLayerImplList(active_tree->root_layer(), &base_list);
+
+ int polygon_counter = 0;
+ ScopedPtrVector<DrawPolygon> polygon_list;
+ for (LayerImplList::iterator it = base_list.begin(); it != base_list.end();
+ ++it) {
+ gfx::Point3F points[8];
+ int num_vertices_in_clipped_quad;
+ gfx::QuadF send_quad((*it)->visible_content_rect());
+ MathUtil::MapClippedQuad3d((*it)->draw_transform(),
enne (OOO) 2014/07/28 23:37:40 It seems to me like maybe you just need a DrawPoly
troyhildebrandt 2014/07/29 19:57:17 Made a more general purpose constructor that will
+ send_quad,
+ points,
+ &num_vertices_in_clipped_quad);
+ std::vector<gfx::Point3F> points_vector;
+ for (int i = 0; i < num_vertices_in_clipped_quad; i++) {
+ points_vector.push_back(points[i]);
+ }
+ DrawPolygon* draw_polygon =
+ new DrawPolygon(NULL, points_vector, polygon_counter++);
+ draw_polygon->ApplyTransformToNormal((*it)->draw_transform());
+ polygon_list.push_back(scoped_ptr<DrawPolygon>(draw_polygon));
+ }
+
+ timer_.Reset();
+ do {
+ ScopedPtrVector<DrawPolygon> test_list;
+ for (unsigned int i = 0; i < polygon_list.size(); i++) {
+ test_list.push_back(polygon_list[i]->CreateCopy());
+ }
+ BspController bsp_controller;
+ BspTree bsp_tree(&bsp_controller, &test_list);
+ timer_.NextLap();
+ } while (!timer_.HasTimeLimitExpired());
+
+ EndTest();
+ }
+};
+
TEST_F(CalcDrawPropsMainTest, TenTen) {
SetTestName("10_10_main_thread");
ReadTestFile("10_10_layer_tree");
@@ -267,5 +330,17 @@ TEST_F(LayerSorterMainTest, LayerSorterRubik) {
RunSortLayers();
}
+TEST_F(BspTreePerfTest, BspTreeCubes) {
+ SetTestName("bsp_tree_cubes");
+ ReadTestFile("layer_sort_cubes");
+ RunSortLayers();
+}
+
+TEST_F(BspTreePerfTest, BspTreeRubik) {
enne (OOO) 2014/07/28 23:37:40 For completeness can you add a BspTreeCubes_2 and
troyhildebrandt 2014/07/29 19:57:17 Done.
+ SetTestName("bsp_tree_rubik");
+ ReadTestFile("layer_sort_rubik");
+ RunSortLayers();
+}
+
} // namespace
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698