Dart WebGPU

Dart 对 WebGPU 图形 API 的绑定。

警告:实验性,开发中

开发正在进行中,并非所有功能都已实现。

  • 像 mapAsync 这样的异步函数目前会导致 Dawn 崩溃,我正在尝试追踪这个问题。

构建 WebGPU 绑定

要更新 webgpu 绑定,请运行 python build_libwebgpu.py

这将下载必需的第三方库,构建它们,并使用 ffigen 生成更新的 ffi Dart 绑定版本。

构建要求

  • git
  • Python 3.0+
  • CMake 3.15+

第三方库

Dart WebGPU 使用以下第三方库

调试技巧

  • 使用 python build_libwebgpu.py 构建 libwebgpu
  • 确保通过在 Dart 程序顶部添加 wgpu.initializeWebGPU(debug: true); 来加载 Debug 版本的库。
  • 在 Dart 代码中添加断点,在调试器中运行,在断点处暂停执行。
  • 在 Visual Studio 中打开 libwebgpu/_build/Debug/libwebgpu.sln
  • 在 VS 中选择 Debug / Attach To Process...
    • 找到带有 dart 程序作为参数的 dart.exe 进程。
    • 在 VS 中打开您想调试的 lib_webgpu 或 Dawn C++ 文件,在您想用调试器捕获的行上添加断点。
    • 取消暂停 Dart Debugger

GitHub

查看 Github