Skip to content

Newsletter 11: Breaking changes in glam 0.9 update #196

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

Merged
merged 4 commits into from
Jul 6, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions content/posts/newsletter-011/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,33 @@ channel in the [PSP Homebrew discord server](https://discord.gg/WY8XhDG).

[rust-psp]: https://github.com/overdrivenpotato/rust-psp

### [glam]

[glam] is a simple and fast linear algebra crate for games and graphics.

This month [glam 0.9] was published to crates.io. This update is a breaking
change from 0.8.

In 0.9 the `Vec3` type was changed from being a 128 byte SIMD vector type to a
tuple of three floats. This changes the size of `Vec3` from 16 bytes to 12 bytes
and the alignment from 16 bytes to 4 bytes. This might not effect all users but
if `Vec3` was used in a context where the size or alignment mattered, such as in
FFI or as input to shaders, this could cause breakage.

The SIMD parts of `Vec3` were moved to a new type, `Vec3A` (`A` for Aligned)
which is 16 byte aligned and thus 16 bytes in size. The `Vec3A` type is still
there for users who want the performance benefits of the SIMD implementation.

The motivation for this change was that it is potentially surprising and
confusing for new users that the `Vec3` type was not 12 bytes. Also it's common
that users needed a `Vec3` that was just 12 bytes.

While glam is reasonably stable it has not yet reached a 1.0 release so it
seemed like now is the time to address such issues in the API.

[glam]: https://github.com/bitshifter/glam-rs
[glam 0.9]: https://github.com/bitshifter/glam-rs/blob/master/CHANGELOG.md#090---2020-06-28

### [This Month in Mun][mun-june]

![Language Server Diagnostics in action](mun-languageserver.gif)
Expand Down