Commit 79198871 authored by jaydasika's avatar jaydasika Committed by Commit bot

Turn on property tree verification for PictureLayerImplTests

We were not clipping the render surface content rect computed using
property trees with maximum supported texture size. That resulted in
property tree verification failures on some PictureLayerImplTests. This
CL fixes that.

BUG=538260
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel

Review URL: https://codereview.chromium.org/1418663006

Cr-Commit-Position: refs/heads/master@{#357101}
parent 7c26f04c
...@@ -80,6 +80,7 @@ class PictureLayerImplTestSettings : public GpuRasterizationEnabledSettings { ...@@ -80,6 +80,7 @@ class PictureLayerImplTestSettings : public GpuRasterizationEnabledSettings {
public: public:
PictureLayerImplTestSettings() { PictureLayerImplTestSettings() {
layer_transforms_should_scale_layer_contents = true; layer_transforms_should_scale_layer_contents = true;
verify_property_trees = true;
} }
}; };
...@@ -148,7 +149,13 @@ class PictureLayerImplTest : public testing::Test { ...@@ -148,7 +149,13 @@ class PictureLayerImplTest : public testing::Test {
invalidation); invalidation);
} }
void RebuildPropertyTreesOnPendingTree() {
host_impl_.pending_tree()->property_trees()->needs_rebuild = true;
host_impl_.pending_tree()->BuildPropertyTreesForTesting();
}
void ActivateTree() { void ActivateTree() {
RebuildPropertyTreesOnPendingTree();
host_impl_.ActivateSyncTree(); host_impl_.ActivateSyncTree();
CHECK(!host_impl_.pending_tree()); CHECK(!host_impl_.pending_tree());
CHECK(host_impl_.recycle_tree()); CHECK(host_impl_.recycle_tree());
...@@ -258,6 +265,7 @@ class PictureLayerImplTest : public testing::Test { ...@@ -258,6 +265,7 @@ class PictureLayerImplTest : public testing::Test {
// Add tilings/tiles for the layer. // Add tilings/tiles for the layer.
bool update_lcd_text = false; bool update_lcd_text = false;
RebuildPropertyTreesOnPendingTree();
host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text);
} }
...@@ -1357,7 +1365,7 @@ TEST_F(PictureLayerImplTest, HugeMasksGetScaledDown) { ...@@ -1357,7 +1365,7 @@ TEST_F(PictureLayerImplTest, HugeMasksGetScaledDown) {
pending_layer_->SetMaskLayer(mask_ptr.Pass()); pending_layer_->SetMaskLayer(mask_ptr.Pass());
pending_layer_->SetHasRenderSurface(true); pending_layer_->SetHasRenderSurface(true);
host_impl_.pending_tree()->BuildPropertyTreesForTesting(); RebuildPropertyTreesOnPendingTree();
host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
bool update_lcd_text = false; bool update_lcd_text = false;
host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text);
...@@ -1486,7 +1494,7 @@ TEST_F(PictureLayerImplTest, ScaledMaskLayer) { ...@@ -1486,7 +1494,7 @@ TEST_F(PictureLayerImplTest, ScaledMaskLayer) {
pending_layer_->SetMaskLayer(mask_ptr.Pass()); pending_layer_->SetMaskLayer(mask_ptr.Pass());
pending_layer_->SetHasRenderSurface(true); pending_layer_->SetHasRenderSurface(true);
host_impl_.pending_tree()->BuildPropertyTreesForTesting(); RebuildPropertyTreesOnPendingTree();
host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
bool update_lcd_text = false; bool update_lcd_text = false;
host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text);
...@@ -3972,6 +3980,7 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, ...@@ -3972,6 +3980,7 @@ TEST_F(OcclusionTrackingPictureLayerImplTest,
layer1->SetContentsOpaque(true); layer1->SetContentsOpaque(true);
layer1->SetPosition(occluding_layer_position); layer1->SetPosition(occluding_layer_position);
RebuildPropertyTreesOnPendingTree();
host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(200)); host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(200));
bool update_lcd_text = false; bool update_lcd_text = false;
host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text);
...@@ -3996,6 +4005,7 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, ...@@ -3996,6 +4005,7 @@ TEST_F(OcclusionTrackingPictureLayerImplTest,
// Full occlusion. // Full occlusion.
layer1->SetPosition(gfx::PointF()); layer1->SetPosition(gfx::PointF());
RebuildPropertyTreesOnPendingTree();
host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(200)); host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(200));
host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text);
...@@ -4064,6 +4074,7 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, ...@@ -4064,6 +4074,7 @@ TEST_F(OcclusionTrackingPictureLayerImplTest,
layer1->SetContentsOpaque(true); layer1->SetContentsOpaque(true);
layer1->SetPosition(occluding_layer_position); layer1->SetPosition(occluding_layer_position);
RebuildPropertyTreesOnPendingTree();
host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(200)); host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(200));
bool update_lcd_text = false; bool update_lcd_text = false;
host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text);
...@@ -4101,6 +4112,7 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, ...@@ -4101,6 +4112,7 @@ TEST_F(OcclusionTrackingPictureLayerImplTest,
// Full occlusion. // Full occlusion.
layer1->SetPosition(gfx::PointF()); layer1->SetPosition(gfx::PointF());
RebuildPropertyTreesOnPendingTree();
host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(200)); host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(200));
host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text);
...@@ -4166,6 +4178,7 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, OcclusionForDifferentScales) { ...@@ -4166,6 +4178,7 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, OcclusionForDifferentScales) {
pending_layer_->AddTiling(1.0f)->set_resolution(HIGH_RESOLUTION); pending_layer_->AddTiling(1.0f)->set_resolution(HIGH_RESOLUTION);
pending_layer_->AddTiling(2.0f)->set_resolution(HIGH_RESOLUTION); pending_layer_->AddTiling(2.0f)->set_resolution(HIGH_RESOLUTION);
RebuildPropertyTreesOnPendingTree();
host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
// UpdateDrawProperties with the occluding layer. // UpdateDrawProperties with the occluding layer.
bool update_lcd_text = false; bool update_lcd_text = false;
...@@ -4343,6 +4356,7 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, ...@@ -4343,6 +4356,7 @@ TEST_F(OcclusionTrackingPictureLayerImplTest,
EXPECT_EQ(1u, pending_layer_->num_tilings()); EXPECT_EQ(1u, pending_layer_->num_tilings());
EXPECT_EQ(2u, active_layer_->num_tilings()); EXPECT_EQ(2u, active_layer_->num_tilings());
RebuildPropertyTreesOnPendingTree();
host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
// UpdateDrawProperties with the occluding layer. // UpdateDrawProperties with the occluding layer.
bool update_lcd_text = false; bool update_lcd_text = false;
......
...@@ -2434,6 +2434,7 @@ void CalculateRenderSurfaceLayerListInternal( ...@@ -2434,6 +2434,7 @@ void CalculateRenderSurfaceLayerListInternal(
bool subtree_visible_from_ancestor, bool subtree_visible_from_ancestor,
const bool can_render_to_separate_surface, const bool can_render_to_separate_surface,
const int current_render_surface_layer_list_id, const int current_render_surface_layer_list_id,
const int max_texture_size,
const bool verify_property_trees) { const bool verify_property_trees) {
// This calculates top level Render Surface Layer List, and Layer List for all // This calculates top level Render Surface Layer List, and Layer List for all
// Render Surfaces. // Render Surfaces.
...@@ -2529,7 +2530,7 @@ void CalculateRenderSurfaceLayerListInternal( ...@@ -2529,7 +2530,7 @@ void CalculateRenderSurfaceLayerListInternal(
child_layer, property_trees, render_surface_layer_list, descendants, child_layer, property_trees, render_surface_layer_list, descendants,
nearest_occlusion_immune_ancestor, layer_is_drawn, nearest_occlusion_immune_ancestor, layer_is_drawn,
can_render_to_separate_surface, current_render_surface_layer_list_id, can_render_to_separate_surface, current_render_surface_layer_list_id,
verify_property_trees); max_texture_size, verify_property_trees);
// If the child is its own render target, then it has a render surface. // If the child is its own render target, then it has a render surface.
if (child_layer->render_target() == child_layer && if (child_layer->render_target() == child_layer &&
...@@ -2583,6 +2584,12 @@ void CalculateRenderSurfaceLayerListInternal( ...@@ -2583,6 +2584,12 @@ void CalculateRenderSurfaceLayerListInternal(
surface_content_rect.Intersect(surface_clip_rect); surface_content_rect.Intersect(surface_clip_rect);
} }
} }
// The RenderSurfaceImpl backing texture cannot exceed the maximum
// supported texture size.
surface_content_rect.set_width(
std::min(surface_content_rect.width(), max_texture_size));
surface_content_rect.set_height(
std::min(surface_content_rect.height(), max_texture_size));
layer->render_surface()->SetContentRectFromPropertyTrees( layer->render_surface()->SetContentRectFromPropertyTrees(
surface_content_rect); surface_content_rect);
} }
...@@ -2645,7 +2652,7 @@ void CalculateRenderSurfaceLayerList( ...@@ -2645,7 +2652,7 @@ void CalculateRenderSurfaceLayerList(
inputs->root_layer, inputs->property_trees, inputs->root_layer, inputs->property_trees,
inputs->render_surface_layer_list, nullptr, nullptr, inputs->render_surface_layer_list, nullptr, nullptr,
subtree_visible_from_ancestor, inputs->can_render_to_separate_surface, subtree_visible_from_ancestor, inputs->can_render_to_separate_surface,
inputs->current_render_surface_layer_list_id, inputs->current_render_surface_layer_list_id, inputs->max_texture_size,
inputs->verify_property_trees); inputs->verify_property_trees);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment