AnswerDotAI / gpu.cpp

A lightweight library for portable low-level GPU computation using WebGPU.
https://gpucpp.answer.ai
Apache License 2.0
3.68k stars 175 forks source link

Fix emscripten deviceLostCallbackInfo #46

Closed MichealReed closed 1 month ago

MichealReed commented 1 month ago

Found out this is available in the native headers but not the emscripten headers. This PR checks for and excludes the callback if emscripten.

https://github.com/eliemichel/WebGPU-Cpp/blob/main/emscripten/webgpu.hpp

vs

https://github.com/eliemichel/WebGPU-Cpp/blob/main/dawn/webgpu.h

austinvhuang commented 1 month ago

Thanks, wil go ahead and merge.

As a note for ourselves we'll eventually want to migrate to the new DeviceLostCallBack type here `https://github.com/emscripten-core/emscripten/blob/f92abe4f715d086d4c7cd5a16620bbf5ec838cb6/system/include/webgpu/webgpu.h#L1345 though may hold off on doing that right away because it will break users on versions of emscripten besides HEAD.

More generally we'll want to think about how we pin webgpu implementation versions of dependencies for emscripten builds, native builds and the prebuilt dawn binary, and from-scratch dawn builds.