[Bf-blender-cvs] [bfa1f2d351a] temp-vulkan-shader: Add destructor and accessor for VKContext::mem_allocator_.
Jeroen Bakker
noreply at git.blender.org
Tue Nov 22 17:01:40 CET 2022
Commit: bfa1f2d351a2860c900d4353c193fd3cee7beb57
Author: Jeroen Bakker
Date: Tue Nov 22 14:22:46 2022 +0100
Branches: temp-vulkan-shader
https://developer.blender.org/rBbfa1f2d351a2860c900d4353c193fd3cee7beb57
Add destructor and accessor for VKContext::mem_allocator_.
===================================================================
M source/blender/gpu/vulkan/vk_context.cc
M source/blender/gpu/vulkan/vk_context.hh
===================================================================
diff --git a/source/blender/gpu/vulkan/vk_context.cc b/source/blender/gpu/vulkan/vk_context.cc
index dff6a3f1346..0bf2d29e124 100644
--- a/source/blender/gpu/vulkan/vk_context.cc
+++ b/source/blender/gpu/vulkan/vk_context.cc
@@ -34,6 +34,11 @@ VKContext::VKContext(void *ghost_window, void *ghost_context)
vmaCreateAllocator(&info, &mem_allocator_);
}
+VKContext::~VKContext()
+{
+ vmaDestroyAllocator(mem_allocator_);
+}
+
void VKContext::activate()
{
}
diff --git a/source/blender/gpu/vulkan/vk_context.hh b/source/blender/gpu/vulkan/vk_context.hh
index 05f4bba18cb..7c83548536d 100644
--- a/source/blender/gpu/vulkan/vk_context.hh
+++ b/source/blender/gpu/vulkan/vk_context.hh
@@ -27,11 +27,12 @@ class VKContext : public Context {
VkDevice device_ = VK_NULL_HANDLE;
uint32_t graphic_queue_familly_ = 0;
- /** Allocator used for texture and buffers. */
+ /** Allocator used for texture and buffers and other resources. */
VmaAllocator mem_allocator_ = VK_NULL_HANDLE;
public:
VKContext(void *ghost_window, void *ghost_context);
+ virtual ~VKContext();
void activate() override;
void deactivate() override;
@@ -45,6 +46,11 @@ class VKContext : public Context {
void debug_group_begin(const char *, int) override;
void debug_group_end() override;
+
+ VmaAllocator mem_allocator_get() const
+ {
+ return mem_allocator_;
+ }
};
} // namespace blender::gpu
\ No newline at end of file
More information about the Bf-blender-cvs
mailing list