Skip to content

Commit

Permalink
Enable playgrounds in all tests and fix default sample counts.
Browse files Browse the repository at this point in the history
The sample counts were invalid after the default assumed rendering to an MSAA target.
  • Loading branch information
chinmaygarde authored and dnfield committed Apr 27, 2022
1 parent a449707 commit 844d400
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions impeller/aiks/aiks_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion impeller/entity/entity_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion impeller/renderer/backend/metal/render_pass_mtl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint64_t>(target_sample_count)
<< " but pipeline wanted "
<< static_cast<uint64_t>(
command.pipeline->GetDescriptor().GetSampleCount())
<< ").";
return false;
}

Expand Down
6 changes: 4 additions & 2 deletions impeller/renderer/renderer_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ TEST_F(RendererTest, CanCreateBoxPrimitive) {
ASSERT_TRUE(context);
using BoxPipelineBuilder = PipelineBuilder<VS, FS>;
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);
Expand Down Expand Up @@ -89,7 +91,7 @@ TEST_F(RendererTest, CanCreateBoxPrimitive) {
}
return true;
};
// OpenPlaygroundHere(callback);
OpenPlaygroundHere(callback);
}

TEST_F(RendererTest, CanRenderMultiplePrimitives) {
Expand Down Expand Up @@ -159,7 +161,7 @@ TEST_F(RendererTest, CanRenderMultiplePrimitives) {

return true;
};
// OpenPlaygroundHere(callback);
OpenPlaygroundHere(callback);
}

TEST_F(RendererTest, CanRenderToTexture) {
Expand Down

0 comments on commit 844d400

Please sign in to comment.