emscripten-core / emscripten-core/emscripten
Cannot convert a BigInt value to a number when calling wgpuCreateInstance
- Lingua principale
- C++
- Stelle
- 27.6k
- Fork
- 3.6k
- Merge medio
- 1g 14h
- PR unite (30g)
- 125
Descrizione
When calling `wgpuCreateInstance`, Chromium errors with
`Cannot convert a BigInt value to a number`
Offending code:
```cpp
WGPUInstance instance = wgpuCreateInstance(nullptr);
```
based on this code in Emscripten tests: https://github.com/emscripten-core/emscripten/blob/0566a76b500bd2bbd535e108f657fce1db7f6f75/test/webgpu_basic_rendering.cpp#L20
Chrome highlights this line in the webassembly as the source of the error:
```wasm
call $wgpuCreateInstance
```
Browser version:
Chromium Version 118.0.5987.0 (Developer Build) (64-bit)
**Version of emscripten/emsdk:**
```
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.45 (ef3e4e3b044de98e1811546e0bc605c65d3412f4)
clang version 18.0.0 (https://github.com/llvm/llvm-project d1e685df45dc5944b43d2547d0138cd4a3ee4efe)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: C:\Users\Admin\Documents\emsdk\upstream\bin
```
**Workaround**
```cpp
instance = reinterpret_cast(1ull);
```
This hack allows my code to continue by tricking the implementation into thinking that I called `wgpuCreateInstance`.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia con test/webgpu_basic_rendering.cpp e riproduci la chiamata a wgpuCreateInstance utilizzando le versioni di Emscripten e Chromium riportate. Segui la chiamata WebAssembly generata mostrata nel report e verifica che la chiamata C++ non modificata venga completata senza l’errore di conversione BigInt o il workaround con reinterpret_cast.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- cpp, wasm
- Ambito
- compilers, web-dev
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100