-
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] specialize the geometry for drawRect #36914
Conversation
The difference in UI time is probably from local engine usage... |
GeometryResult RectGeometry::GetPositionUVBuffer(const ContentContext& renderer, | ||
const Entity& entity, | ||
RenderPass& pass) { | ||
// TODO(jonahwilliams): support texture coordinates in rect geometry. |
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.
nit: file a bug and explain what this would block/where it would go wrong.
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.
Its not really a useful API yet. I was actually thinking we should create a specific drawVertices subclass that adds these methods, since none of the other geometries will use it
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.
I have mixed feelings about this.
- This will help in cases where someone does
canvas.drawRect
, but not if they docanvas.drawPath
with a path that has a bunch of (or a single) rect in it. - This might make it harder to do optimizations that would batch multiple
canvas.drawFoo
calls that are compatible into something that can be handled in a single draw call. I have a dream of making the Aiks canvas able to track the last entity it used and append to it when possible instead of always creating a new one. This means we'd need geometries to know how to append where possible. I think having this kind of specialized geometry won't affect that too much because rects are simple, but it may get harder if we start specializing other geometry types that are more complicated... - How common is canvas.drawRect compared to canvas.drawPath or canvas.drawRRect?
- How does this compare to an approach like I'm describing above, where all the drawRect calls get batched into a single entity/geometry?
|
Avoid polyline generation and tessellation when we are given a rect via canvas.drawRect. This improves the raster time of a frame made of thousands of rects to about 1/3 of the original time.
Before
After
Demo code