Open alice-i-cecile opened 3 weeks ago
Also adding in my comment as well:
Also, this file is the one that has
ne_bytes
instead ofle_bytes
like I was mentioning: https://github.com/bevyengine/bevy/blob/main/crates/bevy_render/src/texture/image_texture_conversion.rsCan probably be a later change, but it should be fixed to always cast to little endian instead of the native endian.
Should be pretty easy to just add a config-gated block on each of these that swaps the bytes if you're on a big-endian target.
It looks like ne_bytes()
methods are used in 4 different files, using this search:
That one in bevy_math
is fine since it's computing a hash, but it does look like the other ones also need to be changed.
Quoting @clarfonthey on #15750:
So, this is a strict improvement, but it doesn't fix the issue completely.
There are plenty of places where
bytemuck
is used to cast slices directly without going through these methods and those need to be fixed too.So, I'm fine approving, since this is an improvement, but under the condition the original issue stays open. (Right now it would get auto closed by this PR.)
This issue is still open because there is some bytemuck
usage that still uses native endian-ness.
I got the following response from a wgpu maintainer on Discord:
The way I interpret that is that I was originally right and it is indeed our responsibility to provide data to wgpu as little endian, not native endian. So
le_bytes
it is, then.In this case, it might be nice to make a follow-up PR to fix any remaining uses of
ne_bytes
in Bevy.Originally posted by @inodentry in https://github.com/bevyengine/bevy/issues/10392#issuecomment-2396819418