chore: Remove .value API#2694
Conversation
…ecated-value-api-on-resources
|
pkg.pr.new packages benchmark commit |
Bundle size comparison (
|
| 🟢 Decreased (max -0.12%) | ➖ Unchanged | 🔴 Increased | ❔ Unknown |
|---|---|---|---|
| 23 | 298 | 0 | 0 |
import { ... } in PR vs import * as ... in PR (is the library tree-Shakeable?):
| Test | tsdown |
|---|---|
| tgpu_init.ts | 255.87 kB ( |
| tgpu_initFromDevice.ts | 255.36 kB ( |
| tgpu_resolve.ts | 161.33 kB ( |
| tgpu_resolveWithContext.ts | 161.27 kB ( |
| tgpu_bindGroupLayout.ts | 68.92 kB ( |
| tgpu_mutableAccessor.ts | 65.94 kB ( |
| tgpu_accessor.ts | 65.93 kB ( |
| tgpu_privateVar.ts | 65.27 kB ( |
| tgpu_workgroupVar.ts | 65.27 kB ( |
| tgpu_const.ts | 64.52 kB ( |
| tgpu_fn.ts | 37.99 kB ( |
| tgpu_fragmentFn.ts | 37.89 kB ( |
| tgpu_vertexFn.ts | 37.71 kB ( |
| tgpu_computeFn.ts | 37.41 kB ( |
| tgpu_vertexLayout.ts | 26.63 kB ( |
| tgpu_comptime.ts | 14.43 kB ( |
| tgpu_unroll.ts | 2.60 kB ( |
| tgpu_slot.ts | 1.54 kB ( |
| tgpu_lazy.ts | 1.19 kB ( |
If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu.
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.34, 2.87, 4.97, 5.46, 8.27, 17.03, 19.24]
line [0.71, 1.51, 3.10, 5.07, 5.48, 8.77, 15.44, 19.49]
line [0.73, 1.55, 3.19, 4.47, 5.17, 8.81, 17.15, 18.96]
---
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.23, 0.41, 0.52, 0.65, 0.91, 0.92, 1.09, 1.17]
line [0.20, 0.47, 0.57, 0.63, 0.88, 0.88, 1.14, 1.15]
line [0.24, 0.42, 0.53, 0.68, 0.97, 0.94, 1.11, 1.22]
---
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.70, 1.85, 3.31, 4.99, 9.39, 20.37, 41.66, 85.64]
line [0.84, 1.70, 3.57, 5.35, 9.11, 18.77, 39.84, 82.66]
line [0.68, 1.74, 3.51, 4.89, 9.94, 20.14, 41.63, 86.08]
|
|
@pullfrog review |
There was a problem hiding this comment.
Important
The removal is incomplete for TgpuVar — its public interface still declares the deprecated .value property, and the implementation keeps a write-only .value setter after the getter was removed.
Reviewed changes — removal of the deprecated .value accessor from TypeGPU resource types (buffers, constants, raw code snippets, samplers, slots/accessors/lazy, textures, variables, bind group layouts).
- Removed
.valuegetter and interface declaration fromTgpuMutable,TgpuReadonly,TgpuUniform, and the sharedTgpuBufferShorthandImpl. - Removed
.valuefromTgpuConst,TgpuRawCodeSnippet, sampler implementations,TgpuSlot/TgpuLazy/TgpuAccessor,TgpuMutableAccessor, texture views, external textures, andTgpuBindGroupLayout. - Replaced internal bind-group-layout
this.valuepopulation with directthis.$population.
⚠️ TgpuVar still exposes .value and has a write-only runtime accessor
packages/typegpu/src/core/variable/tgpuVariable.ts removes the value getter from TgpuVarImpl but leaves both the public TgpuVar.value declaration and a set value(...) implementation. That means const x = myVar.value type-checks (and the interface still marks it as deprecated) but at runtime returns undefined. The setter also continues to accept deprecated .value writes.
To complete the removal, drop value from the TgpuVar interface and remove the set value accessor.
Kimi K2 (free via Pullfrog for OSS) | 𝕏
…ecated-value-api-on-resources
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — remove the deprecated .value getter/setter from TypeGPU resource interfaces in favor of .$.
TgpuMutable/TgpuReadonly/TgpuUniformbuffer shorthands lose.value.TgpuConstloses.value.TgpuRawCodeSnippetloses.value.TgpuSampler/TgpuComparisonSamplerlose.value.TgpuSlot/TgpuLazy/TgpuAccessor/TgpuMutableAccessorlose.value.TgpuExternalTexture/TgpuTextureViewlose.value.TgpuVarloses.value.TgpuBindGroupLayoutloses.value; internal layout-entry accessors now attach directly to.$.
I verified the change by running pnpm --filter typegpu test:types (passes) and pnpm vitest run --project=!browser packages/typegpu/tests/ (passes). No remaining .value references were found in docs, tests, or source for these resource types.
Kimi K2 (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — merge of main commit 15f31f05 into the PR branch and re-verification that the .value removal is complete.
- Merged
mainfix for struct-cast side-effects (#2687):packages/typegpu/src/tgsl/conversion.tsnow rejects struct-to-struct casts when the source has possible side-effects, replacing the previous alias-based check.packages/typegpu/tests/struct.test.tswas updated to exercise the guard with explicit side-effecting expressions.
- Confirmed
TgpuVarno longer exposes.value— previous Pullfrog feedback is fully addressed. - No
.valueproperty references were reintroduced in the merged content. pnpm --filter typegpu test:typesand the struct test suite pass.
Kimi K2 (free via Pullfrog for OSS) | 𝕏

No description provided.