Refactored to use shared pointers

This commit is contained in:
Alejandro Saucedo 2020-08-17 07:38:00 +01:00
parent 81d592e6e0
commit e8b0cac2c7
4 changed files with 21 additions and 22 deletions

View file

@ -119,8 +119,8 @@ void Manager::createInstance() {
}
#endif
this->mInstance = new vk::Instance();
vk::createInstance(&computeInstanceCreateInfo, nullptr, this->mInstance);
this->mInstance = std::make_shared<vk::Instance>();
vk::createInstance(&computeInstanceCreateInfo, nullptr, this->mInstance.get());
SPDLOG_DEBUG("Kompute Manager Instance Created");
#if DEBUG
@ -199,12 +199,12 @@ void Manager::createDevice() {
1, // Number of deviceQueueCreateInfo
&deviceQueueCreateInfo);
this->mDevice = new vk::Device();
physicalDevice.createDevice(&deviceCreateInfo, nullptr, this->mDevice);
this->mDevice = std::make_shared<vk::Device>();
physicalDevice.createDevice(&deviceCreateInfo, nullptr, this->mDevice.get());
SPDLOG_DEBUG("Kompute Manager device created");
this->mComputeQueue = new vk::Queue();
this->mDevice->getQueue(this->mComputeQueueFamilyIndex, 0, this->mComputeQueue);
this->mComputeQueue = std::make_shared<vk::Queue>();
this->mDevice->getQueue(this->mComputeQueueFamilyIndex, 0, this->mComputeQueue.get());
SPDLOG_DEBUG("Kompute Manager compute queue obtained");
}