diff options
author | Thomas Dinges <blender@dingto.org> | 2014-06-13 23:13:18 +0400 |
---|---|---|
committer | Thomas Dinges <blender@dingto.org> | 2014-06-13 23:59:12 +0400 |
commit | cd5e1ff74e4f6443f3e4b836dd23fe46b56cb7ed (patch) | |
tree | 578ee132eab87d348147e49c91e1929660558c20 /intern/cycles/kernel/svm/svm_texture.h | |
parent | d0573ce9054e325c0ad2fbb943087e0f8b9e159a (diff) |
Cycles Refactor: Add SSE Utility code from Embree for cleaner SSE code.
This makes the code a bit easier to understand, and might come in handy
if we want to reuse more Embree code.
Differential Revision: https://developer.blender.org/D482
Code by Brecht, with fixes by Lockal, Sergey and myself.
Diffstat (limited to 'intern/cycles/kernel/svm/svm_texture.h')
-rw-r--r-- | intern/cycles/kernel/svm/svm_texture.h | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/intern/cycles/kernel/svm/svm_texture.h b/intern/cycles/kernel/svm/svm_texture.h index 5fd9204cbf6..d97c85db36a 100644 --- a/intern/cycles/kernel/svm/svm_texture.h +++ b/intern/cycles/kernel/svm/svm_texture.h @@ -140,15 +140,15 @@ ccl_device float voronoi_F1_distance(float3 p) } } #else - __m128 vec_p = load_m128(p); - __m128i xyzi = quick_floor_sse(vec_p); + ssef vec_p = load4f(p); + ssei xyzi = quick_floor_sse(vec_p); for (int xx = -1; xx <= 1; xx++) { for (int yy = -1; yy <= 1; yy++) { for (int zz = -1; zz <= 1; zz++) { - __m128 ip = _mm_cvtepi32_ps(_mm_add_epi32(xyzi, _mm_setr_epi32(xx, yy, zz, 0))); - __m128 vp = _mm_add_ps(ip, cellnoise_color(ip)); - float d = len_squared<1, 1, 1, 0>(_mm_sub_ps(vec_p, vp)); + ssef ip = ssef(xyzi + ssei(xx, yy, zz, 0)); + ssef vp = ip + cellnoise_color(ip); + float d = len_squared<1, 1, 1, 0>(vec_p - vp); da = min(d, da); } } @@ -184,15 +184,15 @@ ccl_device float3 voronoi_F1_color(float3 p) return cellnoise_color(pa); #else - __m128 pa, vec_p = load_m128(p); - __m128i xyzi = quick_floor_sse(vec_p); + ssef pa, vec_p = load4f(p); + ssei xyzi = quick_floor_sse(vec_p); for (int xx = -1; xx <= 1; xx++) { for (int yy = -1; yy <= 1; yy++) { for (int zz = -1; zz <= 1; zz++) { - __m128 ip = _mm_cvtepi32_ps(_mm_add_epi32(xyzi, _mm_setr_epi32(xx, yy, zz, 0))); - __m128 vp = _mm_add_ps(ip, cellnoise_color(ip)); - float d = len_squared<1, 1, 1, 0>(_mm_sub_ps(vec_p, vp)); + ssef ip = ssef(xyzi + ssei(xx, yy, zz, 0)); + ssef vp = ip + cellnoise_color(ip); + float d = len_squared<1, 1, 1, 0>(vec_p - vp); if(d < da) { da = d; @@ -202,7 +202,7 @@ ccl_device float3 voronoi_F1_color(float3 p) } } - __m128 color = cellnoise_color(pa); + ssef color = cellnoise_color(pa); return (float3 &)color; #endif } |