diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-12-03 16:21:44 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-12-03 16:21:44 +0400 |
commit | 41f98978e3430a7d38684d49891505bb954375aa (patch) | |
tree | a69caf8413332c0d359c7a873d86c77f16d3c4fc /intern/cycles/kernel/svm | |
parent | f00a49baaaf4b2f8d8a6a6265255fa7085a79bf8 (diff) |
Fix cycles issue when NaN is used for RGB ramp, can access array out of bounds then.
OSL noise() function is generating NaN's in certain cases, fix for that goes to our
OSL branch.
Also add missing minimum weight and max closure checks to OSL, forgot to add these
when fixing another bug.
Diffstat (limited to 'intern/cycles/kernel/svm')
-rw-r--r-- | intern/cycles/kernel/svm/svm_ramp.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/intern/cycles/kernel/svm/svm_ramp.h b/intern/cycles/kernel/svm/svm_ramp.h index 55c2b3f6af4..c64413cbe84 100644 --- a/intern/cycles/kernel/svm/svm_ramp.h +++ b/intern/cycles/kernel/svm/svm_ramp.h @@ -25,7 +25,8 @@ __device float4 rgb_ramp_lookup(KernelGlobals *kg, int offset, float f) { f = clamp(f, 0.0f, 1.0f)*(RAMP_TABLE_SIZE-1); - int i = (int)f; + /* clamp int as well in case of NaN */ + int i = clamp((int)f, 0, RAMP_TABLE_SIZE-1); float t = f - (float)i; float4 a = fetch_node_float(kg, offset+i); |