-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Impeller] generate stroke vertices into point arena. #56390
Changes from 5 commits
fed2d65
6ff9748
8333074
8de5631
783c093
b03c4e5
dd2bf07
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -2364,6 +2364,45 @@ APPLY_COLOR_FILTER_GRADIENT_TEST(Radial); | |||||
APPLY_COLOR_FILTER_GRADIENT_TEST(Conical); | ||||||
APPLY_COLOR_FILTER_GRADIENT_TEST(Sweep); | ||||||
|
||||||
TEST_P(EntityTest, GiantStrokePathAllocation) { | ||||||
PathBuilder builder{}; | ||||||
for (int i = 0; i < 10000; i++) { | ||||||
builder.LineTo(Point(i, i)); | ||||||
} | ||||||
Path path = builder.TakePath(); | ||||||
auto geom = Geometry::MakeStrokePath(path, /*stroke_width=*/10); | ||||||
|
||||||
ContentContext content_context(GetContext(), nullptr); | ||||||
Entity entity; | ||||||
|
||||||
auto cmd_buffer = content_context.GetContext()->CreateCommandBuffer(); | ||||||
|
||||||
RenderTargetAllocator allocator( | ||||||
content_context.GetContext()->GetResourceAllocator()); | ||||||
|
||||||
auto render_target = | ||||||
allocator.CreateOffscreen(*content_context.GetContext(), {10, 10}, 1); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||||||
auto pass = cmd_buffer->CreateRenderPass(render_target); | ||||||
|
||||||
GeometryResult result = | ||||||
geom->GetPositionBuffer(content_context, entity, *pass); | ||||||
|
||||||
// Validate the buffer data overflowed the small buffer | ||||||
EXPECT_GT(result.vertex_buffer.vertex_count, kPointArenaSize); | ||||||
|
||||||
// Validate that there are no uninitialized points near the gap. | ||||||
Point* written_data = reinterpret_cast<Point*>( | ||||||
(result.vertex_buffer.vertex_buffer.GetBuffer()->OnGetContents() + | ||||||
result.vertex_buffer.vertex_buffer.GetRange().offset)); | ||||||
|
||||||
EXPECT_NE(*(written_data + kPointArenaSize - 2), Point(0, 0)); | ||||||
EXPECT_NE(*(written_data + kPointArenaSize - 1), Point(0, 0)); | ||||||
EXPECT_NE(*(written_data + kPointArenaSize), Point(0, 0)); | ||||||
EXPECT_NE(*(written_data + kPointArenaSize + 1), Point(0, 0)); | ||||||
EXPECT_NE(*(written_data + kPointArenaSize + 2), Point(0, 0)); | ||||||
EXPECT_NE(*(written_data + kPointArenaSize + 3), Point(0, 0)); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we switch these to EXPECT_EQ assertions? Not being Point(0,0) leaves a lot of possibilities. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this is stroke tessellation the generated points are floating point values like 43.22132 ... I could do a CLOSE_TO or something like that though. As long as they are in the ballpark There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||||||
} | ||||||
|
||||||
} // namespace testing | ||||||
} // namespace impeller | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done