Removed glam feature toggle altogether

This commit is contained in:
Sylvester Hesp 2023-03-15 12:25:55 +01:00
parent 5a401f96b9
commit ae66c7cc1a
13 changed files with 10 additions and 35 deletions

View File

@ -12,7 +12,7 @@ spirv-std-types.workspace = true
spirv-std-macros.workspace = true
bitflags = "1.2.1"
num-traits = { version = "0.2.14", default-features = false, features = ["libm"] }
glam = { version = "0.22", default-features = false, features = ["libm"], optional = true }
glam = { version = "0.22", default-features = false, features = ["libm"] }
[features]
default = ["glam"]
default = []

View File

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

View File

@ -27,7 +27,6 @@ macro_rules! sample_type_impls {
}
}
#[cfg(feature = "glam")]
sample_type_impls! {
Unknown: i8 => (glam::IVec2, glam::IVec3, glam::IVec4),
Unknown: i16 => (glam::IVec2, glam::IVec3, glam::IVec4),

View File

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

View File

@ -7,32 +7,19 @@
/// should not be done.
pub unsafe trait Vector<T: crate::scalar::Scalar, const N: usize>: Default {}
#[cfg(feature = "glam")]
unsafe impl Vector<f32, 2> for glam::Vec2 {}
#[cfg(feature = "glam")]
unsafe impl Vector<f32, 3> for glam::Vec3 {}
#[cfg(feature = "glam")]
unsafe impl Vector<f32, 3> for glam::Vec3A {}
#[cfg(feature = "glam")]
unsafe impl Vector<f32, 4> for glam::Vec4 {}
#[cfg(feature = "glam")]
unsafe impl Vector<f64, 2> for glam::DVec2 {}
#[cfg(feature = "glam")]
unsafe impl Vector<f64, 3> for glam::DVec3 {}
#[cfg(feature = "glam")]
unsafe impl Vector<f64, 4> for glam::DVec4 {}
#[cfg(feature = "glam")]
unsafe impl Vector<u32, 2> for glam::UVec2 {}
#[cfg(feature = "glam")]
unsafe impl Vector<u32, 3> for glam::UVec3 {}
#[cfg(feature = "glam")]
unsafe impl Vector<u32, 4> for glam::UVec4 {}
#[cfg(feature = "glam")]
unsafe impl Vector<i32, 2> for glam::IVec2 {}
#[cfg(feature = "glam")]
unsafe impl Vector<i32, 3> for glam::IVec3 {}
#[cfg(feature = "glam")]
unsafe impl Vector<i32, 4> for glam::IVec4 {}

View File

@ -150,7 +150,7 @@ Configure your shader crate as a `"dylib"` type crate, and add `spirv-std` to it
```toml
[dependencies]
spirv-std = { version = "0.4", features = ["glam"] }
spirv-std = { version = "0.6" }
```
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:

View File

@ -11,7 +11,7 @@ repository.workspace = true
crate-type = ["dylib", "lib"]
[dependencies]
spirv-std = { workspace = true, features = ["glam"] }
spirv-std = { workspace = true }
[target.'cfg(not(target_arch = "spirv"))'.dependencies]
rayon = "1.5"

View File

@ -12,4 +12,4 @@ crate-type = ["dylib"]
[dependencies]
shared = { path = "../../shaders/shared" }
spirv-std = { workspace = true, features = ["glam"] }
spirv-std = { workspace = true }

View File

@ -11,4 +11,4 @@ repository.workspace = true
crate-type = ["dylib", "lib"]
[dependencies]
spirv-std = { workspace = true, features = ["glam"] }
spirv-std = { workspace = true }

View File

@ -8,5 +8,5 @@ license.workspace = true
repository.workspace = true
[dependencies]
spirv-std = { workspace = true, features = ["glam"] }
spirv-std = { workspace = true }
bytemuck = { version = "1.6.3", features = ["derive"] }

View File

@ -11,5 +11,5 @@ repository.workspace = true
crate-type = ["dylib"]
[dependencies]
spirv-std = { workspace = true, features = ["glam"] }
spirv-std = { workspace = true }
shared = { path = "../shared" }

View File

@ -12,4 +12,4 @@ crate-type = ["lib", "dylib"]
[dependencies]
shared = { path = "../../shaders/shared" }
spirv-std = { workspace = true, features = ["glam"] }
spirv-std = { workspace = true }

View File

@ -9,4 +9,4 @@ license.workspace = true
repository.workspace = true
[dependencies]
spirv-std = { workspace = true, features = ["glam"] }
spirv-std = { workspace = true }