Skip to content
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

Inconsistent/missing scalar implementation of le/ge functions for Vec3A compared to sse2 #518

Closed
EriKWDev opened this issue May 29, 2024 · 2 comments

Comments

@EriKWDev
Copy link

On x86, this compiles fine.

point.le(&Vec3A::splat(0.5))

On macbook M2, which uses the implementation in src/f32/scalar as opposed to the src/f32/sse2/ which my stationary uses, we get the following compilation error

   |
26 | ...   point.le(&Vec3A::splat(0.5)) && point.ge(&Vec3A::splat(-0...
   |                      ^^ Vec3A is not an iterator
   |
  ::: glam-rs-bbec0e101ff938b0/29413fa/src/f32/scalar/vec3a.rs:30:1
   |
30 | pub struct Vec3A {
   | ---------------- doesn't satisfy Vec3A: Iterator
   |
   = note: the following trait bounds were not satisfied:
           Vec3A: Iterator
           which is required by &mut Vec3A: Iterator

I don't know what implementing Iterator has to do with supporting the PartialOrd trait, but rustc is very determined that is the reason.

@EriKWDev EriKWDev changed the title Icnonsistent/missing scalar implementation of le/ge functions for Vec3A compared to sse2 Inconsistent/missing scalar implementation of le/ge functions for Vec3A compared to sse2 May 29, 2024
@bitshifter
Copy link
Owner

That's an interesting one. Is point in this code also a Vec3A?

@bitshifter
Copy link
Owner

I have fixed this, it will break your code though sorry.

The SIMD types use Deref to give direct access to .x, .y etc. The return type used by Deref was deriving PartialOrd, which is why your code was working in this instance. It wasn't intended, PartialOrd was removed from glam types a long time ago (see #138, #168). You should be able to achieve the same thing with point.cmple(&Vec3A::splat(0.5)).all() I think.

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

No branches or pull requests

2 participants