From d9a45952992bfa3aa55b49d99be1b07a5f3d67aa Mon Sep 17 00:00:00 2001 From: spencer-lunarg Date: Thu, 31 Oct 2024 09:15:45 -0400 Subject: [PATCH] tests: Fix alignment for testICD --- tests/icd/test_icd.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/icd/test_icd.cpp b/tests/icd/test_icd.cpp index 61bb2cab9d7..95cb9727607 100644 --- a/tests/icd/test_icd.cpp +++ b/tests/icd/test_icd.cpp @@ -632,7 +632,16 @@ static VKAPI_ATTR VkResult VKAPI_CALL MapMemory(VkDevice device, VkDeviceMemory else size = 0x10000; } - void* map_addr = malloc((size_t)size); + + // https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/8776 + // things like shaderGroupBaseAlignment can be as big as 64, since these values are dynamically set in the Profile JSON, we need + // to create the large alignment possible to satisfy them all + static const size_t memory_alignment = 64; +#if defined(_WIN32) + void* map_addr = _aligned_malloc((size_t)size, memory_alignment); +#else + void* map_addr = aligned_alloc(memory_alignment, (size_t)size); +#endif mapped_memory_map[memory].push_back(map_addr); *ppData = map_addr; return VK_SUCCESS;