diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-02-04 19:04:07 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-02-04 19:07:50 +0400 |
commit | 28e6d05e0952bf96eec0320231178c883e0b8079 (patch) | |
tree | 7dfda1019692f0402eb3e23d77b2ad494966cb2f /intern/cycles/kernel/kernel_compat_cpu.h | |
parent | 30b5aef6789a2cf39020151b00410bd1d8f1c3d7 (diff) |
Fix cycles crash with float image textures on CPU without AVX support.
The AVX kernel functions for reading image textures could be get used from non-AVX
kernels. These are C++ class methods and need to be marked for inlining, all other
functions are static so they don't leak into other kernels.
Diffstat (limited to 'intern/cycles/kernel/kernel_compat_cpu.h')
-rw-r--r-- | intern/cycles/kernel/kernel_compat_cpu.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/intern/cycles/kernel/kernel_compat_cpu.h b/intern/cycles/kernel/kernel_compat_cpu.h index ce597a87315..b213e91274d 100644 --- a/intern/cycles/kernel/kernel_compat_cpu.h +++ b/intern/cycles/kernel/kernel_compat_cpu.h @@ -37,20 +37,20 @@ CCL_NAMESPACE_BEGIN * pointer lookup. */ template<typename T> struct texture { - T fetch(int index) + ccl_always_inline T fetch(int index) { kernel_assert(index >= 0 && index < width); return data[index]; } #if 0 - __m128 fetch_m128(int index) + ccl_always_inline __m128 fetch_m128(int index) { kernel_assert(index >= 0 && index < width); return ((__m128*)data)[index]; } - __m128i fetch_m128i(int index) + ccl_always_inline __m128i fetch_m128i(int index) { kernel_assert(index >= 0 && index < width); return ((__m128i*)data)[index]; @@ -62,18 +62,18 @@ template<typename T> struct texture { }; template<typename T> struct texture_image { - float4 read(float4 r) + ccl_always_inline float4 read(float4 r) { return r; } - float4 read(uchar4 r) + ccl_always_inline float4 read(uchar4 r) { float f = 1.0f/255.0f; return make_float4(r.x*f, r.y*f, r.z*f, r.w*f); } - int wrap_periodic(int x, int width) + ccl_always_inline int wrap_periodic(int x, int width) { x %= width; if(x < 0) @@ -81,19 +81,19 @@ template<typename T> struct texture_image { return x; } - int wrap_clamp(int x, int width) + ccl_always_inline int wrap_clamp(int x, int width) { return clamp(x, 0, width-1); } - float frac(float x, int *ix) + ccl_always_inline float frac(float x, int *ix) { int i = float_to_int(x) - ((x < 0.0f)? 1: 0); *ix = i; return x - (float)i; } - float4 interp(float x, float y, bool periodic = true) + ccl_always_inline float4 interp(float x, float y, bool periodic = true) { if(!data) return make_float4(0.0f, 0.0f, 0.0f, 0.0f); |