Skip to content

Conversation

@aleksanderkatan
Copy link
Contributor

@aleksanderkatan aleksanderkatan commented Oct 24, 2025

Changes:

  • better error when indexing an external array with a runtime index,
  • better error when using a const inside TGSL.

@github-actions
Copy link

github-actions bot commented Oct 24, 2025

pkg.pr.new

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

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

benchmark
view benchmark

commit
view commit

@aleksanderkatan aleksanderkatan changed the title fix: Better error when indexing an external array with a runtime index fix: Better errors Oct 24, 2025
Copy link

Copilot AI left a 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.const declarations 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.

@aleksanderkatan aleksanderkatan marked this pull request as ready for review October 24, 2025 14:03
Copy link
Collaborator

@iwoplaza iwoplaza left a comment

Choose a reason for hiding this comment

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

Awesome changes! 👏

@iwoplaza iwoplaza added this to the 0.8.1 milestone Nov 3, 2025
@iwoplaza
Copy link
Collaborator

iwoplaza commented Nov 3, 2025

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

@aleksanderkatan aleksanderkatan changed the title fix: Better errors impr: Error messages for invalid array and tgpu.const usage Nov 3, 2025
@aleksanderkatan aleksanderkatan merged commit 731d6f5 into main Nov 3, 2025
3 checks passed
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.

fix: Better error when indexing an external array with a runtime index

4 participants