Skip to content

refactor: Rename BufferShorthand to BufferBinding#2713

Open
aleksanderkatan wants to merge 4 commits into
mainfrom
refactor/rename-shorthand
Open

refactor: Rename BufferShorthand to BufferBinding#2713
aleksanderkatan wants to merge 4 commits into
mainfrom
refactor/rename-shorthand

Conversation

@aleksanderkatan

Copy link
Copy Markdown
Contributor

No description provided.

@aleksanderkatan aleksanderkatan linked an issue Jul 13, 2026 that may be closed by this pull request
@aleksanderkatan

Copy link
Copy Markdown
Contributor Author

@pullfrog review

@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown

pkg.pr.new

packages
Ready to be installed by your favorite package manager ⬇️

https://pkg.pr.new/software-mansion/TypeGPU/tgpu-gen@5333ab85c0a8c01b7a0a99bb819ec9ed30a90a4d
https://pkg.pr.new/software-mansion/TypeGPU/tinyest-for-wgsl@5333ab85c0a8c01b7a0a99bb819ec9ed30a90a4d
https://pkg.pr.new/software-mansion/TypeGPU/typegpu@5333ab85c0a8c01b7a0a99bb819ec9ed30a90a4d
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/cli@5333ab85c0a8c01b7a0a99bb819ec9ed30a90a4d
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/color@5333ab85c0a8c01b7a0a99bb819ec9ed30a90a4d
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/gl@5333ab85c0a8c01b7a0a99bb819ec9ed30a90a4d
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/noise@5333ab85c0a8c01b7a0a99bb819ec9ed30a90a4d
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/radiance-cascades@5333ab85c0a8c01b7a0a99bb819ec9ed30a90a4d
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/react@5333ab85c0a8c01b7a0a99bb819ec9ed30a90a4d
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/sdf@5333ab85c0a8c01b7a0a99bb819ec9ed30a90a4d
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/three@5333ab85c0a8c01b7a0a99bb819ec9ed30a90a4d
https://pkg.pr.new/software-mansion/TypeGPU/unplugin-typegpu@5333ab85c0a8c01b7a0a99bb819ec9ed30a90a4d

benchmark
view benchmark

commit
view commit

@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown

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]
Loading
---
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]
Loading
---
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]
Loading

@github-actions

Copy link
Copy Markdown

Bundle size comparison (import * as ... in PR vs import * as ... in target):

🟢 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 ($${\color{green}-3.2\%}$$)
tgpu_initFromDevice.ts 255.60 kB ($${\color{green}-3.4\%}$$)
tgpu_resolve.ts 161.53 kB ($${\color{green}-38.9\%}$$)
tgpu_resolveWithContext.ts 161.47 kB ($${\color{green}-39.0\%}$$)
tgpu_bindGroupLayout.ts 69.02 kB ($${\color{green}-73.9\%}$$)
tgpu_mutableAccessor.ts 66.00 kB ($${\color{green}-75.1\%}$$)
tgpu_accessor.ts 65.98 kB ($${\color{green}-75.1\%}$$)
tgpu_privateVar.ts 65.32 kB ($${\color{green}-75.3\%}$$)
tgpu_workgroupVar.ts 65.32 kB ($${\color{green}-75.3\%}$$)
tgpu_const.ts 64.54 kB ($${\color{green}-75.6\%}$$)
tgpu_fn.ts 37.99 kB ($${\color{green}-85.6\%}$$)
tgpu_fragmentFn.ts 37.92 kB ($${\color{green}-85.7\%}$$)
tgpu_vertexFn.ts 37.74 kB ($${\color{green}-85.7\%}$$)
tgpu_computeFn.ts 37.44 kB ($${\color{green}-85.8\%}$$)
tgpu_vertexLayout.ts 26.63 kB ($${\color{green}-89.9\%}$$)
tgpu_comptime.ts 14.43 kB ($${\color{green}-94.5\%}$$)
tgpu_unroll.ts 2.60 kB ($${\color{green}-99.0\%}$$)
tgpu_slot.ts 1.57 kB ($${\color{green}-99.4\%}$$)
tgpu_lazy.ts 1.22 kB ($${\color{green}-99.5\%}$$)

If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 TgpuBufferShorthandTgpuBufferBinding in packages/typegpu/src/core/buffer/ and update all internal imports and constructor calls.
  • Rename file bufferShorthand.tsbufferBinding.ts.
  • Add backwards-compatibility alias isBufferShorthand = isBufferBinding, marked @deprecated and tied to issue #2666.
  • Export new isBufferBinding from the package barrel while keeping isBufferShorthand.
  • Update docs to refer to buffer bindings instead of buffer usages / buffer shorthands, and adjust naming-convention examples.
  • Rename test file to bufferBindings.test.ts and 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.

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

Comment thread packages/typegpu/src/core/buffer/bufferBinding.ts
@aleksanderkatan aleksanderkatan marked this pull request as ready for review July 13, 2026 11:39
Copilot AI review requested due to automatic review settings July 13, 2026 11:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 filecore/buffer/bufferShorthand.ts is now bufferBinding.ts; internal types TgpuBufferShorthand, TgpuBufferShorthandImpl, and helper UsageTypeToBufferShorthand were renamed to their BufferBinding equivalents.
  • 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 aliasisBufferShorthand is exported from bufferBinding.ts and indexNamedExports.ts as a @deprecated alias pointing to isBufferBinding.

Pullfrog  | View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: Rename BufferShorthand

2 participants