1
0
mirror of https://github.com/EduApps-CDG/OpenDX synced 2024-12-30 09:45:37 +01:00

[dxvk] Refactored Vulkan device and instance destruction, now more RAII friendly

This commit is contained in:
Philip Rebohle 2017-12-11 19:48:00 +01:00
parent 5f8976fbd4
commit de47fa29e1
4 changed files with 11 additions and 11 deletions

@ -23,12 +23,9 @@ namespace dxvk {
DxvkDevice::~DxvkDevice() { DxvkDevice::~DxvkDevice() {
m_renderPassPool = nullptr; // Wait for all pending Vulkan commands to be
m_pipelineManager = nullptr; // executed before we destroy any resources.
m_memory = nullptr;
m_vkd->vkDeviceWaitIdle(m_vkd->device()); m_vkd->vkDeviceWaitIdle(m_vkd->device());
m_vkd->vkDestroyDevice(m_vkd->device(), nullptr);
} }

@ -10,8 +10,7 @@ namespace dxvk {
DxvkInstance::~DxvkInstance() { DxvkInstance::~DxvkInstance() {
m_vki->vkDestroyInstance(
m_vki->instance(), nullptr);
} }

@ -33,11 +33,15 @@ namespace dxvk::vk {
InstanceFn::InstanceFn(VkInstance instance) InstanceFn::InstanceFn(VkInstance instance)
: InstanceLoader(instance) { } : InstanceLoader(instance) { }
InstanceFn::~InstanceFn() { } InstanceFn::~InstanceFn() {
this->vkDestroyInstance(m_instance, nullptr);
}
DeviceFn::DeviceFn(VkInstance instance, VkDevice device) DeviceFn::DeviceFn(VkInstance instance, VkDevice device)
: DeviceLoader(instance, device) { } : DeviceLoader(instance, device) { }
DeviceFn::~DeviceFn() { } DeviceFn::~DeviceFn() {
this->vkDestroyDevice(m_device, nullptr);
}
} }

@ -28,7 +28,7 @@ namespace dxvk::vk {
InstanceLoader(VkInstance instance); InstanceLoader(VkInstance instance);
PFN_vkVoidFunction sym(const char* name) const; PFN_vkVoidFunction sym(const char* name) const;
VkInstance instance() const { return m_instance; } VkInstance instance() const { return m_instance; }
private: protected:
const VkInstance m_instance; const VkInstance m_instance;
}; };
@ -43,7 +43,7 @@ namespace dxvk::vk {
DeviceLoader(VkInstance instance, VkDevice device); DeviceLoader(VkInstance instance, VkDevice device);
PFN_vkVoidFunction sym(const char* name) const; PFN_vkVoidFunction sym(const char* name) const;
VkDevice device() const { return m_device; } VkDevice device() const { return m_device; }
private: protected:
const PFN_vkGetDeviceProcAddr m_getDeviceProcAddr; const PFN_vkGetDeviceProcAddr m_getDeviceProcAddr;
const VkDevice m_device; const VkDevice m_device;
}; };