refactor: Rename BufferShorthand to BufferBinding#2713
Conversation
|
@pullfrog review |
|
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 [0.99, 2.05, 4.29, 6.61, 7.93, 12.47, 24.99, 27.64]
line [0.95, 1.95, 4.48, 6.72, 7.58, 10.48, 21.75, 26.38]
line [1.02, 2.16, 4.67, 6.84, 8.08, 12.25, 24.18, 26.16]
---
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.29, 0.55, 0.75, 0.90, 1.26, 1.27, 1.57, 1.67]
line [0.32, 0.56, 0.71, 0.84, 1.14, 1.26, 1.51, 1.68]
line [0.37, 0.58, 0.77, 0.96, 1.26, 1.29, 1.59, 1.68]
---
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.89, 2.31, 4.22, 6.86, 13.87, 29.17, 61.13, 121.83]
line [0.88, 2.24, 4.56, 7.82, 13.00, 27.28, 58.68, 118.08]
line [0.85, 2.11, 4.10, 6.66, 13.34, 27.38, 61.34, 120.98]
|
Bundle size comparison (
|
| 🟢 Decreased (max -0.01%) | ➖ Unchanged | 🔴 Increased | ❔ Unknown |
|---|---|---|---|
| 21 | 300 | 0 | 0 |
import { ... } in PR vs import * as ... in PR (is the library tree-Shakeable?):
| Test | tsdown |
|---|---|
| tgpu_init.ts | 256.11 kB ( |
| tgpu_initFromDevice.ts | 255.60 kB ( |
| tgpu_resolve.ts | 161.53 kB ( |
| tgpu_resolveWithContext.ts | 161.47 kB ( |
| tgpu_bindGroupLayout.ts | 69.02 kB ( |
| tgpu_mutableAccessor.ts | 66.00 kB ( |
| tgpu_accessor.ts | 65.98 kB ( |
| tgpu_privateVar.ts | 65.32 kB ( |
| tgpu_workgroupVar.ts | 65.32 kB ( |
| tgpu_const.ts | 64.54 kB ( |
| tgpu_fn.ts | 37.99 kB ( |
| tgpu_fragmentFn.ts | 37.92 kB ( |
| tgpu_vertexFn.ts | 37.74 kB ( |
| tgpu_computeFn.ts | 37.44 kB ( |
| tgpu_vertexLayout.ts | 26.63 kB ( |
| tgpu_comptime.ts | 14.43 kB ( |
| tgpu_unroll.ts | 2.60 kB ( |
| tgpu_slot.ts | 1.57 kB ( |
| tgpu_lazy.ts | 1.22 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.
Important
The rename misses one inline snapshot that now expects stale output, so shellless.test.ts will fail.
Reviewed changes — Rename internal/external buffer concepts from BufferShorthand to BufferBinding, add a deprecated alias for isBufferShorthand, and update docs/tests to the new terminology.
- Rename
TgpuBufferShorthand→TgpuBufferBindinginpackages/typegpu/src/core/buffer/and update all internal imports and constructor calls. - Rename file
bufferShorthand.ts→bufferBinding.ts. - Add backwards-compatibility alias
isBufferShorthand = isBufferBinding, marked@deprecatedand tied to issue#2666. - Export new
isBufferBindingfrom the package barrel while keepingisBufferShorthand. - Update docs to refer to
buffer bindingsinstead ofbuffer usages/buffer shorthands, and adjust naming-convention examples. - Rename test file to
bufferBindings.test.tsand update one test description.
⚠️ Stale snapshot in shellless.test.ts
packages/typegpu/src/core/buffer/bufferBinding.ts:237 changes TgpuBufferShorthandImpl#toString() from ${resourceType}BufferShorthand:... to ${resourceType}BufferBinding:..., but the inline snapshot in packages/typegpu/tests/tgsl/shellless.test.ts:377 still expects uniformBufferShorthand:myUniform. This test will fail after this PR.
Technical details
# Stale snapshot in shellless.test.ts
## Affected sites
- `packages/typegpu/src/core/buffer/bufferBinding.ts:237` — `toString()` now emits `...BufferBinding:...`.
- `packages/typegpu/tests/tgsl/shellless.test.ts:377` — inline snapshot still expects `uniformBufferShorthand:myUniform`.
## Required outcome
- `pnpm test` passes for the touched paths without manual snapshot edits.
## Suggested approach
Run `pnpm test -- --update` (or the repo's equivalent) after `pnpm install` to update the inline snapshot in `shellless.test.ts`, or manually change `uniformBufferShorthand:myUniform` to `uniformBufferBinding:myUniform` in that snapshot.Kimi K2 (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — mechanical rename of the internal "buffer shorthand" concept to "buffer binding", with a deprecated alias left for isBufferShorthand.
- Renamed source file —
core/buffer/bufferShorthand.tsis nowbufferBinding.ts; internal typesTgpuBufferShorthand,TgpuBufferShorthandImpl, and helperUsageTypeToBufferShorthandwere renamed to theirBufferBindingequivalents. - Updated call sites — imports, JSDoc comments, error strings, and a matching test snapshot were updated across
packages/typegpu,apps/typegpu-docs, and tests. - Backward-compat alias —
isBufferShorthandis exported frombufferBinding.tsandindexNamedExports.tsas a@deprecatedalias pointing toisBufferBinding.
Kimi K2 (free via Pullfrog for OSS) | 𝕏

No description provided.