soabuiltins.c File Reference

Go to the source code of this file.

Functions

typedef __attribute__ ((ext_vector_type(4)))
float4 maxvec (float4 a, float4 b)
float4 minvec (float4 a, float4 b)
float powf (float num, float p)
float sqrtf (float x)
float4 powvec (float4 vec, float4 q)
float4 sqrtvec (float4 vec)
float4 sltvec (float4 v1, float4 v2)
void abs (float4 *res, float4 tmp0x, float4 tmp0y, float4 tmp0z, float4 tmp0w)
void dp3 (float4 *res, float4 tmp0x, float4 tmp0y, float4 tmp0z, float4 tmp0w, float4 tmp1x, float4 tmp1y, float4 tmp1z, float4 tmp1w)
void dp4 (float4 *res, float4 tmp0x, float4 tmp0y, float4 tmp0z, float4 tmp0w, float4 tmp1x, float4 tmp1y, float4 tmp1z, float4 tmp1w)
void lit (float4 *res, float4 tmp0x, float4 tmp0y, float4 tmp0z, float4 tmp0w)
void min (float4 *res, float4 tmp0x, float4 tmp0y, float4 tmp0z, float4 tmp0w, float4 tmp1x, float4 tmp1y, float4 tmp1z, float4 tmp1w)
void max (float4 *res, float4 tmp0x, float4 tmp0y, float4 tmp0z, float4 tmp0w, float4 tmp1x, float4 tmp1y, float4 tmp1z, float4 tmp1w)
void pow (float4 *res, float4 tmp0x, float4 tmp0y, float4 tmp0z, float4 tmp0w, float4 tmp1x, float4 tmp1y, float4 tmp1z, float4 tmp1w)
void rsq (float4 *res, float4 tmp0x, float4 tmp0y, float4 tmp0z, float4 tmp0w)
void slt (float4 *res, float4 tmp0x, float4 tmp0y, float4 tmp0z, float4 tmp0w, float4 tmp1x, float4 tmp1y, float4 tmp1z, float4 tmp1w)


Function Documentation

typedef __attribute__ ( (ext_vector_type(4))   ) 

Definition at line 34 of file soabuiltins.c.

00042 {
00043    float4 res;
00044    res.x = fabsf(vec.x);
00045    res.y = fabsf(vec.y);
00046    res.z = fabsf(vec.z);
00047    res.w = fabsf(vec.w);
00048 
00049    return res;
00050 }

void abs ( float4 res,
float4  tmp0x,
float4  tmp0y,
float4  tmp0z,
float4  tmp0w 
)

Definition at line 104 of file soabuiltins.c.

00106 {
00107    res[0] = absvec(tmp0x);
00108    res[1] = absvec(tmp0y);
00109    res[2] = absvec(tmp0z);
00110    res[3] = absvec(tmp0w);
00111 }

void dp3 ( float4 res,
float4  tmp0x,
float4  tmp0y,
float4  tmp0z,
float4  tmp0w,
float4  tmp1x,
float4  tmp1y,
float4  tmp1z,
float4  tmp1w 
)

Definition at line 113 of file soabuiltins.c.

00116 {
00117    float4 dot = (tmp0x * tmp1x) + (tmp0y * tmp1y) +
00118                 (tmp0z * tmp1z);
00119 
00120    res[0] = dot;
00121    res[1] = dot;
00122    res[2] = dot;
00123    res[3] = dot;
00124 }

void dp4 ( float4 res,
float4  tmp0x,
float4  tmp0y,
float4  tmp0z,
float4  tmp0w,
float4  tmp1x,
float4  tmp1y,
float4  tmp1z,
float4  tmp1w 
)

Definition at line 126 of file soabuiltins.c.

00129 {
00130    float4 dot = (tmp0x * tmp1x) + (tmp0y * tmp1y) +
00131                 (tmp0z * tmp1z) + (tmp0w * tmp1w);
00132 
00133    res[0] = dot;
00134    res[1] = dot;
00135    res[2] = dot;
00136    res[3] = dot;
00137 }

void lit ( float4 res,
float4  tmp0x,
float4  tmp0y,
float4  tmp0z,
float4  tmp0w 
)

Definition at line 139 of file soabuiltins.c.

References float4::f, maxvec(), minvec(), and powvec().

00141 {
00142    const float4 zerovec = (float4) {0.0, 0.0, 0.0, 0.0};
00143    const float4 min128 = (float4) {-128.f, -128.f, -128.f, -128.f};
00144    const float4 plus128 = (float4) {128.f,  128.f,  128.f,  128.f};
00145 
00146    res[0] = (float4){1.0, 1.0, 1.0, 1.0};
00147    if (tmp0x.x > 0) {
00148       float4 tmpy = maxvec(tmp0y, zerovec);
00149       float4 tmpw = minvec(tmp0w, plus128);
00150       tmpw = maxvec(tmpw, min128);
00151       res[1] = tmp0x;
00152       res[2] = powvec(tmpy, tmpw);
00153    } else {
00154       res[1] = zerovec;
00155       res[2] = zerovec;
00156    }
00157    res[3] = (float4){1.0, 1.0, 1.0, 1.0};
00158 }

