Skip to content

Commit 764daa2

Browse files
authored
fix: fix VMA crash caused by null VkInstance
1 parent cd1ea68 commit 764daa2

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

deps/VulkanMemoryAllocator/vk_mem_alloc.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3999,7 +3999,8 @@ VMA_CALL_PRE void VMA_CALL_POST vmaDestroyImage(
39993999
#endif // AMD_VULKAN_MEMORY_ALLOCATOR_H
40004000

40014001
// For Visual Studio IntelliSense.
4002-
#if defined(__cplusplus) && defined(__INTELLISENSE__)
4002+
//Planted directly from miniaudio.
4003+
#if defined(Q_CREATOR_RUN) || defined(__INTELLISENSE__) || defined(__CDT_PARSER__)
40034004
#define VMA_IMPLEMENTATION
40044005
#endif
40054006

src/misc/memalloc_backends/backend_vma.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "wrappers/device.h"
2626
#include "wrappers/memory_block.h"
2727
#include "wrappers/physical_device.h"
28+
#include "wrappers/instance.h"
2829

2930
/* Inject Vulkan Memory Allocator impl (ignore any warnings reported for the library) ==> */
3031
#define VMA_IMPLEMENTATION
@@ -175,6 +176,9 @@ bool Anvil::MemoryAllocatorBackends::VMA::VMAAllocator::init()
175176
create_info.preferredLargeHeapBlockSize = 0;
176177
create_info.pVulkanFunctions = m_vma_func_ptrs.get();
177178

179+
//Ideally we need user to supply this.
180+
create_info.instance = m_device_ptr->get_parent_instance()->get_instance_vk();
181+
178182
result = vmaCreateAllocator(&create_info,
179183
&m_allocator);
180184

0 commit comments

Comments
 (0)