Vulkan: Fix crashs
Former-commit-id: feb7e2a90be95b16cabe2777fc24ce7899525cb8 [formerly 8dfbc95cb7828e1767d9cf850f3de17c6d88c02f] Former-commit-id: af32212fb81b9a96b7cc001916e269144778d74f
This commit is contained in:
parent
4c501320b8
commit
6531f6028a
|
|
@ -23,7 +23,7 @@ namespace Nz
|
|||
Vulkan() = delete;
|
||||
~Vulkan() = delete;
|
||||
|
||||
static Vk::Device& CreateDevice(VkPhysicalDevice gpu, const Vk::Surface& surface, UInt32* presentableFamilyQueue);
|
||||
static Vk::DeviceHandle CreateDevice(VkPhysicalDevice gpu, const Vk::Surface& surface, UInt32* presentableFamilyQueue);
|
||||
|
||||
static Vk::Instance& GetInstance();
|
||||
|
||||
|
|
@ -31,7 +31,7 @@ namespace Nz
|
|||
|
||||
static bool IsInitialized();
|
||||
|
||||
static Vk::Device& SelectDevice(VkPhysicalDevice gpu, const Vk::Surface& surface, UInt32* presentableFamilyQueue);
|
||||
static Vk::DeviceHandle SelectDevice(VkPhysicalDevice gpu, const Vk::Surface& surface, UInt32* presentableFamilyQueue);
|
||||
|
||||
static void SetParameters(const ParameterList& parameters);
|
||||
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ namespace Nz
|
|||
return s_moduleReferenceCounter != 0;
|
||||
}
|
||||
|
||||
Vk::Device& Vulkan::CreateDevice(VkPhysicalDevice gpu, const Vk::Surface& surface, UInt32* presentableFamilyQueue)
|
||||
Vk::DeviceHandle Vulkan::CreateDevice(VkPhysicalDevice gpu, const Vk::Surface& surface, UInt32* presentableFamilyQueue)
|
||||
{
|
||||
Nz::ErrorFlags errFlags(ErrorFlag_ThrowException, true);
|
||||
|
||||
|
|
@ -230,8 +230,8 @@ namespace Nz
|
|||
queueCreateInfos.data(),
|
||||
UInt32(enabledLayers.size()),
|
||||
enabledLayers.data(),
|
||||
UInt32(enabledLayers.size()),
|
||||
enabledLayers.data(),
|
||||
UInt32(enabledExtensions.size()),
|
||||
enabledExtensions.data(),
|
||||
nullptr
|
||||
};
|
||||
|
||||
|
|
@ -243,10 +243,10 @@ namespace Nz
|
|||
|
||||
*presentableFamilyQueue = presentQueueNodeIndex;
|
||||
|
||||
return device;
|
||||
return device.CreateHandle();
|
||||
}
|
||||
|
||||
Vk::Device& Vulkan::SelectDevice(VkPhysicalDevice gpu, const Vk::Surface& surface, UInt32* presentableFamilyQueue)
|
||||
Vk::DeviceHandle Vulkan::SelectDevice(VkPhysicalDevice gpu, const Vk::Surface& surface, UInt32* presentableFamilyQueue)
|
||||
{
|
||||
// First, try to find a device compatible with that surface
|
||||
for (Vk::Device& device : s_devices)
|
||||
|
|
@ -276,7 +276,6 @@ namespace Nz
|
|||
|
||||
// No device had support for that surface, create one
|
||||
return CreateDevice(gpu, surface, presentableFamilyQueue);
|
||||
|
||||
}
|
||||
|
||||
void Vulkan::SetParameters(const ParameterList& parameters)
|
||||
|
|
@ -298,6 +297,7 @@ namespace Nz
|
|||
s_moduleReferenceCounter = 0;
|
||||
|
||||
// Uninitialize module here
|
||||
s_devices.clear();
|
||||
s_instance.Destroy();
|
||||
|
||||
Vk::Loader::Uninitialize();
|
||||
|
|
|
|||
Loading…
Reference in New Issue