HDK
|
#include <simd.h>
Public Types | |
enum | { elements = 4 } |
enum | { paddedelements = 4 } |
enum | { bits = elements*32 } |
typedef float | value_t |
Underlying equivalent scalar value type. More... | |
typedef simd_raw_t< float, 4 > ::type | simd_t |
the native SIMD type used More... | |
typedef vfloat4 | vfloat_t |
SIMD int type. More... | |
typedef vint4 | vint_t |
SIMD int type. More... | |
typedef vbool4 | vbool_t |
SIMD bool type. More... | |
typedef vint4 | int_t |
typedef vbool4 | bool_t |
Public Member Functions | |
vfloat4 () | |
Default constructor (contents undefined) More... | |
vfloat4 (float a) | |
Construct from a single value (store it in all slots) More... | |
vfloat4 (float a, float b, float c, float d=0.0f) | |
Construct from 3 or 4 values. More... | |
vfloat4 (const float *f) | |
Construct from a pointer to 4 values. More... | |
vfloat4 (const vfloat4 &other) | |
Copy construct from another vfloat4. More... | |
vfloat4 (const vint4 &ival) | |
Construct from an vint4 (promoting all components to float) More... | |
vfloat4 (const simd_t &m) | |
Construct from the underlying SIMD type. More... | |
operator simd_t () const | |
Return the raw SIMD type. More... | |
simd_t | simd () const |
simd_t & | simd () |
const value_t * | data () const |
Return a pointer to the underlying scalar type. More... | |
value_t * | data () |
vfloat4 (const Imath::V3f &v) | |
Construct from a Imath::V3f. More... | |
const Imath::V3f & | V3f () const |
Cast to a Imath::V3f. More... | |
vfloat4 (const Imath::V4f &v) | |
Construct from a Imath::V4f. More... | |
const Imath::V4f & | V4f () const |
Cast to a Imath::V4f. More... | |
vfloat4 (const unsigned short *vals) | |
Construct from a pointer to 4 unsigned short values. More... | |
vfloat4 (const short *vals) | |
Construct from a pointer to 4 short values. More... | |
vfloat4 (const unsigned char *vals) | |
Construct from a pointer to 4 unsigned char values. More... | |
vfloat4 (const char *vals) | |
Construct from a pointer to 4 char values. More... | |
const vfloat4 & | operator= (float a) |
Assign a single value to all components. More... | |
const vfloat4 & | operator= (vfloat4 other) |
Assign a vfloat4. More... | |
void | clear () |
Set all components to 0.0. More... | |
const vfloat4 & | operator= (const Imath::V4f &v) |
Assign from a Imath::V4f. More... | |
const vfloat4 & | operator= (const Imath::V3f &v) |
Assign from a Imath::V3f. More... | |
float | operator[] (int i) const |
Component access (get) More... | |
float & | operator[] (int i) |
Component access (set) More... | |
void | setcomp (int i, float value) |
Component access (set). More... | |
value_t | x () const |
value_t | y () const |
value_t | z () const |
value_t | w () const |
void | set_x (value_t val) |
void | set_y (value_t val) |
void | set_z (value_t val) |
void | set_w (value_t val) |
void | load (float val) |
Helper: load a single value into all components. More... | |
void | load (float a, float b, float c, float d=0.0f) |
Helper: load 3 or 4 values. (If 3 are supplied, the 4th will be 0.) More... | |
void | load (const float *values) |
Load from an array of 4 values. More... | |
void | load (const float *values, int n) |
void | load (const unsigned short *values) |
Load from an array of 4 unsigned short values, convert to float. More... | |
void | load (const short *values) |
Load from an array of 4 short values, convert to float. More... | |
void | load (const unsigned char *values) |
Load from an array of 4 unsigned char values, convert to float. More... | |
void | load (const char *values) |
Load from an array of 4 char values, convert to float. More... | |
void | store (float *values) const |
void | store (float *values, int n) const |
Store the first n values into memory. More... | |
void | load_mask (int mask, const value_t *values) |
void | load_mask (const vbool_t &mask, const value_t *values) |
void | store_mask (int mask, value_t *values) const |
void | store_mask (const vbool_t &mask, value_t *values) const |
template<int scale = 4> | |
void | gather (const value_t *baseptr, const vint_t &vindex) |
Load values from addresses (char*)basepatr + vindex[i]*scale. More... | |
template<int scale = 4> | |
void | gather_mask (const vbool_t &mask, const value_t *baseptr, const vint_t &vindex) |
Gather elements defined by the mask, leave others unchanged. More... | |
template<int scale = 4> | |
void | gather_mask (int mask, const value_t *baseptr, const vint_t &vindex) |
template<int scale = 4> | |
void | scatter (value_t *baseptr, const vint_t &vindex) const |
Store values at addresses (char*)basepatr + vindex[i]*scale. More... | |
template<int scale = 4> | |
void | scatter_mask (const vbool_t &mask, value_t *baseptr, const vint_t &vindex) const |
Scatter elements defined by the mask. More... | |
template<int scale = 4> | |
void | scatter_mask (int mask, value_t *baseptr, const vint_t &vindex) const |
const vfloat4 & | operator+= (const vfloat4 &a) |
vfloat4 | operator- () const |
const vfloat4 & | operator-= (const vfloat4 &a) |
const vfloat4 & | operator*= (const vfloat4 &a) |
const vfloat4 & | operator*= (float val) |
const vfloat4 & | operator/= (const vfloat4 &a) |
const vfloat4 & | operator/= (float val) |
vfloat4 | xyz0 () const |
Return xyz components, plus 0 for w. More... | |
vfloat4 | xyz1 () const |
Return xyz components, plus 1 for w. More... | |
template<int scale> | |
OIIO_FORCEINLINE void | gather (const value_t *baseptr, const vint_t &vindex) |
template<int scale> | |
OIIO_FORCEINLINE void | gather_mask (const vbool_t &mask, const value_t *baseptr, const vint_t &vindex) |
template<int scale> | |
OIIO_FORCEINLINE void | scatter (value_t *baseptr, const vint_t &vindex) const |
template<int scale> | |
OIIO_FORCEINLINE void | scatter_mask (const vbool_t &mask, value_t *baseptr, const vint_t &vindex) const |
Static Public Member Functions | |
static const char * | type_name () |
static const vfloat4 | Zero () |
Return a vfloat4 with all components set to 0.0. More... | |
static const vfloat4 | One () |
Return a vfloat4 with all components set to 1.0. More... | |
static const vfloat4 | Iota (float start=0.0f, float step=1.0f) |
Protected Attributes | |
union { | |
simd_t m_simd | |
value_t m_val [paddedelements] | |
}; | |
Friends | |
vfloat4 | operator+ (const vfloat4 &a, const vfloat4 &b) |
vfloat4 | operator- (const vfloat4 &a, const vfloat4 &b) |
vfloat4 | operator* (const vfloat4 &a, const vfloat4 &b) |
vfloat4 | operator* (const vfloat4 &a, float b) |
vfloat4 | operator* (float a, const vfloat4 &b) |
vfloat4 | operator/ (const vfloat4 &a, const vfloat4 &b) |
vbool4 | operator== (const vfloat4 &a, const vfloat4 &b) |
vbool4 | operator!= (const vfloat4 &a, const vfloat4 &b) |
vbool4 | operator< (const vfloat4 &a, const vfloat4 &b) |
vbool4 | operator> (const vfloat4 &a, const vfloat4 &b) |
vbool4 | operator>= (const vfloat4 &a, const vfloat4 &b) |
vbool4 | operator<= (const vfloat4 &a, const vfloat4 &b) |
vfloat4 | AxyBxy (const vfloat4 &a, const vfloat4 &b) |
vfloat4 | AxBxAyBy (const vfloat4 &a, const vfloat4 &b) |
std::ostream & | operator<< (std::ostream &cout, const vfloat4 &val) |
Stream output. More... | |
Floating point 4-vector, accelerated by SIMD instructions when available.
typedef vbool4 simd::vfloat4::bool_t |
typedef vint4 simd::vfloat4::int_t |
typedef simd_raw_t<float,4>::type simd::vfloat4::simd_t |
typedef float simd::vfloat4::value_t |
typedef vbool4 simd::vfloat4::vbool_t |
typedef vfloat4 simd::vfloat4::vfloat_t |
typedef vint4 simd::vfloat4::vint_t |
|
inline |
|
inline |
|
inline |
|
inline |
|
explicit |
|
inline |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
OIIO_FORCEINLINE void simd::vfloat4::clear | ( | ) |
|
inline |
void simd::vfloat4::gather | ( | const value_t * | baseptr, |
const vint_t & | vindex | ||
) |
Load values from addresses (char*)basepatr + vindex[i]*scale.
OIIO_FORCEINLINE void simd::vfloat4::gather | ( | const value_t * | baseptr, |
const vint_t & | vindex | ||
) |
void simd::vfloat4::gather_mask | ( | const vbool_t & | mask, |
const value_t * | baseptr, | ||
const vint_t & | vindex | ||
) |
Gather elements defined by the mask, leave others unchanged.
void simd::vfloat4::gather_mask | ( | int | mask, |
const value_t * | baseptr, | ||
const vint_t & | vindex | ||
) |
OIIO_FORCEINLINE void simd::vfloat4::gather_mask | ( | const vbool_t & | mask, |
const value_t * | baseptr, | ||
const vint_t & | vindex | ||
) |
|
static |
OIIO_FORCEINLINE void simd::vfloat4::load | ( | float | val | ) |
OIIO_FORCEINLINE void simd::vfloat4::load | ( | const float * | values | ) |
OIIO_FORCEINLINE void simd::vfloat4::load | ( | const float * | values, |
int | n | ||
) |
OIIO_FORCEINLINE void simd::vfloat4::load | ( | const unsigned short * | values | ) |
OIIO_FORCEINLINE void simd::vfloat4::load | ( | const short * | values | ) |
OIIO_FORCEINLINE void simd::vfloat4::load | ( | const unsigned char * | values | ) |
OIIO_FORCEINLINE void simd::vfloat4::load | ( | const char * | values | ) |
OIIO_FORCEINLINE void simd::vfloat4::load_mask | ( | int | mask, |
const value_t * | values | ||
) |
OIIO_FORCEINLINE void simd::vfloat4::load_mask | ( | const vbool_t & | mask, |
const value_t * | values | ||
) |
|
static |
|
inline |
OIIO_FORCEINLINE const vfloat4 & simd::vfloat4::operator*= | ( | const vfloat4 & | a | ) |
OIIO_FORCEINLINE const vfloat4 & simd::vfloat4::operator*= | ( | float | val | ) |
OIIO_FORCEINLINE const vfloat4 & simd::vfloat4::operator+= | ( | const vfloat4 & | a | ) |
OIIO_FORCEINLINE vfloat4 simd::vfloat4::operator- | ( | ) | const |
OIIO_FORCEINLINE const vfloat4 & simd::vfloat4::operator-= | ( | const vfloat4 & | a | ) |
OIIO_FORCEINLINE const vfloat4 & simd::vfloat4::operator/= | ( | const vfloat4 & | a | ) |
OIIO_FORCEINLINE const vfloat4 & simd::vfloat4::operator/= | ( | float | val | ) |
OIIO_FORCEINLINE const vfloat4 & simd::vfloat4::operator= | ( | const Imath::V4f & | v | ) |
OIIO_FORCEINLINE const vfloat4 & simd::vfloat4::operator= | ( | const Imath::V3f & | v | ) |
OIIO_FORCEINLINE float simd::vfloat4::operator[] | ( | int | i | ) | const |
OIIO_FORCEINLINE float & simd::vfloat4::operator[] | ( | int | i | ) |
void simd::vfloat4::scatter | ( | value_t * | baseptr, |
const vint_t & | vindex | ||
) | const |
Store values at addresses (char*)basepatr + vindex[i]*scale.
OIIO_FORCEINLINE void simd::vfloat4::scatter | ( | value_t * | baseptr, |
const vint_t & | vindex | ||
) | const |
void simd::vfloat4::scatter_mask | ( | const vbool_t & | mask, |
value_t * | baseptr, | ||
const vint_t & | vindex | ||
) | const |
Scatter elements defined by the mask.
void simd::vfloat4::scatter_mask | ( | int | mask, |
value_t * | baseptr, | ||
const vint_t & | vindex | ||
) | const |
OIIO_FORCEINLINE void simd::vfloat4::scatter_mask | ( | const vbool_t & | mask, |
value_t * | baseptr, | ||
const vint_t & | vindex | ||
) | const |
OIIO_FORCEINLINE void simd::vfloat4::set_w | ( | value_t | val | ) |
OIIO_FORCEINLINE void simd::vfloat4::set_x | ( | value_t | val | ) |
OIIO_FORCEINLINE void simd::vfloat4::set_y | ( | value_t | val | ) |
OIIO_FORCEINLINE void simd::vfloat4::set_z | ( | value_t | val | ) |
OIIO_FORCEINLINE void simd::vfloat4::store | ( | float * | values | ) | const |
OIIO_FORCEINLINE void simd::vfloat4::store | ( | float * | values, |
int | n | ||
) | const |
OIIO_FORCEINLINE void simd::vfloat4::store_mask | ( | int | mask, |
value_t * | values | ||
) | const |
OIIO_FORCEINLINE void simd::vfloat4::store_mask | ( | const vbool_t & | mask, |
value_t * | values | ||
) | const |
|
inlinestatic |
|
inline |
|
inline |
OIIO_FORCEINLINE float simd::vfloat4::w | ( | ) | const |
OIIO_FORCEINLINE float simd::vfloat4::x | ( | ) | const |
OIIO_FORCEINLINE vfloat4 simd::vfloat4::xyz0 | ( | ) | const |
OIIO_FORCEINLINE vfloat4 simd::vfloat4::xyz1 | ( | ) | const |
OIIO_FORCEINLINE float simd::vfloat4::y | ( | ) | const |
OIIO_FORCEINLINE float simd::vfloat4::z | ( | ) | const |
|
static |
|
friend |
union { ... } |
value_t simd::vfloat4::m_val[paddedelements] |