Repository navigation
fix(tgpu-gen): Generate matrix and f16 vector schemas for templated WGSL types - #3275
RaphaelFakhri wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
There was a problem hiding this comment.
ℹ️ No critical issues — one optional suggestion inline.
Reviewed changes
typeToAliasmappings (packages/tgpu-gen/gen.mjs) — addsvecN<f16>→vecNhand squarematNxN<f32>→matNxNf, so those templated members no longer emitd.undefined. Correct: both map to schemas thattypegpu/dataactually exports (d.vec2h/3h/4h,d.mat2x2f/3x3f/4x4f).- structs generator test (
packages/tgpu-gen/tests/structs.test.ts) — new case asserting the f16 vector and square-matrix member mappings. Verified locally:npx vitest run --project=!browser packages/tgpu-genreports 31 passing tests, and the new case fails without thegen.mjschange.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
Map vec2<bool>, vec3<bool> and vec4<bool> to d.vec2b, d.vec3b and d.vec4b instead of d.undefined.
|
Thanks for the suggestion. |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
vecN<bool>alias mapping (packages/tgpu-gen/gen.mjs) — adds aboolbranch returningvec2b/vec3b/vec4b, closing thed.undefinedhole the prior review flagged. Verifiedd.vec2b/3b/4bare exported fromtypegpu/data.- bool vector test (
packages/tgpu-gen/tests/structs.test.ts) — new case asserting the bool member mappings.
Confirmed npx vitest run --project=!browser packages/tgpu-gen reports 32 passing tests. The prior review's suggestion was addressed and its thread resolved.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

tgpu-genconverts templated WGSL types to TypeGPU schemas intypeToAlias, which only handlesvec2/vec3/vec4withi32,u32orf32. For any other templated type it returnsundefined, so these members becomed.undefinedin the generated code:mat2x2<f32>,mat3x3<f32>,mat4x4<f32>vec2<f16>,vec3<f16>,vec4<f16>vec2<bool>,vec3<bool>,vec4<bool>The shorthand forms (
mat4x4f,vec3h) already work because they skip that function.Changes
typeToAliasmapsvecN<f16>tovecNh,vecN<bool>tovecNband the squarematNxN<f32>types tomatNxNf, matching the schemas exported fromtypegpu/data.Testing
The
packages/tgpu-gentests pass: 32 tests. Without thegen.mjschanges, the new tests fail because the output containsd.undefined.Fixes #3274