-
-
Notifications
You must be signed in to change notification settings - Fork 27
impr: Error messages for invalid array and tgpu.const usage
#1856
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
impr: Error messages for invalid array and tgpu.const usage
#1856
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 enhances error messages in the WGSL generator to provide clearer guidance when developers encounter common mistakes. The changes improve developer experience by replacing generic error messages with actionable instructions.
Key Changes:
- Enhanced error message for indexing external arrays with runtime indices to suggest three alternative approaches
- Added validation to detect and prevent
tgpu.constdeclarations within GPU function scope with clear remediation steps
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/typegpu/src/tgsl/wgslGenerator.ts | Updated error messages for array indexing and added validation for const declarations |
| packages/typegpu/tests/tgsl/wgslGenerator.test.ts | Added test cases verifying the new descriptive error messages |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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! 👏
|
Could you change the name of the PR slightly to describe in more detail what errors were improved? This will make it easier to generate change notes |
tgpu.const usage
Changes: