-
Notifications
You must be signed in to change notification settings - Fork 160
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
Generate glam source #294
Generate glam source #294
Conversation
7a7b625
to
ab767b8
Compare
Replaces macro codegen with code generated offline by a code generator tool. The intention is to improve source code readability for users.
ab767b8
to
21b467f
Compare
Spotted some weird white space in one of the generated files: perhaps run through a pass of |
@alice-i-cecile for some reason GitHub didn't want to open that link. I do run rustfmt on the generated code, it doesn't remove empty lines though. White space can be controlled from the templates that are used to generate the source though, so it's just a case of fixing up the templates and regenerating. I'm doing a bunch more work separate to this PR though so I intend to try clean up spacing issues as part of that effort. |
README.md
Outdated
@@ -2,7 +2,7 @@ | |||
|
|||
[![Build Status]][github-ci] [![Coverage Status]][coveralls.io] | |||
[![Latest Version]][crates.io] [![docs]][docs.rs] | |||
[![Minimum Supported Rust Version]][Rust 1.52] | |||
[![Minimum Supported Rust Version]][Rust 1.57] |
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.
union
casts in const fn
s were stabilized in Rust 1.56, so as a follow up to this PR many function could become const fn
. cc #76
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.
Oh, interesting. Thanks for the heads up.
All scalar, sse2 and wasm32 code is inside the codegen templates now, the core module is removed.
Needed for const pointer dereferences in const eval.
pub fn mul_add(self, a: Self, b: Self) -> Self { | ||
#[cfg(target_feature = "fma")] | ||
unsafe { | ||
_mm_fmadd_ps(self, b, c) |
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.
Getting a compiler error in the 0.21
release here because c
isn't defined :)
Running into a bunch of: error[E0425]: cannot find value `c` in this scope --> .cargo/registry/src/github.com-1ecc6299db9ec823/glam-0.21.0/src/f32/sse2/vec3a.rs:626:35 | 626 | _mm_fmadd_ps(self, b, c) | ^ help: a local variable with a similar name exists: `a` And: error[E0308]: mismatched types --> .cargo/registry/src/github.com-1ecc6299db9ec823/glam-0.21.0/src/f32/sse2/vec3a.rs:626:26 | 626 | _mm_fmadd_ps(self, b, c) | ^^^^ expected struct `std::arch::x86_64::__m128`, found struct `f32::sse2::vec3a::Vec3A` On the new 0.21 release when building for a CPU with FMA, introduced by the new codegen in bitshifter#294. These are trivially fixable by updating the template.
This is definitely an improvement! Have you considered giving the template file a |
I could do. Mostly kept the |
Just saw this somewhat randomly, and wanted to add that there's a neat trick to get at least GitHub to highlight certain extensions differently, e.g. you could add a *.rs.tera linguist-language=Rust (Official documentation for this GitHub feature can be found in the |
Thanks for the tip @eddyb! |
Replace macro codegen with code generated offline by a tool.
Improves readability of source code for users.