void max ( float4 res,
float4  tmp0x,
float4  tmp0y,
float4  tmp0z,
float4  tmp0w,
float4  tmp1x,
float4  tmp1y,
float4  tmp1z,
float4  tmp1w 
)

Definition at line 171 of file soabuiltins.c.

References maxvec().

00174 {
00175    res[0] = maxvec(tmp0x, tmp1x);
00176    res[1] = maxvec(tmp0y, tmp1y);
00177    res[2] = maxvec(tmp0z, tmp1z);
00178    res[3] = maxvec(tmp0w, tmp1w);
00179 }

float4 maxvec ( float4  a,
float4  b 
)

Definition at line 52 of file soabuiltins.c.

00053 {
00054    return (float4){(a.x > b.x) ? a.x : b.x,
00055          (a.y > b.y) ? a.y : b.y,
00056          (a.z > b.z) ? a.z : b.z,
00057          (a.w > b.w) ? a.w : b.w};
00058 }

void min ( float4 res,
float4  tmp0x,
float4  tmp0y,
float4  tmp0z,
float4  tmp0w,
float4  tmp1x,
float4  tmp1y,
float4  tmp1z,
float4  tmp1w 
)

Definition at line 160 of file soabuiltins.c.

References minvec().

00163 {
00164    res[0] = minvec(tmp0x, tmp1x);
00165    res[1] = minvec(tmp0y, tmp1y);
00166    res[2] = minvec(tmp0z, tmp1z);
00167    res[3] = minvec(tmp0w, tmp1w);
00168 }

float4 minvec ( float4  a,
float4  b 
)

Definition at line 60 of file soabuiltins.c.

00061 {
00062    return (float4){(a.x < b.x) ? a.x : b.x,
00063          (a.y < b.y) ? a.y : b.y,
00064          (a.z < b.z) ? a.z : b.z,
00065          (a.w < b.w) ? a.w : b.w};
00066 }

void pow ( float4 res,
float4  tmp0x,
float4  tmp0y,
float4  tmp0z,
float4  tmp0w,
float4  tmp1x,
float4  tmp1y,
float4  tmp1z,
float4  tmp1w 
)

Definition at line 181 of file soabuiltins.c.

References powvec().

00184 {
00185    res[0] = powvec(tmp0x, tmp1x);
00186    res[1] = res[0];
00187    res[2] = res[0];
00188    res[3] = res[0];
00189 }

float powf ( float  num,
float  p 
)

float4 powvec ( float4  vec,
float4  q 
)

Definition at line 71 of file soabuiltins.c.

References powf().

00072 {
00073    float4 p;
00074    p.x = powf(vec.x, q.x);
00075    p.y = powf(vec.y, q.y);
00076    p.z = powf(vec.z, q.z);
00077    p.w = powf(vec.w, q.w);
00078    return p;
00079 }

void rsq ( float4 res,
float4  tmp0x,
float4  tmp0y,
float4  tmp0z,
float4  tmp0w 
)

Definition at line 191 of file soabuiltins.c.

References sqrtvec().

00193 {
00194    const float4 onevec = (float4) {1., 1., 1., 1.};
00195    res[0] = onevec/sqrtvec(absvec(tmp0x));
00196    res[1] = onevec/sqrtvec(absvec(tmp0y));
00197    res[2] = onevec/sqrtvec(absvec(tmp0z));
00198    res[3] = onevec/sqrtvec(absvec(tmp0w));
00199 }

void slt ( float4 res,
float4  tmp0x,
float4  tmp0y,
float4  tmp0z,
float4  tmp0w,
float4  tmp1x,
float4  tmp1y,
float4  tmp1z,
float4  tmp1w 
)

Definition at line 201 of file soabuiltins.c.

References sltvec().

00204 {
00205    res[0] = sltvec(tmp0x, tmp1x);
00206    res[1] = sltvec(tmp0y, tmp1y);
00207    res[2] = sltvec(tmp0z, tmp1z);
00208    res[3] = sltvec(tmp0w, tmp1w);
00209 }

float4 sltvec ( float4  v1,
float4  v2 
)

Definition at line 91 of file soabuiltins.c.

00092 {
00093    float4 p;
00094    p.x = (v1.x < v2.x) ? 1.0 : 0.0;
00095    p.y = (v1.y < v2.y) ? 1.0 : 0.0;
00096    p.z = (v1.z < v2.z) ? 1.0 : 0.0;
00097    p.w = (v1.w < v2.w) ? 1.0 : 0.0;
00098    return p;
00099 }

float sqrtf ( float  x  ) 

float4 sqrtvec ( float4  vec  ) 

Definition at line 81 of file soabuiltins.c.

References sqrtf().

00082 {
00083    float4 p;
00084    p.x = sqrtf(vec.x);
00085    p.y = sqrtf(vec.y);
00086    p.z = sqrtf(vec.z);
00087    p.w = sqrtf(vec.w);
00088    return p;
00089 }


Generated on Tue Sep 29 06:25:23 2009 for Gallium3D by  doxygen 1.5.4