From 844d400637165adeb5bd53145004f0076d2a0750 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Wed, 2 Feb 2022 16:13:12 -0800 Subject: [PATCH] Enable playgrounds in all tests and fix default sample counts. The sample counts were invalid after the default assumed rendering to an MSAA target. --- impeller/aiks/aiks_unittests.cc | 4 ++-- impeller/entity/entity_unittests.cc | 2 +- impeller/renderer/backend/metal/render_pass_mtl.mm | 7 ++++++- impeller/renderer/renderer_unittests.cc | 6 ++++-- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/impeller/aiks/aiks_unittests.cc b/impeller/aiks/aiks_unittests.cc index 62782b05f526c..a756bbf0185ad 100644 --- a/impeller/aiks/aiks_unittests.cc +++ b/impeller/aiks/aiks_unittests.cc @@ -47,7 +47,7 @@ TEST_F(AiksTest, CanRenderColoredRect) { .AddRect(Rect::MakeXYWH(100.0, 100.0, 100.0, 100.0)) .TakePath(), paint); - // ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture())); + ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture())); } TEST_F(AiksTest, CanRenderImage) { @@ -83,7 +83,7 @@ TEST_F(AiksTest, CanRenderStrokes) { paint.style = Paint::Style::kStroke; canvas.DrawPath(PathBuilder{}.AddLine({200, 100}, {800, 100}).TakePath(), paint); - // ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture())); + ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture())); } TEST_F(AiksTest, CanRenderCurvedStrokes) { diff --git a/impeller/entity/entity_unittests.cc b/impeller/entity/entity_unittests.cc index cf3cafb47cb70..ed83995dc7031 100644 --- a/impeller/entity/entity_unittests.cc +++ b/impeller/entity/entity_unittests.cc @@ -22,7 +22,7 @@ TEST_F(EntityTest, CanDrawRect) { Entity entity; entity.SetPath(PathBuilder{}.AddRect({100, 100, 100, 100}).TakePath()); entity.SetContents(SolidColorContents::Make(Color::Red())); - // ASSERT_TRUE(OpenPlaygroundHere(entity)); + ASSERT_TRUE(OpenPlaygroundHere(entity)); } } // namespace testing diff --git a/impeller/renderer/backend/metal/render_pass_mtl.mm b/impeller/renderer/backend/metal/render_pass_mtl.mm index aa9d5737e93ab..6a685d975c271 100644 --- a/impeller/renderer/backend/metal/render_pass_mtl.mm +++ b/impeller/renderer/backend/metal/render_pass_mtl.mm @@ -409,7 +409,12 @@ static bool Bind(PassBindingsCache& pass, if (target_sample_count != command.pipeline->GetDescriptor().GetSampleCount()) { VALIDATION_LOG << "Pipeline for command and the render target disagree " - "on sample counts."; + "on sample counts (target was " + << static_cast(target_sample_count) + << " but pipeline wanted " + << static_cast( + command.pipeline->GetDescriptor().GetSampleCount()) + << ")."; return false; } diff --git a/impeller/renderer/renderer_unittests.cc b/impeller/renderer/renderer_unittests.cc index 097cba63cd060..3cabc03a43c06 100644 --- a/impeller/renderer/renderer_unittests.cc +++ b/impeller/renderer/renderer_unittests.cc @@ -36,6 +36,8 @@ TEST_F(RendererTest, CanCreateBoxPrimitive) { ASSERT_TRUE(context); using BoxPipelineBuilder = PipelineBuilder; auto desc = BoxPipelineBuilder::MakeDefaultPipelineDescriptor(*context); + ASSERT_TRUE(desc.has_value()); + desc->SetSampleCount(SampleCount::kCount4); auto box_pipeline = context->GetPipelineLibrary()->GetRenderPipeline(std::move(desc)).get(); ASSERT_TRUE(box_pipeline); @@ -89,7 +91,7 @@ TEST_F(RendererTest, CanCreateBoxPrimitive) { } return true; }; - // OpenPlaygroundHere(callback); + OpenPlaygroundHere(callback); } TEST_F(RendererTest, CanRenderMultiplePrimitives) { @@ -159,7 +161,7 @@ TEST_F(RendererTest, CanRenderMultiplePrimitives) { return true; }; - // OpenPlaygroundHere(callback); + OpenPlaygroundHere(callback); } TEST_F(RendererTest, CanRenderToTexture) {