From 5ac628fb477aaf2c2f0ee8ab5c25fb850a4c0a2a Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Sun, 10 Mar 2013 00:11:52 +0000 Subject: Cycles / OSL: * Avoid some conditional branches for the Noise texture and return immediately. --- intern/cycles/kernel/shaders/node_texture.h | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'intern/cycles/kernel/shaders/node_texture.h') diff --git a/intern/cycles/kernel/shaders/node_texture.h b/intern/cycles/kernel/shaders/node_texture.h index 463c68a6c27..67735487b89 100644 --- a/intern/cycles/kernel/shaders/node_texture.h +++ b/intern/cycles/kernel/shaders/node_texture.h @@ -172,26 +172,24 @@ float safe_noise(point p, int type) float noise_basis(point p, string basis) { - float result = 0.0; - if (basis == "Perlin") - result = safe_noise(p, 1); + return safe_noise(p, 1); if (basis == "Voronoi F1") - result = voronoi_F1S(p); + return voronoi_F1S(p); if (basis == "Voronoi F2") - result = voronoi_F2S(p); + return voronoi_F2S(p); if (basis == "Voronoi F3") - result = voronoi_F3S(p); + return voronoi_F3S(p); if (basis == "Voronoi F4") - result = voronoi_F4S(p); + return voronoi_F4S(p); if (basis == "Voronoi F2-F1") - result = voronoi_F1F2S(p); + return voronoi_F1F2S(p); if (basis == "Voronoi Crackle") - result = voronoi_CrS(p); + return voronoi_CrS(p); if (basis == "Cell Noise") - result = cellnoise(p); + return cellnoise(p); - return result; + return 0.0; } /* Soft/Hard Noise */ -- cgit v1.2.3