diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-05-06 08:07:04 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-05-06 08:07:04 +0400 |
commit | fd7f5c423070f52d023e1c403c5c2543ec7fa3a6 (patch) | |
tree | 23dfd496505105635e81e83a8c187fb2c457eea3 /intern/cycles | |
parent | 76602182022b15314138dcc488a3a651ac0da021 (diff) |
Cycles: revert part of the optimization from ff34c2d
This was faster for my AMD system but slower for Intel.
However with gcc4.9,-O3 I was able to get roughly the same speed before/after.
Revert since this isnt giving such clear benefits on most systems.
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/kernel/kernel_compat_cpu.h | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/intern/cycles/kernel/kernel_compat_cpu.h b/intern/cycles/kernel/kernel_compat_cpu.h index e393663361a..d027bb62ebe 100644 --- a/intern/cycles/kernel/kernel_compat_cpu.h +++ b/intern/cycles/kernel/kernel_compat_cpu.h @@ -101,8 +101,8 @@ template<typename T> struct texture_image { int ix, iy, nix, niy; if(interpolation == INTERPOLATION_CLOSEST) { - frac(x*width_fl, &ix); - frac(y*height_fl, &iy); + frac(x*(float)width, &ix); + frac(y*(float)height, &iy); if(periodic) { ix = wrap_periodic(ix, width); iy = wrap_periodic(iy, height); @@ -115,8 +115,8 @@ template<typename T> struct texture_image { return read(data[ix + iy*width]); } else { - float tx = frac(x*width_fl - 0.5f, &ix); - float ty = frac(y*height_fl - 0.5f, &iy); + float tx = frac(x*(float)width - 0.5f, &ix); + float ty = frac(y*(float)height - 0.5f, &iy); if(periodic) { ix = wrap_periodic(ix, width); @@ -150,9 +150,9 @@ template<typename T> struct texture_image { int ix, iy, iz, nix, niy, niz; if(interpolation == INTERPOLATION_CLOSEST) { - frac(x*width_fl, &ix); - frac(y*height_fl, &iy); - frac(z*depth_fl, &iz); + frac(x*(float)width, &ix); + frac(y*(float)height, &iy); + frac(z*(float)depth, &iz); if(periodic) { ix = wrap_periodic(ix, width); @@ -168,9 +168,9 @@ template<typename T> struct texture_image { return read(data[ix + iy*width + iz*width*height]); } else { - float tx = frac(x*width_fl - 0.5f, &ix); - float ty = frac(y*height_fl - 0.5f, &iy); - float tz = frac(z*depth_fl - 0.5f, &iz); + float tx = frac(x*(float)width - 0.5f, &ix); + float ty = frac(y*(float)height - 0.5f, &iy); + float tz = frac(z*(float)depth - 0.5f, &iz); if(periodic) { ix = wrap_periodic(ix, width); @@ -212,18 +212,11 @@ template<typename T> struct texture_image { width = width_; height = height_; depth = depth_; - - width_fl = (float)width_; - height_fl = (float)height_; - depth_fl = (float)depth_; } T *data; int interpolation; int width, height, depth; - - /* avoid int/float conversion */ - float width_fl, height_fl, depth_fl; }; typedef texture<float4> texture_float4; |