Make vk_allocator a singleton

This commit is contained in:
Patrick Nicolas
2024-02-07 18:25:54 +01:00
parent 595d27f8dc
commit df394ec079
15 changed files with 163 additions and 96 deletions
+4 -10
View File
@@ -34,7 +34,7 @@
#include <openxr/openxr.h>
#include <openxr/openxr_platform.h>
#include <openxr/openxr_reflection.h>
#include "vk_mem_alloc.h"
#include "vk/vk_allocator.h"
#include "utils/singleton.h"
#include <glm/glm.hpp>
#include <glm/gtc/quaternion.hpp>
@@ -90,6 +90,9 @@ class application : public singleton<application>
vk::raii::CommandPool vk_cmdpool = nullptr;
vk::raii::PipelineCache pipeline_cache = nullptr;
// Vulkan memory allocator stuff
std::optional<vk_allocator> allocator;
// OpenXR stuff
void initialize_actions();
@@ -107,10 +110,6 @@ class application : public singleton<application>
xr::space right_grip_space;
xr::space right_aim_space;
// Vulkan memory allocator stuff
VmaAllocator allocator;
bool session_running = false;
bool session_focused = false;
bool session_visible = false;
@@ -331,11 +330,6 @@ public:
return server_address;
}
static VmaAllocator get_allocator()
{
return instance().allocator;
}
static vk::raii::PhysicalDevice& get_physical_device()
{
return instance().vk_physical_device;