学习 C++ WebGPU
Learn WebGPU for C++

原始链接: https://eliemichel.github.io/LearnWebGPU/

不用了,我不想看那些初始样板代码。这种安排非常合理,以后随时可以回过头来看基础步骤。你可能想查看每页开头和结尾的“最终代码”(Resulting code)链接,例如: 你想用轻量级包装器来方便阅读吗? * **可以**:请点击“With webgpu.hpp”标签页,我更喜欢 C++ 风格的代码。 * **不可以**:请点击“Vanilla webgpu.h”标签页,展示原始的 C WebGPU API。 注意:Vanilla WebGPU 的最终代码更新可能稍滞后,但该标签页会切换指南中的所有代码块,那些代码块是保持更新的。 要构建此基础代码,请参考项目设置章节中的“构建”(Building)部分。你可以在 `cmake -B build` 命令中添加 `-DWEBGPU_BACKEND=WGPU`(默认)或 `-DWEBGPU_BACKEND=DAWN`,以分别选择 wgpu-native 或 Dawn 作为后端。 你希望基础代码包含到什么程度? * **带有基础交互的 3D 模型查看器**:建议从“光照控制”(Lighting control)章节的末尾开始。

```Hacker News新消息 | 过往 | 评论 | 提问 | 展示 | 招聘 | 提交登录学习 C++ 版 WebGPU (eliemichel.github.io)由 ibobev 发布于 1 小时前,9 点 | 隐藏 | 过往 | 收藏 | 1 条评论帮助 minraws 2 分钟前 [–] 构建得很好的资源,发现了一些小瑕疵,但作为起点相当不错。尽管我觉得除非你需要专门针对 Web 或广泛的跨平台支持,否则对于更高级的框架/库来说,nvrhi 是更好的选择。特别是对 C++ 开发人员而言。而且我觉得如果你是为了跨平台或 Web 进行开发,你很可能正在使用 Rust 或者在编写自己的游戏引擎/库,也许我对生态系统的看法有偏差。回复 考虑申请 YC 2026 年秋季批次!申请截止日期为 7 月 27 日。 准则 | 常见问题解答 | 列表 | API | 安全性 | 法律 | 申请 YC | 联系 搜索: ```
相关文章

原文

No, I’d rather skip the initial boilerplate.

This perfectly makes sense, you can always come back to the basic steps later.

You probably want to check out the Resulting code link at the beginning and end of each page, e.g.:

_images/resulting-code-light.png _images/resulting-code-dark.png

Are you ok with using a shallow wrapper for easier reading?

Yes, I prefer C++ styled code.

Use the “With webgpu.hpp” tab.

No, show me the raw C WebGPU API!

Use the “Vanilla webgpu.h” tab. The Resulting code for vanilla WebGPU is less up to date, but this tab also switches all the code blocks inside the guide, and these are up to date.

To build this base code, refer to the Building section of the project setup chapter. You may add -DWEBGPU_BACKEND=WGPU (default) or -DWEBGPU_BACKEND=DAWN to the cmake -B build line to pick respectively wgpu-native or Dawn as a backend.

How far do you want the base code to go?

A 3D mesh viewer with basic interaction

I recommend starting from the end of the Lighting control chapter.

联系我们 contact @ memedata.com