[gtk+/wip/alexl/broadway4: 35/39] vulkan: Don't crash if vkEnumeratePhysicalDevices fails
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/alexl/broadway4: 35/39] vulkan: Don't crash if vkEnumeratePhysicalDevices fails
- Date: Thu, 30 Nov 2017 20:59:17 +0000 (UTC)
commit f5e0986230f0cefc76208b0c2eea1bace5e6c37c
Author: Alexander Larsson <alexl redhat com>
Date: Thu Nov 30 14:48:15 2017 +0100
vulkan: Don't crash if vkEnumeratePhysicalDevices fails
gdk/gdkvulkancontext.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/gdk/gdkvulkancontext.c b/gdk/gdkvulkancontext.c
index f442534..3fd697a 100644
--- a/gdk/gdkvulkancontext.c
+++ b/gdk/gdkvulkancontext.c
@@ -599,10 +599,9 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
{
uint32_t i, j;
- uint32_t n_devices;
+ uint32_t n_devices = 0;
GDK_VK_CHECK(vkEnumeratePhysicalDevices, display->vk_instance, &n_devices, NULL);
- VkPhysicalDevice *devices = g_newa (VkPhysicalDevice, n_devices);
- GDK_VK_CHECK(vkEnumeratePhysicalDevices, display->vk_instance, &n_devices, devices);
+ VkPhysicalDevice *devices;
if (n_devices == 0)
{
@@ -612,6 +611,9 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
return FALSE;
}
+ devices = g_newa (VkPhysicalDevice, n_devices);
+ GDK_VK_CHECK(vkEnumeratePhysicalDevices, display->vk_instance, &n_devices, devices);
+
for (i = 0; i < n_devices; i++)
{
VkPhysicalDeviceProperties props;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]