Skip to content

Conversation

@aleksanderkatan
Copy link
Contributor

No description provided.

@aleksanderkatan aleksanderkatan linked an issue Aug 20, 2025 that may be closed by this pull request
@github-actions
Copy link

github-actions bot commented Aug 20, 2025

pkg.pr.new

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

https://pkg.pr.new/software-mansion/TypeGPU/typegpu@981da9e8a8f9d3805e0721d8beadec6429362ce1
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/noise@981da9e8a8f9d3805e0721d8beadec6429362ce1
https://pkg.pr.new/software-mansion/TypeGPU/unplugin-typegpu@981da9e8a8f9d3805e0721d8beadec6429362ce1

benchmark
view benchmark

commit
view commit

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 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 MatrixColumnsAccess class 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.

@aleksanderkatan aleksanderkatan marked this pull request as ready for review August 20, 2025 10:26
@cieplypolar
Copy link
Collaborator

LGTM

Copy link
Contributor Author

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

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! Tiny nitpicks 👏

@aleksanderkatan aleksanderkatan merged commit 86ba56d into main Aug 27, 2025
6 checks passed
@aleksanderkatan aleksanderkatan deleted the fix/matrix-array-access-error branch September 25, 2025 11:22
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: Matrix array access

4 participants