fix: Atomic and decorated types for SoA and write fast path#2329
Open
fix: Atomic and decorated types for SoA and write fast path#2329
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 (349 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
Adds better support for writing data into buffers/SoA layouts when schemas include atomics and/or WGSL decorations (align/size), and verifies behavior via new tests.
Changes:
- Extend
TypedArrayFor<>to supportatomic<i32/u32>and decorated schemas by delegating to the inner type. - Update
writeSoApacking logic to treat decorated/atomic schemas as their “packed” equivalents when computing sizes/layout. - Add tests covering fast-path writes for decorated buffers, typed-view writes for atomic arrays, and SoA writes involving atomics/decorated fields.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/typegpu/tests/buffer.test.ts | Adds tests for decorated-buffer raw fast-path, atomic-array typed views, and SoA writes for atomics/decorated fields. |
| packages/typegpu/src/data/wgslTypes.ts | Expands TypedArrayFor<> to recognize Atomic<I32/U32> and unwrap Decorated<>. |
| packages/typegpu/src/common/writeSoA.ts | Introduces “packed schema” handling (undecorate + unwrap atomic) for SoA packing computations/writes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
iwoplaza
approved these changes
Mar 30, 2026
ec6afaa to
79ab5ca
Compare
79ab5ca to
51e3293
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.