|
37 | 37 | #ifdef _WIN32 |
38 | 38 | #pragma comment(linker, "/subsystem:windows") |
39 | 39 | #define APP_NAME_STR_LEN 80 |
40 | | -#endif // _WIN32 |
| 40 | +#endif // _WIN32 |
41 | 41 |
|
42 | 42 | #if defined(VK_USE_PLATFORM_MIR_KHR) |
43 | 43 | #warning "Cube does not have code for Mir at this time" |
|
75 | 75 |
|
76 | 76 | #ifdef _WIN32 |
77 | 77 | bool in_callback = false; |
78 | | -#define ERR_EXIT(err_msg, err_class) \ |
79 | | - do { \ |
80 | | - if (!demo->suppress_popups) \ |
81 | | - MessageBox(NULL, err_msg, err_class, MB_OK); \ |
82 | | - exit(1); \ |
| 78 | +#define ERR_EXIT(err_msg, err_class) \ |
| 79 | + do { \ |
| 80 | + if (!demo->suppress_popups) MessageBox(NULL, err_msg, err_class, MB_OK); \ |
| 81 | + exit(1); \ |
83 | 82 | } while (0) |
84 | 83 |
|
85 | 84 | #elif defined __ANDROID__ |
86 | 85 | #include <android/log.h> |
87 | | -#define ERR_EXIT(err_msg, err_class) \ |
88 | | - do { \ |
89 | | - ((void)__android_log_print(ANDROID_LOG_INFO, "Cube", err_msg)); \ |
90 | | - exit(1); \ |
| 86 | +#define ERR_EXIT(err_msg, err_class) \ |
| 87 | + do { \ |
| 88 | + ((void)__android_log_print(ANDROID_LOG_INFO, "Cube", err_msg)); \ |
| 89 | + exit(1); \ |
91 | 90 | } while (0) |
92 | 91 | #else |
93 | | -#define ERR_EXIT(err_msg, err_class) \ |
94 | | - do { \ |
95 | | - printf(err_msg); \ |
96 | | - fflush(stdout); \ |
97 | | - exit(1); \ |
| 92 | +#define ERR_EXIT(err_msg, err_class) \ |
| 93 | + do { \ |
| 94 | + printf(err_msg); \ |
| 95 | + fflush(stdout); \ |
| 96 | + exit(1); \ |
98 | 97 | } while (0) |
99 | 98 | #endif |
100 | 99 |
|
101 | | -#define GET_INSTANCE_PROC_ADDR(inst, entrypoint) \ |
102 | | - { \ |
103 | | - demo->fp##entrypoint = (PFN_vk##entrypoint)vkGetInstanceProcAddr(inst, "vk" #entrypoint); \ |
104 | | - if (demo->fp##entrypoint == NULL) { \ |
105 | | - ERR_EXIT("vkGetInstanceProcAddr failed to find vk" #entrypoint, "vkGetInstanceProcAddr Failure"); \ |
106 | | - } \ |
| 100 | +#define GET_INSTANCE_PROC_ADDR(inst, entrypoint) \ |
| 101 | + { \ |
| 102 | + demo->fp##entrypoint = (PFN_vk##entrypoint)vkGetInstanceProcAddr(inst, "vk" #entrypoint); \ |
| 103 | + if (demo->fp##entrypoint == NULL) { \ |
| 104 | + ERR_EXIT("vkGetInstanceProcAddr failed to find vk" #entrypoint, "vkGetInstanceProcAddr Failure"); \ |
| 105 | + } \ |
107 | 106 | } |
108 | 107 |
|
109 | 108 | static PFN_vkGetDeviceProcAddr g_gdpa = NULL; |
110 | 109 |
|
111 | | -#define GET_DEVICE_PROC_ADDR(dev, entrypoint) \ |
112 | | - { \ |
113 | | - if (!g_gdpa) \ |
114 | | - g_gdpa = (PFN_vkGetDeviceProcAddr)vkGetInstanceProcAddr(demo->inst, "vkGetDeviceProcAddr"); \ |
115 | | - demo->fp##entrypoint = (PFN_vk##entrypoint)g_gdpa(dev, "vk" #entrypoint); \ |
116 | | - if (demo->fp##entrypoint == NULL) { \ |
117 | | - ERR_EXIT("vkGetDeviceProcAddr failed to find vk" #entrypoint, "vkGetDeviceProcAddr Failure"); \ |
118 | | - } \ |
| 110 | +#define GET_DEVICE_PROC_ADDR(dev, entrypoint) \ |
| 111 | + { \ |
| 112 | + if (!g_gdpa) g_gdpa = (PFN_vkGetDeviceProcAddr)vkGetInstanceProcAddr(demo->inst, "vkGetDeviceProcAddr"); \ |
| 113 | + demo->fp##entrypoint = (PFN_vk##entrypoint)g_gdpa(dev, "vk" #entrypoint); \ |
| 114 | + if (demo->fp##entrypoint == NULL) { \ |
| 115 | + ERR_EXIT("vkGetDeviceProcAddr failed to find vk" #entrypoint, "vkGetDeviceProcAddr Failure"); \ |
| 116 | + } \ |
119 | 117 | } |
120 | 118 |
|
121 | 119 | /* |
@@ -282,10 +280,10 @@ typedef struct { |
282 | 280 | struct demo { |
283 | 281 | #if defined(VK_USE_PLATFORM_WIN32_KHR) |
284 | 282 | #define APP_NAME_STR_LEN 80 |
285 | | - HINSTANCE connection; // hInstance - Windows Instance |
286 | | - char name[APP_NAME_STR_LEN]; // Name to put on the window/icon |
287 | | - HWND window; // hWnd - window handle |
288 | | - POINT minsize; // minimum window size |
| 283 | + HINSTANCE connection; // hInstance - Windows Instance |
| 284 | + char name[APP_NAME_STR_LEN]; // Name to put on the window/icon |
| 285 | + HWND window; // hWnd - window handle |
| 286 | + POINT minsize; // minimum window size |
289 | 287 | #elif defined(VK_USE_PLATFORM_XLIB_KHR) |
290 | 288 | Display *display; |
291 | 289 | Window xlib_window; |
@@ -366,7 +364,7 @@ struct demo { |
366 | 364 | struct texture_object textures[DEMO_TEXTURE_COUNT]; |
367 | 365 | struct texture_object staging_texture; |
368 | 366 |
|
369 | | - VkCommandBuffer cmd; // Buffer for initialization commands |
| 367 | + VkCommandBuffer cmd; // Buffer for initialization commands |
370 | 368 | VkPipelineLayout pipeline_layout; |
371 | 369 | VkDescriptorSetLayout desc_layout; |
372 | 370 | VkPipelineCache pipelineCache; |
@@ -403,7 +401,6 @@ struct demo { |
403 | 401 |
|
404 | 402 | VKAPI_ATTR VkBool32 VKAPI_CALL dbgFunc(VkFlags msgFlags, VkDebugReportObjectTypeEXT objType, uint64_t srcObject, size_t location, |
405 | 403 | int32_t msgCode, const char *pLayerPrefix, const char *pMsg, void *pUserData) { |
406 | | - |
407 | 404 | // clang-format off |
408 | 405 | char *message = (char *)malloc(strlen(pMsg) + 100); |
409 | 406 |
|
|
0 commit comments