diff options
author | Stefan Werner <stefan.werner@tangent-animation.com> | 2020-05-07 11:01:42 +0300 |
---|---|---|
committer | Stefan Werner <stefan.werner@tangent-animation.com> | 2020-05-07 11:04:19 +0300 |
commit | 04a3bdcc524d2c089d11d3ef3576a9e5123ef40e (patch) | |
tree | 4f1ba023e28542a28a1e8f055f36f7b0e213fe6b /source/blender | |
parent | a834c819ee25d0107ad0d53786d67f3b766b37a6 (diff) |
Blenlib: Added explicit BLI_INLINE in perlin noise.
A few tiny functions were not inlined even in some release
configurations. Added BLI_INLINE as extra compiler hint in
places that the profiler showed at hot spots when populating
geometry with hair.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenlib/intern/noise.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c index 229a06948c2..053047d121d 100644 --- a/source/blender/blenlib/intern/noise.c +++ b/source/blender/blenlib/intern/noise.c @@ -24,6 +24,7 @@ #include <math.h> #include "BLI_noise.h" +#include "BLI_compiler_compat.h" /* local */ static float noise3_perlin(float vec[3]); @@ -264,17 +265,17 @@ static const float hashvectf[768] = { /* IMPROVED PERLIN NOISE */ /**************************/ -static float lerp(float t, float a, float b) +BLI_INLINE float lerp(float t, float a, float b) { return (a + t * (b - a)); } -static float npfade(float t) +BLI_INLINE float npfade(float t) { return (t * t * t * (t * (t * 6.0f - 15.0f) + 10.0f)); } -static float grad(int hash_val, float x, float y, float z) +BLI_INLINE float grad(int hash_val, float x, float y, float z) { int h = hash_val & 15; /* CONVERT LO 4 BITS OF HASH CODE */ float u = h < 8 ? x : y; /* INTO 12 GRADIENT DIRECTIONS. */ |