[gtk+] gdk/gdkvulkancontext.c: Avoid VLAs



commit 9db5cc9a98728fd5e8425dead1f4e6290392423a
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Wed Dec 28 22:34:04 2016 +0800

    gdk/gdkvulkancontext.c: Avoid VLAs
    
    During the drive to enable Vulkan context creation on Windows, some more
    VLAs were found here.  Replace them with g_newa().
    
    https://bugzilla.gnome.org/show_bug.cgi?id=773299

 gdk/gdkvulkancontext.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/gdk/gdkvulkancontext.c b/gdk/gdkvulkancontext.c
index d562291..e64cd2f 100644
--- a/gdk/gdkvulkancontext.c
+++ b/gdk/gdkvulkancontext.c
@@ -431,7 +431,7 @@ gdk_vulkan_context_real_init (GInitable     *initable,
       GDK_VK_CHECK (vkGetPhysicalDeviceSurfaceFormatsKHR, gdk_vulkan_context_get_physical_device (context),
                                                           priv->surface,
                                                           &n_formats, NULL);
-      VkSurfaceFormatKHR formats[n_formats];
+      VkSurfaceFormatKHR *formats = g_newa (VkSurfaceFormatKHR, n_formats);
       GDK_VK_CHECK (vkGetPhysicalDeviceSurfaceFormatsKHR, gdk_vulkan_context_get_physical_device (context),
                                                           priv->surface,
                                                           &n_formats, formats);
@@ -577,7 +577,7 @@ gdk_display_create_vulkan_device (GdkDisplay  *display,
 
   uint32_t n_devices;
   GDK_VK_CHECK(vkEnumeratePhysicalDevices, display->vk_instance, &n_devices, NULL);
-  VkPhysicalDevice devices[n_devices];
+  VkPhysicalDevice *devices = g_newa (VkPhysicalDevice, n_devices);
   GDK_VK_CHECK(vkEnumeratePhysicalDevices, display->vk_instance, &n_devices, devices);
 
   if (n_devices == 0)
@@ -609,7 +609,7 @@ gdk_display_create_vulkan_device (GdkDisplay  *display,
 
       uint32_t n_queue_props;
       vkGetPhysicalDeviceQueueFamilyProperties (devices[i], &n_queue_props, NULL);
-      VkQueueFamilyProperties queue_props[n_queue_props];
+      VkQueueFamilyProperties *queue_props = g_newa (VkQueueFamilyProperties, n_queue_props);
       vkGetPhysicalDeviceQueueFamilyProperties (devices[i], &n_queue_props, queue_props);
 
       for (j = 0; j < n_queue_props; j++)
@@ -707,7 +707,7 @@ gdk_display_create_vulkan_instance (GdkDisplay  *display,
 
   uint32_t n_extensions;
   GDK_VK_CHECK (vkEnumerateInstanceExtensionProperties, NULL, &n_extensions, NULL);
-  VkExtensionProperties extensions[n_extensions];
+  VkExtensionProperties *extensions = g_newa (VkExtensionProperties, n_extensions);
   GDK_VK_CHECK (vkEnumerateInstanceExtensionProperties, NULL, &n_extensions, extensions);
 
   used_extensions = g_ptr_array_new ();
@@ -731,7 +731,7 @@ gdk_display_create_vulkan_instance (GdkDisplay  *display,
 
   uint32_t n_layers;
   GDK_VK_CHECK (vkEnumerateInstanceLayerProperties, &n_layers, NULL);
-  VkLayerProperties layers[n_layers];
+  VkLayerProperties *layers = g_newa (VkLayerProperties, n_layers);
   GDK_VK_CHECK (vkEnumerateInstanceLayerProperties, &n_layers, layers);
 
   used_layers = g_ptr_array_new ();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]