Closed as not planned
Description
Hello,
The official C header for WebGPU now use string views in-lieu of null-terminated strings (see webgpu-native/webgpu-headers#170 (comment) ). Emscripten still use null-terminated strings, while Dawn use WGPUStringView
. Those 2 types are incompatible, which is a pain when targeting web/native webgpu through emscripten/dawn.
If you do not have the time to implement string views in Emscripten' webgpu.h, please let me know how to do it, I can submit a PR for that.
dawn/webgpu.h (excerpt)
typedef struct WGPUBindGroupDescriptor {
WGPUChainedStruct* nextInChain;
WGPUStringView label;
WGPUBindGroupLayout layout;
size_t entryCount;
WGPUBindGroupEntry const * entries;
} WGPUBindGroupDescriptor WGPU_STRUCTURE_ATTRIBUTE;
emscripten/webgpu.h (excerpt)
typedef struct WGPUBindGroupDescriptor {
WGPUChainedStruct const * nextInChain;
WGPU_NULLABLE char const * label;
WGPUBindGroupLayout layout;
size_t entryCount;
WGPUBindGroupEntry const * entries;
} WGPUBindGroupDescriptor WGPU_STRUCTURE_ATTRIBUTE;
Notice:
WGPUStringView label; // Dawn
WGPU_NULLABLE char const * label; // Emscripten
Version of emscripten/emsdk:
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 4.0.1-git
clang version 20.0.0git
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /opt/homebrew/Cellar/emscripten/4.0.1/libexec/llvm/bin