Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[Impeller] Start a more generic stroke tessellator for path #40690

Merged
merged 23 commits into from
Mar 29, 2023

Conversation

dnfield
Copy link
Contributor

@dnfield dnfield commented Mar 27, 2023

This is the start of a more generic tessellator for strokes.

Still missing are:

  • Support for multiple contours in a single path
  • Support for non-default endcaps.
  • Support for non-default line joins.

Some other things that are still left to do here:

  • Better tuning around buffer allocation. Right now I'm just allocating buffers that should be oversized for typical paths seen in Flutter. This won't be too good long term.

It does now support arbitrarily mixed path data and ingestion from a Path object. I've tested it on one relatively simple path.

@dnfield
Copy link
Contributor Author

dnfield commented Mar 27, 2023

Argh, I had not rerun gn check on this, I'll fix up the build rules.

@dnfield dnfield marked this pull request as draft March 27, 2023 23:29
@flutter-dashboard
Copy link

This pull request has been changed to a draft. The currently pending flutter-gold status will not be able to resolve until a new commit is pushed or the change is marked ready for review again.

@dnfield dnfield marked this pull request as ready for review March 28, 2023 04:06
Copy link
Member

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm with some questions?


//------------------------------------------------------------------------------
/// @brief A utility that generates triangles of the specified fill type
/// given a polyline. This happens on the CPU.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: what happens on the CPU? Polyline generation right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll fix this, it's an unintentional miss from copying and pasting.

//----------------------------------------------------------------------------
/// @brief Generates triangles from the path.
///
/// @return A buffer view that will be filled with the tessellation result.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to return a status?

///
/// @return A buffer view that will be filled with the tessellation result.
///
Status Tessellate(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does the synchronization work here? I give you a buffer view then once the completion callback has fired then this particular compute workload is done right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll update the doc here.

On Metal, synchronization just works between passes because we're not using MTLHeap allocations. If that changes there will need to be some fences/events handed around to make sure the passes are synchronized on heap resources. I assume for Vulkan we'll need that too.

The callback is if you otherwise need to synchronize on the GPU and don't want to use a blit pass, e.g. because you have a host visible buffer. This is how the unit tests are working right now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chinmaygarde please review this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Particularly for the Vulkan change)

@@ -13266,6 +13263,131 @@
}
}
},
"flutter/impeller/renderer/path_polyline.comp.vkspv": {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea why the changes above are happening. I tried commenting out chagnes in compiler.cc and they still were there.

std::make_shared<fml::NonOwnedMapping>(impeller_scene_shaders_data,
impeller_scene_shaders_length),
std::make_shared<fml::NonOwnedMapping>(
impeller_tessellation_shaders_data,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Consider naming these something other than tessellation shaders since these don't setup tessellation pipeline stages in the rasterizer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

}

if (impeller_enable_compute) {
impeller_shaders("tessellation_shaders") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compute_shaders perhaps because of the overloading if the tessellation term?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -4,18 +4,84 @@

import("//flutter/impeller/tools/impeller.gni")

impeller_component("renderer") {
impeller_component("allocation") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does more than just allocation and contains stuff like formats and descriptors. Perhaps //impeller/core or //impeller/device? (I like the former).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was originally going to call this "buffers" but it also has textures and formats and an allocator. Right now it's a target in //impeller/renderer still. I'm fine naming it whatever, moving to core

@dnfield dnfield added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 29, 2023
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Mar 29, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Mar 29, 2023

auto label is removed for flutter/engine, pr: 40690, due to - The status or check suite Linux Web Framework tests has failed. Please fix the issues identified (or deflake) before re-applying this label.

@dnfield dnfield added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 29, 2023
@auto-submit auto-submit bot merged commit 3b58a4d into flutter:main Mar 29, 2023
@dnfield dnfield deleted the strokes branch March 29, 2023 06:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
autosubmit Merge PR when tree becomes green via auto submit App e: impeller
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants