vello_cpu/fine/common/gradient/
linear.rs

1// Copyright 2025 the Vello Authors
2// SPDX-License-Identifier: Apache-2.0 OR MIT
3
4use crate::fine::common::gradient::SimdGradientKind;
5use core::marker::PhantomData;
6use vello_common::encode::LinearKind;
7use vello_common::fearless_simd::{Simd, f32x8};
8
9#[derive(Debug)]
10pub(crate) struct SimdLinearKind<S: Simd> {
11    // For consistency with the other gradient types.
12    phantom_data: PhantomData<S>,
13}
14
15impl<S: Simd> SimdLinearKind<S> {
16    pub(crate) fn new(_: S, _: LinearKind) -> Self {
17        Self {
18            phantom_data: PhantomData,
19        }
20    }
21}
22
23impl<S: Simd> SimdGradientKind<S> for SimdLinearKind<S> {
24    #[inline(always)]
25    fn cur_pos(&self, x_pos: f32x8<S>, _: f32x8<S>) -> f32x8<S> {
26        x_pos
27    }
28}