use super::*;
use crate::shared::*;
use simdeez::overloads::*;
use simdeez::sse2::*;
#[cfg(target_arch = "x86")]
use std::arch::x86::*;
#[cfg(target_arch = "x86_64")]
use std::arch::x86_64::*;
use std::f32;
#[target_feature(enable = "sse2")]
pub unsafe fn cellular_2d(
x: __m128,
y: __m128,
distance_function: CellDistanceFunction,
return_type: CellReturnType,
jitter: __m128,
) -> __m128 {
cellular::cellular_2d::<Sse2>(
F32x4(x),
F32x4(y),
distance_function,
return_type,
F32x4(jitter),
)
.0
}
#[target_feature(enable = "sse2")]
pub unsafe fn cellular_3d(
x: __m128,
y: __m128,
z: __m128,
distance_function: CellDistanceFunction,
return_type: CellReturnType,
jitter: __m128,
) -> __m128 {
cellular::cellular_3d::<Sse2>(
F32x4(x),
F32x4(y),
F32x4(z),
distance_function,
return_type,
F32x4(jitter),
)
.0
}
#[target_feature(enable = "sse2")]
pub unsafe fn simplex_1d(x: __m128) -> __m128 {
simplex::simplex_1d::<Sse2>(F32x4(x)).0
}
#[target_feature(enable = "sse2")]
pub unsafe fn fbm_1d(
x: __m128,
lacunarity: __m128,
gain: __m128,
octaves: u8,
) -> __m128 {
simplex::fbm_1d::<Sse2>(
F32x4(x),
F32x4(lacunarity),
F32x4(gain),
octaves,
)
.0
}
#[target_feature(enable = "sse2")]
pub unsafe fn ridge_1d(
x: __m128,
lacunarity: __m128,
gain: __m128,
octaves: u8,
) -> __m128 {
simplex::ridge_1d::<Sse2>(
F32x4(x),
F32x4(lacunarity),
F32x4(gain),
octaves,
)
.0
}
#[target_feature(enable = "sse2")]
pub unsafe fn turbulence_1d(
x: __m128,
lacunarity: __m128,
gain: __m128,
octaves: u8,
) -> __m128 {
simplex::turbulence_1d::<Sse2>(
F32x4(x),
F32x4(lacunarity),
F32x4(gain),
octaves,
)
.0
}
#[target_feature(enable = "sse2")]
pub unsafe fn get_1d_noise(noise_type: &NoiseType) -> (Vec<f32>, f32, f32) {
noise_helpers::get_1d_noise::<Sse2>(noise_type)
}
#[target_feature(enable = "sse2")]
pub unsafe fn get_1d_scaled_noise(noise_type: &NoiseType) -> Vec<f32> {
let (mut noise, min, max) = get_1d_noise(noise_type);
let dim = noise_type.get_dimensions();
scale_noise::<Sse2>(dim.min, dim.max, min, max, &mut noise);
noise
}
#[target_feature(enable = "sse2")]
pub unsafe fn simplex_2d(x: __m128, y: __m128) -> __m128 {
simplex::simplex_2d::<Sse2>(F32x4(x), F32x4(y)).0
}
#[target_feature(enable = "sse2")]
pub unsafe fn fbm_2d(
x: __m128,
y: __m128,
lac: __m128,
gain: __m128,
octaves: u8,
) -> __m128 {
simplex::fbm_2d::<Sse2>(
F32x4(x),
F32x4(y),
F32x4(lac),
F32x4(gain),
octaves,
)
.0
}
#[target_feature(enable = "sse2")]
pub unsafe fn ridge_2d(
x: __m128,
y: __m128,
lac: __m128,
gain: __m128,
octaves: u8,
) -> __m128 {
simplex::ridge_2d::<Sse2>(
F32x4(x),
F32x4(y),
F32x4(lac),
F32x4(gain),
octaves,
)
.0
}
#[target_feature(enable = "sse2")]
pub unsafe fn turbulence_2d(
x: __m128,
y: __m128,
lac: __m128,
gain: __m128,
octaves: u8,
) -> __m128 {
simplex::turbulence_2d::<Sse2>(
F32x4(x),
F32x4(y),
F32x4(lac),
F32x4(gain),
octaves,
)
.0
}
#[target_feature(enable = "sse2")]
pub unsafe fn get_2d_noise(noise_type: &NoiseType) -> (Vec<f32>, f32, f32) {
noise_helpers::get_2d_noise::<Sse2>(noise_type)
}
#[target_feature(enable = "sse2")]
pub unsafe fn get_2d_scaled_noise(noise_type: &NoiseType) -> Vec<f32> {
let (mut noise, min, max) = get_2d_noise(noise_type);
let dim = noise_type.get_dimensions();
scale_noise::<Sse2>(dim.min, dim.max, min, max, &mut noise);
noise
}
#[target_feature(enable = "sse2")]
pub unsafe fn simplex_3d(x: __m128, y: __m128, z: __m128) -> __m128 {
simplex::simplex_3d::<Sse2>(F32x4(x), F32x4(y), F32x4(z)).0
}
#[target_feature(enable = "sse2")]
pub unsafe fn fbm_3d(
x: __m128,
y: __m128,
z: __m128,
lac: __m128,
gain: __m128,
octaves: u8,
) -> __m128 {
simplex::fbm_3d::<Sse2>(
F32x4(x),
F32x4(y),
F32x4(z),
F32x4(lac),
F32x4(gain),
octaves,
)
.0
}
#[target_feature(enable = "sse2")]
pub unsafe fn ridge_3d(
x: __m128,
y: __m128,
z: __m128,
lac: __m128,
gain: __m128,
octaves: u8,
) -> __m128 {
simplex::ridge_3d::<Sse2>(
F32x4(x),
F32x4(y),
F32x4(z),
F32x4(lac),
F32x4(gain),
octaves,
)
.0
}
#[target_feature(enable = "sse2")]
pub unsafe fn turbulence_3d(
x: __m128,
y: __m128,
z: __m128,
lac: __m128,
gain: __m128,
octaves: u8,
) -> __m128 {
simplex::turbulence_3d::<Sse2>(
F32x4(x),
F32x4(y),
F32x4(z),
F32x4(lac),
F32x4(gain),
octaves,
)
.0
}
#[target_feature(enable = "sse2")]
pub unsafe fn get_3d_noise(noise_type: &NoiseType) -> (Vec<f32>, f32, f32) {
noise_helpers::get_3d_noise::<Sse2>(noise_type)
}
#[target_feature(enable = "sse2")]
pub unsafe fn get_3d_scaled_noise(noise_type: &NoiseType) -> Vec<f32> {
let (mut noise, min, max) = get_3d_noise(noise_type);
let dim = noise_type.get_dimensions();
scale_noise::<Sse2>(dim.min, dim.max, min, max, &mut noise);
noise
}
#[target_feature(enable = "sse2")]
pub unsafe fn simplex_4d(x: __m128, y: __m128, z: __m128, w: __m128) -> __m128 {
simplex::simplex_4d::<Sse2>(F32x4(x), F32x4(y), F32x4(z), F32x4(w)).0
}
#[target_feature(enable = "sse2")]
pub unsafe fn fbm_4d(
x: __m128,
y: __m128,
z: __m128,
w: __m128,
lac: __m128,
gain: __m128,
octaves: u8,
) -> __m128 {
simplex::fbm_4d::<Sse2>(
F32x4(x),
F32x4(y),
F32x4(z),
F32x4(w),
F32x4(lac),
F32x4(gain),
octaves,
)
.0
}
#[target_feature(enable = "sse2")]
pub unsafe fn ridge_4d(
x: __m128,
y: __m128,
z: __m128,
w: __m128,
lac: __m128,
gain: __m128,
octaves: u8,
) -> __m128 {
simplex::ridge_4d::<Sse2>(
F32x4(x),
F32x4(y),
F32x4(z),
F32x4(w),
F32x4(lac),
F32x4(gain),
octaves,
)
.0
}
#[target_feature(enable = "sse2")]
pub unsafe fn turbulence_4d(
x: __m128,
y: __m128,
z: __m128,
w: __m128,
lac: __m128,
gain: __m128,
octaves: u8,
) -> __m128 {
simplex::turbulence_4d::<Sse2>(
F32x4(x),
F32x4(y),
F32x4(z),
F32x4(w),
F32x4(lac),
F32x4(gain),
octaves,
)
.0
}
#[target_feature(enable = "sse2")]
pub unsafe fn get_4d_noise(noise_type: &NoiseType) -> (Vec<f32>, f32, f32) {
noise_helpers::get_4d_noise::<Sse2>(noise_type)
}
#[target_feature(enable = "sse2")]
pub unsafe fn get_4d_scaled_noise(noise_type: &NoiseType) -> Vec<f32> {
let (mut noise, min, max) = get_4d_noise(noise_type);
let dim = noise_type.get_dimensions();
scale_noise::<Sse2>(dim.min, dim.max, min, max, &mut noise);
noise
}