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:
authorAlexander Gavrilov <angavrilov@gmail.com>2016-09-29 00:35:53 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2016-10-01 14:37:03 +0300
commit40eedd5df9083ce54c38c6307946488a1fa8aae0 (patch)
treee3060fcab4e8ead3d6ec6c9254fddf5cf0b35aec /intern/cycles/kernel/svm/svm_math_util.h
parent95fa303efd0b6e2963af423e601bb2869ac82520 (diff)
Cycles: implement partial constant folding for exponentiation.
This is also an important mathematical operation that can be folded if it is known that one argument is a certain constant. For colors the operation is provided as a Gamma node. The SVM Gamma node needs a small fix to make it follow the 0 ^ 0 == 1 rule, same as the Power node, or the Gamma node itself in OSL mode. Reviewers: #cycles Differential Revision: https://developer.blender.org/D2263
Diffstat (limited to 'intern/cycles/kernel/svm/svm_math_util.h')
-rw-r--r--intern/cycles/kernel/svm/svm_math_util.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/intern/cycles/kernel/svm/svm_math_util.h b/intern/cycles/kernel/svm/svm_math_util.h
index 6d13a0d8e02..01547b60014 100644
--- a/intern/cycles/kernel/svm/svm_math_util.h
+++ b/intern/cycles/kernel/svm/svm_math_util.h
@@ -164,6 +164,9 @@ ccl_device float3 svm_math_blackbody_color(float t) {
ccl_device_inline float3 svm_math_gamma_color(float3 color, float gamma)
{
+ if(gamma == 0.0f)
+ return make_float3(1.0f, 1.0f, 1.0f);
+
if(color.x > 0.0f)
color.x = powf(color.x, gamma);
if(color.y > 0.0f)