diff --git a/Userland/Libraries/LibSoftGPU/SIMD.h b/Userland/Libraries/LibSoftGPU/SIMD.h index 66ade79d50..4e16c92c25 100644 --- a/Userland/Libraries/LibSoftGPU/SIMD.h +++ b/Userland/Libraries/LibSoftGPU/SIMD.h @@ -67,4 +67,40 @@ ALWAYS_INLINE static constexpr Vector4 expand4(Vector4 con }; } +ALWAYS_INLINE static AK::SIMD::f32x4 ddx(AK::SIMD::f32x4 v) +{ + return AK::SIMD::f32x4 { + v[1] - v[0], + v[1] - v[0], + v[3] - v[2], + v[3] - v[2], + }; +} + +ALWAYS_INLINE static AK::SIMD::f32x4 ddy(AK::SIMD::f32x4 v) +{ + return AK::SIMD::f32x4 { + v[2] - v[0], + v[3] - v[1], + v[2] - v[0], + v[3] - v[1], + }; +} + +ALWAYS_INLINE static Vector2 ddx(Vector2 const& v) +{ + return { + ddx(v.x()), + ddx(v.y()), + }; +} + +ALWAYS_INLINE static Vector2 ddy(Vector2 const& v) +{ + return { + ddy(v.x()), + ddy(v.y()), + }; +} + }