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

Side by Side Diff: cc/surfaces/surface_aggregator_unittest.cc

Issue 1883533008: Don't DCHECK on aggregating quads with noninvertible transforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "cc/surfaces/surface_aggregator.h" 5 #include "cc/surfaces/surface_aggregator.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after
1450 : public SurfaceAggregatorValidSurfaceTest { 1450 : public SurfaceAggregatorValidSurfaceTest {
1451 public: 1451 public:
1452 SurfaceAggregatorPartialSwapTest() 1452 SurfaceAggregatorPartialSwapTest()
1453 : SurfaceAggregatorValidSurfaceTest(true) {} 1453 : SurfaceAggregatorValidSurfaceTest(true) {}
1454 }; 1454 };
1455 1455
1456 // Tests that quads outside the damage rect are ignored. 1456 // Tests that quads outside the damage rect are ignored.
1457 TEST_F(SurfaceAggregatorPartialSwapTest, IgnoreOutside) { 1457 TEST_F(SurfaceAggregatorPartialSwapTest, IgnoreOutside) {
1458 SurfaceId child_surface_id = allocator_.GenerateId(); 1458 SurfaceId child_surface_id = allocator_.GenerateId();
1459 factory_.Create(child_surface_id); 1459 factory_.Create(child_surface_id);
1460 // The child surface has two quads, one with a visible rect of 13,13 4x4 and 1460 // The child surface has three quads, one with a visible rect of 13,13 4x4 and
1461 // the other other with a visible rect of 10,10 2x2 (relative to root target 1461 // the other other with a visible rect of 10,10 2x2 (relative to root target
1462 // space). 1462 // space), and one with a non-invertible transform.
1463 { 1463 {
1464 RenderPassId child_pass_id = RenderPassId(1, 1); 1464 RenderPassId child_pass_id = RenderPassId(1, 1);
1465 test::Quad child_quads1[] = {test::Quad::RenderPassQuad(child_pass_id)}; 1465 test::Quad child_quads1[] = {test::Quad::RenderPassQuad(child_pass_id)};
1466 test::Quad child_quads2[] = {test::Quad::RenderPassQuad(child_pass_id)}; 1466 test::Quad child_quads2[] = {test::Quad::RenderPassQuad(child_pass_id)};
1467 test::Quad child_quads3[] = {test::Quad::RenderPassQuad(child_pass_id)};
1467 test::Pass child_passes[] = { 1468 test::Pass child_passes[] = {
1468 test::Pass(child_quads1, arraysize(child_quads1), child_pass_id), 1469 test::Pass(child_quads1, arraysize(child_quads1), child_pass_id),
1469 test::Pass(child_quads2, arraysize(child_quads2), child_pass_id)}; 1470 test::Pass(child_quads2, arraysize(child_quads2), child_pass_id),
1471 test::Pass(child_quads3, arraysize(child_quads2), child_pass_id)};
1470 1472
1471 RenderPassList child_pass_list; 1473 RenderPassList child_pass_list;
1472 AddPasses(&child_pass_list, gfx::Rect(SurfaceSize()), child_passes, 1474 AddPasses(&child_pass_list, gfx::Rect(SurfaceSize()), child_passes,
1473 arraysize(child_passes)); 1475 arraysize(child_passes));
1474 1476
1475 child_pass_list[0]->quad_list.ElementAt(0)->visible_rect = 1477 child_pass_list[0]->quad_list.ElementAt(0)->visible_rect =
1476 gfx::Rect(1, 1, 2, 2); 1478 gfx::Rect(1, 1, 2, 2);
1477 SharedQuadState* child_sqs = 1479 SharedQuadState* child_sqs =
1478 child_pass_list[0]->shared_quad_state_list.ElementAt(0u); 1480 child_pass_list[0]->shared_quad_state_list.ElementAt(0u);
1479 child_sqs->quad_to_target_transform.Translate(1, 1); 1481 child_sqs->quad_to_target_transform.Translate(1, 1);
1480 child_sqs->quad_to_target_transform.Scale(2, 2); 1482 child_sqs->quad_to_target_transform.Scale(2, 2);
1481 1483
1482 child_pass_list[1]->quad_list.ElementAt(0)->visible_rect = 1484 child_pass_list[1]->quad_list.ElementAt(0)->visible_rect =
1483 gfx::Rect(0, 0, 2, 2); 1485 gfx::Rect(0, 0, 2, 2);
1484 1486
1487 SharedQuadState* child_noninvertible_sqs =
1488 child_pass_list[2]->shared_quad_state_list.ElementAt(0u);
1489 child_noninvertible_sqs->quad_to_target_transform.matrix().setDouble(0, 0,
1490 0.0);
1491 EXPECT_FALSE(
1492 child_noninvertible_sqs->quad_to_target_transform.IsInvertible());
1493 child_pass_list[2]->quad_list.ElementAt(0)->visible_rect =
1494 gfx::Rect(0, 0, 2, 2);
1495
1485 SubmitPassListAsFrame(child_surface_id, &child_pass_list); 1496 SubmitPassListAsFrame(child_surface_id, &child_pass_list);
1486 } 1497 }
1487 1498
1488 { 1499 {
1489 test::Quad root_quads[] = {test::Quad::SurfaceQuad(child_surface_id, 1.f)}; 1500 test::Quad root_quads[] = {test::Quad::SurfaceQuad(child_surface_id, 1.f)};
1490 1501
1491 test::Pass root_passes[] = {test::Pass(root_quads, arraysize(root_quads))}; 1502 test::Pass root_passes[] = {test::Pass(root_quads, arraysize(root_quads))};
1492 1503
1493 RenderPassList root_pass_list; 1504 RenderPassList root_pass_list;
1494 AddPasses(&root_pass_list, gfx::Rect(SurfaceSize()), root_passes, 1505 AddPasses(&root_pass_list, gfx::Rect(SurfaceSize()), root_passes,
(...skipping 10 matching lines...) Expand all
1505 std::unique_ptr<CompositorFrame> aggregated_frame = 1516 std::unique_ptr<CompositorFrame> aggregated_frame =
1506 aggregator_.Aggregate(root_surface_id_); 1517 aggregator_.Aggregate(root_surface_id_);
1507 1518
1508 ASSERT_TRUE(aggregated_frame); 1519 ASSERT_TRUE(aggregated_frame);
1509 ASSERT_TRUE(aggregated_frame->delegated_frame_data); 1520 ASSERT_TRUE(aggregated_frame->delegated_frame_data);
1510 1521
1511 DelegatedFrameData* frame_data = aggregated_frame->delegated_frame_data.get(); 1522 DelegatedFrameData* frame_data = aggregated_frame->delegated_frame_data.get();
1512 1523
1513 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list; 1524 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list;
1514 1525
1515 ASSERT_EQ(2u, aggregated_pass_list.size()); 1526 ASSERT_EQ(3u, aggregated_pass_list.size());
1516 1527
1517 // Damage rect for first aggregation should contain entire root surface. 1528 // Damage rect for first aggregation should contain entire root surface.
1518 EXPECT_EQ(gfx::Rect(0, 0, 15, 15), aggregated_pass_list[1]->damage_rect); 1529 EXPECT_EQ(gfx::Rect(0, 0, 15, 15), aggregated_pass_list[2]->damage_rect);
1519 EXPECT_EQ(1u, aggregated_pass_list[0]->quad_list.size()); 1530 EXPECT_EQ(1u, aggregated_pass_list[0]->quad_list.size());
1520 EXPECT_EQ(1u, aggregated_pass_list[1]->quad_list.size()); 1531 EXPECT_EQ(1u, aggregated_pass_list[1]->quad_list.size());
1532 EXPECT_EQ(1u, aggregated_pass_list[2]->quad_list.size());
1521 1533
1522 // Create a root surface with a smaller damage rect. 1534 // Create a root surface with a smaller damage rect.
1523 { 1535 {
1524 test::Quad root_quads[] = {test::Quad::SurfaceQuad(child_surface_id, 1.f)}; 1536 test::Quad root_quads[] = {test::Quad::SurfaceQuad(child_surface_id, 1.f)};
1525 1537
1526 test::Pass root_passes[] = {test::Pass(root_quads, arraysize(root_quads))}; 1538 test::Pass root_passes[] = {test::Pass(root_quads, arraysize(root_quads))};
1527 1539
1528 RenderPassList root_pass_list; 1540 RenderPassList root_pass_list;
1529 AddPasses(&root_pass_list, gfx::Rect(SurfaceSize()), root_passes, 1541 AddPasses(&root_pass_list, gfx::Rect(SurfaceSize()), root_passes,
1530 arraysize(root_passes)); 1542 arraysize(root_passes));
(...skipping 10 matching lines...) Expand all
1541 aggregator_.Aggregate(root_surface_id_); 1553 aggregator_.Aggregate(root_surface_id_);
1542 1554
1543 ASSERT_TRUE(aggregated_frame); 1555 ASSERT_TRUE(aggregated_frame);
1544 ASSERT_TRUE(aggregated_frame->delegated_frame_data); 1556 ASSERT_TRUE(aggregated_frame->delegated_frame_data);
1545 1557
1546 DelegatedFrameData* frame_data = 1558 DelegatedFrameData* frame_data =
1547 aggregated_frame->delegated_frame_data.get(); 1559 aggregated_frame->delegated_frame_data.get();
1548 1560
1549 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list; 1561 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list;
1550 1562
1551 ASSERT_EQ(2u, aggregated_pass_list.size()); 1563 ASSERT_EQ(3u, aggregated_pass_list.size());
1552 1564
1553 // Only first quad from surface is inside damage rect and should be 1565 // Only first quad from surface is inside damage rect and should be
1554 // included. 1566 // included.
1555 EXPECT_EQ(gfx::Rect(10, 10, 2, 2), aggregated_pass_list[1]->damage_rect); 1567 EXPECT_EQ(gfx::Rect(10, 10, 2, 2), aggregated_pass_list[2]->damage_rect);
1556 EXPECT_EQ(0u, aggregated_pass_list[0]->quad_list.size()); 1568 EXPECT_EQ(0u, aggregated_pass_list[0]->quad_list.size());
1557 EXPECT_EQ(1u, aggregated_pass_list[1]->quad_list.size()); 1569 EXPECT_EQ(1u, aggregated_pass_list[1]->quad_list.size());
1558 EXPECT_EQ(gfx::Rect(0, 0, 2, 2), 1570 EXPECT_EQ(gfx::Rect(0, 0, 2, 2),
1559 aggregated_pass_list[1]->quad_list.back()->visible_rect); 1571 aggregated_pass_list[1]->quad_list.back()->visible_rect);
1572 EXPECT_EQ(1u, aggregated_pass_list[2]->quad_list.size());
1560 } 1573 }
1561 1574
1562 // New child frame has same content and no damage, but has a 1575 // New child frame has same content and no damage, but has a
1563 // CopyOutputRequest. 1576 // CopyOutputRequest.
1564 { 1577 {
1565 RenderPassId child_pass_id = RenderPassId(1, 1); 1578 RenderPassId child_pass_id = RenderPassId(1, 1);
1566 test::Quad child_quads1[] = {test::Quad::RenderPassQuad(child_pass_id)}; 1579 test::Quad child_quads1[] = {test::Quad::RenderPassQuad(child_pass_id)};
1567 test::Quad child_quads2[] = {test::Quad::RenderPassQuad(child_pass_id)}; 1580 test::Quad child_quads2[] = {test::Quad::RenderPassQuad(child_pass_id)};
1568 test::Pass child_passes[] = { 1581 test::Pass child_passes[] = {
1569 test::Pass(child_quads1, arraysize(child_quads1), child_pass_id), 1582 test::Pass(child_quads1, arraysize(child_quads1), child_pass_id),
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1606 // Output frame should have no damage, but all quads included. 1619 // Output frame should have no damage, but all quads included.
1607 ASSERT_EQ(3u, aggregated_pass_list.size()); 1620 ASSERT_EQ(3u, aggregated_pass_list.size());
1608 1621
1609 EXPECT_TRUE(aggregated_pass_list[1]->damage_rect.IsEmpty()); 1622 EXPECT_TRUE(aggregated_pass_list[1]->damage_rect.IsEmpty());
1610 ASSERT_EQ(1u, aggregated_pass_list[0]->quad_list.size()); 1623 ASSERT_EQ(1u, aggregated_pass_list[0]->quad_list.size());
1611 ASSERT_EQ(1u, aggregated_pass_list[1]->quad_list.size()); 1624 ASSERT_EQ(1u, aggregated_pass_list[1]->quad_list.size());
1612 EXPECT_EQ(gfx::Rect(1, 1, 2, 2), 1625 EXPECT_EQ(gfx::Rect(1, 1, 2, 2),
1613 aggregated_pass_list[0]->quad_list.ElementAt(0)->visible_rect); 1626 aggregated_pass_list[0]->quad_list.ElementAt(0)->visible_rect);
1614 EXPECT_EQ(gfx::Rect(0, 0, 2, 2), 1627 EXPECT_EQ(gfx::Rect(0, 0, 2, 2),
1615 aggregated_pass_list[1]->quad_list.ElementAt(0)->visible_rect); 1628 aggregated_pass_list[1]->quad_list.ElementAt(0)->visible_rect);
1629 ASSERT_EQ(1u, aggregated_pass_list[2]->quad_list.size());
1616 } 1630 }
1617 1631
1618 { 1632 {
1619 std::unique_ptr<CompositorFrame> aggregated_frame = 1633 std::unique_ptr<CompositorFrame> aggregated_frame =
1620 aggregator_.Aggregate(root_surface_id_); 1634 aggregator_.Aggregate(root_surface_id_);
1621 1635
1622 ASSERT_TRUE(aggregated_frame); 1636 ASSERT_TRUE(aggregated_frame);
1623 ASSERT_TRUE(aggregated_frame->delegated_frame_data); 1637 ASSERT_TRUE(aggregated_frame->delegated_frame_data);
1624 1638
1625 DelegatedFrameData* frame_data = 1639 DelegatedFrameData* frame_data =
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1879 EXPECT_EQ(9u, pass_list->back()->quad_list.size()); 1893 EXPECT_EQ(9u, pass_list->back()->quad_list.size());
1880 1894
1881 factory.Destroy(root_surface_id); 1895 factory.Destroy(root_surface_id);
1882 factory.Destroy(child_surface_id); 1896 factory.Destroy(child_surface_id);
1883 factory.Destroy(middle_surface_id); 1897 factory.Destroy(middle_surface_id);
1884 } 1898 }
1885 1899
1886 } // namespace 1900 } // namespace
1887 } // namespace cc 1901 } // namespace cc
1888 1902
OLDNEW
« cc/surfaces/surface_aggregator.cc ('K') | « cc/surfaces/surface_aggregator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698