-
-
Notifications
You must be signed in to change notification settings - Fork 43
fix: Throw error when accessing matrix elements directly #1625
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
pkg.pr.new packages benchmark commit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a fix to throw an error when attempting to access matrix elements directly in TGSL, enforcing the proper access pattern through the 'columns' property.
- Adds error handling to prevent direct matrix indexing (e.g.,
matrix[4]) - Introduces
MatrixColumnsAccessclass to properly handle matrix column access - Updates code generation to support the correct matrix access pattern
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/typegpu/src/data/dataTypes.ts | Adds MatrixColumnsAccess class for proper matrix access handling |
| packages/typegpu/src/tgsl/wgslGenerator.ts | Implements error throwing for direct matrix access and proper code generation for matrix.columns access |
| packages/typegpu/tests/tgsl/wgslGenerator.test.ts | Adds comprehensive tests for matrix access error cases and correct usage patterns |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now, in indexAccess, the index is resolved first, thus the reordering in this file
iwoplaza
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome changes! Tiny nitpicks 👏
Co-authored-by: Iwo Plaza <[email protected]>
No description provided.