Applied the "clang-format" obfuscator
authorRene Lindsay <rene@lunarg.com>
Fri, 10 Jun 2016 22:33:08 +0000 (15:33 -0700)
committerRene Lindsay <rene@lunarg.com>
Fri, 10 Jun 2016 23:15:30 +0000 (17:15 -0600)
Change-Id: I5ef0862326d9a7ce4e59fe7c8947b532f252d604

demos/vulkaninfo.c

index 7d5214e..e646a8a 100644 (file)
  * Author: Mark Lobodzinski <mark@lunarg.com>
  * Author: Rene Lindsay <rene@lunarg.com>
  */
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdbool.h>
-#include <string.h>
 #include <assert.h>
 #include <inttypes.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
 #ifdef _WIN32
 #include <fcntl.h>
@@ -56,7 +56,7 @@ static int ConsoleIsExclusive(void) {
 
 #define WAIT_FOR_CONSOLE_DESTROY                                               \
     do {                                                                       \
-        if (ConsoleIsExclusive())                                                    \
+        if (ConsoleIsExclusive())                                              \
             Sleep(INFINITE);                                                   \
     } while (0)
 #else
@@ -105,36 +105,38 @@ struct app_instance {
     uint32_t global_layer_count;
     struct layer_extension_list *global_layers;
     uint32_t global_extension_count;
-    VkExtensionProperties *global_extensions;    //Instance Extensions
+    VkExtensionProperties *global_extensions; // Instance Extensions
 
-    PFN_vkGetPhysicalDeviceSurfaceSupportKHR      vkGetPhysicalDeviceSurfaceSupportKHR;
-    PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR vkGetPhysicalDeviceSurfaceCapabilitiesKHR;
-    PFN_vkGetPhysicalDeviceSurfaceFormatsKHR      vkGetPhysicalDeviceSurfaceFormatsKHR;
-    PFN_vkGetPhysicalDeviceSurfacePresentModesKHR vkGetPhysicalDeviceSurfacePresentModesKHR;
+    PFN_vkGetPhysicalDeviceSurfaceSupportKHR
+        vkGetPhysicalDeviceSurfaceSupportKHR;
+    PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR
+        vkGetPhysicalDeviceSurfaceCapabilitiesKHR;
+    PFN_vkGetPhysicalDeviceSurfaceFormatsKHR
+        vkGetPhysicalDeviceSurfaceFormatsKHR;
+    PFN_vkGetPhysicalDeviceSurfacePresentModesKHR
+        vkGetPhysicalDeviceSurfacePresentModesKHR;
 
     VkSurfaceKHR surface;
     int width, height;
 
 #ifdef VK_USE_PLATFORM_WIN32_KHR
-    HINSTANCE hInstance;           // Windows Instance
-    HWND      hWnd;                // window handle
+    HINSTANCE hInstance; // Windows Instance
+    HWND hWnd;           // window handle
 #endif
 
 #ifdef VK_USE_PLATFORM_XCB_KHR
-    xcb_connection_t*        xcb_connection;
-    xcb_screen_t*            xcb_screen;
-    xcb_window_t             xcb_window;
-    xcb_intern_atom_reply_t *xcb_wm_delete_window;
+    xcb_connection_t *xcb_connection;
+    xcb_screen_t *xcb_screen;
+    xcb_window_t xcb_window;
 #endif
 
 #ifdef VK_USE_PLATFORM_XLIB_KHR
-    Display* xlib_display;
-    Window   xlib_window;
-    Atom     xlib_wm_delete_window;
+    Display *xlib_display;
+    Window xlib_window;
 #endif
 
-#ifdef VK_USE_PLATFORM_ANDROID_KHR  //TODO
-    ANativeWindowwindow;
+#ifdef VK_USE_PLATFORM_ANDROID_KHR // TODO
+    ANativeWindow *window;
 #endif
 };
 
@@ -559,7 +561,8 @@ app_get_global_layer_extensions(char *layer_name, uint32_t *extension_count,
 
     /* repeat get until VK_INCOMPLETE goes away */
     do {
-        err = vkEnumerateInstanceExtensionProperties(layer_name, &ext_count,  //get extension count
+        // gets the extension count if the last parameter is NULL
+        err = vkEnumerateInstanceExtensionProperties(layer_name, &ext_count,
                                                      NULL);
         assert(!err);
 
@@ -567,7 +570,8 @@ app_get_global_layer_extensions(char *layer_name, uint32_t *extension_count,
             free(ext_ptr);
         }
         ext_ptr = malloc(ext_count * sizeof(VkExtensionProperties));
-        err = vkEnumerateInstanceExtensionProperties(layer_name, &ext_count,  //get extension properties
+        // gets the extension properties if the last parameter is not NULL
+        err = vkEnumerateInstanceExtensionProperties(layer_name, &ext_count,
                                                      ext_ptr);
     } while (err == VK_INCOMPLETE);
     assert(!err);
@@ -575,89 +579,104 @@ app_get_global_layer_extensions(char *layer_name, uint32_t *extension_count,
     *extension_properties = ext_ptr;
 }
 
-static void app_get_instance_extensions(struct app_instance *inst) {  //get list of layer and instance extensions
-  VkResult U_ASSERT_ONLY err;
-
-  uint32_t count = 0;
-
-  /* Scan layers */
-  VkLayerProperties *global_layer_properties = NULL;
-  struct layer_extension_list *global_layers = NULL;
+/* Gets a list of layer and instance extensions */
+static void app_get_instance_extensions(struct app_instance *inst) {
+    VkResult U_ASSERT_ONLY err;
 
-  do {
-      err = vkEnumerateInstanceLayerProperties(&count, NULL);
-      assert(!err);
+    uint32_t count = 0;
 
-      if (global_layer_properties) {
-          free(global_layer_properties);
-      }
-      global_layer_properties = malloc(sizeof(VkLayerProperties) * count);
-      assert(global_layer_properties);
+    /* Scan layers */
+    VkLayerProperties *global_layer_properties = NULL;
+    struct layer_extension_list *global_layers = NULL;
 
-      if (global_layers) {
-          free(global_layers);
-      }
-      global_layers = malloc(sizeof(struct layer_extension_list) * count);
-      assert(global_layers);
+    do {
+        err = vkEnumerateInstanceLayerProperties(&count, NULL);
+        assert(!err);
 
-      err = vkEnumerateInstanceLayerProperties(&count, global_layer_properties);
-  } while (err == VK_INCOMPLETE);
-  assert(!err);
+        if (global_layer_properties) {
+            free(global_layer_properties);
+        }
+        global_layer_properties = malloc(sizeof(VkLayerProperties) * count);
+        assert(global_layer_properties);
 
-  inst->global_layer_count = count;
-  inst->global_layers = global_layers;
+        if (global_layers) {
+            free(global_layers);
+        }
+        global_layers = malloc(sizeof(struct layer_extension_list) * count);
+        assert(global_layers);
 
-  for (uint32_t i = 0; i < inst->global_layer_count; i++) {
-      VkLayerProperties *src_info = &global_layer_properties[i];
-      struct layer_extension_list *dst_info = &inst->global_layers[i];
-      memcpy(&dst_info->layer_properties, src_info,
-             sizeof(VkLayerProperties));
+        err =
+            vkEnumerateInstanceLayerProperties(&count, global_layer_properties);
+    } while (err == VK_INCOMPLETE);
+    assert(!err);
 
-      /* Save away layer extension info for report */
-      app_get_global_layer_extensions(src_info->layerName,               //get Layer extensions
-                                      &dst_info->extension_count,
-                                      &dst_info->extension_properties);
-  }
-  free(global_layer_properties);
+    inst->global_layer_count = count;
+    inst->global_layers = global_layers;
 
-  /* Collect global extensions */
-  inst->global_extension_count = 0;
-  app_get_global_layer_extensions(NULL, &inst->global_extension_count,   //get Instance extensions (first param is NULL)
-                                  &inst->global_extensions);
+    for (uint32_t i = 0; i < inst->global_layer_count; i++) {
+        VkLayerProperties *src_info = &global_layer_properties[i];
+        struct layer_extension_list *dst_info = &inst->global_layers[i];
+        memcpy(&dst_info->layer_properties, src_info,
+               sizeof(VkLayerProperties));
 
+        /* Save away layer extension info for report */
+        /* Gets layer extensions, if first parameter is not NULL*/
+        app_get_global_layer_extensions(src_info->layerName,
+                                        &dst_info->extension_count,
+                                        &dst_info->extension_properties);
+    }
+    free(global_layer_properties);
+
+    /* Collect global extensions */
+    inst->global_extension_count = 0;
+    /* Gets instance extensions, if no layer was specified in teh first
+     * paramteter */
+    app_get_global_layer_extensions(NULL, &inst->global_extension_count,
+                                    &inst->global_extensions);
 }
 
 static void app_create_instance(struct app_instance *inst) {
-    app_get_instance_extensions(inst);                                                                  //get a list of available extensions
-
+    app_get_instance_extensions(inst);
 
-    //---Build a list of extensions to load---
-    #define MAX_EXTENSIONS 4
-    uint32_t    i = 0;
-    uint32_t    ext_count = 0;
-    const char* ext_names[MAX_EXTENSIONS];  //array of string pointers to extension names
-    for (i = 0; (i < inst->global_extension_count); i++){
-        const char* found_name=inst->global_extensions[i].extensionName;
-        if (!strcmp(VK_KHR_SURFACE_EXTENSION_NAME, found_name)) ext_names[ext_count++] = VK_KHR_SURFACE_EXTENSION_NAME;
+//---Build a list of extensions to load---
+#define MAX_EXTENSIONS 4
+    uint32_t i = 0;
+    uint32_t ext_count = 0;
+    const char *ext_names[MAX_EXTENSIONS]; // array of string pointers to
+                                           // extension names
+    for (i = 0; (i < inst->global_extension_count); i++) {
+        const char *found_name = inst->global_extensions[i].extensionName;
+        if (!strcmp(VK_KHR_SURFACE_EXTENSION_NAME, found_name))
+            ext_names[ext_count++] = VK_KHR_SURFACE_EXTENSION_NAME;
     }
 
-    if(ext_count)
-    for (i = 0; ((i < inst->global_extension_count) && (ext_count < MAX_EXTENSIONS)); i++){
-        const char* found_name=inst->global_extensions[i].extensionName;
-#ifdef    VK_USE_PLATFORM_WIN32_KHR
-        if(!strcmp(VK_KHR_WIN32_SURFACE_EXTENSION_NAME,   found_name)) ext_names[ext_count++] = VK_KHR_WIN32_SURFACE_EXTENSION_NAME;
+    if (ext_count)
+        for (i = 0; ((i < inst->global_extension_count) &&
+                     (ext_count < MAX_EXTENSIONS));
+             i++) {
+            const char *found_name = inst->global_extensions[i].extensionName;
+#ifdef VK_USE_PLATFORM_WIN32_KHR
+            if (!strcmp(VK_KHR_WIN32_SURFACE_EXTENSION_NAME, found_name))
+                ext_names[ext_count++] = VK_KHR_WIN32_SURFACE_EXTENSION_NAME;
 #endif
-#ifdef    VK_USE_PLATFORM_XCB_KHR
-        if(!strcmp(VK_KHR_XCB_SURFACE_EXTENSION_NAME,     found_name)) ext_names[ext_count++] = VK_KHR_XCB_SURFACE_EXTENSION_NAME;
+#ifdef VK_USE_PLATFORM_XCB_KHR
+            if (!strcmp(VK_KHR_XCB_SURFACE_EXTENSION_NAME, found_name))
+                ext_names[ext_count++] = VK_KHR_XCB_SURFACE_EXTENSION_NAME;
 #endif
-#ifdef    VK_USE_PLATFORM_XLIB_KHR
-        if(!strcmp(VK_KHR_XLIB_SURFACE_EXTENSION_NAME,    found_name)) ext_names[ext_count++] = VK_KHR_XLIB_SURFACE_EXTENSION_NAME;
+#ifdef VK_USE_PLATFORM_XLIB_KHR
+            if (!strcmp(VK_KHR_XLIB_SURFACE_EXTENSION_NAME, found_name))
+                ext_names[ext_count++] = VK_KHR_XLIB_SURFACE_EXTENSION_NAME;
 #endif
-#ifdef    VK_USE_PLATFORM_ANDROID_KHR
-        if(!strcmp(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME, found_name)) ext_names[ext_count++] = VK_KHR_ANDROID_SURFACE_EXTENSION_NAME;
+#ifdef VK_USE_PLATFORM_ANDROID_KHR
+            if (!strcmp(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME, found_name))
+                ext_names[ext_count++] = VK_KHR_ANDROID_SURFACE_EXTENSION_NAME;
 #endif
-    }
-    if(ext_count<2) ext_count=0;             // Load at least 2 extensions, or none at all.
+        }
+    // If we don't find the KHR_SURFACE extension and at least one other
+    // device-specific extension,
+    // then give up on reporting presentable surface formats."
+    if (ext_count < 2)
+        ext_count = 0;
     //----------------------------------------
 
     const VkApplicationInfo app_info = {
@@ -676,7 +695,7 @@ static void app_create_instance(struct app_instance *inst) {
         .pApplicationInfo = &app_info,
         .enabledLayerCount = 0,
         .ppEnabledLayerNames = NULL,
-        .enabledExtensionCount =   ext_count,
+        .enabledExtensionCount = ext_count,
         .ppEnabledExtensionNames = ext_names,
     };
 
@@ -698,14 +717,18 @@ static void app_create_instance(struct app_instance *inst) {
         ERR_EXIT(err);
     }
 
-    if(ext_count>0){
-    //--Load Extensions--
-#define GET_INSTANCE_PROC_ADDR(ENTRYPOINT) { inst->ENTRYPOINT = (void*)vkGetInstanceProcAddr(inst->instance, #ENTRYPOINT); }
-        GET_INSTANCE_PROC_ADDR(vkGetPhysicalDeviceSurfaceSupportKHR     )
+    if (ext_count > 0) {
+//--Load Extensions--
+#define GET_INSTANCE_PROC_ADDR(ENTRYPOINT)                                     \
+    {                                                                          \
+        inst->ENTRYPOINT =                                                     \
+            (void *)vkGetInstanceProcAddr(inst->instance, #ENTRYPOINT);        \
+    }
+        GET_INSTANCE_PROC_ADDR(vkGetPhysicalDeviceSurfaceSupportKHR)
         GET_INSTANCE_PROC_ADDR(vkGetPhysicalDeviceSurfaceCapabilitiesKHR)
-        GET_INSTANCE_PROC_ADDR(vkGetPhysicalDeviceSurfaceFormatsKHR     )
+        GET_INSTANCE_PROC_ADDR(vkGetPhysicalDeviceSurfaceFormatsKHR)
         GET_INSTANCE_PROC_ADDR(vkGetPhysicalDeviceSurfacePresentModesKHR)
-#undef  GET_INSTANCE_PROC_ADDR
+#undef GET_INSTANCE_PROC_ADDR
     }
 }
 
@@ -851,7 +874,8 @@ static void app_create_win32_surface(struct app_instance *inst, struct app_gpu *
     createInfo.flags = 0;
     createInfo.hinstance = inst->hInstance;
     createInfo.hwnd = inst->hWnd;
-    err = vkCreateWin32SurfaceKHR(inst->instance, &createInfo, NULL, &inst->surface);    assert(!err);
+    err = vkCreateWin32SurfaceKHR(inst->instance, &createInfo, NULL, &inst->surface);
+    assert(!err);
 }
 
 static void app_destroy_win32_window(struct app_instance *inst) {
@@ -899,19 +923,9 @@ static void app_create_xcb_window(struct app_instance *inst) {
                     XCB_WINDOW_CLASS_INPUT_OUTPUT, inst->xcb_screen->root_visual,
                     value_mask, value_list);
 
-  /* Magic code that will send notification when window is destroyed */
   xcb_intern_atom_cookie_t cookie = xcb_intern_atom(inst->xcb_connection, 1, 12, "WM_PROTOCOLS");
   xcb_intern_atom_reply_t *reply =  xcb_intern_atom_reply(inst->xcb_connection, cookie, 0);
-
-  xcb_intern_atom_cookie_t cookie2 = xcb_intern_atom(inst->xcb_connection, 0, 16, "WM_DELETE_WINDOW");
-  inst->xcb_wm_delete_window =       xcb_intern_atom_reply(inst->xcb_connection, cookie2, 0);
   free(reply);
-
-  xcb_map_window(inst->xcb_connection, inst->xcb_window);
-
-  // Force the x/y coordinates to 100,100 results are identical in consecutive runs
-  const uint32_t coords[] = {100, 100};
-  xcb_configure_window(inst->xcb_connection, inst->xcb_window, XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, coords);
 }
 
 static void app_create_xcb_surface(struct app_instance *inst, struct app_gpu *gpu) {
@@ -922,13 +936,13 @@ static void app_create_xcb_surface(struct app_instance *inst, struct app_gpu *gp
     xcb_createInfo.flags      = 0;
     xcb_createInfo.connection = inst->xcb_connection;
     xcb_createInfo.window     = inst->xcb_window;
-    err = vkCreateXcbSurfaceKHR(inst->instance, &xcb_createInfo, NULL, &inst->surface);   assert(!err);
+    err = vkCreateXcbSurfaceKHR(inst->instance, &xcb_createInfo, NULL, &inst->surface);
+    assert(!err);
 }
 
 static void app_destroy_xcb_window(struct app_instance *inst) {
     xcb_destroy_window(inst->xcb_connection, inst->xcb_window);
     xcb_disconnect(inst->xcb_connection);
-    free(inst->xcb_wm_delete_window);
 }
 #endif //VK_USE_PLATFORM_XCB_KHR
 //-----------------------------------------------------------
@@ -960,10 +974,7 @@ static void app_create_xlib_window(struct app_instance *inst) {
                 visualInfo->visual,
                 CWBackPixel | CWBorderPixel | CWEventMask | CWColormap, &windowAttributes);
 
-    XSelectInput(inst->xlib_display, inst->xlib_window, ExposureMask | KeyPressMask);
-    XMapWindow(inst->xlib_display, inst->xlib_window);
     XFlush(inst->xlib_display);
-    inst->xlib_wm_delete_window = XInternAtom(inst->xlib_display, "WM_DELETE_WINDOW", False);
 }
 
 static void app_create_xlib_surface(struct app_instance *inst, struct app_gpu *gpu) {
@@ -974,7 +985,8 @@ static void app_create_xlib_surface(struct app_instance *inst, struct app_gpu *g
     createInfo.flags  = 0;
     createInfo.dpy    = inst->xlib_display;
     createInfo.window = inst->xlib_window;
-    err = vkCreateXlibSurfaceKHR(inst->instance, &createInfo, NULL, &inst->surface);    assert(!err);
+    err = vkCreateXlibSurfaceKHR(inst->instance, &createInfo, NULL, &inst->surface);
+    assert(!err);
 }
 
 static void app_destroy_xlib_window(struct app_instance *inst) {
@@ -988,9 +1000,11 @@ static int app_dump_surface_formats(struct app_instance *inst, struct app_gpu *g
     // Get the list of VkFormat's that are supported:
   VkResult U_ASSERT_ONLY err;
   uint32_t formatCount=0;
-  err = inst->vkGetPhysicalDeviceSurfaceFormatsKHR(gpu->obj, inst->surface, &formatCount, NULL);               assert(!err);
+  err = inst->vkGetPhysicalDeviceSurfaceFormatsKHR(gpu->obj, inst->surface, &formatCount, NULL);
+  assert(!err);
   VkSurfaceFormatKHR *surfFormats = (VkSurfaceFormatKHR *)malloc(formatCount * sizeof(VkSurfaceFormatKHR));
-  err = inst->vkGetPhysicalDeviceSurfaceFormatsKHR(gpu->obj, inst->surface, &formatCount, surfFormats);        assert(!err);
+  err = inst->vkGetPhysicalDeviceSurfaceFormatsKHR(gpu->obj, inst->surface, &formatCount, surfFormats);
+  assert(!err);
   printf("Format count = %d\n",formatCount);
   uint32_t i;
   for(i=0;i<formatCount;i++) printf("\t%s\n",vk_format_string(surfFormats[i].format));
@@ -1304,12 +1318,23 @@ static void app_gpu_dump_queue_props(const struct app_gpu *gpu, uint32_t id) {
 
     printf("VkQueueFamilyProperties[%d]:\n", id);
     printf("===========================\n");
-    char* sep=""; // separator character
+    char *sep = ""; // separator character
     printf("\tqueueFlags         = ");
-    if(props->queueFlags & VK_QUEUE_GRAPHICS_BIT)      { printf(  "GRAPHICS"    ); sep=" | "; }
-    if(props->queueFlags & VK_QUEUE_COMPUTE_BIT )      { printf("%sCOMPUTE" ,sep); sep=" | "; }
-    if(props->queueFlags & VK_QUEUE_TRANSFER_BIT)      { printf("%sTRANSFER",sep); sep=" | "; }
-    if(props->queueFlags & VK_QUEUE_SPARSE_BINDING_BIT){ printf("%sSPARSE"  ,sep);            }
+    if (props->queueFlags & VK_QUEUE_GRAPHICS_BIT) {
+        printf("GRAPHICS");
+        sep = " | ";
+    }
+    if (props->queueFlags & VK_QUEUE_COMPUTE_BIT) {
+        printf("%sCOMPUTE", sep);
+        sep = " | ";
+    }
+    if (props->queueFlags & VK_QUEUE_TRANSFER_BIT) {
+        printf("%sTRANSFER", sep);
+        sep = " | ";
+    }
+    if (props->queueFlags & VK_QUEUE_SPARSE_BINDING_BIT) {
+        printf("%sSPARSE", sep);
+    }
     printf("\n");
 
     printf("\tqueueCount         = %u\n", props->queueCount);
@@ -1330,30 +1355,35 @@ static void app_gpu_dump_memory_props(const struct app_gpu *gpu) {
     for (uint32_t i = 0; i < props->memoryTypeCount; i++) {
         printf("\tmemoryTypes[%u] : \n", i);
         printf("\t\theapIndex     = %u\n", props->memoryTypes[i].heapIndex);
-        printf("\t\tpropertyFlags = 0x%" PRIxLEAST32 ":\n", props->memoryTypes[i].propertyFlags);
-
-        //Print each named flag, if it is set.
-        VkFlags flags=props->memoryTypes[i].propertyFlags;
-#define PRINT_FLAG(FLAG) if(flags & FLAG) printf("\t\t\t"#FLAG"\n");
+        printf("\t\tpropertyFlags = 0x%" PRIxLEAST32 ":\n",
+               props->memoryTypes[i].propertyFlags);
+
+        // Print each named flag, if it is set.
+        VkFlags flags = props->memoryTypes[i].propertyFlags;
+#define PRINT_FLAG(FLAG)                                                       \
+    if (flags & FLAG)                                                          \
+        printf("\t\t\t" #FLAG "\n");
         PRINT_FLAG(VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)
         PRINT_FLAG(VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)
         PRINT_FLAG(VK_MEMORY_PROPERTY_HOST_COHERENT_BIT)
         PRINT_FLAG(VK_MEMORY_PROPERTY_HOST_CACHED_BIT)
         PRINT_FLAG(VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT)
-#undef  PRINT_FLAG
-
+#undef PRINT_FLAG
     }
     printf("\n");
     printf("\tmemoryHeapCount       = %u\n", props->memoryHeapCount);
     for (uint32_t i = 0; i < props->memoryHeapCount; i++) {
         printf("\tmemoryHeaps[%u] : \n", i);
         const VkDeviceSize memSize = props->memoryHeaps[i].size;
-        printf("\t\tsize          = " PRINTF_SIZE_T_SPECIFIER " (0x%" PRIxLEAST64 ")\n",
+        printf("\t\tsize          = " PRINTF_SIZE_T_SPECIFIER
+               " (0x%" PRIxLEAST64 ")\n",
                (size_t)memSize, memSize);
 
-        VkMemoryHeapFlags heapFlags=props->memoryHeaps[i].flags;
+        VkMemoryHeapFlags heapFlags = props->memoryHeaps[i].flags;
         printf("\t\tflags: \n\t\t\t");
-        printf((heapFlags & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT) ? "VK_MEMORY_HEAP_DEVICE_LOCAL_BIT\n" : "None\n");
+        printf((heapFlags & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT)
+                   ? "VK_MEMORY_HEAP_DEVICE_LOCAL_BIT\n"
+                   : "None\n");
     }
     fflush(stdout);
 }
@@ -1411,8 +1441,7 @@ static void ConsoleEnlarge() {
     // make the console window bigger
     CONSOLE_SCREEN_BUFFER_INFO csbi;
     COORD bufferSize;
-    if (GetConsoleScreenBufferInfo(consoleHandle, &csbi))
-    {
+    if (GetConsoleScreenBufferInfo(consoleHandle, &csbi)) {
         bufferSize.X = csbi.dwSize.X + 30;
         bufferSize.Y = 20000;
         SetConsoleScreenBufferSize(consoleHandle, bufferSize);
@@ -1499,48 +1528,49 @@ int main(int argc, char **argv) {
 
     printf("Presentable Surface formats:\n");
     printf("============================\n");
-    inst.width =256;
-    inst.height=256;
-    int formatCount=0;
+    inst.width = 256;
+    inst.height = 256;
+    int formatCount = 0;
 
-    //--WIN32--
+//--WIN32--
 #ifdef VK_USE_PLATFORM_WIN32_KHR
     app_create_win32_window(&inst);
     for (i = 0; i < gpu_count; i++) {
         app_create_win32_surface(&inst, &gpus[i]);
         printf("GPU id       : %u (%s)\n", i, gpus[i].props.deviceName);
         printf("Surface type : %s\n", VK_KHR_WIN32_SURFACE_EXTENSION_NAME);
-        formatCount+=app_dump_surface_formats(&inst, &gpus[i]);
+        formatCount += app_dump_surface_formats(&inst, &gpus[i]);
         app_destroy_surface(&inst);
     }
     app_destroy_win32_window(&inst);
 #endif
-    //--XCB--
+//--XCB--
 #ifdef VK_USE_PLATFORM_XCB_KHR
     app_create_xcb_window(&inst);
-    for (i = 0; i < gpu_count; i++){
-        app_create_xcb_surface(&inst,&gpus[i]);
+    for (i = 0; i < gpu_count; i++) {
+        app_create_xcb_surface(&inst, &gpus[i]);
         printf("GPU id       : %u (%s)\n", i, gpus[i].props.deviceName);
-        printf("Surface type : %s\n" ,VK_KHR_XCB_SURFACE_EXTENSION_NAME);
-        formatCount+=app_dump_surface_formats(&inst,&gpus[i]);
+        printf("Surface type : %s\n"VK_KHR_XCB_SURFACE_EXTENSION_NAME);
+        formatCount += app_dump_surface_formats(&inst, &gpus[i]);
         app_destroy_surface(&inst);
     }
     app_destroy_xcb_window(&inst);
 #endif
-    //--XLIB--
+//--XLIB--
 #ifdef VK_USE_PLATFORM_XLIB_KHR
     app_create_xlib_window(&inst);
-    for (i = 0; i < gpu_count; i++){
-        app_create_xlib_surface(&inst,&gpus[i]);
+    for (i = 0; i < gpu_count; i++) {
+        app_create_xlib_surface(&inst, &gpus[i]);
         printf("GPU id       : %u (%s)\n", i, gpus[i].props.deviceName);
-        printf("Surface type : %s\n" ,VK_KHR_XLIB_SURFACE_EXTENSION_NAME);
-        formatCount+=app_dump_surface_formats(&inst,&gpus[i]);
+        printf("Surface type : %s\n"VK_KHR_XLIB_SURFACE_EXTENSION_NAME);
+        formatCount += app_dump_surface_formats(&inst, &gpus[i]);
         app_destroy_surface(&inst);
     }
     app_destroy_xlib_window(&inst);
 #endif
-    //TODO: Android / Wayland / MIR
-    if (!formatCount) printf("None found\n");
+    // TODO: Android / Wayland / MIR
+    if (!formatCount)
+        printf("None found\n");
     //---------
 
     for (i = 0; i < gpu_count; i++)