From de9bc553ed0e8bda42057ac441936c20a8185f60 Mon Sep 17 00:00:00 2001 From: skal Date: Sat, 21 Feb 2026 09:44:17 +0100 Subject: refactor(wgsl): Use vec*f alias for vector types Replaces all instances of `vec` 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. --- doc/CODING_STYLE.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'doc') 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, rd: vec3, result: ptr` 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`, `mat4x4`). + +```wgsl +// Correct +var p: vec3f; +var m: mat4x4f; + +// Wrong +var p: vec3; +var m: mat4x4; +``` + +**Rationale:** +- Improves readability and reduces visual noise. +- Aligns with common graphics programming conventions. + --- ## WGPU Object Initialization -- cgit v1.2.3