1 //% gcc -c -Wall -I. -I../include htest.c
2 
3 // Copyright 2019-2023 The Khronos Group Inc.
4 //
5 // SPDX-License-Identifier: Apache-2.0
6 
7 // Simple compilation test for Vulkan headers, including all platform
8 // headers.
9 // To allow compilation in environments without one or more platforms, fake
10 // headers for different platforms are supplied. They provide just the types
11 // Vulkan platforms require.
12 // When a new Vulkan platform is defined, the corresponding USE_PLATFORM
13 // header definition, and any supporting fake platform headers, should be
14 // defined here, along with a trivial compilation test using a Vulkan type
15 // or function specific to that platform.
16 
17 // Enable each platform when vulkan_sc.h is included
18 
19 #define VK_USE_PLATFORM_ANDROID_KHR         // No headers needed
20 #define VK_USE_PLATFORM_FUCHSIA             // <zircon/types.h>
21 #define VK_USE_PLATFORM_GGP                 // <ggp_c/vulkan_types.h>
22 #define VK_USE_PLATFORM_IOS_MVK             // No headers needed
23 #define VK_USE_PLATFORM_MACOS_MVK           // No headers needed
24 #define VK_USE_PLATFORM_METAL_EXT           // No headers needed
25 #define VK_USE_PLATFORM_VI_NN               // No headers needed
26 #define VK_USE_PLATFORM_WAYLAND_KHR         // <wayland-client.h>
27 #define VK_USE_PLATFORM_WIN32_KHR           // <windows.h>
28 #define VK_USE_PLATFORM_XCB_KHR             // <xcb/xcb.h>
29 #define VK_USE_PLATFORM_XLIB_KHR            // <X11/Xlib.h>
30 #define VK_USE_PLATFORM_XLIB_XRANDR_EXT     // <X11/extensions/Xrandr.h>
31 #define VK_USE_PLATFORM_SCREEN_QNX          // <screen/screen.h>
32 #define VK_USE_PLATFORM_SCI                 // nvscisync.h
33 #define VK_ENABLE_BETA_EXTENSIONS           // No headers needed
34 
35 #ifdef USE_HPP
36 #include <vulkan/vulkan_sc_core.hpp>
37 
38 #include <nvscisync.h>
39 #include <nvscibuf.h>
40 #include "vulkan/vulkan_sci.h"
41 #else
42 #include <vulkan/vulkan_sc.h>
43 #endif
44 
45 // Sanity check with a type or function from each platform header in turn
46 // (uncomment type below if a platform extension is enabled for 'vulkansc')
47 
48 //VkAndroidSurfaceCreateFlagsKHR          android_flags;
49 //VkImagePipeSurfaceCreateFlagsFUCHSIA    fuchsia_flags;
50 //VkStreamDescriptorSurfaceCreateFlagsGGP ggp_flags;
51 //VkIOSSurfaceCreateFlagsMVK              ios_flags;
52 //VkMacOSSurfaceCreateFlagsMVK            macos_flags;
53 //VkMetalSurfaceCreateFlagsEXT            metal_flags;
54 //VkViSurfaceCreateFlagsNN                vi_flags;
55 //VkWaylandSurfaceCreateFlagsKHR          wayland_flags;
56 //VkWin32SurfaceCreateFlagsKHR            win32_flags;
57 //VkXcbSurfaceCreateFlagsKHR              xcb_flags;
58 //VkXlibSurfaceCreateFlagsKHR             xlib_flags;
59 //VkScreenSurfaceCreateFlagsQNX           screen_flags;
60 NvSciSyncAttrList                         scisync_attr_list;
61 
main(void)62 int main(void) {
63     VkInstanceCreateInfo instance_info;
64     VkInstance instance;
65 
66     instance_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
67     instance_info.pNext = NULL,
68     instance_info.flags = 0,
69     instance_info.pApplicationInfo = NULL,
70     instance_info.enabledLayerCount = 0,
71     instance_info.ppEnabledLayerNames = NULL,
72     instance_info.enabledExtensionCount = 0,
73     instance_info.ppEnabledExtensionNames = NULL,
74 
75     vkCreateInstance(&instance_info, NULL, &instance);
76     vkDestroyInstance(instance, NULL);
77 
78     return 0;
79 }
80