diff --git a/Code/Framework/AzCore/AzCore/Math/Internal/SimdMathCommon_simd.inl b/Code/Framework/AzCore/AzCore/Math/Internal/SimdMathCommon_simd.inl index fc406f5862..b27abf120f 100644 --- a/Code/Framework/AzCore/AzCore/Math/Internal/SimdMathCommon_simd.inl +++ b/Code/Framework/AzCore/AzCore/Math/Internal/SimdMathCommon_simd.inl @@ -12,29 +12,29 @@ namespace AZ { namespace Simd { - static AZ_ALIGN(constexpr float g_sinCoef1[4], 16) = { -0.0001950727f, -0.0001950727f, -0.0001950727f, -0.0001950727f }; - static AZ_ALIGN(constexpr float g_sinCoef2[4], 16) = { 0.0083320758f, 0.0083320758f, 0.0083320758f, 0.0083320758f }; - static AZ_ALIGN(constexpr float g_sinCoef3[4], 16) = { -0.1666665247f, -0.1666665247f, -0.1666665247f, -0.1666665247f }; - static AZ_ALIGN(constexpr float g_cosCoef1[4], 16) = { -0.0013602249f, -0.0013602249f, -0.0013602249f, -0.0013602249f }; - static AZ_ALIGN(constexpr float g_cosCoef2[4], 16) = { 0.0416566950f, 0.0416566950f, 0.0416566950f, 0.0416566950f }; - static AZ_ALIGN(constexpr float g_cosCoef3[4], 16) = { -0.4999990225f, -0.4999990225f, -0.4999990225f, -0.4999990225f }; - static AZ_ALIGN(constexpr float g_acosHiCoef1[4], 16) = { -0.0012624911f, -0.0012624911f, -0.0012624911f, -0.0012624911f }; - static AZ_ALIGN(constexpr float g_acosHiCoef2[4], 16) = { 0.0066700901f, 0.0066700901f, 0.0066700901f, 0.0066700901f }; - static AZ_ALIGN(constexpr float g_acosHiCoef3[4], 16) = { -0.0170881256f, -0.0170881256f, -0.0170881256f, -0.0170881256f }; - static AZ_ALIGN(constexpr float g_acosHiCoef4[4], 16) = { 0.0308918810f, 0.0308918810f, 0.0308918810f, 0.0308918810f }; - static AZ_ALIGN(constexpr float g_acosLoCoef1[4], 16) = { -0.0501743046f, -0.0501743046f, -0.0501743046f, -0.0501743046f }; - static AZ_ALIGN(constexpr float g_acosLoCoef2[4], 16) = { 0.0889789874f, 0.0889789874f, 0.0889789874f, 0.0889789874f }; - static AZ_ALIGN(constexpr float g_acosLoCoef3[4], 16) = { -0.2145988016f, -0.2145988016f, -0.2145988016f, -0.2145988016f }; - static AZ_ALIGN(constexpr float g_acosLoCoef4[4], 16) = { 1.5707963050f, 1.5707963050f, 1.5707963050f, 1.5707963050f }; - static AZ_ALIGN(constexpr float g_acosCoef1[4], 16) = { -0.0200752200f, -0.0200752200f, -0.0200752200f, -0.0200752200f }; - static AZ_ALIGN(constexpr float g_acosCoef2[4], 16) = { 0.0759031500f, 0.0759031500f, 0.0759031500f, 0.0759031500f }; - static AZ_ALIGN(constexpr float g_acosCoef3[4], 16) = { -0.2126757000f, -0.2126757000f, -0.2126757000f, -0.2126757000f }; - static AZ_ALIGN(constexpr float g_atanHiRange[4], 16) = { 2.4142135624f, 2.4142135624f, 2.4142135624f, 2.4142135624f }; - static AZ_ALIGN(constexpr float g_atanLoRange[4], 16) = { 0.4142135624f, 0.4142135624f, 0.4142135624f, 0.4142135624f }; - static AZ_ALIGN(constexpr float g_atanCoef1[4], 16) = { 8.05374449538e-2f, 8.05374449538e-2f, 8.05374449538e-2f, 8.05374449538e-2f }; - static AZ_ALIGN(constexpr float g_atanCoef2[4], 16) = { -1.38776856032e-1f, -1.38776856032e-1f, -1.38776856032e-1f, -1.38776856032e-1f }; - static AZ_ALIGN(constexpr float g_atanCoef3[4], 16) = { 1.99777106478e-1f, 1.99777106478e-1f, 1.99777106478e-1f, 1.99777106478e-1f }; - static AZ_ALIGN(constexpr float g_atanCoef4[4], 16) = { -3.33329491539e-1f, -3.33329491539e-1f, -3.33329491539e-1f, -3.33329491539e-1f }; + alignas(16) static constexpr float g_sinCoef1[4] = { -0.0001950727f, -0.0001950727f, -0.0001950727f, -0.0001950727f }; + alignas(16) static constexpr float g_sinCoef2[4] = { 0.0083320758f, 0.0083320758f, 0.0083320758f, 0.0083320758f }; + alignas(16) static constexpr float g_sinCoef3[4] = { -0.1666665247f, -0.1666665247f, -0.1666665247f, -0.1666665247f }; + alignas(16) static constexpr float g_cosCoef1[4] = { -0.0013602249f, -0.0013602249f, -0.0013602249f, -0.0013602249f }; + alignas(16) static constexpr float g_cosCoef2[4] = { 0.0416566950f, 0.0416566950f, 0.0416566950f, 0.0416566950f }; + alignas(16) static constexpr float g_cosCoef3[4] = { -0.4999990225f, -0.4999990225f, -0.4999990225f, -0.4999990225f }; + alignas(16) static constexpr float g_acosHiCoef1[4] = { -0.0012624911f, -0.0012624911f, -0.0012624911f, -0.0012624911f }; + alignas(16) static constexpr float g_acosHiCoef2[4] = { 0.0066700901f, 0.0066700901f, 0.0066700901f, 0.0066700901f }; + alignas(16) static constexpr float g_acosHiCoef3[4] = { -0.0170881256f, -0.0170881256f, -0.0170881256f, -0.0170881256f }; + alignas(16) static constexpr float g_acosHiCoef4[4] = { 0.0308918810f, 0.0308918810f, 0.0308918810f, 0.0308918810f }; + alignas(16) static constexpr float g_acosLoCoef1[4] = { -0.0501743046f, -0.0501743046f, -0.0501743046f, -0.0501743046f }; + alignas(16) static constexpr float g_acosLoCoef2[4] = { 0.0889789874f, 0.0889789874f, 0.0889789874f, 0.0889789874f }; + alignas(16) static constexpr float g_acosLoCoef3[4] = { -0.2145988016f, -0.2145988016f, -0.2145988016f, -0.2145988016f }; + alignas(16) static constexpr float g_acosLoCoef4[4] = { 1.5707963050f, 1.5707963050f, 1.5707963050f, 1.5707963050f }; + alignas(16) static constexpr float g_acosCoef1[4] = { -0.0200752200f, -0.0200752200f, -0.0200752200f, -0.0200752200f }; + alignas(16) static constexpr float g_acosCoef2[4] = { 0.0759031500f, 0.0759031500f, 0.0759031500f, 0.0759031500f }; + alignas(16) static constexpr float g_acosCoef3[4] = { -0.2126757000f, -0.2126757000f, -0.2126757000f, -0.2126757000f }; + alignas(16) static constexpr float g_atanHiRange[4] = { 2.4142135624f, 2.4142135624f, 2.4142135624f, 2.4142135624f }; + alignas(16) static constexpr float g_atanLoRange[4] = { 0.4142135624f, 0.4142135624f, 0.4142135624f, 0.4142135624f }; + alignas(16) static constexpr float g_atanCoef1[4] = { 8.05374449538e-2f, 8.05374449538e-2f, 8.05374449538e-2f, 8.05374449538e-2f }; + alignas(16) static constexpr float g_atanCoef2[4] = { -1.38776856032e-1f, -1.38776856032e-1f, -1.38776856032e-1f, -1.38776856032e-1f }; + alignas(16) static constexpr float g_atanCoef3[4] = { 1.99777106478e-1f, 1.99777106478e-1f, 1.99777106478e-1f, 1.99777106478e-1f }; + alignas(16) static constexpr float g_atanCoef4[4] = { -3.33329491539e-1f, -3.33329491539e-1f, -3.33329491539e-1f, -3.33329491539e-1f }; namespace Common { diff --git a/Code/Framework/AzCore/AzCore/Math/SimdMath.h b/Code/Framework/AzCore/AzCore/Math/SimdMath.h index a1f073d10d..0c14ed1eaa 100644 --- a/Code/Framework/AzCore/AzCore/Math/SimdMath.h +++ b/Code/Framework/AzCore/AzCore/Math/SimdMath.h @@ -24,24 +24,24 @@ namespace AZ { namespace Simd { - static AZ_ALIGN(constexpr float g_vec1111[4], 16) = { 1.0f, 1.0f, 1.0f, 1.0f }; - static AZ_ALIGN(constexpr float g_vec1000[4], 16) = { 1.0f, 0.0f, 0.0f, 0.0f }; - static AZ_ALIGN(constexpr float g_vec0100[4], 16) = { 0.0f, 1.0f, 0.0f, 0.0f }; - static AZ_ALIGN(constexpr float g_vec0010[4], 16) = { 0.0f, 0.0f, 1.0f, 0.0f }; - static AZ_ALIGN(constexpr float g_vec0001[4], 16) = { 0.0f, 0.0f, 0.0f, 1.0f }; - static AZ_ALIGN(constexpr float g_Pi[4], 16) = { Constants::Pi, Constants::Pi, Constants::Pi, Constants::Pi }; - static AZ_ALIGN(constexpr float g_TwoPi[4], 16) = { Constants::TwoPi, Constants::TwoPi, Constants::TwoPi, Constants::TwoPi }; - static AZ_ALIGN(constexpr float g_HalfPi[4], 16) = { Constants::HalfPi, Constants::HalfPi, Constants::HalfPi, Constants::HalfPi }; - static AZ_ALIGN(constexpr float g_QuarterPi[4], 16) = { Constants::QuarterPi, Constants::QuarterPi, Constants::QuarterPi, Constants::QuarterPi }; - static AZ_ALIGN(constexpr float g_TwoOverPi[4], 16) = { Constants::TwoOverPi, Constants::TwoOverPi, Constants::TwoOverPi, Constants::TwoOverPi }; - static AZ_ALIGN(constexpr int32_t g_absMask[4], 16) = { (int32_t)0x7fffffff, (int32_t)0x7fffffff, (int32_t)0x7fffffff, (int32_t)0x7fffffff }; - static AZ_ALIGN(constexpr int32_t g_negateMask[4], 16) = { (int32_t)0x80000000, (int32_t)0x80000000, (int32_t)0x80000000, (int32_t)0x80000000 }; - static AZ_ALIGN(constexpr int32_t g_negateXMask[4], 16) = { (int32_t)0x80000000, (int32_t)0x00000000, (int32_t)0x00000000, (int32_t)0x00000000 }; - static AZ_ALIGN(constexpr int32_t g_negateYMask[4], 16) = { (int32_t)0x00000000, (int32_t)0x80000000, (int32_t)0x00000000, (int32_t)0x00000000 }; - static AZ_ALIGN(constexpr int32_t g_negateZMask[4], 16) = { (int32_t)0x00000000, (int32_t)0x00000000, (int32_t)0x80000000, (int32_t)0x00000000 }; - static AZ_ALIGN(constexpr int32_t g_negateWMask[4], 16) = { (int32_t)0x00000000, (int32_t)0x00000000, (int32_t)0x00000000, (int32_t)0x80000000 }; - static AZ_ALIGN(constexpr int32_t g_negateXYZMask[4], 16) = { (int32_t)0x80000000, (int32_t)0x80000000, (int32_t)0x80000000, (int32_t)0x00000000 }; - static AZ_ALIGN(constexpr int32_t g_wMask[4], 16) = { (int32_t)0xffffffff, (int32_t)0xffffffff, (int32_t)0xffffffff, (int32_t)0x00000000 }; + alignas(16) static constexpr float g_vec1111[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; + alignas(16) static constexpr float g_vec1000[4] = { 1.0f, 0.0f, 0.0f, 0.0f }; + alignas(16) static constexpr float g_vec0100[4] = { 0.0f, 1.0f, 0.0f, 0.0f }; + alignas(16) static constexpr float g_vec0010[4] = { 0.0f, 0.0f, 1.0f, 0.0f }; + alignas(16) static constexpr float g_vec0001[4] = { 0.0f, 0.0f, 0.0f, 1.0f }; + alignas(16) static constexpr float g_Pi[4] = { Constants::Pi, Constants::Pi, Constants::Pi, Constants::Pi }; + alignas(16) static constexpr float g_TwoPi[4] = { Constants::TwoPi, Constants::TwoPi, Constants::TwoPi, Constants::TwoPi }; + alignas(16) static constexpr float g_HalfPi[4] = { Constants::HalfPi, Constants::HalfPi, Constants::HalfPi, Constants::HalfPi }; + alignas(16) static constexpr float g_QuarterPi[4] = { Constants::QuarterPi, Constants::QuarterPi, Constants::QuarterPi, Constants::QuarterPi }; + alignas(16) static constexpr float g_TwoOverPi[4] = { Constants::TwoOverPi, Constants::TwoOverPi, Constants::TwoOverPi, Constants::TwoOverPi }; + alignas(16) static constexpr int32_t g_absMask[4] = { (int32_t)0x7fffffff, (int32_t)0x7fffffff, (int32_t)0x7fffffff, (int32_t)0x7fffffff }; + alignas(16) static constexpr int32_t g_negateMask[4] = { (int32_t)0x80000000, (int32_t)0x80000000, (int32_t)0x80000000, (int32_t)0x80000000 }; + alignas(16) static constexpr int32_t g_negateXMask[4] = { (int32_t)0x80000000, (int32_t)0x00000000, (int32_t)0x00000000, (int32_t)0x00000000 }; + alignas(16) static constexpr int32_t g_negateYMask[4] = { (int32_t)0x00000000, (int32_t)0x80000000, (int32_t)0x00000000, (int32_t)0x00000000 }; + alignas(16) static constexpr int32_t g_negateZMask[4] = { (int32_t)0x00000000, (int32_t)0x00000000, (int32_t)0x80000000, (int32_t)0x00000000 }; + alignas(16) static constexpr int32_t g_negateWMask[4] = { (int32_t)0x00000000, (int32_t)0x00000000, (int32_t)0x00000000, (int32_t)0x80000000 }; + alignas(16) static constexpr int32_t g_negateXYZMask[4] = { (int32_t)0x80000000, (int32_t)0x80000000, (int32_t)0x80000000, (int32_t)0x00000000 }; + alignas(16) static constexpr int32_t g_wMask[4] = { (int32_t)0xffffffff, (int32_t)0xffffffff, (int32_t)0xffffffff, (int32_t)0x00000000 }; } } diff --git a/Code/Framework/AzCore/AzCore/Math/Uuid.h b/Code/Framework/AzCore/AzCore/Math/Uuid.h index 13f60002ca..ea920e45c8 100644 --- a/Code/Framework/AzCore/AzCore/Math/Uuid.h +++ b/Code/Framework/AzCore/AzCore/Math/Uuid.h @@ -174,7 +174,7 @@ namespace AZ } // or _m128i and VMX ??? - AZ_ALIGN(unsigned char data[16], 16); + alignas(16) unsigned char data[16]; }; } // namespace AZ diff --git a/Code/Framework/AzCore/AzCore/PlatformDef.h b/Code/Framework/AzCore/AzCore/PlatformDef.h index 47f45931ba..8d28d27959 100644 --- a/Code/Framework/AzCore/AzCore/PlatformDef.h +++ b/Code/Framework/AzCore/AzCore/PlatformDef.h @@ -88,15 +88,6 @@ # define AZ_FORCE_INLINE __forceinline -/// Aligns a declaration. -# define AZ_ALIGN(_decl, _alignment) \ - AZ_PUSH_DISABLE_WARNING(4324, "-Wunknown-warning-option") \ - __declspec(align(_alignment)) \ - _decl \ - AZ_POP_DISABLE_WARNING - -/// Return the alignment of a type. This if for internal use only (use AZStd::alignment_of<>()) -# define AZ_INTERNAL_ALIGNMENT_OF(_type) __alignof(_type) /// Pointer will be aliased. # define AZ_MAY_ALIAS /// Function signature macro @@ -120,15 +111,7 @@ #define AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING # define AZ_FORCE_INLINE inline -/// Aligns a declaration. -# define AZ_ALIGN(_decl, _alignment) \ - AZ_PUSH_DISABLE_WARNING(4324, "-Wunknown-warning-option") \ - _decl \ - __attribute__((aligned(_alignment))) - AZ_POP_DISABLE_WARNING - -/// Return the alignment of a type. This if for internal use only (use AZStd::alignment_of<>()) -# define AZ_INTERNAL_ALIGNMENT_OF(_type) __alignof__(_type) + /// Pointer will be aliased. # define AZ_MAY_ALIAS __attribute__((__may_alias__)) /// Function signature macro diff --git a/Code/Framework/AzCore/AzCore/UnitTest/TestTypes.h b/Code/Framework/AzCore/AzCore/UnitTest/TestTypes.h index a7aa731c09..eb5011bbfa 100644 --- a/Code/Framework/AzCore/AzCore/UnitTest/TestTypes.h +++ b/Code/Framework/AzCore/AzCore/UnitTest/TestTypes.h @@ -162,7 +162,7 @@ namespace UnitTest struct CreationCounter { AZ_TYPE_INFO(CreationCounter, "{E9E35486-4366-4066-86E5-1A8CEB44198B}"); - AZ_ALIGN(int test[size / sizeof(int)], alignment); + alignas(alignment) int test[size / sizeof(int)]; static int s_count; static int s_copied; diff --git a/Code/Framework/AzCore/AzCore/std/any.h b/Code/Framework/AzCore/AzCore/std/any.h index c0e277c2d6..514f5a9c86 100644 --- a/Code/Framework/AzCore/AzCore/std/any.h +++ b/Code/Framework/AzCore/AzCore/std/any.h @@ -384,7 +384,7 @@ namespace AZStd */ union { - AZ_ALIGN(char m_buffer[Internal::ANY_SBO_BUF_SIZE], 32); // Used for objects smaller than SBO_BUF_SIZE + alignas(32) char m_buffer[Internal::ANY_SBO_BUF_SIZE]; // Used for objects smaller than SBO_BUF_SIZE void* m_pointer; // Pointer to large objects }; type_info m_typeInfo; diff --git a/Code/Framework/AzCore/AzCore/std/parallel/combinable.h b/Code/Framework/AzCore/AzCore/std/parallel/combinable.h index 89ba35b5a0..7d62a7b9ac 100644 --- a/Code/Framework/AzCore/AzCore/std/parallel/combinable.h +++ b/Code/Framework/AzCore/AzCore/std/parallel/combinable.h @@ -164,7 +164,7 @@ namespace AZStd //enough. struct Node { - AZ_ALIGN(T m_value, 64); //alignment to avoid cache line sharing + alignas(64) T m_value; //alignment to avoid cache line sharing thread::id m_threadId; Node* m_next; }; diff --git a/Code/Framework/AzCore/AzCore/std/parallel/containers/lock_free_stamped_queue.h b/Code/Framework/AzCore/AzCore/std/parallel/containers/lock_free_stamped_queue.h index 52fb9cccdf..26cb7f345a 100644 --- a/Code/Framework/AzCore/AzCore/std/parallel/containers/lock_free_stamped_queue.h +++ b/Code/Framework/AzCore/AzCore/std/parallel/containers/lock_free_stamped_queue.h @@ -21,7 +21,7 @@ namespace AZStd template struct lock_free_stamped_node_ptr { - AZ_ALIGN(struct lock_free_stamped_queue_node* m_node, 8); + alignas(8) struct lock_free_stamped_queue_node* m_node; unsigned int m_stamp; }; diff --git a/Code/Framework/AzCore/Platform/Windows/AzCore/Debug/StackTracer_Windows.cpp b/Code/Framework/AzCore/Platform/Windows/AzCore/Debug/StackTracer_Windows.cpp index c4a12730ad..f8f94ea2b3 100644 --- a/Code/Framework/AzCore/Platform/Windows/AzCore/Debug/StackTracer_Windows.cpp +++ b/Code/Framework/AzCore/Platform/Windows/AzCore/Debug/StackTracer_Windows.cpp @@ -1073,7 +1073,7 @@ cleanup: } HANDLE hThread = nativeThread; - AZ_ALIGN(CONTEXT context, 8); // Without this alignment the function randomly crashes in release. + CONTEXT alignas(8) context; // Without this alignment the function randomly crashes in release. context.ContextFlags = CONTEXT_ALL; GetThreadContext(hThread, &context); diff --git a/Code/Framework/AzCore/Tests/AZStd/UserTypes.h b/Code/Framework/AzCore/Tests/AZStd/UserTypes.h index 30e83d8f1c..1b8c210205 100644 --- a/Code/Framework/AzCore/Tests/AZStd/UserTypes.h +++ b/Code/Framework/AzCore/Tests/AZStd/UserTypes.h @@ -56,7 +56,7 @@ namespace UnitTestInternal } // We use this class on the stack often, so alignment more than 16 bytes will not work on all platforms. - AZ_ALIGN(int m_data, 16); + alignas(16) int m_data; bool m_isMoved; }; diff --git a/Code/Framework/AzCore/Tests/Memory.cpp b/Code/Framework/AzCore/Tests/Memory.cpp index e1bffc472b..ea6495755e 100644 --- a/Code/Framework/AzCore/Tests/Memory.cpp +++ b/Code/Framework/AzCore/Tests/Memory.cpp @@ -982,7 +982,7 @@ namespace UnitTest : m_data(data) {} ~MyClass() {} - AZ_ALIGN(int m_data, 32); + alignas(32) int m_data; }; // Explicitly doesn't have AZ_CLASS_ALLOCATOR class MyDerivedClass diff --git a/Code/Framework/AzCore/Tests/Outcome.cpp b/Code/Framework/AzCore/Tests/Outcome.cpp index a01f6915a4..ed3a56995f 100644 --- a/Code/Framework/AzCore/Tests/Outcome.cpp +++ b/Code/Framework/AzCore/Tests/Outcome.cpp @@ -86,7 +86,7 @@ namespace UnitTest struct Aligned16 { - AZ_ALIGN(char m_data, 16); + alignas(16) char m_data; }; //! Class that changes a value when it's created and destroyed. diff --git a/Code/Legacy/CryCommon/AndroidSpecific.h b/Code/Legacy/CryCommon/AndroidSpecific.h index cf4359ba47..cf63e58015 100644 --- a/Code/Legacy/CryCommon/AndroidSpecific.h +++ b/Code/Legacy/CryCommon/AndroidSpecific.h @@ -109,9 +109,6 @@ typedef unsigned char byte; #define INVALID_FILE_ATTRIBUTES (-1) -#define DEFINE_ALIGNED_DATA(type, name, alignment) \ - type __attribute__ ((aligned(alignment))) name; - #include "LinuxSpecific.h" // these functions do not exist int the wchar.h header #undef wscasecomp diff --git a/Code/Legacy/CryCommon/AppleSpecific.h b/Code/Legacy/CryCommon/AppleSpecific.h index cd3146403a..60ab80ade6 100644 --- a/Code/Legacy/CryCommon/AppleSpecific.h +++ b/Code/Legacy/CryCommon/AppleSpecific.h @@ -126,10 +126,6 @@ typedef uint8 byte; #define STDMETHODCALLTYPE #endif -#define _ALIGN(num) \ - __attribute__ ((aligned(num))) \ - AZ_POP_DISABLE_WARNING - #define _PACK __attribute__ ((packed)) // Safe memory freeing @@ -265,9 +261,6 @@ typedef union _LARGE_INTEGER #define INVALID_FILE_ATTRIBUTES (-1) -#define DEFINE_ALIGNED_DATA(type, name, alignment) \ - type __attribute__ ((aligned(alignment))) name; - #define BST_UNCHECKED 0x0000 #ifndef HRESULT_VALUES_DEFINED diff --git a/Code/Legacy/CryCommon/Cry_Camera.h b/Code/Legacy/CryCommon/Cry_Camera.h index 851611c8a6..d80a3d120c 100644 --- a/Code/Legacy/CryCommon/Cry_Camera.h +++ b/Code/Legacy/CryCommon/Cry_Camera.h @@ -2146,7 +2146,7 @@ inline uint8 CCamera::IsOBBVisible_EH(const Vec3& wpos, const OBB& obb, f32 usca //--- ADDITIONAL-TEST --- //------------------------------------------------------------------------------ -extern _MS_ALIGN(64) uint32 BoxSides[]; +alignas(64) extern uint32 BoxSides[]; // Description: // A box can easily straddle one of the view-frustum planes far diff --git a/Code/Legacy/CryCommon/Cry_Matrix33.h b/Code/Legacy/CryCommon/Cry_Matrix33.h index f6cdc43b59..075f07a896 100644 --- a/Code/Legacy/CryCommon/Cry_Matrix33.h +++ b/Code/Legacy/CryCommon/Cry_Matrix33.h @@ -1243,7 +1243,6 @@ struct Matrix33_tpl typedef Matrix33_tpl Matrix33; //always 32 bit typedef Matrix33_tpl Matrix33d; //always 64 bit typedef Matrix33_tpl Matrix33r; //variable float precision. depending on the target system it can be between 32, 64 or 80 bit -typedef _MS_ALIGN(16) Matrix33_tpl _ALIGN (16) Matrix33A; //---------------------------------------------------------------------------------- //---------------------------------------------------------------------------------- diff --git a/Code/Legacy/CryCommon/Cry_Matrix34.h b/Code/Legacy/CryCommon/Cry_Matrix34.h index 0cc0c02d5f..dfc059c11e 100644 --- a/Code/Legacy/CryCommon/Cry_Matrix34.h +++ b/Code/Legacy/CryCommon/Cry_Matrix34.h @@ -1224,7 +1224,11 @@ struct Matrix34_tpl typedef Matrix34_tpl Matrix34; //always 32 bit typedef Matrix34_tpl Matrix34d;//always 64 bit typedef Matrix34_tpl Matrix34r;//variable float precision. depending on the target system it can be between 32, 64 or bit -typedef _MS_ALIGN(16) Matrix34_tpl _ALIGN (16) Matrix34A; +#if AZ_COMPILER_MSVC + typedef __declspec(align(16)) Matrix34_tpl Matrix34A; +#elif AZ_COMPILER_CLANG + typedef Matrix34_tpl __attribute__((aligned(16))) Matrix34A; +#endif //---------------------------------------------------------------------------------- //---------------------------------------------------------------------------------- diff --git a/Code/Legacy/CryCommon/Cry_Matrix44.h b/Code/Legacy/CryCommon/Cry_Matrix44.h index cf0b790b0a..8304f7761e 100644 --- a/Code/Legacy/CryCommon/Cry_Matrix44.h +++ b/Code/Legacy/CryCommon/Cry_Matrix44.h @@ -666,7 +666,11 @@ struct Matrix44_tpl typedef Matrix44_tpl Matrix44; //always 32 bit typedef Matrix44_tpl Matrix44d; //always 64 bit typedef Matrix44_tpl Matrix44r; //variable float precision. depending on the target system it can be between 32, 64 or 80 bit -typedef _MS_ALIGN(16) Matrix44_tpl _ALIGN (16) Matrix44A; +#if AZ_COMPILER_MSVC + typedef __declspec(align(16)) Matrix44_tpl Matrix44A; +#elif AZ_COMPILER_CLANG + typedef Matrix44_tpl __attribute__((aligned(16))) Matrix44A; +#endif //---------------------------------------------------------------------------------- //---------------------------------------------------------------------------------- diff --git a/Code/Legacy/CryCommon/Cry_Quat.h b/Code/Legacy/CryCommon/Cry_Quat.h index 15b3c11334..b062c584b7 100644 --- a/Code/Legacy/CryCommon/Cry_Quat.h +++ b/Code/Legacy/CryCommon/Cry_Quat.h @@ -908,14 +908,6 @@ typedef Quat_tpl CryQuat; typedef Quat_tpl quaternionf; typedef Quat_tpl quaternion; -// alligned versions -#ifndef MAX_API_NUM -typedef DEFINE_ALIGNED_DATA (Quat, QuatA, 16); // typedef __declspec(align(16)) Quat_tpl CryQuatA; -typedef DEFINE_ALIGNED_DATA (Quatd, QuatrA, 32); // typedef __declspec(align(16)) Quat_tpl quaternionfA; -#endif - - - /*! * * The "inner product" or "dot product" operation. @@ -1425,11 +1417,6 @@ typedef QuatT_tpl QuatT; //always 32 bit typedef QuatT_tpl QuatTd;//always 64 bit typedef QuatT_tpl QuatTr;//variable float precision. depending on the target system it can be between 32, 64 or bit -// alligned versions -typedef DEFINE_ALIGNED_DATA (QuatT, QuatTA, 32); //wastest 4byte per quatT // typedef __declspec(align(16)) Quat_tpl QuatTA; -typedef DEFINE_ALIGNED_DATA (QuatTd, QuatTrA, 16); // typedef __declspec(align(16)) Quat_tpl QuatTrA; - - /*! * * Implements the multiplication operator: QuatT=Quatpos*Quat @@ -1711,10 +1698,6 @@ typedef QuatTS_tpl QuatTS; //always 64 bit typedef QuatTS_tpl QuatTSd;//always 64 bit typedef QuatTS_tpl QuatTSr;//variable float precision. depending on the target system it can be between 32, 64 or 80 bit -// alligned versions -typedef DEFINE_ALIGNED_DATA (QuatTS, QuatTSA, 16); // typedef __declspec(align(16)) Quat_tpl QuatTSA; -typedef DEFINE_ALIGNED_DATA (QuatTSd, QuatTSrA, 64); // typedef __declspec(align(16)) QuatTS_tpl QuatTSrA; - template ILINE QuatTS_tpl operator * (const QuatTS_tpl& a, const Quat_tpl& b) { @@ -1972,11 +1955,6 @@ typedef QuatTNS_tpl QuatTNS; typedef QuatTNS_tpl QuatTNSr; typedef QuatTNS_tpl QuatTNS_f64; -// alligned versions -typedef DEFINE_ALIGNED_DATA (QuatTNS, QuatTNSA, 16); -typedef DEFINE_ALIGNED_DATA (QuatTNSr, QuatTNSrA, 64); -typedef DEFINE_ALIGNED_DATA (QuatTNS_f64, QuatTNS_f64A, 64); - template ILINE QuatTNS_tpl operator * (const QuatTNS_tpl& a, const Quat_tpl& b) { diff --git a/Code/Legacy/CryCommon/IShader.h b/Code/Legacy/CryCommon/IShader.h index 6ae3bd73df..5f00eb56d3 100644 --- a/Code/Legacy/CryCommon/IShader.h +++ b/Code/Legacy/CryCommon/IShader.h @@ -753,7 +753,7 @@ struct SBending // Description: // Interface for the skinnable objects (renderer calls its functions to get the skinning data). // should only created by EF_CreateSkinningData -_MS_ALIGN(16) struct SSkinningData +struct alignas(16) SSkinningData { uint32 nNumBones; uint32 nHWSkinningFlags; @@ -768,9 +768,10 @@ _MS_ALIGN(16) struct SSkinningData // members below are for Software Skinning void* pCustomData; // client specific data, used for example for sw-skinning on animation side SSkinningData* pNextSkinningData; // List to the next element which needs SW-Skinning -} _ALIGN(16); + [[maybe_unused]] int m_padding[2]; // padding to avoid MSVC warning 4324 +}; -struct SRenderObjData +struct alignas(16) SRenderObjData { uintptr_t m_uniqueObjectId; @@ -837,7 +838,7 @@ struct SRenderObjData { AZ_UNUSED(pSizer); } -} _ALIGN(16); +}; ////////////////////////////////////////////////////////////////////// // Objects using in shader pipeline @@ -856,7 +857,7 @@ struct ShadowMapFrustum; /// It can be compiled into the platform specific efficient rendering compiled object. /// ////////////////////////////////////////////////////////////////////// -_MS_ALIGN(16) class CRenderObject +class alignas(16) CRenderObject { public: AZ_CLASS_ALLOCATOR(CRenderObject, AZ::LegacyAllocator, 0); @@ -929,6 +930,8 @@ public: PerInstanceConstantBufferKey m_PerInstanceConstantBufferKey; + [[maybe_unused]] int m_padding[1]; // padding to avoid MSVC warning 4324 + //! Embedded SRenderObjData, optional data carried by CRenderObject SRenderObjData m_data; @@ -1007,7 +1010,7 @@ protected: } friend class CRenderer; -} _ALIGN(16); +}; enum EResClassName { @@ -1200,8 +1203,8 @@ struct SEfTexModificator return false; } - _MS_ALIGN(16) Matrix44 m_TexGenMatrix _ALIGN(16); - _MS_ALIGN(16) Matrix44 m_TexMatrix _ALIGN(16); + alignas(16) Matrix44 m_TexGenMatrix; + alignas(16) Matrix44 m_TexMatrix; float m_Tiling[3]; float m_Offs[3]; diff --git a/Code/Legacy/CryCommon/Linux32Specific.h b/Code/Legacy/CryCommon/Linux32Specific.h index 6812ddb818..bb9931021b 100644 --- a/Code/Legacy/CryCommon/Linux32Specific.h +++ b/Code/Legacy/CryCommon/Linux32Specific.h @@ -91,9 +91,6 @@ typedef unsigned char byte; #define INVALID_FILE_ATTRIBUTES (-1) -#define DEFINE_ALIGNED_DATA(type, name, alignment) \ - type __attribute__ ((aligned(alignment))) name; - #include "LinuxSpecific.h" #define TARGET_DEFAULT_ALIGN (0x4U) diff --git a/Code/Legacy/CryCommon/Linux64Specific.h b/Code/Legacy/CryCommon/Linux64Specific.h index 4dcb5f1e84..07cb92f207 100644 --- a/Code/Legacy/CryCommon/Linux64Specific.h +++ b/Code/Legacy/CryCommon/Linux64Specific.h @@ -97,9 +97,6 @@ typedef uint8 byte; #define INVALID_FILE_ATTRIBUTES (-1) -#define DEFINE_ALIGNED_DATA(type, name, alignment) \ - type __attribute__ ((aligned(alignment))) name; - #include "LinuxSpecific.h" #define TARGET_DEFAULT_ALIGN (0x8U) diff --git a/Code/Legacy/CryCommon/LinuxSpecific.h b/Code/Legacy/CryCommon/LinuxSpecific.h index 17b465d4cb..b3e75476c9 100644 --- a/Code/Legacy/CryCommon/LinuxSpecific.h +++ b/Code/Legacy/CryCommon/LinuxSpecific.h @@ -83,10 +83,6 @@ typedef float FLOAT; #define STDMETHODCALLTYPE #endif -#define _ALIGN(num) \ - __attribute__ ((aligned(num))) \ - AZ_POP_DISABLE_WARNING - #define _PACK __attribute__ ((packed)) // Safe memory freeing diff --git a/Code/Legacy/CryCommon/Win32specific.h b/Code/Legacy/CryCommon/Win32specific.h index 62d32138b4..4fa116166b 100644 --- a/Code/Legacy/CryCommon/Win32specific.h +++ b/Code/Legacy/CryCommon/Win32specific.h @@ -101,12 +101,6 @@ int64 CryGetTicksPerSec(); } #endif -#define _MS_ALIGN(num) \ - AZ_PUSH_DISABLE_WARNING(4324, "-Wunknown-warning-option") \ - __declspec(align(num)) - -#define DEFINE_ALIGNED_DATA(type, name, alignment) _declspec(align(alignment)) type name; - #ifndef FILE_ATTRIBUTE_NORMAL #define FILE_ATTRIBUTE_NORMAL 0x00000080 #endif diff --git a/Code/Legacy/CryCommon/Win64specific.h b/Code/Legacy/CryCommon/Win64specific.h index 47c9c1aad9..e8c1b87f4d 100644 --- a/Code/Legacy/CryCommon/Win64specific.h +++ b/Code/Legacy/CryCommon/Win64specific.h @@ -84,12 +84,6 @@ int64 CryGetTicksPerSec(); } #endif -#define _MS_ALIGN(num) \ - AZ_PUSH_DISABLE_WARNING(4324, "-Wunknown-warning-option") \ - __declspec(align(num)) - -#define DEFINE_ALIGNED_DATA(type, name, alignment) _declspec(align(alignment)) type name; - #ifndef FILE_ATTRIBUTE_NORMAL #define FILE_ATTRIBUTE_NORMAL 0x00000080 #endif diff --git a/Code/Legacy/CryCommon/platform.h b/Code/Legacy/CryCommon/platform.h index 1b541a293e..3b80079c0f 100644 --- a/Code/Legacy/CryCommon/platform.h +++ b/Code/Legacy/CryCommon/platform.h @@ -372,16 +372,6 @@ threadID CryGetCurrentThreadId(); #define __PACKED #endif -// Fallback for Alignment macro of GCC/CLANG (must be after the class definition) -#if !defined(_ALIGN) - #define _ALIGN(num) AZ_POP_DISABLE_WARNING -#endif - -// Fallback for Alignment macro of MSVC (must be before the class definition) -#if !defined(_MS_ALIGN) - #define _MS_ALIGN(num) AZ_PUSH_DISABLE_WARNING(4324, "-Wunknown-warning-option") -#endif - #if defined(AZ_RESTRICTED_PLATFORM) #define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_13 #include AZ_RESTRICTED_FILE(platform_h) diff --git a/Code/Legacy/CryCommon/platform_impl.cpp b/Code/Legacy/CryCommon/platform_impl.cpp index ecc196a49f..168b5fd253 100644 --- a/Code/Legacy/CryCommon/platform_impl.cpp +++ b/Code/Legacy/CryCommon/platform_impl.cpp @@ -339,7 +339,7 @@ inline void CryDebugStr([[maybe_unused]] const char* format, ...) */ } -_MS_ALIGN(64) uint32 BoxSides[0x40 * 8] = { +alignas(64) uint32 BoxSides[0x40 * 8] = { 0, 0, 0, 0, 0, 0, 0, 0, //00 0, 4, 6, 2, 0, 0, 0, 4, //01 7, 5, 1, 3, 0, 0, 0, 4, //02 diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/Bits.h b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/Bits.h index 6659383c2f..c3972c829e 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/Bits.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/Bits.h @@ -279,28 +279,3 @@ namespace AZ }; } } - - -// Emits an error when padding is introduced into a struct. -#if defined (AZ_COMPILER_MSVC) - -#define AZ_ASSERT_NO_ALIGNMENT_PADDING_BEGIN \ - __pragma(warning(push)) \ - __pragma(warning(error : 4820)) - -#define AZ_ASSERT_NO_ALIGNMENT_PADDING_END \ - __pragma(warning(pop)) - -#elif defined (AZ_COMPILER_CLANG) || defined (AZ_COMPILER_GCC) - -#define AZ_ASSERT_NO_ALIGNMENT_PADDING_BEGIN \ - _Pragma("GCC diagnostic push") \ - _Pragma("GCC diagnostic error \"-Wpadded\"") - -#define AZ_ASSERT_NO_ALIGNMENT_PADDING_END \ - _Pragma("GCC diagnostic pop") - -#else -#define AZ_ASSERT_NO_ALIGNMENT_PADDING_BEGIN -#define AZ_ASSERT_NO_ALIGNMENT_PADDING_END -#endif diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/BufferDescriptor.h b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/BufferDescriptor.h index 80c41bec25..c271045ed0 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/BufferDescriptor.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/BufferDescriptor.h @@ -67,8 +67,6 @@ namespace AZ BufferBindFlags GetBufferBindFlags(ScopeAttachmentUsage usage, ScopeAttachmentAccess access); - AZ_ASSERT_NO_ALIGNMENT_PADDING_BEGIN - /** * A buffer corresponds to a region of linear memory and used for rendering operations. * Its lifecycle is managed by buffer pools. @@ -103,8 +101,6 @@ namespace AZ /// The mask of queue classes supporting shared access of this resource. HardwareQueueClassMask m_sharedQueueMask = HardwareQueueClassMask::All; }; - - AZ_ASSERT_NO_ALIGNMENT_PADDING_END } diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/BufferViewDescriptor.h b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/BufferViewDescriptor.h index 887cbcb9bb..3aadc8e7db 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/BufferViewDescriptor.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/BufferViewDescriptor.h @@ -19,8 +19,6 @@ namespace AZ namespace RHI { - AZ_ASSERT_NO_ALIGNMENT_PADDING_BEGIN - //! Buffer views describe how to interpret a region of memory in a buffer. struct BufferViewDescriptor { @@ -85,7 +83,5 @@ namespace AZ // manual alignment padding char m_pad0 = 0, m_pad1 = 0, m_pad2 = 0; }; - - AZ_ASSERT_NO_ALIGNMENT_PADDING_END } } diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/ImageDescriptor.h b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/ImageDescriptor.h index 17fb5e9207..a90d52ac21 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/ImageDescriptor.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/ImageDescriptor.h @@ -21,8 +21,6 @@ namespace AZ { ImageBindFlags GetImageBindFlags(ScopeAttachmentUsage usage, ScopeAttachmentAccess access); - AZ_ASSERT_NO_ALIGNMENT_PADDING_BEGIN - /** * Images are comprised of sub-resources corresponding to the number of mip-mip levels * and array slices. Image data is stored as pixels in opaque swizzled formats. Images @@ -111,8 +109,6 @@ namespace AZ uint32_t m_isCubemap = 0; }; - AZ_ASSERT_NO_ALIGNMENT_PADDING_END - /// Returns whether mip 'A' is more detailed than mip 'B'. inline bool IsMipMoreDetailedThan(uint32_t mipA, uint32_t mipB) { diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/ImageViewDescriptor.h b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/ImageViewDescriptor.h index cb0682e967..c9ca1856f3 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/ImageViewDescriptor.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/ImageViewDescriptor.h @@ -20,8 +20,6 @@ namespace AZ namespace RHI { - AZ_ASSERT_NO_ALIGNMENT_PADDING_BEGIN - /** * Image views map to a range of mips / array slices in an image. */ @@ -124,7 +122,5 @@ namespace AZ /// This is needed because a texture array can have 1 layer only. uint32_t m_isArray = 0; }; - - AZ_ASSERT_NO_ALIGNMENT_PADDING_END } } diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/IndirectBufferLayout.h b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/IndirectBufferLayout.h index 0cde499546..fd26d845f7 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/IndirectBufferLayout.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/IndirectBufferLayout.h @@ -42,8 +42,6 @@ namespace AZ AZ_DEFINE_ENUM_BITWISE_OPERATORS(AZ::RHI::IndirectCommandTiers); - AZ_ASSERT_NO_ALIGNMENT_PADDING_BEGIN - //! Arguments when setting an indirect Vertex Buffer View command. struct IndirectBufferViewArguments { @@ -84,8 +82,6 @@ namespace AZ IndirectBufferViewArguments m_vertexBufferArgs; }; - AZ_ASSERT_NO_ALIGNMENT_PADDING_END - AZ_FORCE_INLINE bool operator==(const IndirectCommandDescriptor& lhs, const IndirectCommandDescriptor& rhs) { return diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/MultisampleState.h b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/MultisampleState.h index 1c4979b773..689e23562d 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/MultisampleState.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/MultisampleState.h @@ -19,8 +19,6 @@ namespace AZ namespace RHI { - AZ_ASSERT_NO_ALIGNMENT_PADDING_BEGIN - // Defines a custom sample position when doing Multisample rendering. // Sample positions have the origin(0, 0) at the pixel top left. // Each of the X and Y coordinates are unsigned values in the range 0 (top / left) to Limits::Pipeline::MultiSampleCustomLocationGridSize - 1 (bottom / right). @@ -56,7 +54,5 @@ namespace AZ uint16_t m_samples = 1; uint16_t m_quality = 0; }; - - AZ_ASSERT_NO_ALIGNMENT_PADDING_END } } diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/PipelineLayoutDescriptor.h b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/PipelineLayoutDescriptor.h index 31fcd9be10..216021a316 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/PipelineLayoutDescriptor.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/PipelineLayoutDescriptor.h @@ -22,7 +22,6 @@ namespace AZ { namespace RHI { - AZ_ASSERT_NO_ALIGNMENT_PADDING_BEGIN struct ResourceBindingInfo { AZ_TYPE_INFO(ResourceBindingInfo, "{2B25FA97-21C2-4567-8F01-6A64F7B9DFF6}"); @@ -45,7 +44,6 @@ namespace AZ /// Register id of a resource. Register m_registerId = InvalidRegister; }; - AZ_ASSERT_NO_ALIGNMENT_PADDING_END /** * This class describes binding information about the Shader Resource Group diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/RenderAttachmentLayout.h b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/RenderAttachmentLayout.h index 6bbf013261..9a3c3dd226 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/RenderAttachmentLayout.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/RenderAttachmentLayout.h @@ -23,7 +23,6 @@ namespace AZ { static const uint32_t InvalidRenderAttachmentIndex = Limits::Pipeline::RenderAttachmentCountMax; - AZ_ASSERT_NO_ALIGNMENT_PADDING_BEGIN //! Describes one render attachment that is part of a layout. struct RenderAttachmentDescriptor { @@ -91,7 +90,6 @@ namespace AZ //! List with the layout of each subpass. AZStd::array m_subpassLayouts; }; - AZ_ASSERT_NO_ALIGNMENT_PADDING_END //! Describes the layout of a collection of subpasses and it defines which of the subpasses this //! configuration will be using. diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/RenderStates.h b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/RenderStates.h index d56e3e3fd5..ae2141a1e8 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/RenderStates.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/RenderStates.h @@ -82,8 +82,6 @@ namespace AZ void ReflectRenderStateEnums(ReflectContext* context); - AZ_ASSERT_NO_ALIGNMENT_PADDING_BEGIN - struct RasterState { AZ_TYPE_INFO(RasterState, "{57D4BE50-EBE2-4ABE-90A4-C99BF2EA43FB}"); @@ -216,8 +214,6 @@ namespace AZ static constexpr int32_t RenderStates_InvalidInt = std::numeric_limits::max(); static constexpr float RenderStates_InvalidFloat = std::numeric_limits::max(); - AZ_ASSERT_NO_ALIGNMENT_PADDING_END - //! Merges any render states in stateToMerge into the result state object. //! The values in stateToMerge are only copied over into the result if they are //! not invalid (see also GetInvalidState below). diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/SamplerState.h b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/SamplerState.h index 46cc8525f3..2771d23495 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/SamplerState.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/SamplerState.h @@ -70,8 +70,6 @@ namespace AZ void ReflectSamplerStateEnums(ReflectContext* context); - AZ_ASSERT_NO_ALIGNMENT_PADDING_BEGIN - class SamplerState { public: @@ -107,8 +105,6 @@ namespace AZ float m_mipLodBias = 0.0f; BorderColor m_borderColor = BorderColor::TransparentBlack; }; - - AZ_ASSERT_NO_ALIGNMENT_PADDING_END } AZ_TYPE_INFO_SPECIALIZE(RHI::FilterMode, "{CFAE2156-0293-4D71-87D5-68F5C9F98884}"); diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI/IndexBufferView.h b/Gems/Atom/RHI/Code/Include/Atom/RHI/IndexBufferView.h index 7219709109..5e2b244627 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI/IndexBufferView.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI/IndexBufferView.h @@ -24,8 +24,6 @@ namespace AZ uint32_t GetIndexFormatSize(IndexFormat indexFormat); - AZ_ASSERT_NO_ALIGNMENT_PADDING_BEGIN - class IndexBufferView { public: @@ -61,7 +59,5 @@ namespace AZ // Padding the size so it's 8 bytes aligned uint32_t m_pad = 0; }; - - AZ_ASSERT_NO_ALIGNMENT_PADDING_END } } diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI/IndirectBufferView.h b/Gems/Atom/RHI/Code/Include/Atom/RHI/IndirectBufferView.h index 7014fd030c..aabb329434 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI/IndirectBufferView.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI/IndirectBufferView.h @@ -17,8 +17,6 @@ namespace AZ class Buffer; class IndirectBufferSignature; - AZ_ASSERT_NO_ALIGNMENT_PADDING_BEGIN - //! Provides a view into a buffer, to be used as an indirect buffer. The content of the view is a contiguous //! list of commands sequences. It is provided to the RHI back-end at draw time. class IndirectBufferView @@ -62,7 +60,5 @@ namespace AZ // Padding the size so it's 8 bytes aligned uint32_t m_pad = 0; }; - - AZ_ASSERT_NO_ALIGNMENT_PADDING_END } } diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI/StreamBufferView.h b/Gems/Atom/RHI/Code/Include/Atom/RHI/StreamBufferView.h index 9c9a16e8df..df62cb84f8 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI/StreamBufferView.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI/StreamBufferView.h @@ -18,8 +18,6 @@ namespace AZ class Buffer; class InputStreamLayout; - AZ_ASSERT_NO_ALIGNMENT_PADDING_BEGIN - /** * Provides a view into a buffer, to be used as vertex stream. The content of the view is a contiguous * list of input vertex data. It is provided to the RHI back-end at draw time. @@ -68,8 +66,6 @@ namespace AZ uint32_t m_pad = 0; }; - AZ_ASSERT_NO_ALIGNMENT_PADDING_END - /// Utility function for checking that the set of StreamBufferViews aligns with the InputStreamLayout bool ValidateStreamBufferViews(const InputStreamLayout& inputStreamLayout, AZStd::array_view streamBufferViews); } diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/ImagePoolResolver.h b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/ImagePoolResolver.h index d8c1b9378a..c93aa29988 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/ImagePoolResolver.h +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/ImagePoolResolver.h @@ -58,7 +58,6 @@ namespace AZ RHI::Origin m_offset; }; - AZ_ASSERT_NO_ALIGNMENT_PADDING_BEGIN struct BarrierInfo { VkPipelineStageFlags m_srcStageMask = {}; @@ -67,7 +66,6 @@ namespace AZ bool operator==(const BarrierInfo& other) { return ::memcmp(this, &other, sizeof(BarrierInfo)) == 0; } }; - AZ_ASSERT_NO_ALIGNMENT_PADDING_END void EmmitBarriers(CommandList& commandList, const AZStd::vector& barriers) const; diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Queue.h b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Queue.h index 2c3a8ee2cc..5bf831eff5 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Queue.h +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Queue.h @@ -23,7 +23,6 @@ namespace AZ class SwapChain; class Fence; - AZ_ASSERT_NO_ALIGNMENT_PADDING_BEGIN struct QueueId { uint32_t m_familyIndex = 0; @@ -32,7 +31,6 @@ namespace AZ bool operator==(const QueueId& other) const { return ::memcmp(this, &other, sizeof(other)) == 0; } bool operator!=(const QueueId& other) const { return !(*this == other); } }; - AZ_ASSERT_NO_ALIGNMENT_PADDING_END class Queue final : public RHI::DeviceObject diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/RenderPass.h b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/RenderPass.h index 3cc2ff3ba7..8aaef51bd0 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/RenderPass.h +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/RenderPass.h @@ -38,8 +38,6 @@ namespace AZ ~RenderPass() = default; static RHI::Ptr Create(); - AZ_ASSERT_NO_ALIGNMENT_PADDING_BEGIN - enum class AttachmentType : uint32_t { Color, // Color render target attachment @@ -98,8 +96,6 @@ namespace AZ SubpassAttachment m_depthStencilAttachment; }; - AZ_ASSERT_NO_ALIGNMENT_PADDING_END - struct Descriptor { size_t GetHash() const; diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MorphTargetStandard.h b/Gems/EMotionFX/Code/EMotionFX/Source/MorphTargetStandard.h index c4187fd638..8737da7139 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MorphTargetStandard.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MorphTargetStandard.h @@ -98,15 +98,14 @@ namespace EMotionFX * Please keep in mind that the rotation is stored as non-delta value, while the position and scale are * stored as delta values. */ - struct EMFX_API MCORE_ALIGN_PRE(16) Transformation + struct EMFX_API alignas(16) Transformation { AZ::Quaternion m_rotation; /**< The rotation as absolute value. So not a delta value, but a target (absolute) rotation. */ AZ::Quaternion m_scaleRotation; /**< The scale rotation, as absolute value. */ AZ::Vector3 m_position; /**< The position as a delta, so the difference between the original and target position. */ AZ::Vector3 m_scale; /**< The scale as a delta, so the difference between the original and target scale. */ size_t m_nodeIndex; /**< The node number to apply this on. */ - } - MCORE_ALIGN_POST(16); + }; /** * The constructor. diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Transform.h b/Gems/EMotionFX/Code/EMotionFX/Source/Transform.h index 764de9e8f9..cb1489410d 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Transform.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Transform.h @@ -20,7 +20,7 @@ namespace EMotionFX enum EMotionExtractionFlags : uint8; - class EMFX_API MCORE_ALIGN_PRE(16) Transform + class EMFX_API alignas(16) Transform { MCORE_MEMORYOBJECTCATEGORY(Transform, MCore::MCORE_SIMD_ALIGNMENT, EMFX_MEMCATEGORY_TRANSFORM); @@ -142,6 +142,5 @@ namespace EMotionFX #ifndef EMFX_SCALE_DISABLED AZ::Vector3 m_scale; /**< The scale. */ #endif - } - MCORE_ALIGN_POST(16); + }; } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/MCore/Source/Config.h b/Gems/EMotionFX/Code/MCore/Source/Config.h index c753a45ec3..8367e0d4e2 100644 --- a/Gems/EMotionFX/Code/MCore/Source/Config.h +++ b/Gems/EMotionFX/Code/MCore/Source/Config.h @@ -217,22 +217,6 @@ typedef uintptr_t uintPointer; #define NULL 0 #endif -// alignment macro -#if (MCORE_COMPILER == MCORE_COMPILER_MSVC || MCORE_COMPILER == MCORE_COMPILER_INTELC) - #define MCORE_ALIGN(NUMBYTES, X) __declspec(align(NUMBYTES)) X - #define MCORE_ALIGN_PRE(NUMBYTES) __declspec(align(NUMBYTES)) - #define MCORE_ALIGN_POST(NUMBYTES) -#elif (MCORE_COMPILER == MCORE_COMPILER_GCC) - #define MCORE_ALIGN(NUMBYTES, X) X __attribute__((aligned(NUMBYTES))) - #define MCORE_ALIGN_PRE(NUMBYTES) - #define MCORE_ALIGN_POST(NUMBYTES) __attribute__((aligned(NUMBYTES))) -#else - #define MCORE_ALIGN(NUMBYTES, X) X - #define MCORE_ALIGN_PRE(NUMBYTES) - #define MCORE_ALIGN_POST(NUMBYTES) -#endif - - // detect and enable OpenMP support #if defined(_OPENMP) #define MCORE_OPENMP_ENABLED diff --git a/Gems/EMotionFX/Code/MCore/Source/Matrix4.h b/Gems/EMotionFX/Code/MCore/Source/Matrix4.h index c136aa824e..5d6da79bf5 100644 --- a/Gems/EMotionFX/Code/MCore/Source/Matrix4.h +++ b/Gems/EMotionFX/Code/MCore/Source/Matrix4.h @@ -69,8 +69,7 @@ namespace MCore * [Tx Ty Tz 1] // translation
* */ - MCORE_ALIGN_PRE(16) - class MCORE_API Matrix + class MCORE_API alignas(16) Matrix { public: /** @@ -910,7 +909,7 @@ namespace MCore float m_m16[16]; // 16 floats as 1D array float m44[4][4]; // as 2D array }; - } MCORE_ALIGN_POST(16); + }; // include inline code diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Data/BehaviorContextObject.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Data/BehaviorContextObject.h index ca4500eccc..47e2dc472b 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Data/BehaviorContextObject.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Data/BehaviorContextObject.h @@ -268,7 +268,7 @@ namespace ScriptCanvas AZ_INLINE BehaviorContextObject* BehaviorContextObject::CreateDefaultBuffer(const AZ::BehaviorClass& behaviorClass) { - AZ_ALIGN(char buffer[AZStd::Internal::ANY_SBO_BUF_SIZE], 32); + alignas(32) char buffer[AZStd::Internal::ANY_SBO_BUF_SIZE]; AZ::BehaviorObject object = InvokeConstructor(behaviorClass, AZStd::addressof(buffer)); auto bco = aznew BehaviorContextObject(object.m_address, GetAnyTypeInfoObject(behaviorClass), Owned); behaviorClass.m_destructor(object.m_address, behaviorClass.m_userData);