diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2017-10-04 21:45:20 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2017-10-04 22:00:46 +0300 |
commit | 660e8e59e7b4265324a8fba7ae716f84a73c6c64 (patch) | |
tree | 98a0ffa199c00c5a8c335d2140303e6c72cd2a75 /intern/cycles/kernel/svm | |
parent | 754f5d39c588d488620d887b66b22ccfb2d45be8 (diff) |
Fix T52645, T52645: AMD OpenCL compiler crash with recent drivers.
Work around the bug by reshuffling code.
Diffstat (limited to 'intern/cycles/kernel/svm')
-rw-r--r-- | intern/cycles/kernel/svm/svm_math_util.h | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/intern/cycles/kernel/svm/svm_math_util.h b/intern/cycles/kernel/svm/svm_math_util.h index a7f15de7325..f8aeeba4a21 100644 --- a/intern/cycles/kernel/svm/svm_math_util.h +++ b/intern/cycles/kernel/svm/svm_math_util.h @@ -134,33 +134,20 @@ ccl_device float3 svm_math_blackbody_color(float t) { { 6.72595954e-13f, -2.73059993e-08f, 4.24068546e-04f, -7.52204323e-01f }, }; - int i; if(t >= 12000.0f) { return make_float3(0.826270103f, 0.994478524f, 1.56626022f); } - else if(t >= 6365.0f) { - i = 5; - } - else if(t >= 3315.0f) { - i = 4; - } - else if(t >= 1902.0f) { - i = 3; - } - else if(t >= 1449.0f) { - i = 2; - } - else if(t >= 1167.0f) { - i = 1; - } - else if(t >= 965.0f) { - i = 0; - } - else { + else if(t < 965.0f) { /* For 800 <= t < 965 color does not change in OSL implementation, so keep color the same */ return make_float3(4.70366907f, 0.0f, 0.0f); } + int i = (t >= 6365.0f)? 5: + (t >= 3315.0f)? 4: + (t >= 1902.0f)? 3: + (t >= 1449.0f)? 2: + (t >= 1167.0f)? 1: 0; + const float t_inv = 1.0f / t; return make_float3(rc[i][0] * t_inv + rc[i][1] * t + rc[i][2], gc[i][0] * t_inv + gc[i][1] * t + gc[i][2], |