1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
/*
* Copyright (c) 2021, Stephan Unverwerth <s.unverwerth@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/SIMDExtras.h>
#include <LibGfx/Vector2.h>
#include <LibGfx/Vector3.h>
#include <LibGfx/Vector4.h>
namespace SoftGPU {
ALWAYS_INLINE static constexpr Vector2<AK::SIMD::f32x4> expand4(Vector2<float> const& v)
{
return Vector2<AK::SIMD::f32x4> {
AK::SIMD::expand4(v.x()),
AK::SIMD::expand4(v.y()),
};
}
ALWAYS_INLINE static constexpr Vector3<AK::SIMD::f32x4> expand4(Vector3<float> const& v)
{
return Vector3<AK::SIMD::f32x4> {
AK::SIMD::expand4(v.x()),
AK::SIMD::expand4(v.y()),
AK::SIMD::expand4(v.z()),
};
}
ALWAYS_INLINE static constexpr Vector4<AK::SIMD::f32x4> expand4(Vector4<float> const& v)
{
return Vector4<AK::SIMD::f32x4> {
AK::SIMD::expand4(v.x()),
AK::SIMD::expand4(v.y()),
AK::SIMD::expand4(v.z()),
AK::SIMD::expand4(v.w()),
};
}
ALWAYS_INLINE static constexpr Vector2<AK::SIMD::i32x4> expand4(Vector2<int> const& v)
{
return Vector2<AK::SIMD::i32x4> {
AK::SIMD::expand4(v.x()),
AK::SIMD::expand4(v.y()),
};
}
ALWAYS_INLINE static constexpr Vector3<AK::SIMD::i32x4> expand4(Vector3<int> const& v)
{
return Vector3<AK::SIMD::i32x4> {
AK::SIMD::expand4(v.x()),
AK::SIMD::expand4(v.y()),
AK::SIMD::expand4(v.z()),
};
}
ALWAYS_INLINE static constexpr Vector4<AK::SIMD::i32x4> expand4(Vector4<int> const& v)
{
return Vector4<AK::SIMD::i32x4> {
AK::SIMD::expand4(v.x()),
AK::SIMD::expand4(v.y()),
AK::SIMD::expand4(v.z()),
AK::SIMD::expand4(v.w()),
};
}
}
|