[Bf-blender-cvs] [fd7f5c4] master: Cycles: revert part of the optimization from ff34c2d

Campbell Barton noreply at git.blender.org
Tue May 6 06:11:44 CEST 2014


Commit: fd7f5c423070f52d023e1c403c5c2543ec7fa3a6
Author: Campbell Barton
Date:   Tue May 6 14:07:04 2014 +1000
https://developer.blender.org/rBfd7f5c423070f52d023e1c403c5c2543ec7fa3a6

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.

===================================================================

M	intern/cycles/kernel/kernel_compat_cpu.h

===================================================================

diff --git a/intern/cycles/kernel/kernel_compat_cpu.h b/intern/cycles/kernel/kernel_compat_cpu.h
index e393663..d027bb6 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;




More information about the Bf-blender-cvs mailing list