mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-08-28 00:44:10 +00:00
gcore-shaders: fix missing num-traits/libm
features
This commit is contained in:
parent
c5991c6f61
commit
db5f2044d9
8 changed files with 14 additions and 10 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -2023,6 +2023,7 @@ dependencies = [
|
||||||
"kurbo",
|
"kurbo",
|
||||||
"ndarray",
|
"ndarray",
|
||||||
"node-macro",
|
"node-macro",
|
||||||
|
"num-traits",
|
||||||
"rand 0.9.1",
|
"rand 0.9.1",
|
||||||
"rand_chacha 0.9.0",
|
"rand_chacha 0.9.0",
|
||||||
"serde",
|
"serde",
|
||||||
|
|
|
@ -142,7 +142,7 @@ pretty_assertions = "1.4.1"
|
||||||
fern = { version = "0.7", features = ["colored"] }
|
fern = { version = "0.7", features = ["colored"] }
|
||||||
num_enum = "0.7"
|
num_enum = "0.7"
|
||||||
num-derive = "0.4"
|
num-derive = "0.4"
|
||||||
num-traits = { version = "0.2", default-features = false, features = ["i128"] }
|
num-traits = { version = "0.2", default-features = false, features = ["libm"] }
|
||||||
specta = { version = "2.0.0-rc.22", features = [
|
specta = { version = "2.0.0-rc.22", features = [
|
||||||
"glam",
|
"glam",
|
||||||
"derive",
|
"derive",
|
||||||
|
|
|
@ -7,7 +7,7 @@ authors = ["Graphite Authors <contact@graphite.rs>"]
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
std = ["dep:dyn-any", "dep:serde", "dep:specta", "dep:log", "half/std", "half/serde"]
|
std = ["dep:dyn-any", "dep:serde", "dep:specta", "dep:log", "half/std", "half/serde", "num-traits/std"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# Local std dependencies
|
# Local std dependencies
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use core::fmt::Display;
|
use core::fmt::Display;
|
||||||
use core::hash::{Hash, Hasher};
|
use core::hash::{Hash, Hasher};
|
||||||
#[cfg(target_arch = "spirv")]
|
#[cfg(not(feature = "std"))]
|
||||||
use num_traits::float::Float;
|
use num_traits::float::Float;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
|
|
|
@ -3,7 +3,7 @@ use bytemuck::{Pod, Zeroable};
|
||||||
use core::fmt::Debug;
|
use core::fmt::Debug;
|
||||||
use glam::DVec2;
|
use glam::DVec2;
|
||||||
use num_derive::*;
|
use num_derive::*;
|
||||||
#[cfg(target_arch = "spirv")]
|
#[cfg(not(feature = "std"))]
|
||||||
use num_traits::float::Float;
|
use num_traits::float::Float;
|
||||||
|
|
||||||
pub trait Linear {
|
pub trait Linear {
|
||||||
|
|
|
@ -4,9 +4,9 @@ use bytemuck::{Pod, Zeroable};
|
||||||
use core::fmt::Debug;
|
use core::fmt::Debug;
|
||||||
use core::hash::Hash;
|
use core::hash::Hash;
|
||||||
use half::f16;
|
use half::f16;
|
||||||
#[cfg(target_arch = "spirv")]
|
#[cfg(not(feature = "std"))]
|
||||||
use num_traits::Euclid;
|
use num_traits::Euclid;
|
||||||
#[cfg(target_arch = "spirv")]
|
#[cfg(not(feature = "std"))]
|
||||||
use num_traits::float::Float;
|
use num_traits::float::Float;
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
@ -439,9 +439,9 @@ impl Color {
|
||||||
lightness + saturation - lightness * saturation
|
lightness + saturation - lightness * saturation
|
||||||
};
|
};
|
||||||
let temp2 = 2. * lightness - temp1;
|
let temp2 = 2. * lightness - temp1;
|
||||||
#[cfg(not(target_arch = "spirv"))]
|
#[cfg(feature = "std")]
|
||||||
let rem = |x: f32| x.rem_euclid(1.);
|
let rem = |x: f32| x.rem_euclid(1.);
|
||||||
#[cfg(target_arch = "spirv")]
|
#[cfg(not(feature = "std"))]
|
||||||
let rem = |x: f32| x.rem_euclid(&1.);
|
let rem = |x: f32| x.rem_euclid(&1.);
|
||||||
|
|
||||||
let mut red = rem(hue + 1. / 3.);
|
let mut red = rem(hue + 1. / 3.);
|
||||||
|
@ -892,9 +892,9 @@ impl Color {
|
||||||
} else {
|
} else {
|
||||||
4. + (self.red - self.green) / (max_channel - min_channel)
|
4. + (self.red - self.green) / (max_channel - min_channel)
|
||||||
} / 6.;
|
} / 6.;
|
||||||
#[cfg(not(target_arch = "spirv"))]
|
#[cfg(feature = "std")]
|
||||||
let hue = hue.rem_euclid(1.);
|
let hue = hue.rem_euclid(1.);
|
||||||
#[cfg(target_arch = "spirv")]
|
#[cfg(not(feature = "std"))]
|
||||||
let hue = hue.rem_euclid(&1.);
|
let hue = hue.rem_euclid(&1.);
|
||||||
|
|
||||||
[hue, saturation, lightness, self.alpha]
|
[hue, saturation, lightness, self.alpha]
|
||||||
|
|
|
@ -34,6 +34,7 @@ graphene-core = { workspace = true, optional = true }
|
||||||
bytemuck = { workspace = true }
|
bytemuck = { workspace = true }
|
||||||
# glam is reexported from gcore-shaders in no_std mode
|
# glam is reexported from gcore-shaders in no_std mode
|
||||||
glam = { workspace = true, optional = true }
|
glam = { workspace = true, optional = true }
|
||||||
|
num-traits = { workspace = true }
|
||||||
|
|
||||||
# Workspace std dependencies
|
# Workspace std dependencies
|
||||||
specta = { workspace = true, optional = true }
|
specta = { workspace = true, optional = true }
|
||||||
|
|
|
@ -11,6 +11,8 @@ use graphene_core::table::Table;
|
||||||
use graphene_core_shaders::color::Color;
|
use graphene_core_shaders::color::Color;
|
||||||
use graphene_core_shaders::context::Ctx;
|
use graphene_core_shaders::context::Ctx;
|
||||||
use graphene_core_shaders::registry::types::{Angle, Percentage, SignedPercentage};
|
use graphene_core_shaders::registry::types::{Angle, Percentage, SignedPercentage};
|
||||||
|
#[cfg(not(feature = "std"))]
|
||||||
|
use num_traits::float::Float;
|
||||||
|
|
||||||
// TODO: Implement the following:
|
// TODO: Implement the following:
|
||||||
// Color Balance
|
// Color Balance
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue