feat: More convenient TgpuVertexFn.AutoIn and TgpuVertexFn.AutoOut types#2282
feat: More convenient TgpuVertexFn.AutoIn and TgpuVertexFn.AutoOut types#2282
Conversation
|
pkg.pr.new packages benchmark commit |
📊 Bundle Size Comparison
👀 Notable resultsStatic test results:No major changes. Dynamic test results:No major changes. 📋 All resultsClick to reveal the results table (348 entries).
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.
Pull request overview
This PR adds more convenient TgpuVertexFn.AutoIn, TgpuVertexFn.AutoOut, TgpuFragmentFn.AutoIn, and TgpuFragmentFn.AutoOut namespace types as alternatives to the standalone AutoVertexIn, AutoVertexOut, AutoFragmentIn, and AutoFragmentOut types, which are now deprecated. The new TgpuVertexFn.AutoIn type (_AutoVertexIn) is more flexible, accepting TgpuVertexAttrib properties and automatically inferring their GPU types.
Changes:
- Added
_AutoVertexIn<T>type inautoIO.tsthat mapsTgpuVertexAttribproperties to their GPU types before delegating to the originalAutoVertexIn - Added
AutoInandAutoOuttype aliases inTgpuVertexFnandTgpuFragmentFnnamespaces - Deprecated the standalone
AutoVertexIn,AutoVertexOut,AutoFragmentIn,AutoFragmentOutexports in favor of the namespace versions
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
packages/typegpu/src/core/function/autoIO.ts |
Added _AutoVertexIn<T> type and new imports for its implementation |
packages/typegpu/src/core/function/tgpuVertexFn.ts |
Added AutoIn and AutoOut type aliases in TgpuVertexFn namespace |
packages/typegpu/src/core/function/tgpuFragmentFn.ts |
Added AutoIn and AutoOut type aliases in TgpuFragmentFn namespace |
packages/typegpu/src/indexNamedExports.ts |
Deprecated standalone auto IO type exports, re-exported _AutoVertexIn as AutoVertexIn |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
aleksanderkatan
left a comment
There was a problem hiding this comment.
Can we add an example use to docs?
| type In = Record<string, BaseData>; | ||
| type Out = Record<string, BaseData> | BaseData; | ||
| type AutoIn<T extends AnyAutoCustoms> = AutoFragmentIn<T>; | ||
| type AutoOut<T extends AnyAutoCustoms = AnyAutoCustoms> = AutoFragmentOut<T>; |
There was a problem hiding this comment.
is there a reason why out has a default type and in does not?
No description provided.