Skip to content

Conversation

@iwoplaza
Copy link
Collaborator

@iwoplaza iwoplaza commented Jan 7, 2026

Accessors could always provide:

  • Comptime-known values
  • tgpu.fn functions that return a value matching the schema
  • Buffer usages and buffer shorthands that hold the schema

Now, accessors can provide:

  • tgpu.const references
  • tgpu.*Var references
  • Shell-less functions
  • Deep references to nested structures (with regular callbacks)
  • comptime functions that are ran when requesting the value

There's also a new resource: tgpu.mutableAccessor. It's currently functionally the same as tgpu.accessor but with a more restricted API, and with future PRs, values accessed from regular accessors will be immutable.

Things to do in subsequent PRs:

@github-actions
Copy link

github-actions bot commented Jan 7, 2026

pkg.pr.new

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

https://pkg.pr.new/software-mansion/TypeGPU/typegpu@f7d89a91ba50448d80c15746aad1486d8f83eb3f
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/noise@f7d89a91ba50448d80c15746aad1486d8f83eb3f
https://pkg.pr.new/software-mansion/TypeGPU/unplugin-typegpu@f7d89a91ba50448d80c15746aad1486d8f83eb3f

benchmark
view benchmark

commit
view commit

@iwoplaza iwoplaza marked this pull request as ready for review January 7, 2026 17:16
Copy link
Collaborator

@cieplypolar cieplypolar left a comment

Choose a reason for hiding this comment

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

Amazing :accessibility:

@github-actions
Copy link

📊 Bundle Size Comparison

📈 Summary

  • 📈 Increased: 14 bundles

  • 📉 Decreased: 0 bundles

  • Unchanged: 10 bundles

  • Unknown: 0 bundles

📋 Bundle Size Comparison

Test tsdown webpack
dataImportEverything.ts 80.05 kB ($${\color{red}+0.0\%}$$) 85.35 kB ($${\color{red}+0.0\%}$$)
dataImportOneDirect.ts 40.28 kB (➖) 40.75 kB (➖)
dataImportOneStar.ts 40.28 kB (➖) 40.75 kB (➖)
functionWithUseGpu.ts 268 B (➖) 276 B (➖)
functionWithoutUseGpu.ts 24 B (➖) 59 B (➖)
importEntireLibrary.ts 257.79 kB ($${\color{red}+0.4\%}$$) 284.89 kB ($${\color{red}+0.4\%}$$)
importEntireLibraryUnused.ts 0 B (➖) 0 B (➖)
stdImportEverything.ts 113.12 kB ($${\color{red}+0.0\%}$$) 117.61 kB ($${\color{red}+0.0\%}$$)
stdImportOneDirect.ts 61.98 kB ($${\color{red}+0.0\%}$$) 62.94 kB ($${\color{red}+0.0\%}$$)
stdImportOneStar.ts 61.98 kB ($${\color{red}+0.0\%}$$) 62.94 kB ($${\color{red}+0.0\%}$$)
tgpuImportEverything.ts 238.79 kB ($${\color{red}+0.4\%}$$) 265.51 kB ($${\color{red}+0.4\%}$$)
tgpuImportOne.ts 238.81 kB ($${\color{red}+0.4\%}$$) 265.52 kB ($${\color{red}+0.4\%}$$)

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.

Accessors should accept runtime-sized schemas feat: More capable accessor values

3 participants