[Bf-blender-cvs] [83d9f8e3796] master: Compositor: Ensured 16 byte alignment for variables accessed by SSE instructions.

Stefan Werner noreply at git.blender.org
Thu Nov 9 14:38:19 CET 2017


Commit: 83d9f8e37963e622fbd7d8c0902d077b67618f7b
Author: Stefan Werner
Date:   Thu Nov 9 14:38:17 2017 +0100
Branches: master
https://developer.blender.org/rB83d9f8e37963e622fbd7d8c0902d077b67618f7b

Compositor: Ensured 16 byte alignment for variables accessed by SSE instructions.

Before this patch, the XBlur/YBlur compositor nodes would crash for me when run in a MSVC 2015 debug build (test scene: BMW27_cpu). I added the compiler instructions to explicitly align the local variables that the SSE instructions are accessing.

===================================================================

M	source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
M	source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp

===================================================================

diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
index 29ed4334412..c413e94c173 100644
--- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
@@ -85,6 +85,13 @@ void GaussianXBlurOperation::updateGauss()
 
 void GaussianXBlurOperation::executePixel(float output[4], int x, int y, void *data)
 {
+#ifdef __SSE2__
+#  if defined(_WIN32) && !defined(FREE_WINDOWS)
+    __declspec(align(16))
+#  else
+    __attribute__((aligned(16)))
+#  endif
+#endif
 	float color_accum[4] = {0.0f, 0.0f, 0.0f, 0.0f};
 	float multiplier_accum = 0.0f;
 	MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
index 4b55333c08c..5c8c6399981 100644
--- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
@@ -84,6 +84,13 @@ void GaussianYBlurOperation::updateGauss()
 
 void GaussianYBlurOperation::executePixel(float output[4], int x, int y, void *data)
 {
+#ifdef __SSE2__
+#  if defined(_WIN32) && !defined(FREE_WINDOWS)
+    __declspec(align(16))
+#  else
+    __attribute__((aligned(16)))
+#  endif
+#endif
 	float color_accum[4] = {0.0f, 0.0f, 0.0f, 0.0f};
 	float multiplier_accum = 0.0f;
 	MemoryBuffer *inputBuffer = (MemoryBuffer *)data;



More information about the Bf-blender-cvs mailing list