Skip to content

disallow Vec3A for spirv intrinsics and asm - #660

Merged
Firestar99 merged 1 commit into
mainfrom
disallow_vec3a_intrinsics
Oct 6, 2026
Merged

Firestar99 merged 1 commit into
mainfrom
disallow_vec3a_intrinsics

Conversation

@Firestar99

@Firestar99 Firestar99 commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

From bitshifter/glam-rs#898

Context:

Main change: don't special case Vec3A as a rust-gpu SPIR-V vector

This PR:

  • this makes Vec3A incompatible with certain SPIR-V intrinsics
    • rust-gpu removes it's unsafe impl Vector for Vec3A to disallow it's use
    • Migration: use Vec3 instead and convert back and forward with Vec3::to_vec3a() and Vec3A::to_vec3()

This change affects ALL glam versions, not just v0.34.

@Firestar99
Firestar99 added this pull request to stack #662 October 5, 2026 14:24
@Firestar99 Firestar99 mentioned this pull request Oct 5, 2026
4 tasks done
@Firestar99
Firestar99 force-pushed the disallow_vec3a_intrinsics branch from ab1e567 to 3de7c32 Compare October 5, 2026 14:27
@Firestar99
Firestar99 marked this pull request as ready for review October 5, 2026 16:11
@Firestar99
Firestar99 requested a review from LegNeato as a code owner October 5, 2026 16:11
@Firestar99 Firestar99 changed the title disallow Vec3A for spirv intrisics and asm disallow Vec3A for spirv intrinsics and asm Oct 5, 2026
@Firestar99
Firestar99 added this pull request to the merge queue Oct 5, 2026
@Firestar99
Firestar99 removed this pull request from the merge queue due to a manual request Oct 5, 2026
@Firestar99
Firestar99 force-pushed the disallow_vec3a_intrinsics branch from 3de7c32 to 679457f Compare October 5, 2026 16:17
bitshifter pushed a commit to bitshifter/glam-rs that referenced this pull request Oct 6, 2026
Related rust-gpu PRs: Rust-GPU/rust-gpu#660
Rust-GPU/rust-gpu#661

# Objective

**Main change: don't special case `Vec3A` as a rust-gpu SPIR-V vector**
* changes it's SPIR-V representation from `OpTypeVector %f32 3` to
`OpTypeStruct %f32 %f32 %f32 %f32`
* this makes `Vec3A` incompatible with certain SPIR-V intrinsics 
* rust-gpu removes it's `unsafe impl Vector for Vec3A` to disallow it's
use
* Migration: use `Vec3` instead and convert back and forward with
`Vec3::to_vec3a()` and `Vec3A::to_vec3()`
* as it's no longer special cased, glam can add back the `_w: f32`
member and derive `Pod` and such
* so we can revert the hack from
#861
  
Best reviewed commit by commit, as the first commit is just a revert
(that needed a little manual conflict resolution) and the second commit
is the actual 3 line change.

**I would like this change to be released as a minor patch like
v0.34.1**. Upgrading from 0.34.0 to 0.34.1 is *technically* a breaking
change for any rust-gpu user, but rust-gpu doesn't support glam 0.34.0
yet. So when I do add support for 0.34, I can just require at least
version 0.34.1 to mitigate it.

To prevent future breakages: Changing the members of a struct annotated
with `#[rust_gpu::vector::v1]` is considered a breaking change for
rust-gpu, even if they're just private. When I added those annotations,
I assumed that'll basically never happen, but
#786 changed `Vec3A` to have a
private `_w: f32` member.

## Checklist

- [ ] `cargo run -p ci` passes.
- [ ] PR title follows [Conventional
Commits](CONTRIBUTING.md#pull-request-titles); mark breaking changes
with `!`.
@Firestar99
Firestar99 added this pull request to the merge queue Oct 6, 2026
Merged via the queue into main with commit 87ac579 Oct 6, 2026
24 checks passed
@Firestar99
Firestar99 deleted the disallow_vec3a_intrinsics branch October 6, 2026 10:48
@github-actions github-actions Bot mentioned this pull request Oct 6, 2026
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.

2 participants