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;
|
||||||
~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();
|
static Vk::Instance& GetInstance();
|
||||||
|
|
||||||
|
|
@ -31,7 +31,7 @@ namespace Nz
|
||||||
|
|
||||||
static bool IsInitialized();
|
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);
|
static void SetParameters(const ParameterList& parameters);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ namespace Nz
|
||||||
return s_moduleReferenceCounter != 0;
|
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);
|
Nz::ErrorFlags errFlags(ErrorFlag_ThrowException, true);
|
||||||
|
|
||||||
|
|
@ -230,8 +230,8 @@ namespace Nz
|
||||||
queueCreateInfos.data(),
|
queueCreateInfos.data(),
|
||||||
UInt32(enabledLayers.size()),
|
UInt32(enabledLayers.size()),
|
||||||
enabledLayers.data(),
|
enabledLayers.data(),
|
||||||
UInt32(enabledLayers.size()),
|
UInt32(enabledExtensions.size()),
|
||||||
enabledLayers.data(),
|
enabledExtensions.data(),
|
||||||
nullptr
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -243,10 +243,10 @@ namespace Nz
|
||||||
|
|
||||||
*presentableFamilyQueue = presentQueueNodeIndex;
|
*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
|
// First, try to find a device compatible with that surface
|
||||||
for (Vk::Device& device : s_devices)
|
for (Vk::Device& device : s_devices)
|
||||||
|
|
@ -276,7 +276,6 @@ namespace Nz
|
||||||
|
|
||||||
// No device had support for that surface, create one
|
// No device had support for that surface, create one
|
||||||
return CreateDevice(gpu, surface, presentableFamilyQueue);
|
return CreateDevice(gpu, surface, presentableFamilyQueue);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Vulkan::SetParameters(const ParameterList& parameters)
|
void Vulkan::SetParameters(const ParameterList& parameters)
|
||||||
|
|
@ -298,6 +297,7 @@ namespace Nz
|
||||||
s_moduleReferenceCounter = 0;
|
s_moduleReferenceCounter = 0;
|
||||||
|
|
||||||
// Uninitialize module here
|
// Uninitialize module here
|
||||||
|
s_devices.clear();
|
||||||
s_instance.Destroy();
|
s_instance.Destroy();
|
||||||
|
|
||||||
Vk::Loader::Uninitialize();
|
Vk::Loader::Uninitialize();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue