Add --available-symbols to skip wrappers for unprovided functions#36
Open
yuiseki wants to merge 1 commit into
Open
Add --available-symbols to skip wrappers for unprovided functions#36yuiseki wants to merge 1 commit into
yuiseki wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Adds an optional
--available-symbols FILEflag. The file lists thewgpu*C symbols actually provided by the library you link against (one per line, leading underscore optional). Procedures whose underlying C function is not in the list are skipped during generation, so the wrapper only references symbols that exist at link time. It reuses the same skip path as the existing blacklist.Compatibility
Fully backward compatible. The flag is opt-in and defaults to off; an empty or missing file disables filtering. Without it, output is byte-for-byte identical to before.
Why it's needed
The WebGPU header declares the full spec surface, but a backend like wgpu-native implements only a subset (e.g. external textures and the mapped-range helpers are declared but not implemented). The
WEBGPU_CPP_IMPLEMENTATIONTU then emits references to those absent functions, which become unresolvedwgpu*symbols when linking statically (for us, bundling into an amalgamation). Today the only workaround is to maintain a hand-written blacklist that drifts every time the header is updated.--available-symbolsderives the exclusions automatically from the target library (e.g.nm), so it stays correct across backend and header versions.