diff options
author | Zack Rusin <zack@tungstengraphics.com> | 2007-11-02 11:47:09 -0400 |
---|---|---|
committer | Zack Rusin <zack@tungstengraphics.com> | 2007-11-02 11:47:09 -0400 |
commit | 5c7bfb06e087ce4162590359ad75d1fca98f3549 (patch) | |
tree | 31156ef549c67612c0f396d813d5b916ba482dbe /src/mesa/pipe/llvm/llvm_builtins.c | |
parent | cf363ba30746ee0fd46b97986ea9fd753e093039 (diff) |
Implement COS and CMP opcode.
There's some weird rounding issue with COS that I can't figure
out.
Diffstat (limited to 'src/mesa/pipe/llvm/llvm_builtins.c')
-rw-r--r-- | src/mesa/pipe/llvm/llvm_builtins.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/mesa/pipe/llvm/llvm_builtins.c b/src/mesa/pipe/llvm/llvm_builtins.c index 9d3d6141a6..a570e0e089 100644 --- a/src/mesa/pipe/llvm/llvm_builtins.c +++ b/src/mesa/pipe/llvm/llvm_builtins.c @@ -43,7 +43,7 @@ inline float approx(float a, float b) return powf(a, b); } -float4 lit(float4 tmp) +inline float4 lit(float4 tmp) { float4 result; result.x = 1.0; @@ -57,3 +57,29 @@ float4 lit(float4 tmp) } return result; } + +inline float4 cmp(float4 tmp0, float4 tmp1, float4 tmp2) +{ + float4 result; + + result.x = (tmp0.x < 0.0) ? tmp1.x : tmp2.x; + result.y = (tmp0.y < 0.0) ? tmp1.y : tmp2.y; + result.z = (tmp0.z < 0.0) ? tmp1.z : tmp2.z; + result.w = (tmp0.w < 0.0) ? tmp1.w : tmp2.w; + + return result; +} + +extern float cosf(float val); + +inline float4 vcos(float4 val) +{ + float4 result; + printf("VEC IN is %f %f %f %f\n", val.x, val.y, val.z, val.w); + result.x = cosf(val.x); + result.y = cosf(val.x); + result.z = cosf(val.x); + result.w = cosf(val.x); + printf("VEC OUT is %f %f %f %f\n", result.x, result.y, result.z, result.w); + return result; +} |