From c5b7f0e6000fd61a920a69d4983624ae105a644b Mon Sep 17 00:00:00 2001 From: Jean-Philippe Bruyère Date: Thu, 22 Oct 2026 00:36:55 +0200 Subject: don't recreate allocattor on dev import if exists --- src/vkh_device.c | 6 ++++-- src/vkh_device.h | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/vkh_device.c b/src/vkh_device.c index 8849a55..8659ef3 100644 --- a/src/vkh_device.c +++ b/src/vkh_device.c @@ -48,8 +48,10 @@ VkhDevice vkh_device_import(VkInstance inst, VkPhysicalDevice phy, VkDevice vkDe vkGetPhysicalDeviceMemoryProperties(phy, &dev->phyMemProps); #ifdef VKH_USE_VMA - VmaAllocatorCreateInfo allocatorInfo = {.physicalDevice = phy, .device = vkDev}; - vmaCreateAllocator(&allocatorInfo, &dev->allocator); + if (!dev->allocator) { + VmaAllocatorCreateInfo allocatorInfo = {.physicalDevice = phy, .device = vkDev}; + vmaCreateAllocator(&allocatorInfo, &dev->allocator); + } #else #endif diff --git a/src/vkh_device.h b/src/vkh_device.h index 16c449a..1340bdf 100644 --- a/src/vkh_device.h +++ b/src/vkh_device.h @@ -33,15 +33,15 @@ extern "C" { #endif typedef struct _vkh_device_t { + VkResult status; VkDevice dev; - VkPhysicalDeviceMemoryProperties phyMemProps; VkPhysicalDevice phy; VkInstance instance; + VkPhysicalDeviceMemoryProperties phyMemProps; #ifdef VKH_USE_VMA VmaAllocator allocator; #endif VkhApp vkhApplication; - VkResult status; } vkh_device_t; #ifdef __cplusplus -- cgit v1.3.1-4-g156e