diff options
author | Bastien Montagne <bastien@blender.org> | 2020-10-30 17:34:12 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-10-30 17:34:12 +0300 |
commit | aacdc3995886b4aad93044c4cec5e05f3dfc6cae (patch) | |
tree | 7d25f7a26fc886ee545255e262ea761fccd19a32 /source | |
parent | fc9ec1b9d80fb17d3cc5d3c63f8e4bb356fa7ebc (diff) | |
parent | 8b836f6894a375bee1fe6ffcd5f8ce609571ad9e (diff) |
Merge branch 'blender-v2.91-release' into master
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/lattice_deform.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/lattice_deform.c b/source/blender/blenkernel/intern/lattice_deform.c index ee69aaea815..14c600caa46 100644 --- a/source/blender/blenkernel/intern/lattice_deform.c +++ b/source/blender/blenkernel/intern/lattice_deform.c @@ -235,10 +235,16 @@ void BKE_lattice_deform_data_eval_co(LatticeDeformData *lattice_deform_data, #ifdef __SSE2__ { __m128 weight_vec = _mm_set1_ps(u); - /* This will load one extra element, this is ok because - * we ignore that part of register anyway. - */ - __m128 lattice_vec = _mm_loadu_ps(&latticedata[idx * 3]); + /* We need to address special case for last item to avoid accessing invalid memory. */ + __m128 lattice_vec; + if (idx * 3 == idx_w_max) { + copy_v3_v3((float *)&lattice_vec, &latticedata[idx * 3]); + } + else { + /* When not on last item, we can safely access one extra float, it will be ignored + * anyway. */ + lattice_vec = _mm_loadu_ps(&latticedata[idx * 3]); + } co_vec = _mm_add_ps(co_vec, _mm_mul_ps(lattice_vec, weight_vec)); } #else |