Skip to content

Commit ae66c7c

Browse files
committed
Removed glam feature toggle altogether
1 parent 5a401f9 commit ae66c7c

File tree

13 files changed

+10
-35
lines changed

13 files changed

+10
-35
lines changed

crates/spirv-std/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ spirv-std-types.workspace = true
1212
spirv-std-macros.workspace = true
1313
bitflags = "1.2.1"
1414
num-traits = { version = "0.2.14", default-features = false, features = ["libm"] }
15-
glam = { version = "0.22", default-features = false, features = ["libm"], optional = true }
15+
glam = { version = "0.22", default-features = false, features = ["libm"] }
1616

1717
[features]
18-
default = ["glam"]
18+
default = []

crates/spirv-std/src/float.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ pub fn f32_to_f16(float: f32) -> u32 {
8282

8383
/// Converts an f16 (half) into an f32 (float). The parameter is a u32, due to GPU support for u16
8484
/// not being universal - the upper 16 bits are ignored.
85-
#[cfg(feature = "glam")]
8685
#[spirv_std_macros::gpu_only]
8786
pub fn f16_to_f32(packed: u32) -> f32 {
8887
f16x2_to_vec2::<F32x2>(packed).x

crates/spirv-std/src/image/params.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ macro_rules! sample_type_impls {
2727
}
2828
}
2929

30-
#[cfg(feature = "glam")]
3130
sample_type_impls! {
3231
Unknown: i8 => (glam::IVec2, glam::IVec3, glam::IVec4),
3332
Unknown: i16 => (glam::IVec2, glam::IVec3, glam::IVec4),

crates/spirv-std/src/lib.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -113,18 +113,8 @@ pub use byte_addressable_buffer::ByteAddressableBuffer;
113113
pub use num_traits;
114114
pub use runtime_array::*;
115115

116-
#[cfg(feature = "glam")]
117116
pub use glam;
118117

119-
// HACK(shesp) As we removed support for generic user-configurable vector types in the Image API,
120-
// glam is now required. In the future we might want to add other popular vector math libraries,
121-
// so we keep the "glam" feature toggle intact for now. As the code won't currently compile
122-
// without it, present the user with a somewhat friendly error message.
123-
#[cfg(not(feature = "glam"))]
124-
compile_error!(
125-
r#"`spriv-std` now requires the use of `glam`. Make sure the "glam" feature is specified for `spirv-std` in `Cargo.toml`"#
126-
);
127-
128118
#[cfg(all(not(test), target_arch = "spirv"))]
129119
#[panic_handler]
130120
fn panic(_: &core::panic::PanicInfo<'_>) -> ! {

crates/spirv-std/src/vector.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,19 @@
77
/// should not be done.
88
pub unsafe trait Vector<T: crate::scalar::Scalar, const N: usize>: Default {}
99

10-
#[cfg(feature = "glam")]
1110
unsafe impl Vector<f32, 2> for glam::Vec2 {}
12-
#[cfg(feature = "glam")]
1311
unsafe impl Vector<f32, 3> for glam::Vec3 {}
14-
#[cfg(feature = "glam")]
1512
unsafe impl Vector<f32, 3> for glam::Vec3A {}
16-
#[cfg(feature = "glam")]
1713
unsafe impl Vector<f32, 4> for glam::Vec4 {}
1814

19-
#[cfg(feature = "glam")]
2015
unsafe impl Vector<f64, 2> for glam::DVec2 {}
21-
#[cfg(feature = "glam")]
2216
unsafe impl Vector<f64, 3> for glam::DVec3 {}
23-
#[cfg(feature = "glam")]
2417
unsafe impl Vector<f64, 4> for glam::DVec4 {}
2518

26-
#[cfg(feature = "glam")]
2719
unsafe impl Vector<u32, 2> for glam::UVec2 {}
28-
#[cfg(feature = "glam")]
2920
unsafe impl Vector<u32, 3> for glam::UVec3 {}
30-
#[cfg(feature = "glam")]
3121
unsafe impl Vector<u32, 4> for glam::UVec4 {}
3222

33-
#[cfg(feature = "glam")]
3423
unsafe impl Vector<i32, 2> for glam::IVec2 {}
35-
#[cfg(feature = "glam")]
3624
unsafe impl Vector<i32, 3> for glam::IVec3 {}
37-
#[cfg(feature = "glam")]
3825
unsafe impl Vector<i32, 4> for glam::IVec4 {}

docs/src/writing-shader-crates.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ Configure your shader crate as a `"dylib"` type crate, and add `spirv-std` to it
150150

151151
```toml
152152
[dependencies]
153-
spirv-std = { version = "0.4", features = ["glam"] }
153+
spirv-std = { version = "0.6" }
154154
```
155155

156156
Make sure your shader code uses the `no_std` attribute and makes the `spirv` attribute visibile in the global scope. Then, you're ready to write your first shader. Here's a very simple fragment shader called `main_fs` as an example that outputs the color red:

examples/shaders/compute-shader/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ repository.workspace = true
1111
crate-type = ["dylib", "lib"]
1212

1313
[dependencies]
14-
spirv-std = { workspace = true, features = ["glam"] }
14+
spirv-std = { workspace = true }
1515

1616
[target.'cfg(not(target_arch = "spirv"))'.dependencies]
1717
rayon = "1.5"

examples/shaders/mouse-shader/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ crate-type = ["dylib"]
1212

1313
[dependencies]
1414
shared = { path = "../../shaders/shared" }
15-
spirv-std = { workspace = true, features = ["glam"] }
15+
spirv-std = { workspace = true }

examples/shaders/reduce/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ repository.workspace = true
1111
crate-type = ["dylib", "lib"]
1212

1313
[dependencies]
14-
spirv-std = { workspace = true, features = ["glam"] }
14+
spirv-std = { workspace = true }

examples/shaders/shared/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ license.workspace = true
88
repository.workspace = true
99

1010
[dependencies]
11-
spirv-std = { workspace = true, features = ["glam"] }
11+
spirv-std = { workspace = true }
1212
bytemuck = { version = "1.6.3", features = ["derive"] }

examples/shaders/simplest-shader/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ repository.workspace = true
1111
crate-type = ["dylib"]
1212

1313
[dependencies]
14-
spirv-std = { workspace = true, features = ["glam"] }
14+
spirv-std = { workspace = true }
1515
shared = { path = "../shared" }

examples/shaders/sky-shader/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ crate-type = ["lib", "dylib"]
1212

1313
[dependencies]
1414
shared = { path = "../../shaders/shared" }
15-
spirv-std = { workspace = true, features = ["glam"] }
15+
spirv-std = { workspace = true }

tests/deps-helper/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ license.workspace = true
99
repository.workspace = true
1010

1111
[dependencies]
12-
spirv-std = { workspace = true, features = ["glam"] }
12+
spirv-std = { workspace = true }

0 commit comments

Comments
 (0)