Skip to content
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

Lyon GPU-accelerated canvas #216

Open
dhardy opened this issue Jul 3, 2021 · 0 comments
Open

Lyon GPU-accelerated canvas #216

dhardy opened this issue Jul 3, 2021 · 0 comments

Comments

@dhardy
Copy link
Collaborator

dhardy commented Jul 3, 2021

The recently added canvas (#215) uses CPU rendering via tiny-skia to a cached texture.

Tiny-skia does not support GPU rendering at all; Lyon provides a vaguely similar API and does; see this example.

The objective should be an easy-to-use Lyon Canvas widget over a fixed pipeline (or fixed set of pipelines). This requires an API which doesn't exist in the examples, but could work roughly as follows:

// add to DrawSharedT:
// this method tessellates a path, returning some identifier
#[cfg(feature = "lyon")]
fn lyon_path(&mut self, path: lyon::path::Path, ..) -> PathId;

// new trait:
#[cfg(feature = "lyon")]
pub trait DrawableLyon: Drawable {
    fn lyon_instances(&mut self, instances: &[Primitive]);
}

It is an open question how flexible the API should be. Note that a custom WGPU pipeline (similar to the Mandlebrot example) can be used where this API insufficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant