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

Better API for already GPU-resident images #664

Open
DJMcNab opened this issue Aug 12, 2024 · 5 comments
Open

Better API for already GPU-resident images #664

DJMcNab opened this issue Aug 12, 2024 · 5 comments

Comments

@DJMcNab
Copy link
Member

DJMcNab commented Aug 12, 2024

There have been repeated requests for supporting using a wgpu Texture within a Vello Scene, such as #660.

We did implement a targeted fix for this in #636.

In #gpu > vello adding wgpu texture buffers to scene, Chad suggested a new variant of Brush for this use case.
I think that is likely to be the best API, due to the other constraints on the Scene API (namely that we have chosen to make it independent of wgpu, for any consumers who use Vello without using wgpu directly)

@nicoburns
Copy link
Contributor

namely that we have chosen to make it independent of wgpu, for any consumers who use Vello without using wgpu directly

What does this mean? I thought Vello was heavily dependent on wgpu.

@DJMcNab
Copy link
Member Author

DJMcNab commented Aug 16, 2024

We have several users/potential users who cannot use wgpu directly. These include:

  1. People who use their own renderer with Vello. See e.g. vello_shaders crate for AOT compilation and lightweight integration with external renderer projects #265, 📀 Make wgpu an optional dependency #359
  2. People who want to use Vello with wgpu-core, rather than wgpu (e.g. your colleages https://xi.zulipchat.com/#narrow/stream/197075-gpu/topic/Servo.202D.20canvas.20backend)

@DJMcNab DJMcNab added this to the Vello 0.4 Release milestone Oct 3, 2024
@waywardmonkeys waywardmonkeys removed this from the Vello 0.4 Release milestone Jan 5, 2025
@KySpace
Copy link

KySpace commented Feb 28, 2025

We have several users/potential users who cannot use wgpu directly. These include:

1. People who use their own renderer with Vello. See e.g. [`vello_shaders` crate for AOT compilation and lightweight integration with external renderer projects #265](https://github.com/linebender/vello/pull/265), [📀 Make `wgpu` an optional dependency #359](https://github.com/linebender/vello/pull/359)

2. People who want to use Vello with wgpu-core, rather than wgpu (e.g. your colleages https://xi.zulipchat.com/#narrow/stream/197075-gpu/topic/Servo.202D.20canvas.20backend)

As I am the second kind, what should I do now?

@DJMcNab
Copy link
Member Author

DJMcNab commented Mar 4, 2025

The situation has changed somewhat since that was written; we've re-evaluated the recording API, as it was not being used at all, and it adds a lot of complexity with unclear semantics.
gfx-rs/wgpu#6658 is being driven by the Servo people for this use case, and I'd probably follow what they're doing.

Currently your options would be:

  1. Wait for Support extern context impl gfx-rs/wgpu#6658 to land and be released (around the middle of April?)
  2. Make a custom runner for the Vello shaders (i.e. using the vello_encoding and vello_shaders crate)
  3. Try and get Recording working for you - this is in the low_level module

@sagudev
Copy link

sagudev commented Mar 4, 2025

Actually I think it would be enough for wgpu to support some kind of concept of "external textures" (something like this already exists in web), that would allow loading wgpu::Texture from different wgpu::Device (as external texture). This is something we would want in servo too (but it's very low priority).

EDIT: Here are relevant links to wgpu: gfx-rs/wgpu#2320, gfx-rs/wgpu#3145, gfx-rs/wgpu#4067

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

No branches or pull requests

5 participants