juj / wasm_webgpu

System headers for interfacing WebGPU from C programs compiled via Emscripten to WebAssembly
BSD 3-Clause "New" or "Revised" License
331 stars 26 forks source link

Fix wgpu_buffer_map_async #33

Closed alienself closed 1 year ago

alienself commented 1 year ago

buffer which contains the id of the buffer must be send back the callback function otherwise buffer value inside callback function is "0", I fixed that.

juj commented 1 year ago

Thanks, good catch!

I opted to fix by using let instead of const, since let is already collapsed to single byte entropy in compression, lib_webgpu.js does not currently contain the keyword const. (it is typically good practice to use const, but for these kinds of system level bindings, code compression is key)