Added RAII vulkan instance destructor
This commit is contained in:
parent
66af7fc1e8
commit
c3b623384f
3 changed files with 20 additions and 5 deletions
|
|
@ -15,6 +15,8 @@ private:
|
|||
|
||||
void createGraphicsPipeline(const std::string &vertFilepath,
|
||||
const std::string &fragFilepath);
|
||||
|
||||
|
||||
};
|
||||
|
||||
} // namespace yave
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
#include "yave_vulkan_instance.hpp"
|
||||
#include <vulkan/vulkan_core.h>
|
||||
|
||||
namespace yave {
|
||||
|
||||
YaveVulkanInstance::YaveVulkanInstance() { createInstance(); }
|
||||
YaveVulkanInstance::~YaveVulkanInstance() { destroyInstance(); }
|
||||
|
||||
void YaveVulkanInstance::createInstance() {
|
||||
VkApplicationInfo appInfo{};
|
||||
|
|
@ -32,4 +34,8 @@ void YaveVulkanInstance::createInstance() {
|
|||
}
|
||||
}
|
||||
|
||||
void YaveVulkanInstance::destroyInstance() {
|
||||
vkDestroyInstance(this->instance, nullptr);
|
||||
}
|
||||
|
||||
} // namespace yave
|
||||
|
|
|
|||
|
|
@ -14,8 +14,15 @@ class YaveVulkanInstance {
|
|||
|
||||
void createInstance();
|
||||
|
||||
public:
|
||||
YaveVulkanInstance();
|
||||
void destroyInstance();
|
||||
|
||||
public:
|
||||
// Delete Copy constructors
|
||||
// This class should match one to one with vulkan instances
|
||||
YaveVulkanInstance(const YaveVulkanInstance&) = delete;
|
||||
YaveVulkanInstance &operator=(const YaveVulkanInstance &) = delete;
|
||||
|
||||
YaveVulkanInstance();
|
||||
~YaveVulkanInstance();
|
||||
};
|
||||
} // namespace yave
|
||||
|
|
|
|||
Loading…
Reference in a new issue