From 338eecd9e687815a56bca750a3f830e22a944976 Mon Sep 17 00:00:00 2001 From: moraaar Date: Tue, 18 Jan 2022 16:00:28 +0000 Subject: [PATCH] Blast memory allocator must allocate with 16 byte aligment (#6968) From Blast allocator documentation "Allocates size bytes of memory, which must be 16-byte aligned." https://gameworksdocs.nvidia.com/Blast/1.1/api_docs/files/class_nv_1_1_blast_1_1_allocator_callback.html Fixes #5162 Signed-off-by: moraaar moraaar@amazon.com --- Gems/Blast/Code/Source/Components/BlastSystemComponent.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Gems/Blast/Code/Source/Components/BlastSystemComponent.h b/Gems/Blast/Code/Source/Components/BlastSystemComponent.h index 8f6c200870..a3d4b200bc 100644 --- a/Gems/Blast/Code/Source/Components/BlastSystemComponent.h +++ b/Gems/Blast/Code/Source/Components/BlastSystemComponent.h @@ -100,11 +100,14 @@ namespace Blast class AZBlastAllocatorCallback : public Nv::Blast::AllocatorCallback { public: + // Blast requires 16-byte alignment + static const size_t alignment = 16; + void* allocate( size_t size, const char* typeName, [[maybe_unused]] const char* filename, [[maybe_unused]] int line) override { - return azmalloc_4(size, 0, AZ::SystemAllocator, typeName); + return azmalloc_4(size, alignment, AZ::SystemAllocator, typeName); } void deallocate(void* ptr) override