[Bf-blender-cvs] [df886b178c9] master: Moved alignment attributes from my last commit to BLI_compiler_attrs.h for future use.

Stefan Werner noreply at git.blender.org
Thu Nov 9 14:59:52 CET 2017


Commit: df886b178c9c176eefb73617c997f85e9d750c2d
Author: Stefan Werner
Date:   Thu Nov 9 14:59:31 2017 +0100
Branches: master
https://developer.blender.org/rBdf886b178c9c176eefb73617c997f85e9d750c2d

Moved alignment attributes from my last commit to BLI_compiler_attrs.h for future use.

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

M	source/blender/blenlib/BLI_compiler_attrs.h
M	source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
M	source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp

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

diff --git a/source/blender/blenlib/BLI_compiler_attrs.h b/source/blender/blenlib/BLI_compiler_attrs.h
index 4c548654e33..2b6baa0d67b 100644
--- a/source/blender/blenlib/BLI_compiler_attrs.h
+++ b/source/blender/blenlib/BLI_compiler_attrs.h
@@ -94,10 +94,16 @@
 
 /* Use to suppress '-Wimplicit-fallthrough' (in place of 'break'). */
 #if defined(__GNUC__) && (__GNUC__ >= 7)  /* gcc7.0+ only */
-#define ATTR_FALLTHROUGH __attribute__((fallthrough))
+#  define ATTR_FALLTHROUGH __attribute__((fallthrough))
 #else
-#define ATTR_FALLTHROUGH ((void)0)
+#  define ATTR_FALLTHROUGH ((void)0)
 #endif
 
+/* Declare the memory alignment in Bytes. */
+#if defined(_WIN32) && !defined(FREE_WINDOWS)
+#  define ATTR_ALIGN(x) __declspec(align(x))
+#else
+#  define ATTR_ALIGN(x) __attribute__((aligned(x)))
+#endif
 
 #endif  /* __BLI_COMPILER_ATTRS_H__ */
diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
index c413e94c173..4d05ece7ef0 100644
--- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
@@ -85,14 +85,7 @@ 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 ATTR_ALIGN(16) color_accum[4] = {0.0f, 0.0f, 0.0f, 0.0f};
 	float multiplier_accum = 0.0f;
 	MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
 	float *buffer = inputBuffer->getBuffer();
diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
index 5c8c6399981..3203914b5a7 100644
--- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
@@ -84,14 +84,7 @@ 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 ATTR_ALIGN(16) color_accum[4] = {0.0f, 0.0f, 0.0f, 0.0f};
 	float multiplier_accum = 0.0f;
 	MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
 	float *buffer = inputBuffer->getBuffer();



More information about the Bf-blender-cvs mailing list