mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-02 01:24:11 +01:00
[dxvk] Refactored Vulkan device and instance destruction, now more RAII friendly
This commit is contained in:
parent
5f8976fbd4
commit
de47fa29e1
@ -23,12 +23,9 @@ namespace dxvk {
|
||||
|
||||
|
||||
DxvkDevice::~DxvkDevice() {
|
||||
m_renderPassPool = nullptr;
|
||||
m_pipelineManager = nullptr;
|
||||
m_memory = nullptr;
|
||||
|
||||
// Wait for all pending Vulkan commands to be
|
||||
// executed before we destroy any resources.
|
||||
m_vkd->vkDeviceWaitIdle(m_vkd->device());
|
||||
m_vkd->vkDestroyDevice(m_vkd->device(), nullptr);
|
||||
}
|
||||
|
||||
|
||||
|
@ -10,8 +10,7 @@ namespace dxvk {
|
||||
|
||||
|
||||
DxvkInstance::~DxvkInstance() {
|
||||
m_vki->vkDestroyInstance(
|
||||
m_vki->instance(), nullptr);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -33,11 +33,15 @@ namespace dxvk::vk {
|
||||
|
||||
InstanceFn::InstanceFn(VkInstance instance)
|
||||
: InstanceLoader(instance) { }
|
||||
InstanceFn::~InstanceFn() { }
|
||||
InstanceFn::~InstanceFn() {
|
||||
this->vkDestroyInstance(m_instance, nullptr);
|
||||
}
|
||||
|
||||
|
||||
DeviceFn::DeviceFn(VkInstance instance, VkDevice device)
|
||||
: DeviceLoader(instance, device) { }
|
||||
DeviceFn::~DeviceFn() { }
|
||||
DeviceFn::~DeviceFn() {
|
||||
this->vkDestroyDevice(m_device, nullptr);
|
||||
}
|
||||
|
||||
}
|
@ -28,7 +28,7 @@ namespace dxvk::vk {
|
||||
InstanceLoader(VkInstance instance);
|
||||
PFN_vkVoidFunction sym(const char* name) const;
|
||||
VkInstance instance() const { return m_instance; }
|
||||
private:
|
||||
protected:
|
||||
const VkInstance m_instance;
|
||||
};
|
||||
|
||||
@ -43,7 +43,7 @@ namespace dxvk::vk {
|
||||
DeviceLoader(VkInstance instance, VkDevice device);
|
||||
PFN_vkVoidFunction sym(const char* name) const;
|
||||
VkDevice device() const { return m_device; }
|
||||
private:
|
||||
protected:
|
||||
const PFN_vkGetDeviceProcAddr m_getDeviceProcAddr;
|
||||
const VkDevice m_device;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user