diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-21 09:44:17 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-21 09:50:09 +0100 |
| commit | de9bc553ed0e8bda42057ac441936c20a8185f60 (patch) | |
| tree | 1d7417510512b670bf3ce14c18020b45e5baec24 /doc | |
| parent | e0f326e23f6b96f31ce9e8bbd5b5f2233e6a90ba (diff) | |
refactor(wgsl): Use vec*f alias for vector types
Replaces all instances of `vec<f32>` with the more concise `vec*f` alias (e.g., `vec3f`) across all `.wgsl` shaders. This improves readability and aligns with common graphics programming conventions.
Also adds a new coding style rule to `doc/CODING_STYLE.md` to enforce this standard going forward.
Finally, this commit fixes a build error in `test_effect_base.cc` by replacing a call to the non-existent `wgpuDeviceTick` with `wgpuDevicePoll`, which resolves the test failure.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/CODING_STYLE.md | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/doc/CODING_STYLE.md b/doc/CODING_STYLE.md index b688d6b..57d4478 100644 --- a/doc/CODING_STYLE.md +++ b/doc/CODING_STYLE.md @@ -170,6 +170,24 @@ fn rayMarchWithID(ro: vec3<f32>, rd: vec3<f32>, result: ptr<function, RayMarchRe - Functional style is clearer and less error-prone - `ptr<function, T>` adds complexity with no performance gain for small types +### Vector and Matrix Type Aliases + +**Rule:** Use concise aliases for vector and matrix types (`vec3f`, `mat4x4f`) instead of the verbose generic form (`vec3<f32>`, `mat4x4<f32>`). + +```wgsl +// Correct +var p: vec3f; +var m: mat4x4f; + +// Wrong +var p: vec3<f32>; +var m: mat4x4<f32>; +``` + +**Rationale:** +- Improves readability and reduces visual noise. +- Aligns with common graphics programming conventions. + --- ## WGPU Object Initialization |
