summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/gallivm/soabuiltins.c
diff options
context:
space:
mode:
authorZack Rusin <[email protected]>2008-05-16 16:06:59 -0400
committerZack Rusin <[email protected]>2008-05-17 13:58:44 -0400
commit1d1cf8edf6a0409caf9aa7d44e186eb51f51fa1f (patch)
tree8a5aceaaedc73b62500fb0915e90bdb03ba55c4e /src/gallium/auxiliary/gallivm/soabuiltins.c
parentea1a607292ef31df70cda8c6476755e0224c9f7d (diff)
do the lit (some artifacts present)
Diffstat (limited to 'src/gallium/auxiliary/gallivm/soabuiltins.c')
-rw-r--r--src/gallium/auxiliary/gallivm/soabuiltins.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/src/gallium/auxiliary/gallivm/soabuiltins.c b/src/gallium/auxiliary/gallivm/soabuiltins.c
index 935283f962b..b3bfebfe509 100644
--- a/src/gallium/auxiliary/gallivm/soabuiltins.c
+++ b/src/gallium/auxiliary/gallivm/soabuiltins.c
@@ -109,20 +109,6 @@ void pow(float4 *res,
res[3] = res[0];
}
-void lit(float4 *res,
- float4 tmp0x, float4 tmp0y, float4 tmp0z, float4 tmp0w,
- float4 tmp1x, float4 tmp1y, float4 tmp1z, float4 tmp1w)
-{
- const float4 zerovec = (float4) {0, 0, 0, 0};
- float4 tmpx = tmp0x;
- float4 tmpy = tmp0y;
-
- res[0] = (float4){1.0, 1.0, 1.0, 1.0};
- res[1] = tmpx;
- res[2] = tmpy;
- res[3] = (float4){1.0, 1.0, 1.0, 1.0};
-}
-
float4 minvec(float4 a, float4 b)
{
return (float4){(a.x < b.x) ? a.x : b.x,
@@ -159,3 +145,26 @@ void max(float4 *res,
res[2] = maxvec(tmp0z, tmp1z);
res[3] = maxvec(tmp0w, tmp1w);
}
+
+
+void lit(float4 *res,
+ float4 tmp0x, float4 tmp0y, float4 tmp0z, float4 tmp0w)
+{
+ const float4 zerovec = (float4) {0, 0, 0, 0};
+ const float4 min128 = (float4) {-128.f, -128.f, -128.f, -128.f};
+ const float4 plus128 = (float4) {128.f, 128.f, 128.f, 128.f};
+
+ res[0] = (float4){1.0, 1.0, 1.0, 1.0};
+ if (tmp0x.x > 0) {
+ float4 tmpx = maxvec(tmpx, zerovec);
+ float4 tmpy = maxvec(tmp0y, zerovec);
+ float4 tmpw = minvec(tmp0w, plus128);
+ tmpw = maxvec(tmpw, min128);
+ res[1] = tmpx;
+ res[2] = powvec(tmpy, tmpw);
+ } else {
+ res[1] = zerovec;
+ res[2] = zerovec;
+ }
+ res[3] = (float4){1.0, 1.0, 1.0, 1.0};
+}