Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2011-05-20 16:26:01 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2011-05-20 16:26:01 +0400
commit63d4bafff57392ffd81d686a7ccdd4fbdf863c97 (patch)
tree9210c3c675d79bdbe80747f98e544dd2e0251a73 /intern/cycles/kernel/svm/svm_mix.h
parent2e66cb520c5e41b83665119a9787e9839ce7c2b3 (diff)
Cycles: some steps to getting OpenCL backend to compile.
Diffstat (limited to 'intern/cycles/kernel/svm/svm_mix.h')
-rw-r--r--intern/cycles/kernel/svm/svm_mix.h26
1 files changed, 17 insertions, 9 deletions
diff --git a/intern/cycles/kernel/svm/svm_mix.h b/intern/cycles/kernel/svm/svm_mix.h
index 5a8ca2f76dd..c9e6cdf43b9 100644
--- a/intern/cycles/kernel/svm/svm_mix.h
+++ b/intern/cycles/kernel/svm/svm_mix.h
@@ -41,7 +41,8 @@ __device float3 rgb_to_hsv(float3 rgb)
h = 0.0f;
}
else {
- c = (make_float3(cmax, cmax, cmax) - rgb)/cdelta;
+ float3 cmax3 = make_float3(cmax, cmax, cmax);
+ c = (cmax3 - rgb)/cdelta;
if(rgb.x == cmax) h = c.z - c.y;
else if(rgb.y == cmax) h = 2.0f + c.x - c.z;
@@ -91,26 +92,33 @@ __device float3 hsv_to_rgb(float3 hsv)
return rgb;
}
+__device float3 svm_lerp(const float3 a, const float3 b, float t)
+{
+ return (a * (1.0f - t) + b * t);
+}
+
__device float3 svm_mix_blend(float t, float3 col1, float3 col2)
{
- return lerp(col1, col2, t);
+ return svm_lerp(col1, col2, t);
}
__device float3 svm_mix_add(float t, float3 col1, float3 col2)
{
- return lerp(col1, col1 + col2, t);
+ return svm_lerp(col1, col1 + col2, t);
}
__device float3 svm_mix_mul(float t, float3 col1, float3 col2)
{
- return lerp(col1, col1 * col2, t);
+ return svm_lerp(col1, col1 * col2, t);
}
__device float3 svm_mix_screen(float t, float3 col1, float3 col2)
{
float tm = 1.0f - t;
+ float3 one = make_float3(1.0f, 1.0f, 1.0f);
+ float3 tm3 = make_float3(tm, tm, tm);
- return make_float3(1.0f, 1.0f, 1.0f) - (make_float3(tm, tm, tm) + t*(make_float3(1.0f, 1.0f, 1.0f) - col2))*(make_float3(1.0f, 1.0f, 1.0f) - col1);
+ return one - (tm3 + t*(one - col2))*(one - col1);
}
__device float3 svm_mix_overlay(float t, float3 col1, float3 col2)
@@ -139,7 +147,7 @@ __device float3 svm_mix_overlay(float t, float3 col1, float3 col2)
__device float3 svm_mix_sub(float t, float3 col1, float3 col2)
{
- return lerp(col1, col1 - col2, t);
+ return svm_lerp(col1, col1 - col2, t);
}
__device float3 svm_mix_div(float t, float3 col1, float3 col2)
@@ -157,7 +165,7 @@ __device float3 svm_mix_div(float t, float3 col1, float3 col2)
__device float3 svm_mix_diff(float t, float3 col1, float3 col2)
{
- return lerp(col1, fabs(col1 - col2), t);
+ return svm_lerp(col1, fabs(col1 - col2), t);
}
__device float3 svm_mix_dark(float t, float3 col1, float3 col2)
@@ -255,7 +263,7 @@ __device float3 svm_mix_hue(float t, float3 col1, float3 col2)
hsv.x = hsv2.x;
float3 tmp = hsv_to_rgb(hsv);
- outcol = lerp(outcol, tmp, t);
+ outcol = svm_lerp(outcol, tmp, t);
}
return outcol;
@@ -302,7 +310,7 @@ __device float3 svm_mix_color(float t, float3 col1, float3 col2)
hsv.y = hsv2.y;
float3 tmp = hsv_to_rgb(hsv);
- outcol = lerp(outcol, tmp, t);
+ outcol = svm_lerp(outcol, tmp, t);
}
return outcol;