Commit 18cd93f
authored
Fix bevy_math when no alloc is available (#21969)
# Objective
`bevy_math` does not work when no `alloc` is available despite the
existance of the `alloc` feature which should gate all logic that
requires it. Support for no std + no alloc can be useful for some
embedded usecases, for example using `bevy_math` types on the GPU using
Rust GPU.
## Solution
Swap `smallvec` out with `arrayvec`, and fix two minor uses of
`alloc::slice::sort_by` (not available on `core` because they allocate
`Vec`s internally)
## Testing
- Unit tests still pass
- I was able to compile a shader with Rust GPU while depending on
bevy_math1 parent b2f5212 commit 18cd93f
File tree
4 files changed
+20
-16
lines changed- crates/bevy_math
- src
- bounding/bounded2d
- primitives
4 files changed
+20
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1727 | 1727 | | |
1728 | 1728 | | |
1729 | 1729 | | |
1730 | | - | |
| 1730 | + | |
1731 | 1731 | | |
1732 | 1732 | | |
1733 | 1733 | | |
1734 | 1734 | | |
1735 | | - | |
1736 | | - | |
| 1735 | + | |
| 1736 | + | |
| 1737 | + | |
1737 | 1738 | | |
1738 | 1739 | | |
1739 | 1740 | | |
| |||
1745 | 1746 | | |
1746 | 1747 | | |
1747 | 1748 | | |
1748 | | - | |
| 1749 | + | |
1749 | 1750 | | |
1750 | 1751 | | |
1751 | 1752 | | |
1752 | 1753 | | |
1753 | | - | |
1754 | | - | |
| 1754 | + | |
| 1755 | + | |
| 1756 | + | |
1755 | 1757 | | |
1756 | 1758 | | |
1757 | 1759 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1235 | 1235 | | |
1236 | 1236 | | |
1237 | 1237 | | |
1238 | | - | |
| 1238 | + | |
1239 | 1239 | | |
1240 | 1240 | | |
1241 | 1241 | | |
1242 | 1242 | | |
1243 | | - | |
1244 | | - | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
1245 | 1246 | | |
1246 | 1247 | | |
1247 | 1248 | | |
| |||
1253 | 1254 | | |
1254 | 1255 | | |
1255 | 1256 | | |
1256 | | - | |
| 1257 | + | |
1257 | 1258 | | |
1258 | 1259 | | |
1259 | 1260 | | |
1260 | 1261 | | |
1261 | | - | |
1262 | | - | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
1263 | 1265 | | |
1264 | 1266 | | |
1265 | 1267 | | |
| |||
0 commit comments