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

WebGPU missing functions from webgpu_cpp.h #23432

Open
orhun-sketchup opened this issue Jan 16, 2025 · 2 comments
Open

WebGPU missing functions from webgpu_cpp.h #23432

orhun-sketchup opened this issue Jan 16, 2025 · 2 comments
Assignees
Labels

Comments

@orhun-sketchup
Copy link

Is it possible to update to a recent version of webgpu_cpp.h?

I am specifically interested in missing templated async functions.

like in the Buffer class.

template <typename F, typename T,
              typename Cb = BufferMapCallback<T>,
              typename CbChar = void (MapAsyncStatus status, const char* message, T userdata),
              typename = std::enable_if_t<std::is_convertible_v<F, Cb*> || std::is_convertible_v<F, CbChar*>>>
Future MapAsync(MapMode mode, size_t offset, size_t size, CallbackMode callbackMode, F callback, T userdata) const;
template <typename L,
              typename Cb = BufferMapCallback<>,
              typename CbChar = std::function<void(MapAsyncStatus status, const char* message)>,
              typename = std::enable_if_t<std::is_convertible_v<L, Cb> || std::is_convertible_v<L, CbChar>>>
Future MapAsync(MapMode mode, size_t offset, size_t size, CallbackMode callbackMode, L callback) const;
@kainino0x
Copy link
Collaborator

For the moment we won't be bringing any new changes into Emscripten's WebGPU bindings because we don't want to continuously make breaking changes on every Emscripten release. However we are currently working on an updated fork which lives in Dawn. You can use this fork along with regular Emscripten - it's a big pain right now but it's possible. See:
https://source.chromium.org/chromium/chromium/src/+/main:third_party/dawn/src/emdawnwebgpu/README.md
This sample repo is set up to do this:
https://github.com/kainino0x/webgpu-cross-platform-demo/tree/dawnwasm
You can follow here for updates on the un-forking: https://crbug.com/371024051 (+1 button in the top right)

@ypujante
Copy link
Contributor

ypujante commented Jan 18, 2025

@kainino0x Now that you can write contrib ports in Emscripten, wouldn't it make sense to have a contrib.webgpu (or contrib.dawn_webgpu) to do this? That way you are not breaking Emscripten WebGPU binding. You just upgrade the port version (which might contain breaking changes).

You can also have the port not be a contrib port at all meaning it is a port that anybody can use (simply) without being part of Emscripten. Like I did for ImGui. This port file could live in the Dawn project.

I don't know the internals of Dawn or why it was chosen to have an Emscripten fork which lives in Dawn. I am just pointing out that there is a new mechanism (Emscripten ports) that is available...

I am very familiar with Emscripten contrib/external ports, since I am the one who implemented the feature, so don't hesitate to reach out if you need help/guidance...

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

No branches or pull requests

4 participants