Skip to content

Conversation

manuel5975p
Copy link

  • Get both the WebGPU backend and its example up to date with the current (standardized) webgpu.h header.
    • API change for wgpuInstanceRequestAdapter
    • API change for wgpuAdapterRequestDevice
    • Some renamings, i.e. WGPUEmscriptenSurfaceSourceCanvasHTMLSelector and its sType
  • Remove dependencies on the C++ header webgpu_cpp.h as it's nonstandard and doesn't provide much benefit here

The current implementation has been tested against webgpu.h generated by chromium/7281

In the example, a glfw callback is added to correctly deal with window resizes.

However, here's some parts of this PR that are still unrefined:

  • A lot of places use #ifdef switching depending on the backend to choose a code path. This PR keeps it that way, however this should maybe be removed entirely? The only purpose of this is to deal with outdated headers of some implementations.
  • Similarly, compiling for web requires the WEBGPU_BACKEND_EMDAWNWEBGPU flag and the IMGUI_IMPL_WEBGPU_BACKEND_DAWN at the same time, which only works by commenting out an #error directive.

Makefile has been updated for the current state of emscripten, featuring --use-port=emdawnwebgpu and REMOVING -sUSE_WEBGPU=1
The example is again up to date with webgpu.h and doesn't require webgpu_cpp anymore
@ocornut
Copy link
Owner

ocornut commented Jul 30, 2025

Thanks! Linking to #8674 #8567 #8381

FYI I am struggling to take on action with any of those since they are difficult to test :(

Also, any PR which exhibit the fact that the submitting person has not carefully reviewed every line of the PR is also quite unfortunately immediately taking a huge hit in term of trust. It's difficult for me to consider reviewing a PR if I feel that I cannot trust the submitter. It's 100% certain there are useful stuff in there, which I can use as reference at minimum, but if I can spot 5 mistakes in one minute of reviewing the whole thing begins with a huge hit on trust.

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

Successfully merging this pull request may close these issues.

2 participants