Conversation
|
pkg.pr.new packages benchmark commit |
Resolution Time Benchmark---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Random Branching (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [1.01, 1.98, 4.61, 6.22, 7.25, 11.50, 22.76, 25.30]
line [0.95, 1.94, 4.32, 7.06, 7.69, 11.72, 23.52, 26.69]
line [1.02, 1.94, 4.60, 6.69, 7.27, 10.64, 23.72, 22.93]
---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Linear Recursion (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [0.35, 0.55, 0.70, 0.81, 1.05, 1.16, 1.37, 1.55]
line [0.29, 0.48, 0.63, 0.77, 1.03, 1.13, 1.35, 1.49]
line [0.33, 0.55, 0.68, 0.83, 1.09, 1.16, 1.32, 1.52]
---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Full Tree (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [0.86, 2.41, 3.51, 7.23, 12.27, 26.36, 55.16, 111.20]
line [0.83, 2.28, 3.98, 7.03, 12.60, 26.59, 55.56, 112.12]
line [0.89, 2.05, 3.43, 7.29, 12.43, 26.40, 54.39, 110.90]
|
Bundle size comparison (
|
| 🟢 Decreased | ➖ Unchanged | 🔴 Increased (max 1.77%) | ❔ Unknown |
|---|---|---|---|
| 0 | 39 | 286 | 0 |
import * as ... in PR vs import * as ... in target (did bundle size increase?):
| Test | tsdown |
|---|---|
| STATIC_tgpu.ts | 277.66 kB ( |
| tgpu_initFromDevice.ts | 267.04 kB ( |
| tgpu_init.ts | 267.58 kB ( |
| STATIC_allImports.ts | 303.91 kB ( |
| d_ref.ts | 5.03 kB ( |
If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu.
There was a problem hiding this comment.
ℹ️ No critical issues — one minor suggestion inline.
Reviewed changes
- Lighting shaders — replaced DSL chains (
.mul/.sub/.div) andtgpu.fnwith'use gpu'bodies using infix operators and direct accessor reads;depthToColoris now a plain TS'use gpu'fn. - PointLight immediates — dropped the six shadow
Cameras in favor of atgpu.accessor(d.mat4x4f)fed byimmediateVar+pass.setImmediates, with a per-face uniform-bind-group fallback whenimmediate_address_spaceis unsupported. - Render loop — moved to an explicit
root['~unstable'].createCommandEncoder()with hand-rolled passes; destroyeddepthTexture/msaaTextureon resize;scene._instanceBuffernow destroyed before rebuild. - Camera / types —
CameraDatastruct replaced by a singled.mat4x4fviewProjuniform (dropped unusedinverseViewProjectionMatrix). - box-geometry — model matrix built with wgpu-matrix (
quat.fromEuler(…, 'zyx')+mat4.fromQuat/setTranslation/scale); verified equivalent to the oldT*Rz*Ry*Rx*Schain. - Snapshot test — updated WGSL inline snapshot (immediate path).
I verified the two things that looked risky: pointLight.positionUniform.$ needs no explicit bind group (TypeGPU's auto-generated catch-all bind group covers it, see resolutionCtx.ts), and the wgpu-matrix fromEuler('zyx') quaternion is exactly qz⊗qy⊗qx, i.e. the same rotation the old rotationZ().mul(rotationY()).mul(rotationX()) chain produced.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
e991685 to
3ed038b
Compare
85378ac to
5aa6bea
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The changes consistently update the example code, shader bindings, and tests to the new immediates/encoder-based approach without introducing any confirmed correctness issues.
Pull request overview
Updates the point-light-shadow docs example to use TypeGPU “Immediates” (with a uniform fallback) and the newer command-encoder/pass-style rendering flow, simplifying several data structures along the way.
Changes:
- Switch shadow-face view-projection data to an accessor backed by an immediate var when supported, with a per-face uniform/bind-group fallback otherwise.
- Simplify camera/view-projection handling (remove
CameraDatastruct usage) and update shaders + bindings accordingly. - Move rendering to explicit
CommandEncoderrender passes; add explicit destruction for rebuilt buffers and resized textures.
File summaries
| File | Description |
|---|---|
| apps/typegpu-docs/tests/individual-example-tests/point-light-shadow.test.ts | Updates the WGSL snapshot to reflect immediate-backed view-projection and new binding names. |
| apps/typegpu-docs/src/examples/rendering/point-light-shadow/types.ts | Removes CameraData from the example’s shared types. |
| apps/typegpu-docs/src/examples/rendering/point-light-shadow/scene.ts | Destroys/recreates the instance buffer when rebuilding the instance array. |
| apps/typegpu-docs/src/examples/rendering/point-light-shadow/point-light.ts | Implements per-face shadow rendering using immediates (or per-face uniform fallback) and encoder-based passes. |
| apps/typegpu-docs/src/examples/rendering/point-light-shadow/index.ts | Refactors the example to use encoder passes, binds the new view-projection inputs, and wires up shadow rendering accordingly. |
| apps/typegpu-docs/src/examples/rendering/point-light-shadow/camera.ts | Uses a single mat4x4f uniform for view-projection (no inverse matrix). |
| apps/typegpu-docs/src/examples/rendering/point-light-shadow/box-geometry.ts | Changes model-matrix construction to use wgpu-matrix quaternion/Euler utilities. |
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
ℹ️ No critical issues — one minor suggestion inline.
Reviewed changes
- Lighting shaders — replaced
.mul/.sub/.divDSL chains andtgpu.fnwith'use gpu'bodies using infix operators and direct accessor reads;depthToColoris now a plain TS'use gpu'arrow fn inlined into two fragment bodies. - PointLight immediates — dropped the six shadow
Cameras for atgpu.accessor(d.mat4x4f)fed byimmediateVar+pass.setImmediates, with a per-face uniform bind-group (faceLayout) fallback whenimmediate_address_spaceis unsupported. - Render loop — explicit
root['~unstable'].createCommandEncoder()with hand-rolled passes;depthTexture/msaaTexturedestroyed on resize;scene.#instanceBufferdestroyed before rebuild. - Camera / types —
CameraDatastruct replaced by a singled.mat4x4fviewProjuniform (dropped the unusedinverseViewProjectionMatrix). - box-geometry — model matrix built with wgpu-matrix (
quat.fromEuler(…, 'zyx')+mat4.fromQuat/setTranslation/scale). - Snapshot test — WGSL inline snapshot updated (immediate path).
I re-verified the previously-reviewed surface against the current head (5aa6bea): the wgpu-matrix fromEuler('zyx') rotation is numerically equivalent to the old T*Rz*Ry*Rx*S chain (max diff ~1e-7, float rounding only); the new pass API defaults depthLoadOp: 'clear' / depthClearValue: 1 for depth attachments, matching the old explicit values; and the non-immediate fallback compiles to valid WGSL (verified with a scratch test that removes immediate_address_space from the mock device's feature set).
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| pass.setVertexBuffer(instanceLayout, scene.instanceBuffer); | ||
| pass.setIndexBuffer(BoxGeometry.indexBuffer, 'uint16'); | ||
| pass.setPipeline(pipeline); | ||
| if (this.#faceImmediate) { |
There was a problem hiding this comment.
The uniform fallback branch (#faceUniforms/#faceBindGroups) is only exercised when immediate_address_space isn't supported, but the committed snapshot test always runs with the mock device's feature set containing it, so only the immediate path is covered. I confirmed the fallback compiles to valid WGSL (removing the feature yields @group(1) @binding(0) var<uniform> viewProj in the depth shader, no var<immediate> item) — but since this is the only code path on devices without the extension, a test variant that disables the feature would pin it against regressions.
* split comparison helper * fix pill overflow
* triplanar mapping example * new thumbnail
* docs: Examples page visual revamp * Example showcase
* new transpilers * external chain * function parts * simplify * transpilation options * more simplification * working version * fix types * polish * unplugin update * review fixes * consistent comments * unnecessary import * cleanup * legacy * review fixes
* update unsupported syntax in plugin * tinyest + tinyest for wgsl fix 1 test format * obfuscation + tseynit * wgslgenerator * glslgenerator * fix fields order in examples * better error in glsl (tseynit) * legacy transpilers support computed properties * align with new api * review fixes - 0 new nodes * rename parse -> transpile
5aa6bea to
4f4b2f6
Compare

No description provided.