Skip to content

[Impeller] FillPointsForPolyLine and TessellateConvex have too much allocation. #133348

@jonahwilliams

Description

@jonahwilliams

Neither TessellateConvex nor FillPointsForPolyLine preallocates any space for the resulting points/indices generated, so profiles of this code show a lot of std::vector reallocation:

image

For TessellateConvex, we should be able to compute the exact number of indices and vertex points needed and size the vector correctly the first time. Additionally, we may wish to make the method accept a host buffer and emplace directly into it.

For FillPointsForPolyLine, we should experiment with a two pass system - one pass to compute or estimate the number of points needed and another to fill in. Alternatively, we could allocate a large buffer internally and hand out temporary views to this buffer - as tessellation will only be done from a single thread right now this should be mostly safe.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work liste: impellerImpeller rendering backend issues and features requeststeam-engineOwned by Engine teamtriaged-engineTriaged by Engine team

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions