Skip to content

Build: support both emdawnwebgpu callback generations (WGPUQueueWorkDoneCallback) - #3

Open
octopusburrow wants to merge 1 commit into
dwalter:webgpu-4.6.2from
octopusburrow:pr1-dawn-compat
Open

Build: support both emdawnwebgpu callback generations (WGPUQueueWorkDoneCallback)#3
octopusburrow wants to merge 1 commit into
dwalter:webgpu-4.6.2from
octopusburrow:pr1-dawn-compat

Conversation

@octopusburrow

Copy link
Copy Markdown

Newer emdawnwebgpu changed WGPUQueueWorkDoneCallback from 3 parameters to 4 (adding a
WGPUStringView message), which breaks the build on one generation or the other. Macro
presence can't discriminate the two (both define the obvious candidates), so this defines
both signatures as overloads and lets assignment to the port's own callback typedef select
the match at compile time. Both functions are static (single TU — no ODR exposure), and
this is the only callback typedef that differs between the generations; the file's other
callbacks already carried WGPUStringView in both.

Verified by compiling a minimal reproduction against both toolchains (emsdk 4.0.10 — the
fork's deploy toolchain — and 6.x): the base's single 3-param callback fails on 6.x with
"invalid conversion"; the overload set compiles clean on both, each picking its match.

…acros

Newer emdawnwebgpu packages add a WGPUStringView message parameter to
WGPUQueueWorkDoneCallback (4 params: status, message, userdata1,
userdata2); earlier packages use 3 (no message). The signature is a
property of the Dawn package each emsdk release pins, so no clean
version macro exists — and macro PRESENCE does not discriminate: both
generations define WGPU_STRLEN/WGPUStringView (verified against Dawn
v20260423.175430 [4-param] and the earlier package in this fork's
deploy toolchain [3-param]).

So: provide both signatures as overloads of _fence_work_done_callback
and let the assignment to the port's own WGPUQueueWorkDoneCallback
typedef select the matching one. The 4-param overload is additionally
guarded on WGPU_STRING_VIEW_INIT for hypothetical pre-StringView
headers. The dispatch pattern compiles against both package
generations (verified standalone on both toolchains); a full engine
build is verified on the 3-param toolchain.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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

Successfully merging this pull request may close these issues.

1 participant