Repository navigation
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 [0.64, 1.46, 3.24, 4.86, 5.53, 9.96, 20.15, 18.89]
line [0.76, 1.57, 3.00, 4.42, 5.34, 9.72, 19.70, 23.35]
line [0.71, 1.42, 2.83, 4.89, 5.76, 8.88, 19.82, 17.84]
---
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.18, 0.36, 0.51, 0.58, 0.78, 0.84, 1.02, 1.09]
line [0.17, 0.38, 0.56, 0.69, 0.97, 0.94, 1.07, 1.26]
line [0.20, 0.39, 0.49, 0.57, 0.89, 0.86, 1.02, 1.14]
---
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.90, 2.39, 3.93, 5.43, 12.34, 22.12, 45.92, 97.43]
line [0.90, 1.97, 3.80, 5.20, 10.46, 23.19, 45.23, 95.28]
line [0.93, 1.86, 2.85, 5.03, 9.12, 21.50, 42.41, 88.67]
|
Bundle size comparison (
|
| 🟢 Decreased | ➖ Unchanged | 🔴 Increased (max 1.82%) | ❔ Unknown |
|---|---|---|---|
| 0 | 347 | 13 | 1 |
import * as ... in PR vs import * as ... in target (did bundle size increase?):
| Test | tsdown |
|---|---|
| STATIC_tgpu.js | 283.43 kB ( |
| STATIC_allImports.js | 335.54 kB ( |
| tgpu_bindGroupLayout.js | 73.08 kB ( |
| d_memoryLayoutOf.js | 37.76 kB ( |
| std_bufferArrayView.js | 42.71 kB ( |
| std_bufferView.js | 42.71 kB ( |
| std_bufferLength.js | 43.86 kB ( |
| tgpu_bufferRegion.js | 90.42 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 blocking issues — three non-blocking findings and one doc nit below.
Approach: sound — a region becomes a { buffer, offset, size } binding at the single place bind groups are created, and alignment failures surface synchronously with the offending limit named.
Reviewed changes
- Region binding —
bufferBindingOfmaps regions to offset/sizeGPUBufferBindings and validatesminUniformBufferOffsetAlignment/minStorageBufferOffsetAlignment; it backs both bind groups and the newregion.as(...). - Usage-flag inheritance —
InheritedUsageFlagstiesbuffer.region()'s flags to the parent buffer and schema, andBindableBufferthreads the buffer type throughTgpuMutable/TgpuReadonly/TgpuUniformandLayoutEntryToInput. - Unwrap and serialization —
root.unwrap(region)returns the exactGPUBufferBinding; unwrapping a binding of a region now throws a named error; region bindings survive the soul round-trip. - Docs and tests — new "Binding a region" docs section with a twoslash example, alignment and usage-scope cautions, plus tests for bound bytes, alignment errors, unwrap and serialization.
Non-blocking
- Regions carry vertex/index/indirect flags that nothing consumes.
InheritedUsageFlagsaddsVertexFlag,IndexFlagandIndirectFlag, andTgpuBufferRegionImplexposesusableAsVertex/usableAsIndex/usableAsIndirect, butsetVertexBuffer,setIndexBufferand the indirect draw/dispatch paths still requireTgpuBuffer(andisUsableAsVertex/isUsableAsIndexare unchanged). Either drop those flags and getters until the pass APIs accept regions, or wire the APIs up; today this suggests support that does not exist. - The skills reference was not updated for regions.
packages/typegpu/skills/typegpu/references/buffers.mdstill has no buffer-region section, and line 159 says a binding's.bufferis itsTgpuBuffer— false for a binding of a region. Addregion(...),.as(...), the offset alignment rule androot.unwrap(region)there (and mention regions intypes.md's.as(...)line) so the skill matches the API. - The new bind-group test builds a group WebGPU would reject in a pass. bufferRegion.test.ts:187 binds the same region as read-only storage (
boids) and writable storage (mutableBoids) in one bind group; the usage-scope caution added in this PR says that combination is invalid within a dispatch or render pass. The mock device does not enforce usage scopes, so the test passes, but it models a pattern readers may copy. Use a second region/buffer, or assert the entries without presenting the group as usable. - Doc typo. buffers.mdx:786 reads "Both limits are at most 256 bytes, and 256 bytes on many devices" — missing "are".
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
6fc6602 to
e5900ae
Compare
e5900ae to
c641162
Compare
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. Try requesting a review at a lower effort level.
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 blocking issues — the new commit resolves all four prior non-blocking findings; two doc nits remain.
Reviewed changes
Since the prior review, the delta drops the inert vertex/index/indirect usage flags from regions, updates the skill references to describe region binding, and fixes the earlier docs and test issues.
- Usage-flag removal. Dropped the inert
VertexFlag/IndexFlag/IndirectFlaginheritance and theusableAsVertex/usableAsIndex/usableAsIndirectgetters, soInheritedUsageFlagsnow covers only uniform and storage; the type assertions were narrowed to match. - Skills updated. Documented region binding,
.as(...), offset alignment, usage scope androot.unwrap(region)inreferences/buffers.md, and widened.as(...)to regions plusisBufferRegioninreferences/types.md. - Prior test finding fixed. The bind-group test now binds the read-only and mutable regions from two separate buffers, so it no longer models a usage scope WebGPU would reject.
- Docs typo fixed. "Both limits are at most 256 bytes, and are 256 bytes on many devices."
Non-blocking
- Skills say a region binding's
.buffersupportsdestroy.references/buffers.md:178listscopyFrom,clearanddestroyas the reason to reach.buffer, but for a region binding.bufferis aTgpuBufferRegion, which hascopyFromandclearbut nodestroy(onlydestroyed). Split the sentence sodestroyis described as whole-buffer only. - Docs and JSDoc still claim a region works "wherever a buffer can".
buffers.mdx:680and theTgpuBufferRegiondoc comment promise more than the removed flags now allow: the supported surfaces are bind groups and.as(...), not vertex/index/indirect. Reword to "wherever a buffer binding can" so readers do not expectsetVertexBufferto accept a region.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
c641162 to
4312ee0
Compare
There was a problem hiding this comment.
✅ No new issues found.
Approach: sound — regions now hand their own aligned { offset, size } binding to the bind-group layer, and .as(...) bindings carry the region through instead of collapsing to the whole buffer.
Reviewed changes
The delta since the prior Pullfrog review (c641162) replaces the region API, splits the type module, and routes binding through region internals.
- Factory API. Replaced the
buffer.region(...)methods withtgpu.bufferRegion(buffer, schema, accessor | options), with the region's public types moved tobufferRegionTypes.ts(which also breaks the runtime cycle withbufferBinding.ts). - Region-owned binding.
TgpuBufferRegion[$internal]now exposesbinding(usage), which validates the offset against the device'smin*BufferOffsetAlignment, clamps and rounds the size, and returns theGPUBufferBinding.bufferBindingOfmoved intotgpuBindGroupLayout.tsand delegates to it for both direct regions and.as(...)bindings. - Binding types.
TgpuBufferBinding,TgpuMutable,TgpuReadonlyandTgpuUniformgained a secondTBufferparameter defaulting to the whole buffer,BindableBufferis exported,TgpuBufferRegioninherits usage flags from its buffer, andisUsableAsUniformis widened to any carrier. - Partial writes and unwrap.
writePartialon a binding now patches through its buffer or region (so region bindings work), simulation of a region binding throws a named error, androot.unwrapof a binding-of-region throws instead of returning the wrongGPUBuffer. - Docs and skills. Both now use
tgpu.bufferRegion, cover binding, alignment and usage scope, documentroot.unwrap(region), and state thatdestroyexists only on whole buffers — which also resolves the last review's two doc nits.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

Regions bind only their own bytes in bind groups and through
.as(...), androot.unwrap(region)returns aGPUBufferBinding. Binding a region at an offset the device'smin*BufferOffsetAlignmentdoesn't allow throws an error naming the limit