Skip to content

Commit

Permalink
更新 naga url
Browse files Browse the repository at this point in the history
  • Loading branch information
jinleili committed Nov 29, 2024
1 parent 2284e44 commit 78c2023
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion code/integration-and-debugging/wgpu_in_web/src/web_ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use glam::{uvec2, vec2};
use utils::init_logger;
use wasm_bindgen::prelude::*;

// 创建 wgpu app 窗口
// 创建 wgpu app 实例
#[wasm_bindgen]
pub async fn create_wgpu_app(canvas_id: &str, handle: u32) -> u64 {
init_logger();
Expand Down
2 changes: 1 addition & 1 deletion docs/beginner/tutorial3-pipeline/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
**WGSL** (WebGPU Shading Language) 是 WebGPU 的着色器语言。
WGSL 的开发重点是让它轻松转换为与后端对应的着色器语言;例如,Vulkan 的 SPIR-V、Metal 的 MSL、DX12 的 HLSL 和 OpenGL 的 GLSL。
这种转换是在内部完成的,我们不需要关心这些细节。
就 wgpu 而言,它是由名为 [naga](https://github.com/gfx-rs/naga)****完成的。
就 wgpu 而言,它是由名为 [naga](https://github.com/gfx-rs/wgpu/tree/trunk/naga)****完成的。

[WGSL 着色器语言](../wgsl) 一章中,有对 WGSL 的由来及语法的更详细介绍。

Expand Down
2 changes: 1 addition & 1 deletion docs/beginner/wgsl.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ WebGPU 成员花了 2 年半的时间来争论 WebGPU 是否应该有自己的

**WGSL** 的目标不是要与 **GLSL** 兼容,它是对现代着色器语言的重新设计。

2020 年 4 月 27 日,WGSL 标准有了第一次提交。自此开始,wgpu 和 dawn 都摆脱了对 shaderc 之类复杂繁重的着色器转译工具的依赖。wgpu 里使用的 WGSL 转译工具叫 [naga](https://github.com/gfx-rs/naga), kvark 有一篇博客([Shader translation benchmark](http://kvark.github.io/naga/shader/2022/02/17/shader-translation-benchmark.html))对比了 naga 相比于其它转译工具的性能优化,总体来说,有 10 倍以上的性能优势。
2020 年 4 月 27 日,WGSL 标准有了第一次提交。自此开始,wgpu 和 dawn 都摆脱了对 shaderc 之类复杂繁重的着色器转译工具的依赖。wgpu 里使用的 WGSL 转译工具叫 [naga](https://github.com/gfx-rs/wgpu/tree/trunk/naga), kvark 有一篇博客([Shader translation benchmark](http://kvark.github.io/naga/shader/2022/02/17/shader-translation-benchmark.html))对比了 naga 相比于其它转译工具的性能优化,总体来说,有 10 倍以上的性能优势。

2023 年之前,WGSL 的学习资源不多,唯一好的参考是 [WGSL 规范](https://www.w3.org/TR/WGSL/),但它是对语言实现细节的规范,对普通用户来说有点难以理解。
我从 2018 年开始使用 wgpu (那时还是 使用 GLSL 做为着色器语言),2021 年底完成了个人作品 [字习 Pro](https://apps.apple.com/cn/app/字习-pro/id1507339788) 及其他几个练手作品从 GLSL 到 WGSL 的 100 多个着色器的移植工作,在这个过程中对这两个着色器语言有了比较深入的了解。这个增补章节旨在介绍 WGSL 的一些基础知识,希望这对从 OpenGL / WebGL 迁移到 WebGPU 的朋友带来一点有益的经验(下边的所有 GLSL 代码均是按照 **GLSL450** 标准编写的)。
Expand Down

0 comments on commit 78c2023

Please sign in to comment.