Top |
The graphene_simd4f_t type wraps a platform specific implementation of a vector of four floating point values.
Graphene can be compiled to use different implementations of the SIMD types, and will generally prefer the faster hardware-backed implementation if one is available.
The graphene_simd4f_t should be treated as an opaque, integral type; you cannot access its components directly, and you can only operate on all components at the same time.
graphene_simd4f_t graphene_simd4f_init (float x
,float y
,float z
,float w
);
Initializes a graphene_simd4f_t with the given values.
x |
the first component of the vector |
|
y |
the second component of the vector |
|
z |
the third component of the vector |
|
w |
the fourth component of the vector |
Since: 1.0
graphene_simd4f_t
graphene_simd4f_init_zero (void
);
Initializes a graphene_simd4f_t with 0 in all components.
Since: 1.0
graphene_simd4f_t
graphene_simd4f_init_4f (const float *v
);
Initializes a graphene_simd4f_t using an array of 4 floating point values.
Since: 1.0
graphene_simd4f_t
graphene_simd4f_init_3f (const float *v
);
Initializes a graphene_simd4f_t using an array of 3 floating point values.
Since: 1.0
graphene_simd4f_t
graphene_simd4f_init_2f (const float *v
);
Initializes a graphene_simd4f_t using an array of 2 floating point values.
Since: 1.0
void graphene_simd4f_dup_4f (const graphene_simd4f_t s
,float *v
);
Copies the contents of a graphene_simd4f_t into an array of floating points.
s |
||
v |
return location for an array of at least 4 floating point values. |
[out][array fixed-size=4] |
Since: 1.0
void graphene_simd4f_dup_3f (const graphene_simd4f_t s
,float *v
);
Copies the contents of a graphene_simd4f_t into an array of floating points.
s |
||
v |
return location for an array of at least 3 floating point values. |
[out][array fixed-size=3] |
Since: 1.0
void graphene_simd4f_dup_2f (const graphene_simd4f_t s
,float *v
);
Copies the contents of a graphene_simd4f_t into an array of floating points.
s |
||
v |
return location for an array of at least 2 floating point values. |
[out][array fixed-size=2] |
Since: 1.0
float graphene_simd4f_get (const graphene_simd4f_t s
,unsigned int i
);
Retrieves the given component of a graphene_simd4f_t.
Since: 1.2
float
graphene_simd4f_get_x (const graphene_simd4f_t s
);
Retrieves the first component of s
.
Since: 1.0
float
graphene_simd4f_get_y (const graphene_simd4f_t s
);
Retrieves the second component of s
.
Since: 1.0
float
graphene_simd4f_get_z (const graphene_simd4f_t s
);
Retrieves the third component of s
.
Since: 1.0
float
graphene_simd4f_get_w (const graphene_simd4f_t s
);
Retrieves the fourth component of s
.
Since: 1.0
graphene_simd4f_t
graphene_simd4f_splat (float v
);
Sets all the components of a new graphene_simd4f_t to the
same value v
:
{ .x = v, .y = v, .z = v, .w = v };
Since: 1.0
graphene_simd4f_t
graphene_simd4f_splat_x (const graphene_simd4f_t s
);
Sets all the components of a new graphene_simd4f_t to the same value of the first component of the passed vector:
{ .x = s.x, .y = s.x, .z = s.x, .w = s.x }
Since: 1.0
graphene_simd4f_t
graphene_simd4f_splat_y (const graphene_simd4f_t s
);
Sets all the components of a new graphene_simd4f_t to the same value of the second component of the passed vector:
{ .x = s.y, .y = s.y, .z = s.y, .w = s.y }
Since: 1.0
graphene_simd4f_t
graphene_simd4f_splat_z (const graphene_simd4f_t s
);
Sets all the components of a graphene_simd4f_t to the same value of the third component of the passed vector:
{ .x = s.z, .y = s.z, .z = s.z, .w = s.z }
Since: 1.0
graphene_simd4f_t
graphene_simd4f_splat_w (const graphene_simd4f_t s
);
Sets all the components of a graphene_simd4f_t to the same value of the fourth component of the passed vector:
{ .x = s.w, .y = s.w, .z = s.w, .w = s.w }
Since: 1.0
graphene_simd4f_t graphene_simd4f_add (const graphene_simd4f_t a
,const graphene_simd4f_t b
);
Creates a new graphene_simd4f_t vector where each
component is the sum of the respective components
in a
and b
.
1 2 3 4 5 6 |
{ .x = a.x + b.x, .y = a.y + b.y, .z = a.z + b.z, .w = a.w + b.w } |
Since: 1.0
graphene_simd4f_t graphene_simd4f_sub (const graphene_simd4f_t a
,const graphene_simd4f_t b
);
Creates a new graphene_simd4f_t vector where each
component is the subtraction of the respective components
in a
and b
.
1 2 3 4 5 6 |
{ .x = a.x - b.x, .y = a.y - b.y, .z = a.z - b.z, .w = a.w - b.w } |
Since: 1.0
graphene_simd4f_t graphene_simd4f_mul (const graphene_simd4f_t a
,const graphene_simd4f_t b
);
Creates a new graphene_simd4f_t vector where each
component is the multiplication of the respective components
in a
and b
.
1 2 3 4 5 6 |
{ .x = a.x * b.x, .y = a.y * b.y, .z = a.z * b.z, .w = a.w * b.w } |
Since: 1.0
graphene_simd4f_t graphene_simd4f_div (const graphene_simd4f_t a
,const graphene_simd4f_t b
);
Creates a new graphene_simd4f_t vector where each
component is the division of the respective components
in a
and b
.
1 2 3 4 5 6 |
{ .x = a.x / b.x, .y = a.y / b.y, .z = a.z / b.z, .w = a.w / b.w } |
Since: 1.0
graphene_simd4f_t
graphene_simd4f_sqrt (const graphene_simd4f_t s
);
Computes the square root of every component of s
.
{ .x = sqrt (s.x), .y = sqrt (s.y), .z = sqrt (s.z), .w = sqrt (s.w) }
Since: 1.0
graphene_simd4f_t
graphene_simd4f_reciprocal (const graphene_simd4f_t s
);
Computes the reciprocal of every component of s
.
{ .x = 1.0 / s.x, .y = 1.0 / s.y, .z = 1.0 / s.z, .w = 1.0 / s.w }
Since: 1.0
graphene_simd4f_t
graphene_simd4f_rsqrt (const graphene_simd4f_t s
);
Computes the reciprocal square root of every component
of s
.
{ .x = 1.0 / sqrt (s.x), .y = 1.0 / sqrt (s.y), .z = 1.0 / sqrt (s.z), .w = 1.0 / sqrt (s.w) }
Since: 1.0
graphene_simd4f_t graphene_simd4f_cross3 (const graphene_simd4f_t a
,const graphene_simd4f_t b
);
Creates a new graphene_simd4f_t vector where each
component contains the 3-way cross product of the
given a
and b
vectors.
Since: 1.0
graphene_simd4f_t graphene_simd4f_min (const graphene_simd4f_t a
,const graphene_simd4f_t b
);
Creates a new graphene_simd4f_t that contains the
minimum value of each component of a
and b
.
Since: 1.0
graphene_simd4f_t graphene_simd4f_max (const graphene_simd4f_t a
,const graphene_simd4f_t b
);
Creates a new graphene_simd4f_t that contains the
maximum value of each component of a
and b
.
Since: 1.0
graphene_simd4f_t
graphene_simd4f_min_val (const graphene_simd4f_t v
);
Computes the minimum value of all the channels in the given vector.
Since: 1.4
graphene_simd4f_t
graphene_simd4f_max_val (const graphene_simd4f_t v
);
Computes the maximum value of all the channels in the given vector.
Since: 1.4
graphene_simd4f_t graphene_simd4f_clamp (const graphene_simd4f_t v
,const graphene_simd4f_t min
,const graphene_simd4f_t max
);
Ensures that all components of the vector v
are within
the components of the lower
and upper
boundaries.
Since: 1.2
graphene_simd4f_t graphene_simd4f_clamp_scalar (const graphene_simd4f_t v
,float min
,float max
);
Ensures that all components of the vector v
are within
the lower
and upper
boundary scalar values.
Since: 1.2
graphene_simd4f_t
graphene_simd4f_shuffle_wxyz (const graphene_simd4f_t s
);
Creates a new graphene_simd4f_t that contains the
re-ordered values of the W, X, Y, and Z components
of s
.
Since: 1.0
graphene_simd4f_t
graphene_simd4f_shuffle_zwxy (const graphene_simd4f_t s
);
Creates a new graphene_simd4f_t that contains the
re-ordered values of the Z, W, X, and Y components
of s
.
Since: 1.0
graphene_simd4f_t
graphene_simd4f_shuffle_yzwx (const graphene_simd4f_t s
);
Creates a new graphene_simd4f_t that contains the
re-ordered values of the Y, Z, W, and X components
of s
.
Since: 1.0
graphene_simd4f_t
graphene_simd4f_zero_w (const graphene_simd4f_t s
);
Creates a new graphene_simd4f_t that contains the
same values of the given s
vector, except for the
W component, which is set to 0.
Since: 1.0
graphene_simd4f_t
graphene_simd4f_zero_zw (const graphene_simd4f_t s
);
Creates a new graphene_simd4f_t that contains the
same values of the given s
vector, except for the
Z and W components, which are set to 0.
Since: 1.0
graphene_simd4f_t graphene_simd4f_merge_w (const graphene_simd4f_t s
,float v
);
Creates a new graphene_simd4f_t that contains the
same values of the given s
vector, except for the
W component, which is set to v
.
Since: 1.0
graphene_simd4f_t graphene_simd4f_merge_high (const graphene_simd4f_t a
,const graphene_simd4f_t b
);
Creates a new graphene_simd4f_t that contains the
last two components of the vector a
and the last
two components of the vector b
.
Since: 1.0
graphene_simd4f_t graphene_simd4f_merge_low (const graphene_simd4f_t a
,const graphene_simd4f_t b
);
Creates a new graphene_simd4f_t that contains the
first two components of the vector a
and the first
two components of the vector b
.
Since: 1.0
graphene_simd4f_t
graphene_simd4f_flip_sign_0101 (const graphene_simd4f_t s
);
Flips the signs of the second and fourth components of
the given vector s
.
Since: 1.0
graphene_simd4f_t
graphene_simd4f_flip_sign_1010 (const graphene_simd4f_t s
);
Flips the signs of the first and third components of
the given vector s
.
Since: 1.0
bool graphene_simd4f_cmp_eq (const graphene_simd4f_t a
,const graphene_simd4f_t b
);
Checks if the two given graphene_simd4f_t are equal.
Since: 1.0
bool graphene_simd4f_cmp_neq (const graphene_simd4f_t a
,const graphene_simd4f_t b
);
Checks if the two given graphene_simd4f_t are not equal.
Since: 1.0
bool graphene_simd4f_cmp_lt (const graphene_simd4f_t a
,const graphene_simd4f_t b
);
Compares two graphene_simd4f_t and checks if all components
of the vector a
are less than the respective components of
the vector b
.
Since: 1.2
bool graphene_simd4f_cmp_le (const graphene_simd4f_t a
,const graphene_simd4f_t b
);
Compares two graphene_simd4f_t and checks if all components
of the vector a
are less than or equal to the respective components
of the vector b
.
Since: 1.2
bool graphene_simd4f_cmp_ge (const graphene_simd4f_t a
,const graphene_simd4f_t b
);
Compares two graphene_simd4f_t and checks if all components
of the vector a
are greater than or equal to the respective
components of the vector b
.
Since: 1.0
bool graphene_simd4f_cmp_gt (const graphene_simd4f_t a
,const graphene_simd4f_t b
);
Compares two graphene_simd4f_t and checks if all components
of the vector a
are greater than the respective components of
the vector b
.
Since: 1.0
graphene_simd4f_t
graphene_simd4f_neg (const graphene_simd4f_t s
);
Negates the values of s
.
Since: 1.0
graphene_simd4f_t graphene_simd4f_madd (const graphene_simd4f_t m1
,const graphene_simd4f_t m2
,const graphene_simd4f_t a
);
Adds a
to the product of m1
and m2
.
Since: 1.0
graphene_simd4f_t
graphene_simd4f_sum (const graphene_simd4f_t v
);
Sums all components of the given vector.
Since: 1.0
float
graphene_simd4f_sum_scalar (const graphene_simd4f_t v
);
Sums all the components of the given vector.
Since: 1.0
graphene_simd4f_t graphene_simd4f_dot4 (const graphene_simd4f_t a
,const graphene_simd4f_t b
);
Computes the dot product of all the components of the two given graphene_simd4f_t.
a vector whose components are all set to be the dot product of the components of the two operands
Since: 1.0
graphene_simd4f_t graphene_simd4f_dot3 (const graphene_simd4f_t a
,const graphene_simd4f_t b
);
Computes the dot product of the first three components of the two given graphene_simd4f_t.
a vector whose components are all set to the dot product of the components of the two operands
Since: 1.0
float graphene_simd4f_dot3_scalar (const graphene_simd4f_t a
,const graphene_simd4f_t b
);
Computes the dot product of the first three components of the two given graphene_simd4f_t.
Since: 1.4
graphene_simd4f_t graphene_simd4f_dot2 (const graphene_simd4f_t a
,const graphene_simd4f_t b
);
Computes the dot product of the first two components of the two given graphene_simd4f_t.
a vector whose components are all set to the dot product of the components of the two operands
Since: 1.0
graphene_simd4f_t
graphene_simd4f_length4 (const graphene_simd4f_t v
);
Computes the length of the given graphene_simd4f_t vector, using all four of its components.
Since: 1.0
graphene_simd4f_t
graphene_simd4f_length3 (const graphene_simd4f_t v
);
Computes the length of the given graphene_simd4f_t vector, using the first three of its components.
Since: 1.0
graphene_simd4f_t
graphene_simd4f_length2 (const graphene_simd4f_t v
);
Computes the length of the given graphene_simd4f_t vector, using the first two of its components.
Since: 1.0
graphene_simd4f_t
graphene_simd4f_normalize4 (const graphene_simd4f_t v
);
Computes the normalization of the given graphene_simd4f_t vector, using all of its components.
Since: 1.0
graphene_simd4f_t
graphene_simd4f_normalize3 (const graphene_simd4f_t v
);
Computes the normalization of the given graphene_simd4f_t vector, using the first three of its components.
Since: 1.0
graphene_simd4f_t
graphene_simd4f_normalize2 (const graphene_simd4f_t v
);
Computes the normalization of the given graphene_simd4f_t vector, using the first two of its components.
Since: 1.0
bool
graphene_simd4f_is_zero4 (const graphene_simd4f_t v
);
Checks whether the given graphene_simd4f_t has all its components set to 0.
Since: 1.0
bool
graphene_simd4f_is_zero3 (const graphene_simd4f_t v
);
Checks whether the given graphene_simd4f_t has the first three of its components set to 0.
Since: 1.0
bool
graphene_simd4f_is_zero2 (const graphene_simd4f_t v
);
Checks whether the given graphene_simd4f_t has the first two of its components set to 0.
Since: 1.0
graphene_simd4f_t graphene_simd4f_interpolate (const graphene_simd4f_t a
,const graphene_simd4f_t b
,float f
);
Linearly interpolates all components of the two given
graphene_simd4f_t vectors using the given factor f
.
Since: 1.0
typedef struct _graphene_simd4f_t graphene_simd4f_t;
A vector type containing four floating point values.
The contents of the graphene_simd4f_t type are private and cannot be directly accessed; use the provided API instead.
Since: 1.0