├── .gitignore ├── README.md ├── build.zig ├── doc └── xproto.zig ├── example └── nox.zig ├── shaders ├── frag.spv ├── shader.frag ├── shader.vert └── vert.spv └── src ├── dummy.zig ├── libc_bits.h ├── main.zig ├── static-window.zig ├── vulkan-loader ├── cJSON.c ├── cJSON.h ├── debug_utils.c ├── debug_utils.h ├── dev_ext_trampoline.c ├── extension_manual.c ├── extension_manual.h ├── gpa_helper.h ├── include │ └── vulkan │ │ ├── vk_icd.h │ │ ├── vk_layer.h │ │ ├── vk_platform.h │ │ ├── vk_sdk_platform.h │ │ ├── vulkan.h │ │ ├── vulkan.hpp │ │ ├── vulkan_android.h │ │ ├── vulkan_beta.h │ │ ├── vulkan_core.h │ │ ├── vulkan_directfb.h │ │ ├── vulkan_fuchsia.h │ │ ├── vulkan_ggp.h │ │ ├── vulkan_ios.h │ │ ├── vulkan_macos.h │ │ ├── vulkan_metal.h │ │ ├── vulkan_vi.h │ │ ├── vulkan_wayland.h │ │ ├── vulkan_win32.h │ │ ├── vulkan_xcb.h │ │ ├── vulkan_xlib.h │ │ └── vulkan_xlib_xrandr.h ├── loader.c ├── loader.h ├── loader_cmake_config.h ├── murmurhash.c ├── murmurhash.h ├── phys_dev_ext.c ├── trampoline.c ├── unknown_ext_chain.c ├── vk_layer_dispatch_table.h ├── vk_loader_extensions.c ├── vk_loader_extensions.h ├── vk_loader_layer.h ├── vk_loader_platform.h ├── vk_object_types.h ├── wsi.c └── wsi.h ├── vulkan.zig ├── x11.zig ├── xcb ├── xcb.h └── xproto.h └── xproto.zig /.gitignore: -------------------------------------------------------------------------------- 1 | zig-cache/ 2 | triangle 3 | minimal 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # zig-window 2 | 3 | ## My Vision 4 | 5 | A window client library. It gives you an API for creating windows, possibly 6 | fullscreen, a graphics context, and events associated with the windows, such 7 | as mouse and keyboard input. 8 | 9 | * No dependency on libc or any C libraries 10 | * Cross platform: 11 | * X11 12 | * Windows 13 | * MacOS 14 | * Wayland 15 | * Graphics contexts: 16 | * Vulkan 17 | * DirectX 18 | * Metal 19 | * OpenGL 20 | 21 | ## Current Status 22 | 23 | It's a proof-of-concept of a Vulkan "Hello World" triangle, whose binaries 24 | are portable across different Linux distributions, even ones that have 25 | nonstandard dynamic linkers. 26 | 27 | "how it works" writeup is TODO. 28 | 29 | ### Building 30 | 31 | Tested with Zig 0.7.0+479f259ea. 32 | 33 | ``` 34 | zig build -Dtarget=x86_64-linux 35 | patchelf --remove-needed libdummy.so.0 zig-cache/bin/static-window 36 | ./zig-cache/bin/static-window 37 | ``` 38 | 39 | The `-Dtarget` parameter is important if you want to put the binary up for 40 | downloading - this makes Zig target the "baseline" CPU instead of using 41 | the fancy cool features of your native CPU. 42 | 43 | This should work just fine on other CPU architectures though; for example you 44 | could change `x86_64` to `aarch64` for 64-bit ARM. 45 | 46 | Removing the external dependency on `patchelf` is TODO. 47 | 48 | Reported to work on these systems so far: 49 | 50 | * Ubuntu 51 | * Debian 52 | * NixOS 53 | * Arch Linux 54 | * clearlinux 55 | * glibc-based void linux 56 | * musl-based void linux 57 | 58 | Please file an issue if you find that `vkcube` from your package manager works 59 | but binaries produced by this project do not. 60 | -------------------------------------------------------------------------------- /build.zig: -------------------------------------------------------------------------------- 1 | const Builder = @import("std").build.Builder; 2 | 3 | pub fn build(b: *Builder) void { 4 | const target = b.standardTargetOptions(.{}); 5 | const mode = b.standardReleaseOptions(); 6 | 7 | const nox_exe = b.addExecutable("nox", "example/nox.zig"); 8 | nox_exe.addPackagePath("window", "src/main.zig"); 9 | nox_exe.setBuildMode(mode); 10 | nox_exe.install(); 11 | const run_nox_cmd = nox_exe.run(); 12 | const run_nox_step = b.step("example-nox", "Run the example app that doesn't link X11 C library"); 13 | run_nox_step.dependOn(&run_nox_cmd.step); 14 | 15 | const vulkan_loader = b.addStaticLibrary("vulkan", null); 16 | vulkan_loader.setTarget(target); 17 | vulkan_loader.force_pic = true; 18 | vulkan_loader.addIncludeDir("src/vulkan-loader/include"); 19 | vulkan_loader.addIncludeDir("src"); 20 | vulkan_loader.defineCMacro("API_NAME=Vulkan"); 21 | vulkan_loader.defineCMacro("FALLBACK_CONFIG_DIRS=\"/etc/xdg\""); 22 | vulkan_loader.defineCMacro("FALLBACK_DATA_DIRS=\"/usr/local/share:/usr/share\""); 23 | vulkan_loader.defineCMacro("VK_USE_PLATFORM_XCB_KHR"); 24 | // TODO patch vulkan-loader to make this configurable at runtime 25 | vulkan_loader.defineCMacro("SYSCONFDIR=\"/run/opengl-driver/share/\""); 26 | 27 | const cflags = [_][]const u8{"-std=c11"}; 28 | const c_files = [_][]const u8{ 29 | "src/vulkan-loader/cJSON.c", 30 | "src/vulkan-loader/debug_utils.c", 31 | "src/vulkan-loader/dev_ext_trampoline.c", 32 | "src/vulkan-loader/extension_manual.c", 33 | "src/vulkan-loader/loader.c", 34 | "src/vulkan-loader/murmurhash.c", 35 | "src/vulkan-loader/phys_dev_ext.c", 36 | "src/vulkan-loader/trampoline.c", 37 | "src/vulkan-loader/unknown_ext_chain.c", 38 | "src/vulkan-loader/wsi.c", 39 | }; 40 | for (c_files) |c_file| { 41 | vulkan_loader.addCSourceFile(c_file, &cflags); 42 | } 43 | 44 | // a dummy .so file that we can link "static-window" against to trick the linker 45 | // into making a valid ELF executable that can be loaded with ld 46 | const dummy_so = b.addSharedLibrary("dummy", "src/dummy.zig", b.version(0, 0, 0)); 47 | dummy_so.setBuildMode(mode); 48 | dummy_so.setTarget(target); 49 | dummy_so.install(); 50 | 51 | const static_window_exe = b.addExecutable("static-window", "src/static-window.zig"); 52 | static_window_exe.setTarget(target); 53 | static_window_exe.setBuildMode(mode); 54 | static_window_exe.install(); 55 | static_window_exe.linkLibrary(vulkan_loader); 56 | static_window_exe.linkLibrary(dummy_so); 57 | } 58 | -------------------------------------------------------------------------------- /example/nox.zig: -------------------------------------------------------------------------------- 1 | const std = @import("std"); 2 | const window = @import("window"); 3 | 4 | var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){}; 5 | 6 | pub fn main() anyerror!void { 7 | const gpa = &general_purpose_allocator.allocator; 8 | defer _ = general_purpose_allocator.deinit(); 9 | 10 | var conn = try window.openDefaultDisplay(gpa); 11 | switch (conn.status) { 12 | .Ok => {}, 13 | else => { 14 | std.debug.warn("unable to open default display: {s}\n", .{conn.setup}); 15 | std.process.exit(1); 16 | }, 17 | } 18 | defer conn.close(); 19 | 20 | std.debug.warn("OK\n", .{}); 21 | } 22 | -------------------------------------------------------------------------------- /shaders/frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrk/zig-window/313e3090b2eecdc5317291b5b13dc7871023d025/shaders/frag.spv -------------------------------------------------------------------------------- /shaders/shader.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout(location = 0) in vec3 fragColor; 5 | 6 | layout(location = 0) out vec4 outColor; 7 | 8 | void main() { 9 | outColor = vec4(fragColor, 1.0); 10 | } 11 | -------------------------------------------------------------------------------- /shaders/shader.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | out gl_PerVertex { 5 | vec4 gl_Position; 6 | }; 7 | 8 | layout(location = 0) out vec3 fragColor; 9 | 10 | vec2 positions[3] = vec2[]( 11 | vec2(0.0, -0.5), 12 | vec2(0.5, 0.5), 13 | vec2(-0.5, 0.5) 14 | ); 15 | 16 | vec3 colors[3] = vec3[]( 17 | vec3(1.0, 0.0, 0.0), 18 | vec3(0.0, 1.0, 0.0), 19 | vec3(0.0, 0.0, 1.0) 20 | ); 21 | 22 | void main() { 23 | gl_Position = vec4(positions[gl_VertexIndex], 0.0, 1.0); 24 | fragColor = colors[gl_VertexIndex]; 25 | } 26 | 27 | 28 | -------------------------------------------------------------------------------- /shaders/vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrk/zig-window/313e3090b2eecdc5317291b5b13dc7871023d025/shaders/vert.spv -------------------------------------------------------------------------------- /src/dummy.zig: -------------------------------------------------------------------------------- 1 | export fn dummypassthru(x: i32) i32 { 2 | return x; 3 | } 4 | -------------------------------------------------------------------------------- /src/libc_bits.h: -------------------------------------------------------------------------------- 1 | #ifndef _LIBC_BITS_H 2 | #define _LIBC_BITS_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include 9 | #include 10 | #include 11 | typedef long ssize_t; 12 | typedef unsigned long pthread_t; 13 | typedef unsigned uid_t; 14 | typedef unsigned gid_t; 15 | typedef __builtin_va_list __isoc_va_list; 16 | typedef struct { union { int __i[sizeof(long)==8?10:6]; volatile int __vi[sizeof(long)==8?10:6]; volatile void *volatile __p[sizeof(long)==8?5:6]; } __u; } pthread_mutex_t; 17 | typedef struct { unsigned __attr; } pthread_mutexattr_t; 18 | typedef struct { union { int __i[12]; volatile int __vi[12]; void *__p[12*sizeof(int)/sizeof(void*)]; } __u; } pthread_cond_t; 19 | typedef struct { unsigned __attr; } pthread_condattr_t; 20 | typedef long long time_t; 21 | struct timespec { time_t tv_sec; int :8*(sizeof(time_t)-sizeof(long))*(__BYTE_ORDER__==4321); long tv_nsec; int :8*(sizeof(time_t)-sizeof(long))*(__BYTE_ORDER__!=4321); }; 22 | 23 | struct tm { 24 | int tm_sec; 25 | int tm_min; 26 | int tm_hour; 27 | int tm_mday; 28 | int tm_mon; 29 | int tm_year; 30 | int tm_wday; 31 | int tm_yday; 32 | int tm_isdst; 33 | long __tm_gmtoff; 34 | const char *__tm_zone; 35 | }; 36 | 37 | struct _IO_FILE; 38 | typedef struct _IO_FILE FILE; 39 | 40 | struct __dirstream; 41 | typedef struct __dirstream DIR; 42 | 43 | typedef unsigned long long ino_t; 44 | typedef long long off_t; 45 | 46 | struct dirent { 47 | ino_t d_ino; 48 | off_t d_off; 49 | unsigned short d_reclen; 50 | unsigned char d_type; 51 | char d_name[256]; 52 | }; 53 | 54 | extern __attribute__((weak)) FILE *const stdin; 55 | extern __attribute__((weak)) FILE *const stdout; 56 | extern __attribute__((weak)) FILE *const stderr; 57 | 58 | #define F_OK 0 59 | #define R_OK 4 60 | #define W_OK 2 61 | #define X_OK 1 62 | 63 | #define RTLD_LAZY 1 64 | #define RTLD_NOW 2 65 | #define RTLD_NOLOAD 4 66 | #define RTLD_NODELETE 4096 67 | #define RTLD_GLOBAL 256 68 | #define RTLD_LOCAL 0 69 | 70 | #define RTLD_NEXT ((void *)-1) 71 | #define RTLD_DEFAULT ((void *)0) 72 | 73 | #define RTLD_DI_LINKMAP 2 74 | 75 | #undef SEEK_SET 76 | #undef SEEK_CUR 77 | #undef SEEK_END 78 | #define SEEK_SET 0 79 | #define SEEK_CUR 1 80 | #define SEEK_END 2 81 | 82 | _Noreturn void __attribute__((weak)) abort (void); 83 | 84 | long __attribute__((weak)) atol (const char *); 85 | long long __attribute__((weak)) atoll (const char *); 86 | double __attribute__((weak)) atof (const char *); 87 | 88 | float __attribute__((weak)) strtof (const char *__restrict, char **__restrict); 89 | double __attribute__((weak)) strtod (const char *__restrict, char **__restrict); 90 | long double __attribute__((weak)) strtold (const char *__restrict, char **__restrict); 91 | 92 | long __attribute__((weak)) strtol (const char *__restrict, char **__restrict, int); 93 | unsigned long __attribute__((weak)) strtoul (const char *__restrict, char **__restrict, int); 94 | long long __attribute__((weak)) strtoll (const char *__restrict, char **__restrict, int); 95 | unsigned long long __attribute__((weak)) strtoull (const char *__restrict, char **__restrict, int); 96 | void *__attribute__((weak)) malloc (size_t); 97 | void *__attribute__((weak)) calloc (size_t, size_t); 98 | void *__attribute__((weak)) realloc (void *, size_t); 99 | void __attribute__((weak)) free (void *); 100 | void *__attribute__((weak)) aligned_alloc(size_t, size_t); 101 | void *__attribute__((weak)) memcpy (void *__restrict, const void *__restrict, size_t); 102 | void *__attribute__((weak)) memmove (void *, const void *, size_t); 103 | void *__attribute__((weak)) memset (void *, int, size_t); 104 | int __attribute__((weak)) memcmp (const void *, const void *, size_t); 105 | void *__attribute__((weak)) memchr (const void *, int, size_t); 106 | char *__attribute__((weak)) strcpy (char *__restrict, const char *__restrict); 107 | char *__attribute__((weak)) strncpy (char *__restrict, const char *__restrict, size_t); 108 | char *__attribute__((weak)) strcat (char *__restrict, const char *__restrict); 109 | char *__attribute__((weak)) strncat (char *__restrict, const char *__restrict, size_t); 110 | int __attribute__((weak)) strcmp (const char *, const char *); 111 | int __attribute__((weak)) strncmp (const char *, const char *, size_t); 112 | int __attribute__((weak)) strcoll (const char *, const char *); 113 | size_t __attribute__((weak)) strxfrm (char *__restrict, const char *__restrict, size_t); 114 | char *__attribute__((weak)) strchr (const char *, int); 115 | char *__attribute__((weak)) strrchr (const char *, int); 116 | size_t __attribute__((weak)) strcspn (const char *, const char *); 117 | size_t __attribute__((weak)) strspn (const char *, const char *); 118 | char *__attribute__((weak)) strpbrk (const char *, const char *); 119 | char *__attribute__((weak)) strstr (const char *, const char *); 120 | char *__attribute__((weak)) strtok (char *__restrict, const char *__restrict); 121 | char *__attribute__((weak)) strerror (int); 122 | char *__attribute__((weak)) getenv (const char *); 123 | int __attribute__((weak)) fputs(const char *__restrict, FILE *__restrict); 124 | int __attribute__((weak)) puts(const char *); 125 | int __attribute__((weak)) printf(const char *__restrict, ...); 126 | int __attribute__((weak)) fprintf(FILE *__restrict, const char *__restrict, ...); 127 | int __attribute__((weak)) sprintf(char *__restrict, const char *__restrict, ...); 128 | int __attribute__((weak)) snprintf(char *__restrict, size_t, const char *__restrict, ...); 129 | char * __attribute__((weak)) strchrnul(const char *, int); 130 | 131 | int __attribute__((weak)) vprintf(const char *__restrict, __isoc_va_list); 132 | int __attribute__((weak)) vfprintf(FILE *__restrict, const char *__restrict, __isoc_va_list); 133 | int __attribute__((weak)) vsprintf(char *__restrict, const char *__restrict, __isoc_va_list); 134 | int __attribute__((weak)) vsnprintf(char *__restrict, size_t, const char *__restrict, __isoc_va_list); 135 | 136 | int __attribute__((weak)) fgetc(FILE *); 137 | int __attribute__((weak)) getc(FILE *); 138 | int __attribute__((weak)) getchar(void); 139 | int __attribute__((weak)) ungetc(int, FILE *); 140 | int __attribute__((weak)) fputc(int, FILE *); 141 | int __attribute__((weak)) putc(int, FILE *); 142 | int __attribute__((weak)) putchar(int); 143 | FILE *__attribute__((weak)) fopen(const char *__restrict, const char *__restrict); 144 | int __attribute__((weak)) fclose(FILE *); 145 | int __attribute__((weak)) fseek(FILE *, long, int); 146 | long __attribute__((weak)) ftell(FILE *); 147 | void __attribute__((weak)) rewind(FILE *); 148 | size_t __attribute__((weak)) fread(void *__restrict, size_t, size_t, FILE *__restrict); 149 | size_t __attribute__((weak)) fwrite(const void *__restrict, size_t, size_t, FILE *__restrict); 150 | 151 | int __attribute__((weak)) closedir(DIR *); 152 | DIR *__attribute__((weak)) fdopendir(int); 153 | DIR *__attribute__((weak)) opendir(const char *); 154 | struct dirent *__attribute__((weak)) readdir(DIR *); 155 | 156 | time_t __attribute__((weak)) time (time_t *); 157 | struct tm *__attribute__((weak)) localtime (const time_t *); 158 | time_t __attribute__((weak)) mktime (struct tm *); 159 | 160 | int __attribute__((weak)) access(const char *, int); 161 | char *__attribute__((weak)) dirname(char *); 162 | char *__attribute__((weak)) basename(char *); 163 | ssize_t __attribute__((weak)) readlink(const char *__restrict, char *__restrict, size_t); 164 | ssize_t __attribute__((weak)) readlinkat(int, const char *__restrict, char *__restrict, size_t); 165 | uid_t __attribute__((weak)) getuid(void); 166 | uid_t __attribute__((weak)) geteuid(void); 167 | gid_t __attribute__((weak)) getgid(void); 168 | gid_t __attribute__((weak)) getegid(void); 169 | int __attribute__((weak)) getgroups(int, gid_t []); 170 | int __attribute__((weak)) setuid(uid_t); 171 | int __attribute__((weak)) seteuid(uid_t); 172 | int __attribute__((weak)) setgid(gid_t); 173 | int __attribute__((weak)) setegid(gid_t); 174 | 175 | int __attribute__((weak)) dlclose(void *); 176 | char *__attribute__((weak)) dlerror(void); 177 | void *__attribute__((weak)) dlopen(const char *, int); 178 | void *__attribute__((weak)) dlsym(void *__restrict, const char *__restrict); 179 | 180 | double __attribute__((weak)) pow(double, double); 181 | 182 | pthread_t __attribute__((weak)) pthread_self(void); 183 | 184 | int __attribute__((weak)) pthread_mutex_init(pthread_mutex_t *__restrict, const pthread_mutexattr_t *__restrict); 185 | int __attribute__((weak)) pthread_mutex_lock(pthread_mutex_t *); 186 | int __attribute__((weak)) pthread_mutex_unlock(pthread_mutex_t *); 187 | int __attribute__((weak)) pthread_mutex_trylock(pthread_mutex_t *); 188 | int __attribute__((weak)) pthread_mutex_timedlock(pthread_mutex_t *__restrict, const struct timespec *__restrict); 189 | int __attribute__((weak)) pthread_mutex_destroy(pthread_mutex_t *); 190 | int __attribute__((weak)) pthread_mutex_consistent(pthread_mutex_t *); 191 | 192 | int __attribute__((weak)) pthread_cond_init(pthread_cond_t *__restrict, const pthread_condattr_t *__restrict); 193 | int __attribute__((weak)) pthread_cond_destroy(pthread_cond_t *); 194 | int __attribute__((weak)) pthread_cond_wait(pthread_cond_t *__restrict, pthread_mutex_t *__restrict); 195 | int __attribute__((weak)) pthread_cond_timedwait(pthread_cond_t *__restrict, pthread_mutex_t *__restrict, const struct timespec *__restrict); 196 | int __attribute__((weak)) pthread_cond_broadcast(pthread_cond_t *); 197 | int __attribute__((weak)) pthread_cond_signal(pthread_cond_t *); 198 | 199 | #ifdef NDEBUG 200 | #define assert(x) (void)0 201 | #else 202 | #define assert(x) ((void)((x) || (abort(),0))) 203 | #endif 204 | 205 | #define alloca __builtin_alloca 206 | 207 | #define UINT8_MAX (0xff) 208 | #define UINT16_MAX (0xffff) 209 | #define UINT32_MAX (0xffffffffu) 210 | #define UINT64_MAX (0xffffffffffffffffu) 211 | 212 | #if __UINTPTR_MAX__ == UINT64_MAX 213 | #define __PRI64 "l" 214 | #define __PRIPTR "l" 215 | #else 216 | #define __PRI64 "ll" 217 | #define __PRIPTR "" 218 | #endif 219 | 220 | #define PRId8 "d" 221 | #define PRId16 "d" 222 | #define PRId32 "d" 223 | #define PRId64 __PRI64 "d" 224 | 225 | #define PRIdLEAST8 "d" 226 | #define PRIdLEAST16 "d" 227 | #define PRIdLEAST32 "d" 228 | #define PRIdLEAST64 __PRI64 "d" 229 | 230 | #define PRIdFAST8 "d" 231 | #define PRIdFAST16 "d" 232 | #define PRIdFAST32 "d" 233 | #define PRIdFAST64 __PRI64 "d" 234 | 235 | #define PRIi8 "i" 236 | #define PRIi16 "i" 237 | #define PRIi32 "i" 238 | #define PRIi64 __PRI64 "i" 239 | 240 | #define PRIiLEAST8 "i" 241 | #define PRIiLEAST16 "i" 242 | #define PRIiLEAST32 "i" 243 | #define PRIiLEAST64 __PRI64 "i" 244 | 245 | #define PRIiFAST8 "i" 246 | #define PRIiFAST16 "i" 247 | #define PRIiFAST32 "i" 248 | #define PRIiFAST64 __PRI64 "i" 249 | 250 | #define PRIo8 "o" 251 | #define PRIo16 "o" 252 | #define PRIo32 "o" 253 | #define PRIo64 __PRI64 "o" 254 | 255 | #define PRIoLEAST8 "o" 256 | #define PRIoLEAST16 "o" 257 | #define PRIoLEAST32 "o" 258 | #define PRIoLEAST64 __PRI64 "o" 259 | 260 | #define PRIoFAST8 "o" 261 | #define PRIoFAST16 "o" 262 | #define PRIoFAST32 "o" 263 | #define PRIoFAST64 __PRI64 "o" 264 | 265 | #define PRIu8 "u" 266 | #define PRIu16 "u" 267 | #define PRIu32 "u" 268 | #define PRIu64 __PRI64 "u" 269 | 270 | static inline size_t strlen(const char *s) { 271 | const char *a = s; 272 | for (; *s; s++); 273 | return s-a; 274 | } 275 | 276 | #ifdef __cplusplus 277 | } 278 | #endif 279 | 280 | #endif 281 | -------------------------------------------------------------------------------- /src/main.zig: -------------------------------------------------------------------------------- 1 | const std = @import("std"); 2 | const builtin = @import("builtin"); 3 | const mem = std.mem; 4 | const os = std.os; 5 | const fs = std.fs; 6 | const net = std.net; 7 | const assert = std.debug.assert; 8 | const Allocator = std.mem.Allocator; 9 | 10 | usingnamespace @import("xproto.zig"); 11 | 12 | pub const Display = struct { 13 | name: []u8, 14 | }; 15 | 16 | pub const Connection = struct { 17 | allocator: *Allocator, 18 | socket: net.Stream, 19 | setup: []u8, 20 | status: Status, 21 | 22 | pub const Status = enum { 23 | SetupFailed = 0, 24 | Ok = 1, 25 | Authenticate = 2, 26 | }; 27 | 28 | pub fn close(self: *Connection) void { 29 | self.allocator.free(self.setup); 30 | self.socket.close(); 31 | self.* = undefined; 32 | } 33 | }; 34 | 35 | pub const Auth = struct { 36 | family: u16, 37 | address: []u8, 38 | number: []u8, 39 | name: []u8, 40 | data: []u8, 41 | 42 | fn deinit(self: *Auth, allocator: *Allocator) void { 43 | allocator.free(self.address); 44 | allocator.free(self.number); 45 | allocator.free(self.name); 46 | allocator.free(self.data); 47 | self.* = undefined; 48 | } 49 | }; 50 | 51 | pub fn openDefaultDisplay(allocator: *Allocator) !Connection { 52 | const default_name = getDefaultDisplayName() orelse return error.UnknownDefaultDisplay; 53 | return openDisplay(allocator, default_name); 54 | } 55 | 56 | pub fn getDefaultDisplayName() ?[]const u8 { 57 | return os.getenv("DISPLAY"); 58 | } 59 | 60 | pub const OpenDisplayError = error{ 61 | OutOfMemory, 62 | InvalidDisplayFormat, 63 | UnableToConnectToServer, 64 | SetupFailed, 65 | AuthFileUnavailable, 66 | 67 | // TODO get rid of some of these 68 | FileDescriptorAlreadyPresentInSet, 69 | OperationCausesCircularLoop, 70 | FileDescriptorNotRegistered, 71 | SystemResources, 72 | UserResourceLimitReached, 73 | FileDescriptorIncompatibleWithEpoll, 74 | Unexpected, 75 | InputOutput, 76 | AccessDenied, 77 | EndOfStream, 78 | InvalidStatus, 79 | ConnectionTimedOut, 80 | NotOpenForReading, 81 | NotOpenForWriting, 82 | }; 83 | 84 | pub fn openDisplay(allocator: *Allocator, name: []const u8) OpenDisplayError!Connection { 85 | const parsed = parseDisplay(name) catch |err| switch (err) { 86 | error.Overflow => return error.InvalidDisplayFormat, 87 | error.MissingColon => return error.InvalidDisplayFormat, 88 | error.MissingDisplayIndex => return error.InvalidDisplayFormat, 89 | error.InvalidCharacter => return error.InvalidDisplayFormat, 90 | }; 91 | return try connectToDisplay(allocator, parsed, null); 92 | } 93 | 94 | pub const ParsedDisplay = struct { 95 | host: []const u8, 96 | protocol: []const u8, 97 | display: u32, 98 | screen: u32, 99 | }; 100 | 101 | pub fn parseDisplay(name: []const u8) !ParsedDisplay { 102 | var result = ParsedDisplay{ 103 | .host = undefined, 104 | .protocol = name[0..0], 105 | .display = undefined, 106 | .screen = undefined, 107 | }; 108 | const after_prot = if (mem.lastIndexOfScalar(u8, name, '/')) |slash_pos| blk: { 109 | result.protocol = name[0..slash_pos]; 110 | break :blk name[slash_pos..]; 111 | } else name; 112 | 113 | const colon = mem.lastIndexOfScalar(u8, after_prot, ':') orelse return error.MissingColon; 114 | var it = mem.split(after_prot[colon + 1 ..], "."); 115 | result.display = try std.fmt.parseInt(u32, it.next() orelse return error.MissingDisplayIndex, 10); 116 | result.screen = if (it.next()) |s| try std.fmt.parseInt(u32, s, 10) else 0; 117 | result.host = after_prot[0..colon]; 118 | return result; 119 | } 120 | 121 | pub fn open(host: []const u8, protocol: []const u8, display: u32) !net.Stream { 122 | if (protocol.len != 0 and !mem.eql(u8, protocol, "unix")) { 123 | return error.UnsupportedProtocol; 124 | } 125 | 126 | var path_buf: [fs.MAX_PATH_BYTES]u8 = undefined; 127 | const socket_path = std.fmt.bufPrint(path_buf[0..], "/tmp/.X11-unix/X{d}", .{display}) catch unreachable; 128 | 129 | return net.connectUnixSocket(socket_path); 130 | } 131 | 132 | pub fn connectToDisplay(allocator: *Allocator, parsed: ParsedDisplay, optional_auth: ?Auth) !Connection { 133 | const sock = open(parsed.host, parsed.protocol, parsed.display) catch return error.UnableToConnectToServer; 134 | errdefer sock.close(); 135 | 136 | var cleanup_auth = false; 137 | var auth = if (optional_auth) |a| a else blk: { 138 | cleanup_auth = true; 139 | break :blk getAuth(allocator, sock, parsed.display) catch |e| switch (e) { 140 | error.WouldBlock => unreachable, 141 | 142 | error.OperationAborted => unreachable, 143 | error.ConnectionResetByPeer => return error.AuthFileUnavailable, 144 | error.IsDir => return error.AuthFileUnavailable, 145 | error.SharingViolation => return error.AuthFileUnavailable, 146 | error.PathAlreadyExists => return error.AuthFileUnavailable, 147 | error.FileNotFound => return error.AuthFileUnavailable, 148 | error.PipeBusy => return error.AuthFileUnavailable, 149 | error.NameTooLong => return error.AuthFileUnavailable, 150 | error.InvalidUtf8 => return error.AuthFileUnavailable, 151 | error.BadPathName => return error.AuthFileUnavailable, 152 | error.FileTooBig => return error.AuthFileUnavailable, 153 | error.SymLinkLoop => return error.AuthFileUnavailable, 154 | error.ProcessFdQuotaExceeded => return error.AuthFileUnavailable, 155 | error.NoDevice => return error.AuthFileUnavailable, 156 | error.NoSpaceLeft => return error.AuthFileUnavailable, 157 | error.EndOfStream => return error.AuthFileUnavailable, 158 | error.InputOutput => return error.AuthFileUnavailable, 159 | error.NotDir => return error.AuthFileUnavailable, 160 | error.AccessDenied => return error.AuthFileUnavailable, 161 | error.HomeDirectoryNotFound => return error.AuthFileUnavailable, 162 | error.BrokenPipe => return error.AuthFileUnavailable, 163 | error.DeviceBusy => return error.AuthFileUnavailable, 164 | error.PermissionDenied => return error.AuthFileUnavailable, 165 | error.FileLocksNotSupported => return error.AuthFileUnavailable, 166 | error.ConnectionTimedOut => return error.AuthFileUnavailable, 167 | error.NotOpenForReading => return error.AuthFileUnavailable, 168 | 169 | error.Unexpected => return error.Unexpected, 170 | 171 | error.SystemFdQuotaExceeded => return error.SystemResources, 172 | error.SystemResources => return error.AuthFileUnavailable, 173 | 174 | error.OutOfMemory => return error.OutOfMemory, 175 | }; 176 | }; 177 | defer if (cleanup_auth) auth.deinit(allocator); 178 | 179 | return connectToStream(allocator, sock, auth) catch |err| switch (err) { 180 | error.WouldBlock => unreachable, 181 | error.DiskQuota => unreachable, 182 | error.OperationAborted => unreachable, 183 | error.FileTooBig => unreachable, 184 | error.NoSpaceLeft => unreachable, 185 | 186 | error.IsDir => return error.UnableToConnectToServer, 187 | error.BrokenPipe => return error.UnableToConnectToServer, 188 | error.ConnectionResetByPeer => return error.UnableToConnectToServer, 189 | else => |e| return e, 190 | }; 191 | } 192 | 193 | fn xpad(n: usize) usize { 194 | return @bitCast(usize, (-%@bitCast(isize, n)) & 3); 195 | } 196 | 197 | test "xpad" { 198 | assert(xpad(1) == 3); 199 | assert(xpad(2) == 2); 200 | assert(xpad(3) == 1); 201 | assert(xpad(4) == 0); 202 | assert(xpad(5) == 3); 203 | assert(xpad(6) == 2); 204 | assert(xpad(7) == 1); 205 | assert(xpad(8) == 0); 206 | } 207 | 208 | /// sock must be `O_RDWR`. 209 | /// `O_NONBLOCK` may be set if `std.event.Loop.instance != null`. 210 | pub fn connectToStream(allocator: *Allocator, sock: net.Stream, auth: ?Auth) !Connection { 211 | var conn = Connection{ 212 | .allocator = allocator, 213 | .socket = sock, 214 | .setup = undefined, 215 | .status = undefined, 216 | }; 217 | 218 | try writeSetup(sock, auth); 219 | try readSetup(allocator, &conn); 220 | 221 | return conn; 222 | } 223 | 224 | fn readSetup(allocator: *Allocator, conn: *Connection) !void { 225 | const reader = conn.socket.reader(); 226 | 227 | const xcb_setup_generic_t = extern struct { 228 | status: u8, 229 | pad0: [5]u8, 230 | length: u16, 231 | }; 232 | const header = try reader.readStruct(xcb_setup_generic_t); 233 | 234 | conn.setup = try allocator.alloc(u8, header.length * 4); 235 | errdefer allocator.free(conn.setup); 236 | 237 | try reader.readNoEof(conn.setup); 238 | 239 | conn.status = switch (header.status) { 240 | 0 => Connection.Status.SetupFailed, 241 | 1 => Connection.Status.Ok, 242 | 2 => Connection.Status.Authenticate, 243 | else => return error.InvalidStatus, 244 | }; 245 | } 246 | 247 | fn writeSetup(sock: net.Stream, auth: ?Auth) !void { 248 | const pad = [3]u8{ 0, 0, 0 }; 249 | var parts: [6]os.iovec_const = undefined; 250 | var parts_index: usize = 0; 251 | var setup_req = xcb_setup_request_t{ 252 | .byte_order = if (builtin.endian == builtin.Endian.Big) 0x42 else 0x6c, 253 | .pad0 = 0, 254 | .protocol_major_version = X_PROTOCOL, 255 | .protocol_minor_version = X_PROTOCOL_REVISION, 256 | .authorization_protocol_name_len = 0, 257 | .authorization_protocol_data_len = 0, 258 | .pad1 = [2]u8{ 0, 0 }, 259 | }; 260 | parts[parts_index].iov_len = @sizeOf(xcb_setup_request_t); 261 | parts[parts_index].iov_base = @ptrCast([*]const u8, &setup_req); 262 | parts_index += 1; 263 | comptime assert(xpad(@sizeOf(xcb_setup_request_t)) == 0); 264 | 265 | if (auth) |a| { 266 | setup_req.authorization_protocol_name_len = @intCast(u16, a.name.len); 267 | parts[parts_index].iov_len = a.name.len; 268 | parts[parts_index].iov_base = a.name.ptr; 269 | parts_index += 1; 270 | parts[parts_index].iov_len = xpad(a.name.len); 271 | parts[parts_index].iov_base = &pad; 272 | parts_index += 1; 273 | 274 | setup_req.authorization_protocol_data_len = @intCast(u16, a.data.len); 275 | parts[parts_index].iov_len = a.data.len; 276 | parts[parts_index].iov_base = a.data.ptr; 277 | parts_index += 1; 278 | parts[parts_index].iov_len = xpad(a.data.len); 279 | parts[parts_index].iov_base = &pad; 280 | parts_index += 1; 281 | } 282 | 283 | assert(parts_index <= parts.len); 284 | 285 | return sock.writevAll(parts[0..parts_index]); 286 | } 287 | 288 | pub fn getAuth(allocator: *Allocator, sock: net.Stream, display: u32) !Auth { 289 | const xau_file = if (os.getenv("XAUTHORITY")) |xau_file_name| blk: { 290 | break :blk try fs.openFileAbsolute(xau_file_name, .{}); 291 | } else blk: { 292 | const home = os.getenv("HOME") orelse return error.HomeDirectoryNotFound; 293 | var dir = try fs.cwd().openDir(home, .{}); 294 | defer dir.close(); 295 | 296 | break :blk try dir.openFile(".Xauthority", .{}); 297 | }; 298 | defer xau_file.close(); 299 | 300 | const stream = xau_file.reader(); 301 | 302 | var hostname_buf: [os.HOST_NAME_MAX]u8 = undefined; 303 | const hostname = try os.gethostname(&hostname_buf); 304 | 305 | while (true) { 306 | var auth = blk: { 307 | const family = try stream.readIntBig(u16); 308 | const address = try readCountedString(allocator, stream); 309 | errdefer allocator.free(address); 310 | const number = try readCountedString(allocator, stream); 311 | errdefer allocator.free(number); 312 | const name = try readCountedString(allocator, stream); 313 | errdefer allocator.free(name); 314 | const data = try readCountedString(allocator, stream); 315 | errdefer allocator.free(data); 316 | 317 | break :blk Auth{ 318 | .family = family, 319 | .address = address, 320 | .number = number, 321 | .name = name, 322 | .data = data, 323 | }; 324 | }; 325 | if (mem.eql(u8, hostname, auth.address)) { 326 | return auth; 327 | } else { 328 | auth.deinit(allocator); 329 | continue; 330 | } 331 | } 332 | 333 | return error.AuthNotFound; 334 | } 335 | 336 | fn readCountedString(allocator: *Allocator, stream: anytype) ![]u8 { 337 | const len = try stream.readIntBig(u16); 338 | const buf = try allocator.alloc(u8, len); 339 | errdefer allocator.free(buf); 340 | 341 | try stream.readNoEof(buf); 342 | return buf; 343 | } 344 | -------------------------------------------------------------------------------- /src/vulkan-loader/cJSON.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2009 Dave Gamble 3 | Copyright (c) 2015-2016 The Khronos Group Inc. 4 | Copyright (c) 2015-2016 Valve Corporation 5 | Copyright (c) 2015-2016 LunarG, Inc. 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | THE SOFTWARE. 24 | */ 25 | 26 | #ifndef cJSON__h 27 | #define cJSON__h 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | /* cJSON Types: */ 34 | #define cJSON_False 0 35 | #define cJSON_True 1 36 | #define cJSON_NULL 2 37 | #define cJSON_Number 3 38 | #define cJSON_String 4 39 | #define cJSON_Array 5 40 | #define cJSON_Object 6 41 | 42 | #define cJSON_IsReference 256 43 | #define cJSON_StringIsConst 512 44 | 45 | /* The cJSON structure: */ 46 | typedef struct cJSON { 47 | struct cJSON *next, *prev; /* next/prev allow you to walk array/object 48 | chains. Alternatively, use 49 | GetArraySize/GetArrayItem/GetObjectItem */ 50 | struct cJSON *child; /* An array or object item will have a child pointer 51 | pointing to a chain of the items in the 52 | array/object. */ 53 | 54 | int type; /* The type of the item, as above. */ 55 | 56 | char *valuestring; /* The item's string, if type==cJSON_String */ 57 | int valueint; /* The item's number, if type==cJSON_Number */ 58 | double valuedouble; /* The item's number, if type==cJSON_Number */ 59 | 60 | char *string; /* The item's name string, if this item is the child of, or is 61 | in the list of subitems of an object. */ 62 | } cJSON; 63 | 64 | typedef struct cJSON_Hooks { 65 | void *(*malloc_fn)(size_t sz); 66 | void (*free_fn)(void *ptr); 67 | } cJSON_Hooks; 68 | 69 | /* Supply malloc, realloc and free functions to cJSON */ 70 | extern void cJSON_InitHooks(cJSON_Hooks *hooks); 71 | 72 | /* Supply a block of JSON, and this returns a cJSON object you can interrogate. 73 | * Call cJSON_Delete when finished. */ 74 | extern cJSON *cJSON_Parse(const char *value); 75 | /* Render a cJSON entity to text for transfer/storage. Free the char* when 76 | * finished. */ 77 | extern char *cJSON_Print(cJSON *item); 78 | /* Render a cJSON entity to text for transfer/storage without any formatting. 79 | * Free the char* when finished. */ 80 | extern char *cJSON_PrintUnformatted(cJSON *item); 81 | /* Render a cJSON entity to text using a buffered strategy. prebuffer is a guess 82 | * at the final size. guessing well reduces reallocation. fmt=0 gives 83 | * unformatted, =1 gives formatted */ 84 | extern char *cJSON_PrintBuffered(cJSON *item, int prebuffer, int fmt); 85 | /* Delete a cJSON entity and all subentities. */ 86 | extern void cJSON_Delete(cJSON *c); 87 | /* Delete an item allocated inside the JSON parser*/ 88 | extern void cJSON_Free(void *p); 89 | 90 | /* Returns the number of items in an array (or object). */ 91 | extern int cJSON_GetArraySize(cJSON *array); 92 | /* Retrieve item number "item" from array "array". Returns NULL if unsuccessful. 93 | */ 94 | extern cJSON *cJSON_GetArrayItem(cJSON *array, int item); 95 | /* Get item "string" from object. Case insensitive. */ 96 | extern cJSON *cJSON_GetObjectItem(cJSON *object, const char *string); 97 | 98 | /* For analysing failed parses. This returns a pointer to the parse error. 99 | * You'll probably need to look a few chars back to make sense of it. Defined 100 | * when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */ 101 | extern const char *cJSON_GetErrorPtr(void); 102 | 103 | /* These calls create a cJSON item of the appropriate type. */ 104 | extern cJSON *cJSON_CreateNull(void); 105 | extern cJSON *cJSON_CreateTrue(void); 106 | extern cJSON *cJSON_CreateFalse(void); 107 | extern cJSON *cJSON_CreateBool(int b); 108 | extern cJSON *cJSON_CreateNumber(double num); 109 | extern cJSON *cJSON_CreateString(const char *string); 110 | extern cJSON *cJSON_CreateArray(void); 111 | extern cJSON *cJSON_CreateObject(void); 112 | 113 | /* These utilities create an Array of count items. */ 114 | extern cJSON *cJSON_CreateIntArray(const int *numbers, int count); 115 | extern cJSON *cJSON_CreateFloatArray(const float *numbers, int count); 116 | extern cJSON *cJSON_CreateDoubleArray(const double *numbers, int count); 117 | extern cJSON *cJSON_CreateStringArray(const char **strings, int count); 118 | 119 | /* Append item to the specified array/object. */ 120 | extern void cJSON_AddItemToArray(cJSON *array, cJSON *item); 121 | extern void cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item); 122 | extern void cJSON_AddItemToObjectCS(cJSON *object, const char *string, 123 | cJSON *item); /* Use this when string is definitely const (i.e. a literal, 124 | or as good as), and will definitely survive the cJSON 125 | object */ 126 | /* Append reference to item to the specified array/object. Use this when you 127 | * want to add an existing cJSON to a new cJSON, but don't want to corrupt your 128 | * existing cJSON. */ 129 | extern void cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item); 130 | extern void cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item); 131 | 132 | /* Remove/Detatch items from Arrays/Objects. */ 133 | extern cJSON *cJSON_DetachItemFromArray(cJSON *array, int which); 134 | extern void cJSON_DeleteItemFromArray(cJSON *array, int which); 135 | extern cJSON *cJSON_DetachItemFromObject(cJSON *object, const char *string); 136 | extern void cJSON_DeleteItemFromObject(cJSON *object, const char *string); 137 | 138 | /* Update array items. */ 139 | extern void cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */ 140 | extern void cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem); 141 | extern void cJSON_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem); 142 | 143 | /* Duplicate a cJSON item */ 144 | extern cJSON *cJSON_Duplicate(cJSON *item, int recurse); 145 | /* Duplicate will create a new, identical cJSON item to the one you pass, in new 146 | memory that will 147 | need to be released. With recurse!=0, it will duplicate any children connected 148 | to the item. 149 | The item->next and ->prev pointers are always zero on return from Duplicate. */ 150 | 151 | /* ParseWithOpts allows you to require (and check) that the JSON is null 152 | * terminated, and to retrieve the pointer to the final byte parsed. */ 153 | extern cJSON *cJSON_ParseWithOpts(const char *value, const char **return_parse_end, int require_null_terminated); 154 | 155 | extern void cJSON_Minify(char *json); 156 | 157 | /* Macros for creating things quickly. */ 158 | #define cJSON_AddNullToObject(object, name) cJSON_AddItemToObject(object, name, cJSON_CreateNull()) 159 | #define cJSON_AddTrueToObject(object, name) cJSON_AddItemToObject(object, name, cJSON_CreateTrue()) 160 | #define cJSON_AddFalseToObject(object, name) cJSON_AddItemToObject(object, name, cJSON_CreateFalse()) 161 | #define cJSON_AddBoolToObject(object, name, b) cJSON_AddItemToObject(object, name, cJSON_CreateBool(b)) 162 | #define cJSON_AddNumberToObject(object, name, n) cJSON_AddItemToObject(object, name, cJSON_CreateNumber(n)) 163 | #define cJSON_AddStringToObject(object, name, s) cJSON_AddItemToObject(object, name, cJSON_CreateString(s)) 164 | 165 | /* When assigning an integer value, it needs to be propagated to valuedouble 166 | * too. */ 167 | #define cJSON_SetIntValue(object, val) ((object) ? (object)->valueint = (object)->valuedouble = (val) : (val)) 168 | #define cJSON_SetNumberValue(object, val) ((object) ? (object)->valueint = (object)->valuedouble = (val) : (val)) 169 | 170 | #ifdef __cplusplus 171 | } 172 | #endif 173 | 174 | #endif 175 | -------------------------------------------------------------------------------- /src/vulkan-loader/debug_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2017 The Khronos Group Inc. 3 | * Copyright (c) 2015-2017 Valve Corporation 4 | * Copyright (c) 2015-2017 LunarG, Inc. 5 | * Copyright (C) 2015-2016 Google Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * Author: Courtney Goeltzenleuchter 20 | * Author: Jon Ashburn 21 | * Author: Mark Young 22 | * 23 | */ 24 | 25 | #include "vk_loader_platform.h" 26 | #include "loader.h" 27 | 28 | // General utilities 29 | 30 | void debug_utils_AddInstanceExtensions(const struct loader_instance *inst, struct loader_extension_list *ext_list); 31 | void debug_utils_CreateInstance(struct loader_instance *ptr_instance, const VkInstanceCreateInfo *pCreateInfo); 32 | bool debug_utils_InstanceGpa(struct loader_instance *ptr_instance, const char *name, void **addr); 33 | bool debug_utils_ReportFlagsToAnnotFlags(VkDebugReportFlagsEXT dr_flags, bool default_flag_is_spec, 34 | VkDebugUtilsMessageSeverityFlagBitsEXT *da_severity, 35 | VkDebugUtilsMessageTypeFlagsEXT *da_type); 36 | bool debug_utils_AnnotFlagsToReportFlags(VkDebugUtilsMessageSeverityFlagBitsEXT da_severity, 37 | VkDebugUtilsMessageTypeFlagsEXT da_type, VkDebugReportFlagsEXT *dr_flags); 38 | bool debug_utils_ReportObjectToAnnotObject(VkDebugReportObjectTypeEXT dr_object_type, uint64_t object_handle, 39 | VkDebugUtilsObjectNameInfoEXT *da_object_name_info); 40 | bool debug_utils_AnnotObjectToDebugReportObject(const VkDebugUtilsObjectNameInfoEXT *da_object_name_info, 41 | VkDebugReportObjectTypeEXT *dr_object_type, uint64_t *dr_object_handle); 42 | 43 | // VK_EXT_debug_utils related items 44 | 45 | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugUtilsMessengerEXT(VkInstance instance, 46 | const VkDebugUtilsMessengerCreateInfoEXT *pCreateInfo, 47 | const VkAllocationCallbacks *pAllocator, 48 | VkDebugUtilsMessengerEXT *pMessenger); 49 | VKAPI_ATTR void VKAPI_CALL terminator_DestroyDebugUtilsMessengerEXT(VkInstance instance, VkDebugUtilsMessengerEXT messenger, 50 | const VkAllocationCallbacks *pAllocator); 51 | VKAPI_ATTR void VKAPI_CALL terminator_SubmitDebugUtilsMessageEXT(VkInstance instance, 52 | VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, 53 | VkDebugUtilsMessageTypeFlagsEXT messageTypes, 54 | const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData); 55 | VkResult util_CreateDebugUtilsMessenger(struct loader_instance *inst, const VkDebugUtilsMessengerCreateInfoEXT *pCreateInfo, 56 | const VkAllocationCallbacks *pAllocator, VkDebugUtilsMessengerEXT messenger); 57 | VkResult util_CreateDebugUtilsMessengers(struct loader_instance *inst, const VkAllocationCallbacks *pAllocator, 58 | uint32_t num_messengers, VkDebugUtilsMessengerCreateInfoEXT *infos, 59 | VkDebugUtilsMessengerEXT *messengers); 60 | VkBool32 util_SubmitDebugUtilsMessageEXT(const struct loader_instance *inst, VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, 61 | VkDebugUtilsMessageTypeFlagsEXT messageTypes, 62 | const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData); 63 | VkResult util_CopyDebugUtilsMessengerCreateInfos(const void *pChain, const VkAllocationCallbacks *pAllocator, 64 | uint32_t *num_messengers, VkDebugUtilsMessengerCreateInfoEXT **infos, 65 | VkDebugUtilsMessengerEXT **messengers); 66 | void util_DestroyDebugUtilsMessenger(struct loader_instance *inst, VkDebugUtilsMessengerEXT messenger, 67 | const VkAllocationCallbacks *pAllocator); 68 | void util_DestroyDebugUtilsMessengers(struct loader_instance *inst, const VkAllocationCallbacks *pAllocator, 69 | uint32_t num_messengers, VkDebugUtilsMessengerEXT *messengers); 70 | void util_FreeDebugUtilsMessengerCreateInfos(const VkAllocationCallbacks *pAllocator, VkDebugUtilsMessengerCreateInfoEXT *infos, 71 | VkDebugUtilsMessengerEXT *messengers); 72 | 73 | // VK_EXT_debug_report related items 74 | 75 | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugReportCallbackEXT(VkInstance instance, 76 | const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, 77 | const VkAllocationCallbacks *pAllocator, 78 | VkDebugReportCallbackEXT *pCallback); 79 | 80 | VKAPI_ATTR void VKAPI_CALL terminator_DestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT callback, 81 | const VkAllocationCallbacks *pAllocator); 82 | 83 | VKAPI_ATTR void VKAPI_CALL terminator_DebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, 84 | VkDebugReportObjectTypeEXT objType, uint64_t object, size_t location, 85 | int32_t msgCode, const char *pLayerPrefix, const char *pMsg); 86 | 87 | VkResult util_CreateDebugReportCallback(struct loader_instance *inst, VkDebugReportCallbackCreateInfoEXT *pCreateInfo, 88 | const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackEXT callback); 89 | VkResult util_CreateDebugReportCallbacks(struct loader_instance *inst, const VkAllocationCallbacks *pAllocator, 90 | uint32_t num_callbacks, VkDebugReportCallbackCreateInfoEXT *infos, 91 | VkDebugReportCallbackEXT *callbacks); 92 | VkBool32 util_DebugReportMessage(const struct loader_instance *inst, VkFlags msgFlags, VkDebugReportObjectTypeEXT objectType, 93 | uint64_t srcObject, size_t location, int32_t msgCode, const char *pLayerPrefix, const char *pMsg); 94 | VkResult util_CopyDebugReportCreateInfos(const void *pChain, const VkAllocationCallbacks *pAllocator, uint32_t *num_callbacks, 95 | VkDebugReportCallbackCreateInfoEXT **infos, VkDebugReportCallbackEXT **callbacks); 96 | void util_DestroyDebugReportCallback(struct loader_instance *inst, VkDebugReportCallbackEXT callback, 97 | const VkAllocationCallbacks *pAllocator); 98 | void util_DestroyDebugReportCallbacks(struct loader_instance *inst, const VkAllocationCallbacks *pAllocator, uint32_t num_callbacks, 99 | VkDebugReportCallbackEXT *callbacks); 100 | void util_FreeDebugReportCreateInfos(const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackCreateInfoEXT *infos, 101 | VkDebugReportCallbackEXT *callbacks); 102 | -------------------------------------------------------------------------------- /src/vulkan-loader/extension_manual.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2017 The Khronos Group Inc. 3 | * Copyright (c) 2015-2017 Valve Corporation 4 | * Copyright (c) 2015-2017 LunarG, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Mark Young 19 | * Author: Lenny Komow 20 | */ 21 | 22 | #ifndef _GNU_SOURCE 23 | #define _GNU_SOURCE 24 | #endif 25 | #include 26 | #include "vk_loader_platform.h" 27 | #include "loader.h" 28 | #include "vk_loader_extensions.h" 29 | #include 30 | #include "wsi.h" 31 | #include "debug_utils.h" 32 | 33 | // ---- Manually added trampoline/terminator functions 34 | 35 | // These functions, for whatever reason, require more complex changes than 36 | // can easily be automatically generated. 37 | 38 | // ---- VK_NV_external_memory_capabilities extension trampoline/terminators 39 | 40 | VKAPI_ATTR VkResult VKAPI_CALL 41 | GetPhysicalDeviceExternalImageFormatPropertiesNV( 42 | VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, 43 | VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, 44 | VkExternalMemoryHandleTypeFlagsNV externalHandleType, 45 | VkExternalImageFormatPropertiesNV *pExternalImageFormatProperties) { 46 | const VkLayerInstanceDispatchTable *disp; 47 | VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); 48 | disp = loader_get_instance_layer_dispatch(physicalDevice); 49 | 50 | return disp->GetPhysicalDeviceExternalImageFormatPropertiesNV( 51 | unwrapped_phys_dev, format, type, tiling, usage, flags, 52 | externalHandleType, pExternalImageFormatProperties); 53 | } 54 | 55 | VKAPI_ATTR VkResult VKAPI_CALL 56 | terminator_GetPhysicalDeviceExternalImageFormatPropertiesNV( 57 | VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, 58 | VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, 59 | VkExternalMemoryHandleTypeFlagsNV externalHandleType, 60 | VkExternalImageFormatPropertiesNV *pExternalImageFormatProperties) { 61 | struct loader_physical_device_term *phys_dev_term = 62 | (struct loader_physical_device_term *)physicalDevice; 63 | struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; 64 | 65 | if (!icd_term->dispatch.GetPhysicalDeviceExternalImageFormatPropertiesNV) { 66 | if (externalHandleType) { 67 | return VK_ERROR_FORMAT_NOT_SUPPORTED; 68 | } 69 | 70 | if (!icd_term->dispatch.GetPhysicalDeviceImageFormatProperties) { 71 | return VK_ERROR_INITIALIZATION_FAILED; 72 | } 73 | 74 | pExternalImageFormatProperties->externalMemoryFeatures = 0; 75 | pExternalImageFormatProperties->exportFromImportedHandleTypes = 0; 76 | pExternalImageFormatProperties->compatibleHandleTypes = 0; 77 | 78 | return icd_term->dispatch.GetPhysicalDeviceImageFormatProperties( 79 | phys_dev_term->phys_dev, format, type, tiling, usage, flags, 80 | &pExternalImageFormatProperties->imageFormatProperties); 81 | } 82 | 83 | return icd_term->dispatch.GetPhysicalDeviceExternalImageFormatPropertiesNV( 84 | phys_dev_term->phys_dev, format, type, tiling, usage, flags, 85 | externalHandleType, pExternalImageFormatProperties); 86 | } 87 | 88 | // ---- VK_EXT_display_surface_counter extension trampoline/terminators 89 | 90 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceCapabilities2EXT(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, 91 | VkSurfaceCapabilities2EXT *pSurfaceCapabilities) { 92 | const VkLayerInstanceDispatchTable *disp; 93 | VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); 94 | disp = loader_get_instance_layer_dispatch(physicalDevice); 95 | return disp->GetPhysicalDeviceSurfaceCapabilities2EXT(unwrapped_phys_dev, surface, pSurfaceCapabilities); 96 | } 97 | 98 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceCapabilities2EXT( 99 | VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilities2EXT *pSurfaceCapabilities) { 100 | struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; 101 | struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; 102 | 103 | VkIcdSurface *icd_surface = (VkIcdSurface *)(surface); 104 | uint8_t icd_index = phys_dev_term->icd_index; 105 | 106 | // Unwrap the surface if needed 107 | VkSurfaceKHR unwrapped_surface = surface; 108 | if (icd_surface->real_icd_surfaces != NULL && (void *)icd_surface->real_icd_surfaces[icd_index] != NULL) { 109 | unwrapped_surface = icd_surface->real_icd_surfaces[icd_index]; 110 | } 111 | 112 | if (icd_term->dispatch.GetPhysicalDeviceSurfaceCapabilities2EXT != NULL) { 113 | // Pass the call to the driver 114 | return icd_term->dispatch.GetPhysicalDeviceSurfaceCapabilities2EXT(phys_dev_term->phys_dev, unwrapped_surface, 115 | pSurfaceCapabilities); 116 | } else { 117 | // Emulate the call 118 | loader_log(icd_term->this_instance, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, 119 | "vkGetPhysicalDeviceSurfaceCapabilities2EXT: Emulating call in ICD \"%s\" using " 120 | "vkGetPhysicalDeviceSurfaceCapabilitiesKHR", 121 | icd_term->scanned_icd->lib_name); 122 | 123 | VkSurfaceCapabilitiesKHR surface_caps; 124 | VkResult res = 125 | icd_term->dispatch.GetPhysicalDeviceSurfaceCapabilitiesKHR(phys_dev_term->phys_dev, unwrapped_surface, &surface_caps); 126 | pSurfaceCapabilities->minImageCount = surface_caps.minImageCount; 127 | pSurfaceCapabilities->maxImageCount = surface_caps.maxImageCount; 128 | pSurfaceCapabilities->currentExtent = surface_caps.currentExtent; 129 | pSurfaceCapabilities->minImageExtent = surface_caps.minImageExtent; 130 | pSurfaceCapabilities->maxImageExtent = surface_caps.maxImageExtent; 131 | pSurfaceCapabilities->maxImageArrayLayers = surface_caps.maxImageArrayLayers; 132 | pSurfaceCapabilities->supportedTransforms = surface_caps.supportedTransforms; 133 | pSurfaceCapabilities->currentTransform = surface_caps.currentTransform; 134 | pSurfaceCapabilities->supportedCompositeAlpha = surface_caps.supportedCompositeAlpha; 135 | pSurfaceCapabilities->supportedUsageFlags = surface_caps.supportedUsageFlags; 136 | pSurfaceCapabilities->supportedSurfaceCounters = 0; 137 | 138 | if (pSurfaceCapabilities->pNext != NULL) { 139 | loader_log(icd_term->this_instance, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, 140 | "vkGetPhysicalDeviceSurfaceCapabilities2EXT: Emulation found unrecognized structure type in " 141 | "pSurfaceCapabilities->pNext - this struct will be ignored"); 142 | } 143 | 144 | return res; 145 | } 146 | } 147 | 148 | // ---- VK_EXT_direct_mode_display extension trampoline/terminators 149 | 150 | VKAPI_ATTR VkResult VKAPI_CALL ReleaseDisplayEXT(VkPhysicalDevice physicalDevice, VkDisplayKHR display) { 151 | const VkLayerInstanceDispatchTable *disp; 152 | VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); 153 | disp = loader_get_instance_layer_dispatch(physicalDevice); 154 | return disp->ReleaseDisplayEXT(unwrapped_phys_dev, display); 155 | } 156 | 157 | VKAPI_ATTR VkResult VKAPI_CALL terminator_ReleaseDisplayEXT(VkPhysicalDevice physicalDevice, VkDisplayKHR display) { 158 | struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; 159 | struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; 160 | 161 | if (icd_term->dispatch.ReleaseDisplayEXT == NULL) { 162 | loader_log(icd_term->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, 163 | "ICD \"%s\" associated with VkPhysicalDevice does not support vkReleaseDisplayEXT - Consequently, the call is " 164 | "invalid because it should not be possible to acquire a display on this device", 165 | icd_term->scanned_icd->lib_name); 166 | } 167 | return icd_term->dispatch.ReleaseDisplayEXT(phys_dev_term->phys_dev, display); 168 | } 169 | 170 | // ---- VK_EXT_acquire_xlib_display extension trampoline/terminators 171 | 172 | #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT 173 | VKAPI_ATTR VkResult VKAPI_CALL AcquireXlibDisplayEXT(VkPhysicalDevice physicalDevice, Display *dpy, VkDisplayKHR display) { 174 | const VkLayerInstanceDispatchTable *disp; 175 | VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); 176 | disp = loader_get_instance_layer_dispatch(physicalDevice); 177 | return disp->AcquireXlibDisplayEXT(unwrapped_phys_dev, dpy, display); 178 | } 179 | 180 | VKAPI_ATTR VkResult VKAPI_CALL terminator_AcquireXlibDisplayEXT(VkPhysicalDevice physicalDevice, Display *dpy, 181 | VkDisplayKHR display) { 182 | struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; 183 | struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; 184 | 185 | if (icd_term->dispatch.AcquireXlibDisplayEXT != NULL) { 186 | // Pass the call to the driver 187 | return icd_term->dispatch.AcquireXlibDisplayEXT(phys_dev_term->phys_dev, dpy, display); 188 | } else { 189 | // Emulate the call 190 | loader_log(icd_term->this_instance, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, 191 | "vkAcquireXLibDisplayEXT: Emulating call in ICD \"%s\" by returning error", icd_term->scanned_icd->lib_name); 192 | 193 | // Fail for the unsupported command 194 | return VK_ERROR_INITIALIZATION_FAILED; 195 | } 196 | } 197 | 198 | VKAPI_ATTR VkResult VKAPI_CALL GetRandROutputDisplayEXT(VkPhysicalDevice physicalDevice, Display *dpy, RROutput rrOutput, 199 | VkDisplayKHR *pDisplay) { 200 | const VkLayerInstanceDispatchTable *disp; 201 | VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); 202 | disp = loader_get_instance_layer_dispatch(physicalDevice); 203 | return disp->GetRandROutputDisplayEXT(unwrapped_phys_dev, dpy, rrOutput, pDisplay); 204 | } 205 | 206 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetRandROutputDisplayEXT(VkPhysicalDevice physicalDevice, Display *dpy, RROutput rrOutput, 207 | VkDisplayKHR *pDisplay) { 208 | struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; 209 | struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; 210 | 211 | if (icd_term->dispatch.GetRandROutputDisplayEXT != NULL) { 212 | // Pass the call to the driver 213 | return icd_term->dispatch.GetRandROutputDisplayEXT(phys_dev_term->phys_dev, dpy, rrOutput, pDisplay); 214 | } else { 215 | // Emulate the call 216 | loader_log(icd_term->this_instance, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, 217 | "vkGetRandROutputDisplayEXT: Emulating call in ICD \"%s\" by returning null display", 218 | icd_term->scanned_icd->lib_name); 219 | 220 | // Return a null handle to indicate this can't be done 221 | *pDisplay = VK_NULL_HANDLE; 222 | return VK_SUCCESS; 223 | } 224 | } 225 | 226 | #endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT 227 | 228 | #ifdef VK_USE_PLATFORM_WIN32_KHR 229 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfacePresentModes2EXT( 230 | VkPhysicalDevice physicalDevice, 231 | const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, 232 | uint32_t* pPresentModeCount, 233 | VkPresentModeKHR* pPresentModes) { 234 | const VkLayerInstanceDispatchTable *disp; 235 | VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); 236 | disp = loader_get_instance_layer_dispatch(physicalDevice); 237 | return disp->GetPhysicalDeviceSurfacePresentModes2EXT(unwrapped_phys_dev, pSurfaceInfo, pPresentModeCount, pPresentModes); 238 | } 239 | 240 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfacePresentModes2EXT( 241 | VkPhysicalDevice physicalDevice, 242 | const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, 243 | uint32_t* pPresentModeCount, 244 | VkPresentModeKHR* pPresentModes) { 245 | struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; 246 | struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; 247 | if (NULL == icd_term->dispatch.GetPhysicalDeviceSurfacePresentModes2EXT) { 248 | loader_log(icd_term->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, 249 | "ICD associated with VkPhysicalDevice does not support GetPhysicalDeviceSurfacePresentModes2EXT"); 250 | } 251 | VkIcdSurface *icd_surface = (VkIcdSurface *)(pSurfaceInfo->surface); 252 | uint8_t icd_index = phys_dev_term->icd_index; 253 | if (NULL != icd_surface->real_icd_surfaces && NULL != (void *)icd_surface->real_icd_surfaces[icd_index]) { 254 | const VkPhysicalDeviceSurfaceInfo2KHR surface_info_copy = { 255 | .sType = pSurfaceInfo->sType, 256 | .pNext = pSurfaceInfo->pNext, 257 | .surface = icd_surface->real_icd_surfaces[icd_index], 258 | }; 259 | return icd_term->dispatch.GetPhysicalDeviceSurfacePresentModes2EXT(phys_dev_term->phys_dev, &surface_info_copy, pPresentModeCount, pPresentModes); 260 | } 261 | return icd_term->dispatch.GetPhysicalDeviceSurfacePresentModes2EXT(phys_dev_term->phys_dev, pSurfaceInfo, pPresentModeCount, pPresentModes); 262 | } 263 | 264 | VKAPI_ATTR VkResult VKAPI_CALL GetDeviceGroupSurfacePresentModes2EXT( 265 | VkDevice device, 266 | const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, 267 | VkDeviceGroupPresentModeFlagsKHR* pModes) { 268 | const VkLayerDispatchTable *disp = loader_get_dispatch(device); 269 | return disp->GetDeviceGroupSurfacePresentModes2EXT(device, pSurfaceInfo, pModes); 270 | } 271 | 272 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDeviceGroupSurfacePresentModes2EXT( 273 | VkDevice device, 274 | const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, 275 | VkDeviceGroupPresentModeFlagsKHR* pModes) { 276 | uint32_t icd_index = 0; 277 | struct loader_device *dev; 278 | struct loader_icd_term *icd_term = loader_get_icd_and_device(device, &dev, &icd_index); 279 | if (NULL != icd_term && NULL != icd_term->dispatch.GetDeviceGroupSurfacePresentModes2EXT) { 280 | VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)pSurfaceInfo->surface; 281 | if (NULL != icd_surface->real_icd_surfaces && (VkSurfaceKHR)NULL != icd_surface->real_icd_surfaces[icd_index]) { 282 | const VkPhysicalDeviceSurfaceInfo2KHR surface_info_copy = { 283 | .sType = pSurfaceInfo->sType, 284 | .pNext = pSurfaceInfo->pNext, 285 | .surface = icd_surface->real_icd_surfaces[icd_index], 286 | }; 287 | return icd_term->dispatch.GetDeviceGroupSurfacePresentModes2EXT(device, &surface_info_copy, pModes); 288 | } 289 | return icd_term->dispatch.GetDeviceGroupSurfacePresentModes2EXT(device, pSurfaceInfo, pModes); 290 | } 291 | return VK_SUCCESS; 292 | } 293 | 294 | #endif // VK_USE_PLATFORM_WIN32_KHR 295 | 296 | // ---- VK_EXT_tooling_info extension trampoline/terminators 297 | 298 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceToolPropertiesEXT( 299 | VkPhysicalDevice physicalDevice, 300 | uint32_t* pToolCount, 301 | VkPhysicalDeviceToolPropertiesEXT* pToolProperties) { 302 | const VkLayerInstanceDispatchTable *disp; 303 | VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); 304 | disp = loader_get_instance_layer_dispatch(physicalDevice); 305 | return disp->GetPhysicalDeviceToolPropertiesEXT(unwrapped_phys_dev, pToolCount, pToolProperties); 306 | } 307 | 308 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceToolPropertiesEXT( 309 | VkPhysicalDevice physicalDevice, 310 | uint32_t* pToolCount, 311 | VkPhysicalDeviceToolPropertiesEXT* pToolProperties) { 312 | return VK_SUCCESS; 313 | } 314 | -------------------------------------------------------------------------------- /src/vulkan-loader/extension_manual.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2017 The Khronos Group Inc. 3 | * Copyright (c) 2015-2017 Valve Corporation 4 | * Copyright (c) 2015-2017 LunarG, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Mark Young 19 | */ 20 | 21 | #pragma once 22 | 23 | // ---- Manually added trampoline/terminator functions 24 | 25 | // These functions, for whatever reason, require more complex changes than 26 | // can easily be automatically generated. 27 | 28 | VKAPI_ATTR VkResult VKAPI_CALL 29 | GetPhysicalDeviceExternalImageFormatPropertiesNV( 30 | VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, 31 | VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, 32 | VkExternalMemoryHandleTypeFlagsNV externalHandleType, 33 | VkExternalImageFormatPropertiesNV *pExternalImageFormatProperties); 34 | 35 | VKAPI_ATTR VkResult VKAPI_CALL 36 | terminator_GetPhysicalDeviceExternalImageFormatPropertiesNV( 37 | VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, 38 | VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, 39 | VkExternalMemoryHandleTypeFlagsNV externalHandleType, 40 | VkExternalImageFormatPropertiesNV *pExternalImageFormatProperties); 41 | 42 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceCapabilities2EXT(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, 43 | VkSurfaceCapabilities2EXT* pSurfaceCapabilities); 44 | 45 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceCapabilities2EXT(VkPhysicalDevice physicalDevice, 46 | VkSurfaceKHR surface, 47 | VkSurfaceCapabilities2EXT* pSurfaceCapabilities); 48 | 49 | VKAPI_ATTR VkResult VKAPI_CALL ReleaseDisplayEXT(VkPhysicalDevice physicalDevice, VkDisplayKHR display); 50 | 51 | VKAPI_ATTR VkResult VKAPI_CALL terminator_ReleaseDisplayEXT(VkPhysicalDevice physicalDevice, VkDisplayKHR display); 52 | 53 | #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT 54 | VKAPI_ATTR VkResult VKAPI_CALL AcquireXlibDisplayEXT(VkPhysicalDevice physicalDevice, Display* dpy, VkDisplayKHR display); 55 | 56 | VKAPI_ATTR VkResult VKAPI_CALL terminator_AcquireXlibDisplayEXT(VkPhysicalDevice physicalDevice, Display* dpy, 57 | VkDisplayKHR display); 58 | 59 | VKAPI_ATTR VkResult VKAPI_CALL GetRandROutputDisplayEXT(VkPhysicalDevice physicalDevice, Display* dpy, RROutput rrOutput, 60 | VkDisplayKHR* pDisplay); 61 | 62 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetRandROutputDisplayEXT(VkPhysicalDevice physicalDevice, Display* dpy, RROutput rrOutput, 63 | VkDisplayKHR* pDisplay); 64 | #endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT 65 | 66 | #ifdef VK_USE_PLATFORM_WIN32_KHR 67 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfacePresentModes2EXT( 68 | VkPhysicalDevice physicalDevice, 69 | const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, 70 | uint32_t* pPresentModeCount, 71 | VkPresentModeKHR* pPresentModes); 72 | 73 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfacePresentModes2EXT( 74 | VkPhysicalDevice physicalDevice, 75 | const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, 76 | uint32_t* pPresentModeCount, 77 | VkPresentModeKHR* pPresentModes); 78 | #endif // VK_USE_PLATFORM_WIN32_KHR 79 | 80 | VKAPI_ATTR VkResult VKAPI_CALL GetDeviceGroupSurfacePresentModes2EXT( 81 | VkDevice device, 82 | const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, 83 | VkDeviceGroupPresentModeFlagsKHR* pModes); 84 | 85 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDeviceGroupSurfacePresentModes2EXT( 86 | VkDevice device, 87 | const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, 88 | VkDeviceGroupPresentModeFlagsKHR* pModes); 89 | 90 | // ---- VK_EXT_tooling_info extension trampoline/terminators 91 | 92 | VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceToolPropertiesEXT( 93 | VkPhysicalDevice physicalDevice, 94 | uint32_t* pToolCount, 95 | VkPhysicalDeviceToolPropertiesEXT* pToolProperties); 96 | 97 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceToolPropertiesEXT( 98 | VkPhysicalDevice physicalDevice, 99 | uint32_t* pToolCount, 100 | VkPhysicalDeviceToolPropertiesEXT* pToolProperties); 101 | -------------------------------------------------------------------------------- /src/vulkan-loader/gpa_helper.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2015-18, 2020 The Khronos Group Inc. 4 | * Copyright (c) 2015-18, 2020 Valve Corporation 5 | * Copyright (c) 2015-18, 2020 LunarG, Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * Author: Jon Ashburn 20 | */ 21 | 22 | #include 23 | #include "debug_utils.h" 24 | #include "wsi.h" 25 | 26 | static inline void *trampolineGetProcAddr(struct loader_instance *inst, const char *funcName) { 27 | // Don't include or check global functions 28 | if (!strcmp(funcName, "vkGetInstanceProcAddr")) return vkGetInstanceProcAddr; 29 | if (!strcmp(funcName, "vkDestroyInstance")) return vkDestroyInstance; 30 | if (!strcmp(funcName, "vkEnumeratePhysicalDevices")) return vkEnumeratePhysicalDevices; 31 | if (!strcmp(funcName, "vkGetPhysicalDeviceFeatures")) return vkGetPhysicalDeviceFeatures; 32 | if (!strcmp(funcName, "vkGetPhysicalDeviceFormatProperties")) return vkGetPhysicalDeviceFormatProperties; 33 | if (!strcmp(funcName, "vkGetPhysicalDeviceImageFormatProperties")) return vkGetPhysicalDeviceImageFormatProperties; 34 | if (!strcmp(funcName, "vkGetPhysicalDeviceSparseImageFormatProperties")) return vkGetPhysicalDeviceSparseImageFormatProperties; 35 | if (!strcmp(funcName, "vkGetPhysicalDeviceProperties")) return vkGetPhysicalDeviceProperties; 36 | if (!strcmp(funcName, "vkGetPhysicalDeviceQueueFamilyProperties")) return vkGetPhysicalDeviceQueueFamilyProperties; 37 | if (!strcmp(funcName, "vkGetPhysicalDeviceMemoryProperties")) return vkGetPhysicalDeviceMemoryProperties; 38 | if (!strcmp(funcName, "vkEnumerateDeviceLayerProperties")) return vkEnumerateDeviceLayerProperties; 39 | if (!strcmp(funcName, "vkEnumerateDeviceExtensionProperties")) return vkEnumerateDeviceExtensionProperties; 40 | if (!strcmp(funcName, "vkCreateDevice")) return vkCreateDevice; 41 | if (!strcmp(funcName, "vkGetDeviceProcAddr")) return vkGetDeviceProcAddr; 42 | if (!strcmp(funcName, "vkDestroyDevice")) return vkDestroyDevice; 43 | if (!strcmp(funcName, "vkGetDeviceQueue")) return vkGetDeviceQueue; 44 | if (!strcmp(funcName, "vkQueueSubmit")) return vkQueueSubmit; 45 | if (!strcmp(funcName, "vkQueueWaitIdle")) return vkQueueWaitIdle; 46 | if (!strcmp(funcName, "vkDeviceWaitIdle")) return vkDeviceWaitIdle; 47 | if (!strcmp(funcName, "vkAllocateMemory")) return vkAllocateMemory; 48 | if (!strcmp(funcName, "vkFreeMemory")) return vkFreeMemory; 49 | if (!strcmp(funcName, "vkMapMemory")) return vkMapMemory; 50 | if (!strcmp(funcName, "vkUnmapMemory")) return vkUnmapMemory; 51 | if (!strcmp(funcName, "vkFlushMappedMemoryRanges")) return vkFlushMappedMemoryRanges; 52 | if (!strcmp(funcName, "vkInvalidateMappedMemoryRanges")) return vkInvalidateMappedMemoryRanges; 53 | if (!strcmp(funcName, "vkGetDeviceMemoryCommitment")) return vkGetDeviceMemoryCommitment; 54 | if (!strcmp(funcName, "vkGetImageSparseMemoryRequirements")) return vkGetImageSparseMemoryRequirements; 55 | if (!strcmp(funcName, "vkGetImageMemoryRequirements")) return vkGetImageMemoryRequirements; 56 | if (!strcmp(funcName, "vkGetBufferMemoryRequirements")) return vkGetBufferMemoryRequirements; 57 | if (!strcmp(funcName, "vkBindImageMemory")) return vkBindImageMemory; 58 | if (!strcmp(funcName, "vkBindBufferMemory")) return vkBindBufferMemory; 59 | if (!strcmp(funcName, "vkQueueBindSparse")) return vkQueueBindSparse; 60 | if (!strcmp(funcName, "vkCreateFence")) return vkCreateFence; 61 | if (!strcmp(funcName, "vkDestroyFence")) return vkDestroyFence; 62 | if (!strcmp(funcName, "vkGetFenceStatus")) return vkGetFenceStatus; 63 | if (!strcmp(funcName, "vkResetFences")) return vkResetFences; 64 | if (!strcmp(funcName, "vkWaitForFences")) return vkWaitForFences; 65 | if (!strcmp(funcName, "vkCreateSemaphore")) return vkCreateSemaphore; 66 | if (!strcmp(funcName, "vkDestroySemaphore")) return vkDestroySemaphore; 67 | if (!strcmp(funcName, "vkCreateEvent")) return vkCreateEvent; 68 | if (!strcmp(funcName, "vkDestroyEvent")) return vkDestroyEvent; 69 | if (!strcmp(funcName, "vkGetEventStatus")) return vkGetEventStatus; 70 | if (!strcmp(funcName, "vkSetEvent")) return vkSetEvent; 71 | if (!strcmp(funcName, "vkResetEvent")) return vkResetEvent; 72 | if (!strcmp(funcName, "vkCreateQueryPool")) return vkCreateQueryPool; 73 | if (!strcmp(funcName, "vkDestroyQueryPool")) return vkDestroyQueryPool; 74 | if (!strcmp(funcName, "vkGetQueryPoolResults")) return vkGetQueryPoolResults; 75 | if (!strcmp(funcName, "vkCreateBuffer")) return vkCreateBuffer; 76 | if (!strcmp(funcName, "vkDestroyBuffer")) return vkDestroyBuffer; 77 | if (!strcmp(funcName, "vkCreateBufferView")) return vkCreateBufferView; 78 | if (!strcmp(funcName, "vkDestroyBufferView")) return vkDestroyBufferView; 79 | if (!strcmp(funcName, "vkCreateImage")) return vkCreateImage; 80 | if (!strcmp(funcName, "vkDestroyImage")) return vkDestroyImage; 81 | if (!strcmp(funcName, "vkGetImageSubresourceLayout")) return vkGetImageSubresourceLayout; 82 | if (!strcmp(funcName, "vkCreateImageView")) return vkCreateImageView; 83 | if (!strcmp(funcName, "vkDestroyImageView")) return vkDestroyImageView; 84 | if (!strcmp(funcName, "vkCreateShaderModule")) return vkCreateShaderModule; 85 | if (!strcmp(funcName, "vkDestroyShaderModule")) return vkDestroyShaderModule; 86 | if (!strcmp(funcName, "vkCreatePipelineCache")) return vkCreatePipelineCache; 87 | if (!strcmp(funcName, "vkDestroyPipelineCache")) return vkDestroyPipelineCache; 88 | if (!strcmp(funcName, "vkGetPipelineCacheData")) return vkGetPipelineCacheData; 89 | if (!strcmp(funcName, "vkMergePipelineCaches")) return vkMergePipelineCaches; 90 | if (!strcmp(funcName, "vkCreateGraphicsPipelines")) return vkCreateGraphicsPipelines; 91 | if (!strcmp(funcName, "vkCreateComputePipelines")) return vkCreateComputePipelines; 92 | if (!strcmp(funcName, "vkDestroyPipeline")) return vkDestroyPipeline; 93 | if (!strcmp(funcName, "vkCreatePipelineLayout")) return vkCreatePipelineLayout; 94 | if (!strcmp(funcName, "vkDestroyPipelineLayout")) return vkDestroyPipelineLayout; 95 | if (!strcmp(funcName, "vkCreateSampler")) return vkCreateSampler; 96 | if (!strcmp(funcName, "vkDestroySampler")) return vkDestroySampler; 97 | if (!strcmp(funcName, "vkCreateDescriptorSetLayout")) return vkCreateDescriptorSetLayout; 98 | if (!strcmp(funcName, "vkDestroyDescriptorSetLayout")) return vkDestroyDescriptorSetLayout; 99 | if (!strcmp(funcName, "vkCreateDescriptorPool")) return vkCreateDescriptorPool; 100 | if (!strcmp(funcName, "vkDestroyDescriptorPool")) return vkDestroyDescriptorPool; 101 | if (!strcmp(funcName, "vkResetDescriptorPool")) return vkResetDescriptorPool; 102 | if (!strcmp(funcName, "vkAllocateDescriptorSets")) return vkAllocateDescriptorSets; 103 | if (!strcmp(funcName, "vkFreeDescriptorSets")) return vkFreeDescriptorSets; 104 | if (!strcmp(funcName, "vkUpdateDescriptorSets")) return vkUpdateDescriptorSets; 105 | if (!strcmp(funcName, "vkCreateFramebuffer")) return vkCreateFramebuffer; 106 | if (!strcmp(funcName, "vkDestroyFramebuffer")) return vkDestroyFramebuffer; 107 | if (!strcmp(funcName, "vkCreateRenderPass")) return vkCreateRenderPass; 108 | if (!strcmp(funcName, "vkDestroyRenderPass")) return vkDestroyRenderPass; 109 | if (!strcmp(funcName, "vkGetRenderAreaGranularity")) return vkGetRenderAreaGranularity; 110 | if (!strcmp(funcName, "vkCreateCommandPool")) return vkCreateCommandPool; 111 | if (!strcmp(funcName, "vkDestroyCommandPool")) return vkDestroyCommandPool; 112 | if (!strcmp(funcName, "vkResetCommandPool")) return vkResetCommandPool; 113 | if (!strcmp(funcName, "vkAllocateCommandBuffers")) return vkAllocateCommandBuffers; 114 | if (!strcmp(funcName, "vkFreeCommandBuffers")) return vkFreeCommandBuffers; 115 | if (!strcmp(funcName, "vkBeginCommandBuffer")) return vkBeginCommandBuffer; 116 | if (!strcmp(funcName, "vkEndCommandBuffer")) return vkEndCommandBuffer; 117 | if (!strcmp(funcName, "vkResetCommandBuffer")) return vkResetCommandBuffer; 118 | if (!strcmp(funcName, "vkCmdBindPipeline")) return vkCmdBindPipeline; 119 | if (!strcmp(funcName, "vkCmdBindDescriptorSets")) return vkCmdBindDescriptorSets; 120 | if (!strcmp(funcName, "vkCmdBindVertexBuffers")) return vkCmdBindVertexBuffers; 121 | if (!strcmp(funcName, "vkCmdBindIndexBuffer")) return vkCmdBindIndexBuffer; 122 | if (!strcmp(funcName, "vkCmdSetViewport")) return vkCmdSetViewport; 123 | if (!strcmp(funcName, "vkCmdSetScissor")) return vkCmdSetScissor; 124 | if (!strcmp(funcName, "vkCmdSetLineWidth")) return vkCmdSetLineWidth; 125 | if (!strcmp(funcName, "vkCmdSetDepthBias")) return vkCmdSetDepthBias; 126 | if (!strcmp(funcName, "vkCmdSetBlendConstants")) return vkCmdSetBlendConstants; 127 | if (!strcmp(funcName, "vkCmdSetDepthBounds")) return vkCmdSetDepthBounds; 128 | if (!strcmp(funcName, "vkCmdSetStencilCompareMask")) return vkCmdSetStencilCompareMask; 129 | if (!strcmp(funcName, "vkCmdSetStencilWriteMask")) return vkCmdSetStencilWriteMask; 130 | if (!strcmp(funcName, "vkCmdSetStencilReference")) return vkCmdSetStencilReference; 131 | if (!strcmp(funcName, "vkCmdDraw")) return vkCmdDraw; 132 | if (!strcmp(funcName, "vkCmdDrawIndexed")) return vkCmdDrawIndexed; 133 | if (!strcmp(funcName, "vkCmdDrawIndirect")) return vkCmdDrawIndirect; 134 | if (!strcmp(funcName, "vkCmdDrawIndexedIndirect")) return vkCmdDrawIndexedIndirect; 135 | if (!strcmp(funcName, "vkCmdDispatch")) return vkCmdDispatch; 136 | if (!strcmp(funcName, "vkCmdDispatchIndirect")) return vkCmdDispatchIndirect; 137 | if (!strcmp(funcName, "vkCmdCopyBuffer")) return vkCmdCopyBuffer; 138 | if (!strcmp(funcName, "vkCmdCopyImage")) return vkCmdCopyImage; 139 | if (!strcmp(funcName, "vkCmdBlitImage")) return vkCmdBlitImage; 140 | if (!strcmp(funcName, "vkCmdCopyBufferToImage")) return vkCmdCopyBufferToImage; 141 | if (!strcmp(funcName, "vkCmdCopyImageToBuffer")) return vkCmdCopyImageToBuffer; 142 | if (!strcmp(funcName, "vkCmdUpdateBuffer")) return vkCmdUpdateBuffer; 143 | if (!strcmp(funcName, "vkCmdFillBuffer")) return vkCmdFillBuffer; 144 | if (!strcmp(funcName, "vkCmdClearColorImage")) return vkCmdClearColorImage; 145 | if (!strcmp(funcName, "vkCmdClearDepthStencilImage")) return vkCmdClearDepthStencilImage; 146 | if (!strcmp(funcName, "vkCmdClearAttachments")) return vkCmdClearAttachments; 147 | if (!strcmp(funcName, "vkCmdResolveImage")) return vkCmdResolveImage; 148 | if (!strcmp(funcName, "vkCmdSetEvent")) return vkCmdSetEvent; 149 | if (!strcmp(funcName, "vkCmdResetEvent")) return vkCmdResetEvent; 150 | if (!strcmp(funcName, "vkCmdWaitEvents")) return vkCmdWaitEvents; 151 | if (!strcmp(funcName, "vkCmdPipelineBarrier")) return vkCmdPipelineBarrier; 152 | if (!strcmp(funcName, "vkCmdBeginQuery")) return vkCmdBeginQuery; 153 | if (!strcmp(funcName, "vkCmdEndQuery")) return vkCmdEndQuery; 154 | if (!strcmp(funcName, "vkCmdResetQueryPool")) return vkCmdResetQueryPool; 155 | if (!strcmp(funcName, "vkCmdWriteTimestamp")) return vkCmdWriteTimestamp; 156 | if (!strcmp(funcName, "vkCmdCopyQueryPoolResults")) return vkCmdCopyQueryPoolResults; 157 | if (!strcmp(funcName, "vkCmdPushConstants")) return vkCmdPushConstants; 158 | if (!strcmp(funcName, "vkCmdBeginRenderPass")) return vkCmdBeginRenderPass; 159 | if (!strcmp(funcName, "vkCmdNextSubpass")) return vkCmdNextSubpass; 160 | if (!strcmp(funcName, "vkCmdEndRenderPass")) return vkCmdEndRenderPass; 161 | if (!strcmp(funcName, "vkCmdExecuteCommands")) return vkCmdExecuteCommands; 162 | 163 | // Core 1.1 functions 164 | if (!strcmp(funcName, "vkEnumeratePhysicalDeviceGroups")) return vkEnumeratePhysicalDeviceGroups; 165 | if (!strcmp(funcName, "vkGetPhysicalDeviceFeatures2")) return vkGetPhysicalDeviceFeatures2; 166 | if (!strcmp(funcName, "vkGetPhysicalDeviceProperties2")) return vkGetPhysicalDeviceProperties2; 167 | if (!strcmp(funcName, "vkGetPhysicalDeviceFormatProperties2")) return vkGetPhysicalDeviceFormatProperties2; 168 | if (!strcmp(funcName, "vkGetPhysicalDeviceImageFormatProperties2")) return vkGetPhysicalDeviceImageFormatProperties2; 169 | if (!strcmp(funcName, "vkGetPhysicalDeviceQueueFamilyProperties2")) return vkGetPhysicalDeviceQueueFamilyProperties2; 170 | if (!strcmp(funcName, "vkGetPhysicalDeviceMemoryProperties2")) return vkGetPhysicalDeviceMemoryProperties2; 171 | if (!strcmp(funcName, "vkGetPhysicalDeviceSparseImageFormatProperties2")) 172 | return vkGetPhysicalDeviceSparseImageFormatProperties2; 173 | if (!strcmp(funcName, "vkGetPhysicalDeviceExternalBufferProperties")) return vkGetPhysicalDeviceExternalBufferProperties; 174 | if (!strcmp(funcName, "vkGetPhysicalDeviceExternalSemaphoreProperties")) return vkGetPhysicalDeviceExternalSemaphoreProperties; 175 | if (!strcmp(funcName, "vkGetPhysicalDeviceExternalFenceProperties")) return vkGetPhysicalDeviceExternalFenceProperties; 176 | if (!strcmp(funcName, "vkBindBufferMemory2")) return vkBindBufferMemory2; 177 | if (!strcmp(funcName, "vkBindImageMemory2")) return vkBindImageMemory2; 178 | if (!strcmp(funcName, "vkGetDeviceGroupPeerMemoryFeatures")) return vkGetDeviceGroupPeerMemoryFeatures; 179 | if (!strcmp(funcName, "vkCmdSetDeviceMask")) return vkCmdSetDeviceMask; 180 | if (!strcmp(funcName, "vkCmdDispatchBase")) return vkCmdDispatchBase; 181 | if (!strcmp(funcName, "vkGetImageMemoryRequirements2")) return vkGetImageMemoryRequirements2; 182 | if (!strcmp(funcName, "vkTrimCommandPool")) return vkTrimCommandPool; 183 | if (!strcmp(funcName, "vkGetDeviceQueue2")) return vkGetDeviceQueue2; 184 | if (!strcmp(funcName, "vkCreateSamplerYcbcrConversion")) return vkCreateSamplerYcbcrConversion; 185 | if (!strcmp(funcName, "vkDestroySamplerYcbcrConversion")) return vkDestroySamplerYcbcrConversion; 186 | if (!strcmp(funcName, "vkGetDescriptorSetLayoutSupport")) return vkGetDescriptorSetLayoutSupport; 187 | if (!strcmp(funcName, "vkCreateDescriptorUpdateTemplate")) return vkCreateDescriptorUpdateTemplate; 188 | if (!strcmp(funcName, "vkDestroyDescriptorUpdateTemplate")) return vkDestroyDescriptorUpdateTemplate; 189 | if (!strcmp(funcName, "vkUpdateDescriptorSetWithTemplate")) return vkUpdateDescriptorSetWithTemplate; 190 | if (!strcmp(funcName, "vkGetImageSparseMemoryRequirements2")) return vkGetImageSparseMemoryRequirements2; 191 | if (!strcmp(funcName, "vkGetBufferMemoryRequirements2")) return vkGetBufferMemoryRequirements2; 192 | 193 | // Core 1.2 functions 194 | if (!strcmp(funcName, "vkCreateRenderPass2")) return vkCreateRenderPass2; 195 | if (!strcmp(funcName, "vkCmdBeginRenderPass2")) return vkCmdBeginRenderPass2; 196 | if (!strcmp(funcName, "vkCmdNextSubpass2")) return vkCmdNextSubpass2; 197 | if (!strcmp(funcName, "vkCmdEndRenderPass2")) return vkCmdEndRenderPass2; 198 | if (!strcmp(funcName, "vkCmdDrawIndirectCount")) return vkCmdDrawIndirectCount; 199 | if (!strcmp(funcName, "vkCmdDrawIndexedIndirectCount")) return vkCmdDrawIndexedIndirectCount; 200 | if (!strcmp(funcName, "vkGetSemaphoreCounterValue")) return vkGetSemaphoreCounterValue; 201 | if (!strcmp(funcName, "vkWaitSemaphores")) return vkWaitSemaphores; 202 | if (!strcmp(funcName, "vkSignalSemaphore")) return vkSignalSemaphore; 203 | if (!strcmp(funcName, "vkGetBufferDeviceAddress")) return vkGetBufferDeviceAddress; 204 | if (!strcmp(funcName, "vkGetBufferOpaqueCaptureAddress")) return vkGetBufferOpaqueCaptureAddress; 205 | if (!strcmp(funcName, "vkGetDeviceMemoryOpaqueCaptureAddress")) return vkGetDeviceMemoryOpaqueCaptureAddress; 206 | if (!strcmp(funcName, "vkResetQueryPool")) return vkResetQueryPool; 207 | 208 | // Instance extensions 209 | void *addr; 210 | if (debug_utils_InstanceGpa(inst, funcName, &addr)) return addr; 211 | 212 | if (wsi_swapchain_instance_gpa(inst, funcName, &addr)) return addr; 213 | 214 | if (extension_instance_gpa(inst, funcName, &addr)) return addr; 215 | 216 | // Unknown physical device extensions 217 | if (loader_phys_dev_ext_gpa(inst, funcName, true, &addr, NULL)) return addr; 218 | 219 | // Unknown device extensions 220 | addr = loader_dev_ext_gpa(inst, funcName); 221 | return addr; 222 | } 223 | 224 | static inline void *globalGetProcAddr(const char *name) { 225 | if (!name || name[0] != 'v' || name[1] != 'k') return NULL; 226 | 227 | name += 2; 228 | if (!strcmp(name, "CreateInstance")) return vkCreateInstance; 229 | if (!strcmp(name, "EnumerateInstanceExtensionProperties")) return vkEnumerateInstanceExtensionProperties; 230 | if (!strcmp(name, "EnumerateInstanceLayerProperties")) return vkEnumerateInstanceLayerProperties; 231 | if (!strcmp(name, "EnumerateInstanceVersion")) return vkEnumerateInstanceVersion; 232 | if (!strcmp(name, "GetInstanceProcAddr")) return vkGetInstanceProcAddr; 233 | 234 | return NULL; 235 | } 236 | 237 | static inline void *loader_non_passthrough_gdpa(const char *name) { 238 | if (!name || name[0] != 'v' || name[1] != 'k') return NULL; 239 | 240 | name += 2; 241 | 242 | if (!strcmp(name, "GetDeviceProcAddr")) return vkGetDeviceProcAddr; 243 | if (!strcmp(name, "DestroyDevice")) return vkDestroyDevice; 244 | if (!strcmp(name, "GetDeviceQueue")) return vkGetDeviceQueue; 245 | if (!strcmp(name, "GetDeviceQueue2")) return vkGetDeviceQueue2; 246 | if (!strcmp(name, "AllocateCommandBuffers")) return vkAllocateCommandBuffers; 247 | 248 | return NULL; 249 | } 250 | -------------------------------------------------------------------------------- /src/vulkan-loader/include/vulkan/vk_icd.h: -------------------------------------------------------------------------------- 1 | // 2 | // File: vk_icd.h 3 | // 4 | /* 5 | * Copyright (c) 2015-2016 The Khronos Group Inc. 6 | * Copyright (c) 2015-2016 Valve Corporation 7 | * Copyright (c) 2015-2016 LunarG, Inc. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * 21 | */ 22 | 23 | #ifndef VKICD_H 24 | #define VKICD_H 25 | 26 | #include "vulkan.h" 27 | #include 28 | 29 | // Loader-ICD version negotiation API. Versions add the following features: 30 | // Version 0 - Initial. Doesn't support vk_icdGetInstanceProcAddr 31 | // or vk_icdNegotiateLoaderICDInterfaceVersion. 32 | // Version 1 - Add support for vk_icdGetInstanceProcAddr. 33 | // Version 2 - Add Loader/ICD Interface version negotiation 34 | // via vk_icdNegotiateLoaderICDInterfaceVersion. 35 | // Version 3 - Add ICD creation/destruction of KHR_surface objects. 36 | // Version 4 - Add unknown physical device extension qyering via 37 | // vk_icdGetPhysicalDeviceProcAddr. 38 | // Version 5 - Tells ICDs that the loader is now paying attention to the 39 | // application version of Vulkan passed into the ApplicationInfo 40 | // structure during vkCreateInstance. This will tell the ICD 41 | // that if the loader is older, it should automatically fail a 42 | // call for any API version > 1.0. Otherwise, the loader will 43 | // manually determine if it can support the expected version. 44 | // Version 6 - Add support for vk_icdEnumerateAdapterPhysicalDevices. 45 | #define CURRENT_LOADER_ICD_INTERFACE_VERSION 6 46 | #define MIN_SUPPORTED_LOADER_ICD_INTERFACE_VERSION 0 47 | #define MIN_PHYS_DEV_EXTENSION_ICD_INTERFACE_VERSION 4 48 | 49 | // Old typedefs that don't follow a proper naming convention but are preserved for compatibility 50 | typedef VkResult(VKAPI_PTR *PFN_vkNegotiateLoaderICDInterfaceVersion)(uint32_t *pVersion); 51 | // This is defined in vk_layer.h which will be found by the loader, but if an ICD is building against this 52 | // file directly, it won't be found. 53 | #ifndef PFN_GetPhysicalDeviceProcAddr 54 | typedef PFN_vkVoidFunction(VKAPI_PTR *PFN_GetPhysicalDeviceProcAddr)(VkInstance instance, const char *pName); 55 | #endif 56 | 57 | // Typedefs for loader/ICD interface 58 | typedef VkResult (VKAPI_PTR *PFN_vk_icdNegotiateLoaderICDInterfaceVersion)(uint32_t* pVersion); 59 | typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vk_icdGetInstanceProcAddr)(VkInstance instance, const char* pName); 60 | typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vk_icdGetPhysicalDeviceProcAddr)(VkInstance instance, const char* pName); 61 | #if defined(VK_USE_PLATFORM_WIN32_KHR) 62 | typedef VkResult (VKAPI_PTR *PFN_vk_icdEnumerateAdapterPhysicalDevices)(VkInstance instance, LUID adapterLUID, 63 | uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices); 64 | #endif 65 | 66 | // Prototypes for loader/ICD interface 67 | #if !defined(VK_NO_PROTOTYPES) 68 | #ifdef __cplusplus 69 | extern "C" { 70 | #endif 71 | VKAPI_ATTR VkResult VKAPI_CALL vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t* pVersion); 72 | VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetInstanceProcAddr(VkInstance instance, const char* pName); 73 | VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetPhysicalDeviceProcAddr(VkInstance isntance, const char* pName); 74 | #if defined(VK_USE_PLATFORM_WIN32_KHR) 75 | VKAPI_ATTR VkResult VKAPI_CALL vk_icdEnumerateAdapterPhysicalDevices(VkInstance instance, LUID adapterLUID, 76 | uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices); 77 | #endif 78 | #ifdef __cplusplus 79 | } 80 | #endif 81 | #endif 82 | 83 | /* 84 | * The ICD must reserve space for a pointer for the loader's dispatch 85 | * table, at the start of . 86 | * The ICD must initialize this variable using the SET_LOADER_MAGIC_VALUE macro. 87 | */ 88 | 89 | #define ICD_LOADER_MAGIC 0x01CDC0DE 90 | 91 | typedef union { 92 | uintptr_t loaderMagic; 93 | void *loaderData; 94 | } VK_LOADER_DATA; 95 | 96 | static inline void set_loader_magic_value(void *pNewObject) { 97 | VK_LOADER_DATA *loader_info = (VK_LOADER_DATA *)pNewObject; 98 | loader_info->loaderMagic = ICD_LOADER_MAGIC; 99 | } 100 | 101 | static inline bool valid_loader_magic_value(void *pNewObject) { 102 | const VK_LOADER_DATA *loader_info = (VK_LOADER_DATA *)pNewObject; 103 | return (loader_info->loaderMagic & 0xffffffff) == ICD_LOADER_MAGIC; 104 | } 105 | 106 | /* 107 | * Windows and Linux ICDs will treat VkSurfaceKHR as a pointer to a struct that 108 | * contains the platform-specific connection and surface information. 109 | */ 110 | typedef enum { 111 | VK_ICD_WSI_PLATFORM_MIR, 112 | VK_ICD_WSI_PLATFORM_WAYLAND, 113 | VK_ICD_WSI_PLATFORM_WIN32, 114 | VK_ICD_WSI_PLATFORM_XCB, 115 | VK_ICD_WSI_PLATFORM_XLIB, 116 | VK_ICD_WSI_PLATFORM_ANDROID, 117 | VK_ICD_WSI_PLATFORM_MACOS, 118 | VK_ICD_WSI_PLATFORM_IOS, 119 | VK_ICD_WSI_PLATFORM_GGP, 120 | VK_ICD_WSI_PLATFORM_DISPLAY, 121 | VK_ICD_WSI_PLATFORM_HEADLESS, 122 | VK_ICD_WSI_PLATFORM_METAL, 123 | VK_ICD_WSI_PLATFORM_DIRECTFB, 124 | VK_ICD_WSI_PLATFORM_VI, 125 | } VkIcdWsiPlatform; 126 | 127 | typedef struct { 128 | VkIcdWsiPlatform platform; 129 | } VkIcdSurfaceBase; 130 | 131 | #ifdef VK_USE_PLATFORM_MIR_KHR 132 | typedef struct { 133 | VkIcdSurfaceBase base; 134 | MirConnection *connection; 135 | MirSurface *mirSurface; 136 | } VkIcdSurfaceMir; 137 | #endif // VK_USE_PLATFORM_MIR_KHR 138 | 139 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR 140 | typedef struct { 141 | VkIcdSurfaceBase base; 142 | struct wl_display *display; 143 | struct wl_surface *surface; 144 | } VkIcdSurfaceWayland; 145 | #endif // VK_USE_PLATFORM_WAYLAND_KHR 146 | 147 | #ifdef VK_USE_PLATFORM_WIN32_KHR 148 | typedef struct { 149 | VkIcdSurfaceBase base; 150 | HINSTANCE hinstance; 151 | HWND hwnd; 152 | } VkIcdSurfaceWin32; 153 | #endif // VK_USE_PLATFORM_WIN32_KHR 154 | 155 | #ifdef VK_USE_PLATFORM_XCB_KHR 156 | typedef struct { 157 | VkIcdSurfaceBase base; 158 | xcb_connection_t *connection; 159 | xcb_window_t window; 160 | } VkIcdSurfaceXcb; 161 | #endif // VK_USE_PLATFORM_XCB_KHR 162 | 163 | #ifdef VK_USE_PLATFORM_XLIB_KHR 164 | typedef struct { 165 | VkIcdSurfaceBase base; 166 | Display *dpy; 167 | Window window; 168 | } VkIcdSurfaceXlib; 169 | #endif // VK_USE_PLATFORM_XLIB_KHR 170 | 171 | #ifdef VK_USE_PLATFORM_DIRECTFB_EXT 172 | typedef struct { 173 | VkIcdSurfaceBase base; 174 | IDirectFB *dfb; 175 | IDirectFBSurface *surface; 176 | } VkIcdSurfaceDirectFB; 177 | #endif // VK_USE_PLATFORM_DIRECTFB_EXT 178 | 179 | #ifdef VK_USE_PLATFORM_ANDROID_KHR 180 | typedef struct { 181 | VkIcdSurfaceBase base; 182 | struct ANativeWindow *window; 183 | } VkIcdSurfaceAndroid; 184 | #endif // VK_USE_PLATFORM_ANDROID_KHR 185 | 186 | #ifdef VK_USE_PLATFORM_MACOS_MVK 187 | typedef struct { 188 | VkIcdSurfaceBase base; 189 | const void *pView; 190 | } VkIcdSurfaceMacOS; 191 | #endif // VK_USE_PLATFORM_MACOS_MVK 192 | 193 | #ifdef VK_USE_PLATFORM_IOS_MVK 194 | typedef struct { 195 | VkIcdSurfaceBase base; 196 | const void *pView; 197 | } VkIcdSurfaceIOS; 198 | #endif // VK_USE_PLATFORM_IOS_MVK 199 | 200 | #ifdef VK_USE_PLATFORM_GGP 201 | typedef struct { 202 | VkIcdSurfaceBase base; 203 | GgpStreamDescriptor streamDescriptor; 204 | } VkIcdSurfaceGgp; 205 | #endif // VK_USE_PLATFORM_GGP 206 | 207 | typedef struct { 208 | VkIcdSurfaceBase base; 209 | VkDisplayModeKHR displayMode; 210 | uint32_t planeIndex; 211 | uint32_t planeStackIndex; 212 | VkSurfaceTransformFlagBitsKHR transform; 213 | float globalAlpha; 214 | VkDisplayPlaneAlphaFlagBitsKHR alphaMode; 215 | VkExtent2D imageExtent; 216 | } VkIcdSurfaceDisplay; 217 | 218 | typedef struct { 219 | VkIcdSurfaceBase base; 220 | } VkIcdSurfaceHeadless; 221 | 222 | #ifdef VK_USE_PLATFORM_METAL_EXT 223 | typedef struct { 224 | VkIcdSurfaceBase base; 225 | const CAMetalLayer *pLayer; 226 | } VkIcdSurfaceMetal; 227 | #endif // VK_USE_PLATFORM_METAL_EXT 228 | 229 | #ifdef VK_USE_PLATFORM_VI_NN 230 | typedef struct { 231 | VkIcdSurfaceBase base; 232 | void *window; 233 | } VkIcdSurfaceVi; 234 | #endif // VK_USE_PLATFORM_VI_NN 235 | 236 | #endif // VKICD_H 237 | -------------------------------------------------------------------------------- /src/vulkan-loader/include/vulkan/vk_layer.h: -------------------------------------------------------------------------------- 1 | // 2 | // File: vk_layer.h 3 | // 4 | /* 5 | * Copyright (c) 2015-2017 The Khronos Group Inc. 6 | * Copyright (c) 2015-2017 Valve Corporation 7 | * Copyright (c) 2015-2017 LunarG, Inc. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * 21 | */ 22 | 23 | /* Need to define dispatch table 24 | * Core struct can then have ptr to dispatch table at the top 25 | * Along with object ptrs for current and next OBJ 26 | */ 27 | #pragma once 28 | 29 | #include "vulkan.h" 30 | #if defined(__GNUC__) && __GNUC__ >= 4 31 | #define VK_LAYER_EXPORT __attribute__((visibility("default"))) 32 | #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590) 33 | #define VK_LAYER_EXPORT __attribute__((visibility("default"))) 34 | #else 35 | #define VK_LAYER_EXPORT 36 | #endif 37 | 38 | #define MAX_NUM_UNKNOWN_EXTS 250 39 | 40 | // Loader-Layer version negotiation API. Versions add the following features: 41 | // Versions 0/1 - Initial. Doesn't support vk_layerGetPhysicalDeviceProcAddr 42 | // or vk_icdNegotiateLoaderLayerInterfaceVersion. 43 | // Version 2 - Add support for vk_layerGetPhysicalDeviceProcAddr and 44 | // vk_icdNegotiateLoaderLayerInterfaceVersion. 45 | #define CURRENT_LOADER_LAYER_INTERFACE_VERSION 2 46 | #define MIN_SUPPORTED_LOADER_LAYER_INTERFACE_VERSION 1 47 | 48 | #define VK_CURRENT_CHAIN_VERSION 1 49 | 50 | // Typedef for use in the interfaces below 51 | typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_GetPhysicalDeviceProcAddr)(VkInstance instance, const char* pName); 52 | 53 | // Version negotiation values 54 | typedef enum VkNegotiateLayerStructType { 55 | LAYER_NEGOTIATE_UNINTIALIZED = 0, 56 | LAYER_NEGOTIATE_INTERFACE_STRUCT = 1, 57 | } VkNegotiateLayerStructType; 58 | 59 | // Version negotiation structures 60 | typedef struct VkNegotiateLayerInterface { 61 | VkNegotiateLayerStructType sType; 62 | void *pNext; 63 | uint32_t loaderLayerInterfaceVersion; 64 | PFN_vkGetInstanceProcAddr pfnGetInstanceProcAddr; 65 | PFN_vkGetDeviceProcAddr pfnGetDeviceProcAddr; 66 | PFN_GetPhysicalDeviceProcAddr pfnGetPhysicalDeviceProcAddr; 67 | } VkNegotiateLayerInterface; 68 | 69 | // Version negotiation functions 70 | typedef VkResult (VKAPI_PTR *PFN_vkNegotiateLoaderLayerInterfaceVersion)(VkNegotiateLayerInterface *pVersionStruct); 71 | 72 | // Function prototype for unknown physical device extension command 73 | typedef VkResult(VKAPI_PTR *PFN_PhysDevExt)(VkPhysicalDevice phys_device); 74 | 75 | // ------------------------------------------------------------------------------------------------ 76 | // CreateInstance and CreateDevice support structures 77 | 78 | /* Sub type of structure for instance and device loader ext of CreateInfo. 79 | * When sType == VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO 80 | * or sType == VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO 81 | * then VkLayerFunction indicates struct type pointed to by pNext 82 | */ 83 | typedef enum VkLayerFunction_ { 84 | VK_LAYER_LINK_INFO = 0, 85 | VK_LOADER_DATA_CALLBACK = 1, 86 | VK_LOADER_LAYER_CREATE_DEVICE_CALLBACK = 2, 87 | VK_LOADER_FEATURES = 3, 88 | } VkLayerFunction; 89 | 90 | typedef struct VkLayerInstanceLink_ { 91 | struct VkLayerInstanceLink_ *pNext; 92 | PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr; 93 | PFN_GetPhysicalDeviceProcAddr pfnNextGetPhysicalDeviceProcAddr; 94 | } VkLayerInstanceLink; 95 | 96 | /* 97 | * When creating the device chain the loader needs to pass 98 | * down information about it's device structure needed at 99 | * the end of the chain. Passing the data via the 100 | * VkLayerDeviceInfo avoids issues with finding the 101 | * exact instance being used. 102 | */ 103 | typedef struct VkLayerDeviceInfo_ { 104 | void *device_info; 105 | PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr; 106 | } VkLayerDeviceInfo; 107 | 108 | typedef VkResult (VKAPI_PTR *PFN_vkSetInstanceLoaderData)(VkInstance instance, 109 | void *object); 110 | typedef VkResult (VKAPI_PTR *PFN_vkSetDeviceLoaderData)(VkDevice device, 111 | void *object); 112 | typedef VkResult (VKAPI_PTR *PFN_vkLayerCreateDevice)(VkInstance instance, VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, 113 | const VkAllocationCallbacks *pAllocator, VkDevice *pDevice, PFN_vkGetInstanceProcAddr layerGIPA, PFN_vkGetDeviceProcAddr *nextGDPA); 114 | typedef void (VKAPI_PTR *PFN_vkLayerDestroyDevice)(VkDevice physicalDevice, const VkAllocationCallbacks *pAllocator, PFN_vkDestroyDevice destroyFunction); 115 | 116 | typedef enum VkLoaderFeastureFlagBits { 117 | VK_LOADER_FEATURE_PHYSICAL_DEVICE_SORTING = 0x00000001, 118 | } VkLoaderFlagBits; 119 | typedef VkFlags VkLoaderFeatureFlags; 120 | 121 | typedef struct { 122 | VkStructureType sType; // VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO 123 | const void *pNext; 124 | VkLayerFunction function; 125 | union { 126 | VkLayerInstanceLink *pLayerInfo; 127 | PFN_vkSetInstanceLoaderData pfnSetInstanceLoaderData; 128 | struct { 129 | PFN_vkLayerCreateDevice pfnLayerCreateDevice; 130 | PFN_vkLayerDestroyDevice pfnLayerDestroyDevice; 131 | } layerDevice; 132 | VkLoaderFeatureFlags loaderFeatures; 133 | } u; 134 | } VkLayerInstanceCreateInfo; 135 | 136 | typedef struct VkLayerDeviceLink_ { 137 | struct VkLayerDeviceLink_ *pNext; 138 | PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr; 139 | PFN_vkGetDeviceProcAddr pfnNextGetDeviceProcAddr; 140 | } VkLayerDeviceLink; 141 | 142 | typedef struct { 143 | VkStructureType sType; // VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO 144 | const void *pNext; 145 | VkLayerFunction function; 146 | union { 147 | VkLayerDeviceLink *pLayerInfo; 148 | PFN_vkSetDeviceLoaderData pfnSetDeviceLoaderData; 149 | } u; 150 | } VkLayerDeviceCreateInfo; 151 | 152 | #ifdef __cplusplus 153 | extern "C" { 154 | #endif 155 | 156 | VKAPI_ATTR VkResult VKAPI_CALL vkNegotiateLoaderLayerInterfaceVersion(VkNegotiateLayerInterface *pVersionStruct); 157 | 158 | typedef enum VkChainType { 159 | VK_CHAIN_TYPE_UNKNOWN = 0, 160 | VK_CHAIN_TYPE_ENUMERATE_INSTANCE_EXTENSION_PROPERTIES = 1, 161 | VK_CHAIN_TYPE_ENUMERATE_INSTANCE_LAYER_PROPERTIES = 2, 162 | VK_CHAIN_TYPE_ENUMERATE_INSTANCE_VERSION = 3, 163 | } VkChainType; 164 | 165 | typedef struct VkChainHeader { 166 | VkChainType type; 167 | uint32_t version; 168 | uint32_t size; 169 | } VkChainHeader; 170 | 171 | typedef struct VkEnumerateInstanceExtensionPropertiesChain { 172 | VkChainHeader header; 173 | VkResult(VKAPI_PTR *pfnNextLayer)(const struct VkEnumerateInstanceExtensionPropertiesChain *, const char *, uint32_t *, 174 | VkExtensionProperties *); 175 | const struct VkEnumerateInstanceExtensionPropertiesChain *pNextLink; 176 | 177 | #if defined(__cplusplus) 178 | inline VkResult CallDown(const char *pLayerName, uint32_t *pPropertyCount, VkExtensionProperties *pProperties) const { 179 | return pfnNextLayer(pNextLink, pLayerName, pPropertyCount, pProperties); 180 | } 181 | #endif 182 | } VkEnumerateInstanceExtensionPropertiesChain; 183 | 184 | typedef struct VkEnumerateInstanceLayerPropertiesChain { 185 | VkChainHeader header; 186 | VkResult(VKAPI_PTR *pfnNextLayer)(const struct VkEnumerateInstanceLayerPropertiesChain *, uint32_t *, VkLayerProperties *); 187 | const struct VkEnumerateInstanceLayerPropertiesChain *pNextLink; 188 | 189 | #if defined(__cplusplus) 190 | inline VkResult CallDown(uint32_t *pPropertyCount, VkLayerProperties *pProperties) const { 191 | return pfnNextLayer(pNextLink, pPropertyCount, pProperties); 192 | } 193 | #endif 194 | } VkEnumerateInstanceLayerPropertiesChain; 195 | 196 | typedef struct VkEnumerateInstanceVersionChain { 197 | VkChainHeader header; 198 | VkResult(VKAPI_PTR *pfnNextLayer)(const struct VkEnumerateInstanceVersionChain *, uint32_t *); 199 | const struct VkEnumerateInstanceVersionChain *pNextLink; 200 | 201 | #if defined(__cplusplus) 202 | inline VkResult CallDown(uint32_t *pApiVersion) const { 203 | return pfnNextLayer(pNextLink, pApiVersion); 204 | } 205 | #endif 206 | } VkEnumerateInstanceVersionChain; 207 | 208 | #ifdef __cplusplus 209 | } 210 | #endif 211 | -------------------------------------------------------------------------------- /src/vulkan-loader/include/vulkan/vk_platform.h: -------------------------------------------------------------------------------- 1 | // 2 | // File: vk_platform.h 3 | // 4 | /* 5 | ** Copyright (c) 2014-2020 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | 11 | #ifndef VK_PLATFORM_H_ 12 | #define VK_PLATFORM_H_ 13 | 14 | #ifdef __cplusplus 15 | extern "C" 16 | { 17 | #endif // __cplusplus 18 | 19 | /* 20 | *************************************************************************************************** 21 | * Platform-specific directives and type declarations 22 | *************************************************************************************************** 23 | */ 24 | 25 | /* Platform-specific calling convention macros. 26 | * 27 | * Platforms should define these so that Vulkan clients call Vulkan commands 28 | * with the same calling conventions that the Vulkan implementation expects. 29 | * 30 | * VKAPI_ATTR - Placed before the return type in function declarations. 31 | * Useful for C++11 and GCC/Clang-style function attribute syntax. 32 | * VKAPI_CALL - Placed after the return type in function declarations. 33 | * Useful for MSVC-style calling convention syntax. 34 | * VKAPI_PTR - Placed between the '(' and '*' in function pointer types. 35 | * 36 | * Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void); 37 | * Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void); 38 | */ 39 | #if defined(_WIN32) 40 | // On Windows, Vulkan commands use the stdcall convention 41 | #define VKAPI_ATTR 42 | #define VKAPI_CALL __stdcall 43 | #define VKAPI_PTR VKAPI_CALL 44 | #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7 45 | #error "Vulkan isn't supported for the 'armeabi' NDK ABI" 46 | #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE) 47 | // On Android 32-bit ARM targets, Vulkan functions use the "hardfloat" 48 | // calling convention, i.e. float parameters are passed in registers. This 49 | // is true even if the rest of the application passes floats on the stack, 50 | // as it does by default when compiling for the armeabi-v7a NDK ABI. 51 | #define VKAPI_ATTR __attribute__((pcs("aapcs-vfp"))) 52 | #define VKAPI_CALL 53 | #define VKAPI_PTR VKAPI_ATTR 54 | #else 55 | // On other platforms, use the default calling convention 56 | #define VKAPI_ATTR 57 | #define VKAPI_CALL 58 | #define VKAPI_PTR 59 | #endif 60 | 61 | #include 62 | 63 | #if !defined(VK_NO_STDINT_H) 64 | #if defined(_MSC_VER) && (_MSC_VER < 1600) 65 | typedef signed __int8 int8_t; 66 | typedef unsigned __int8 uint8_t; 67 | typedef signed __int16 int16_t; 68 | typedef unsigned __int16 uint16_t; 69 | typedef signed __int32 int32_t; 70 | typedef unsigned __int32 uint32_t; 71 | typedef signed __int64 int64_t; 72 | typedef unsigned __int64 uint64_t; 73 | #else 74 | #include 75 | #endif 76 | #endif // !defined(VK_NO_STDINT_H) 77 | 78 | #ifdef __cplusplus 79 | } // extern "C" 80 | #endif // __cplusplus 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /src/vulkan-loader/include/vulkan/vk_sdk_platform.h: -------------------------------------------------------------------------------- 1 | // 2 | // File: vk_sdk_platform.h 3 | // 4 | /* 5 | * Copyright (c) 2015-2016 The Khronos Group Inc. 6 | * Copyright (c) 2015-2016 Valve Corporation 7 | * Copyright (c) 2015-2016 LunarG, Inc. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #ifndef VK_SDK_PLATFORM_H 23 | #define VK_SDK_PLATFORM_H 24 | 25 | #if defined(_WIN32) 26 | #define NOMINMAX 27 | #ifndef __cplusplus 28 | #undef inline 29 | #define inline __inline 30 | #endif // __cplusplus 31 | 32 | #if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/) 33 | // C99: 34 | // Microsoft didn't implement C99 in Visual Studio; but started adding it with 35 | // VS2013. However, VS2013 still didn't have snprintf(). The following is a 36 | // work-around (Note: The _CRT_SECURE_NO_WARNINGS macro must be set in the 37 | // "CMakeLists.txt" file). 38 | // NOTE: This is fixed in Visual Studio 2015. 39 | #define snprintf _snprintf 40 | #endif 41 | 42 | #define strdup _strdup 43 | 44 | #endif // _WIN32 45 | 46 | // Check for noexcept support using clang, with fallback to Windows or GCC version numbers 47 | #ifndef NOEXCEPT 48 | #if defined(__clang__) 49 | #if __has_feature(cxx_noexcept) 50 | #define HAS_NOEXCEPT 51 | #endif 52 | #else 53 | #if defined(__GXX_EXPERIMENTAL_CXX0X__) && __GNUC__ * 10 + __GNUC_MINOR__ >= 46 54 | #define HAS_NOEXCEPT 55 | #else 56 | #if defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 190023026 && defined(_HAS_EXCEPTIONS) && _HAS_EXCEPTIONS 57 | #define HAS_NOEXCEPT 58 | #endif 59 | #endif 60 | #endif 61 | 62 | #ifdef HAS_NOEXCEPT 63 | #define NOEXCEPT noexcept 64 | #else 65 | #define NOEXCEPT 66 | #endif 67 | #endif 68 | 69 | #endif // VK_SDK_PLATFORM_H 70 | -------------------------------------------------------------------------------- /src/vulkan-loader/include/vulkan/vulkan.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_H_ 2 | #define VULKAN_H_ 1 3 | 4 | /* 5 | ** Copyright (c) 2015-2020 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | #include "vk_platform.h" 11 | #include "vulkan_core.h" 12 | 13 | #ifdef VK_USE_PLATFORM_ANDROID_KHR 14 | #include "vulkan_android.h" 15 | #endif 16 | 17 | #ifdef VK_USE_PLATFORM_FUCHSIA 18 | #include 19 | #include "vulkan_fuchsia.h" 20 | #endif 21 | 22 | #ifdef VK_USE_PLATFORM_IOS_MVK 23 | #include "vulkan_ios.h" 24 | #endif 25 | 26 | 27 | #ifdef VK_USE_PLATFORM_MACOS_MVK 28 | #include "vulkan_macos.h" 29 | #endif 30 | 31 | #ifdef VK_USE_PLATFORM_METAL_EXT 32 | #include "vulkan_metal.h" 33 | #endif 34 | 35 | #ifdef VK_USE_PLATFORM_VI_NN 36 | #include "vulkan_vi.h" 37 | #endif 38 | 39 | 40 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR 41 | #include 42 | #include "vulkan_wayland.h" 43 | #endif 44 | 45 | 46 | #ifdef VK_USE_PLATFORM_WIN32_KHR 47 | #include 48 | #include "vulkan_win32.h" 49 | #endif 50 | 51 | 52 | #ifdef VK_USE_PLATFORM_XCB_KHR 53 | #include 54 | #include "vulkan_xcb.h" 55 | #endif 56 | 57 | 58 | #ifdef VK_USE_PLATFORM_XLIB_KHR 59 | #include 60 | #include "vulkan_xlib.h" 61 | #endif 62 | 63 | 64 | #ifdef VK_USE_PLATFORM_DIRECTFB_EXT 65 | #include 66 | #include "vulkan_directfb.h" 67 | #endif 68 | 69 | 70 | #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT 71 | #include 72 | #include 73 | #include "vulkan_xlib_xrandr.h" 74 | #endif 75 | 76 | 77 | #ifdef VK_USE_PLATFORM_GGP 78 | #include 79 | #include "vulkan_ggp.h" 80 | #endif 81 | 82 | 83 | #ifdef VK_ENABLE_BETA_EXTENSIONS 84 | #include "vulkan_beta.h" 85 | #endif 86 | 87 | #endif // VULKAN_H_ 88 | -------------------------------------------------------------------------------- /src/vulkan-loader/include/vulkan/vulkan_android.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_ANDROID_H_ 2 | #define VULKAN_ANDROID_H_ 1 3 | 4 | /* 5 | ** Copyright (c) 2015-2020 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_KHR_android_surface 1 23 | struct ANativeWindow; 24 | #define VK_KHR_ANDROID_SURFACE_SPEC_VERSION 6 25 | #define VK_KHR_ANDROID_SURFACE_EXTENSION_NAME "VK_KHR_android_surface" 26 | typedef VkFlags VkAndroidSurfaceCreateFlagsKHR; 27 | typedef struct VkAndroidSurfaceCreateInfoKHR { 28 | VkStructureType sType; 29 | const void* pNext; 30 | VkAndroidSurfaceCreateFlagsKHR flags; 31 | struct ANativeWindow* window; 32 | } VkAndroidSurfaceCreateInfoKHR; 33 | 34 | typedef VkResult (VKAPI_PTR *PFN_vkCreateAndroidSurfaceKHR)(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 35 | 36 | #ifndef VK_NO_PROTOTYPES 37 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateAndroidSurfaceKHR( 38 | VkInstance instance, 39 | const VkAndroidSurfaceCreateInfoKHR* pCreateInfo, 40 | const VkAllocationCallbacks* pAllocator, 41 | VkSurfaceKHR* pSurface); 42 | #endif 43 | 44 | 45 | #define VK_ANDROID_external_memory_android_hardware_buffer 1 46 | struct AHardwareBuffer; 47 | #define VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_SPEC_VERSION 3 48 | #define VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_NAME "VK_ANDROID_external_memory_android_hardware_buffer" 49 | typedef struct VkAndroidHardwareBufferUsageANDROID { 50 | VkStructureType sType; 51 | void* pNext; 52 | uint64_t androidHardwareBufferUsage; 53 | } VkAndroidHardwareBufferUsageANDROID; 54 | 55 | typedef struct VkAndroidHardwareBufferPropertiesANDROID { 56 | VkStructureType sType; 57 | void* pNext; 58 | VkDeviceSize allocationSize; 59 | uint32_t memoryTypeBits; 60 | } VkAndroidHardwareBufferPropertiesANDROID; 61 | 62 | typedef struct VkAndroidHardwareBufferFormatPropertiesANDROID { 63 | VkStructureType sType; 64 | void* pNext; 65 | VkFormat format; 66 | uint64_t externalFormat; 67 | VkFormatFeatureFlags formatFeatures; 68 | VkComponentMapping samplerYcbcrConversionComponents; 69 | VkSamplerYcbcrModelConversion suggestedYcbcrModel; 70 | VkSamplerYcbcrRange suggestedYcbcrRange; 71 | VkChromaLocation suggestedXChromaOffset; 72 | VkChromaLocation suggestedYChromaOffset; 73 | } VkAndroidHardwareBufferFormatPropertiesANDROID; 74 | 75 | typedef struct VkImportAndroidHardwareBufferInfoANDROID { 76 | VkStructureType sType; 77 | const void* pNext; 78 | struct AHardwareBuffer* buffer; 79 | } VkImportAndroidHardwareBufferInfoANDROID; 80 | 81 | typedef struct VkMemoryGetAndroidHardwareBufferInfoANDROID { 82 | VkStructureType sType; 83 | const void* pNext; 84 | VkDeviceMemory memory; 85 | } VkMemoryGetAndroidHardwareBufferInfoANDROID; 86 | 87 | typedef struct VkExternalFormatANDROID { 88 | VkStructureType sType; 89 | void* pNext; 90 | uint64_t externalFormat; 91 | } VkExternalFormatANDROID; 92 | 93 | typedef VkResult (VKAPI_PTR *PFN_vkGetAndroidHardwareBufferPropertiesANDROID)(VkDevice device, const struct AHardwareBuffer* buffer, VkAndroidHardwareBufferPropertiesANDROID* pProperties); 94 | typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryAndroidHardwareBufferANDROID)(VkDevice device, const VkMemoryGetAndroidHardwareBufferInfoANDROID* pInfo, struct AHardwareBuffer** pBuffer); 95 | 96 | #ifndef VK_NO_PROTOTYPES 97 | VKAPI_ATTR VkResult VKAPI_CALL vkGetAndroidHardwareBufferPropertiesANDROID( 98 | VkDevice device, 99 | const struct AHardwareBuffer* buffer, 100 | VkAndroidHardwareBufferPropertiesANDROID* pProperties); 101 | 102 | VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryAndroidHardwareBufferANDROID( 103 | VkDevice device, 104 | const VkMemoryGetAndroidHardwareBufferInfoANDROID* pInfo, 105 | struct AHardwareBuffer** pBuffer); 106 | #endif 107 | 108 | #ifdef __cplusplus 109 | } 110 | #endif 111 | 112 | #endif 113 | -------------------------------------------------------------------------------- /src/vulkan-loader/include/vulkan/vulkan_directfb.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_DIRECTFB_H_ 2 | #define VULKAN_DIRECTFB_H_ 1 3 | 4 | /* 5 | ** Copyright (c) 2015-2020 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_EXT_directfb_surface 1 23 | #define VK_EXT_DIRECTFB_SURFACE_SPEC_VERSION 1 24 | #define VK_EXT_DIRECTFB_SURFACE_EXTENSION_NAME "VK_EXT_directfb_surface" 25 | typedef VkFlags VkDirectFBSurfaceCreateFlagsEXT; 26 | typedef struct VkDirectFBSurfaceCreateInfoEXT { 27 | VkStructureType sType; 28 | const void* pNext; 29 | VkDirectFBSurfaceCreateFlagsEXT flags; 30 | IDirectFB* dfb; 31 | IDirectFBSurface* surface; 32 | } VkDirectFBSurfaceCreateInfoEXT; 33 | 34 | typedef VkResult (VKAPI_PTR *PFN_vkCreateDirectFBSurfaceEXT)(VkInstance instance, const VkDirectFBSurfaceCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 35 | typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceDirectFBPresentationSupportEXT)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, IDirectFB* dfb); 36 | 37 | #ifndef VK_NO_PROTOTYPES 38 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateDirectFBSurfaceEXT( 39 | VkInstance instance, 40 | const VkDirectFBSurfaceCreateInfoEXT* pCreateInfo, 41 | const VkAllocationCallbacks* pAllocator, 42 | VkSurfaceKHR* pSurface); 43 | 44 | VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceDirectFBPresentationSupportEXT( 45 | VkPhysicalDevice physicalDevice, 46 | uint32_t queueFamilyIndex, 47 | IDirectFB* dfb); 48 | #endif 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/vulkan-loader/include/vulkan/vulkan_fuchsia.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_FUCHSIA_H_ 2 | #define VULKAN_FUCHSIA_H_ 1 3 | 4 | /* 5 | ** Copyright (c) 2015-2020 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_FUCHSIA_imagepipe_surface 1 23 | #define VK_FUCHSIA_IMAGEPIPE_SURFACE_SPEC_VERSION 1 24 | #define VK_FUCHSIA_IMAGEPIPE_SURFACE_EXTENSION_NAME "VK_FUCHSIA_imagepipe_surface" 25 | typedef VkFlags VkImagePipeSurfaceCreateFlagsFUCHSIA; 26 | typedef struct VkImagePipeSurfaceCreateInfoFUCHSIA { 27 | VkStructureType sType; 28 | const void* pNext; 29 | VkImagePipeSurfaceCreateFlagsFUCHSIA flags; 30 | zx_handle_t imagePipeHandle; 31 | } VkImagePipeSurfaceCreateInfoFUCHSIA; 32 | 33 | typedef VkResult (VKAPI_PTR *PFN_vkCreateImagePipeSurfaceFUCHSIA)(VkInstance instance, const VkImagePipeSurfaceCreateInfoFUCHSIA* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 34 | 35 | #ifndef VK_NO_PROTOTYPES 36 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateImagePipeSurfaceFUCHSIA( 37 | VkInstance instance, 38 | const VkImagePipeSurfaceCreateInfoFUCHSIA* pCreateInfo, 39 | const VkAllocationCallbacks* pAllocator, 40 | VkSurfaceKHR* pSurface); 41 | #endif 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/vulkan-loader/include/vulkan/vulkan_ggp.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_GGP_H_ 2 | #define VULKAN_GGP_H_ 1 3 | 4 | /* 5 | ** Copyright (c) 2015-2020 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_GGP_stream_descriptor_surface 1 23 | #define VK_GGP_STREAM_DESCRIPTOR_SURFACE_SPEC_VERSION 1 24 | #define VK_GGP_STREAM_DESCRIPTOR_SURFACE_EXTENSION_NAME "VK_GGP_stream_descriptor_surface" 25 | typedef VkFlags VkStreamDescriptorSurfaceCreateFlagsGGP; 26 | typedef struct VkStreamDescriptorSurfaceCreateInfoGGP { 27 | VkStructureType sType; 28 | const void* pNext; 29 | VkStreamDescriptorSurfaceCreateFlagsGGP flags; 30 | GgpStreamDescriptor streamDescriptor; 31 | } VkStreamDescriptorSurfaceCreateInfoGGP; 32 | 33 | typedef VkResult (VKAPI_PTR *PFN_vkCreateStreamDescriptorSurfaceGGP)(VkInstance instance, const VkStreamDescriptorSurfaceCreateInfoGGP* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 34 | 35 | #ifndef VK_NO_PROTOTYPES 36 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateStreamDescriptorSurfaceGGP( 37 | VkInstance instance, 38 | const VkStreamDescriptorSurfaceCreateInfoGGP* pCreateInfo, 39 | const VkAllocationCallbacks* pAllocator, 40 | VkSurfaceKHR* pSurface); 41 | #endif 42 | 43 | 44 | #define VK_GGP_frame_token 1 45 | #define VK_GGP_FRAME_TOKEN_SPEC_VERSION 1 46 | #define VK_GGP_FRAME_TOKEN_EXTENSION_NAME "VK_GGP_frame_token" 47 | typedef struct VkPresentFrameTokenGGP { 48 | VkStructureType sType; 49 | const void* pNext; 50 | GgpFrameToken frameToken; 51 | } VkPresentFrameTokenGGP; 52 | 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /src/vulkan-loader/include/vulkan/vulkan_ios.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_IOS_H_ 2 | #define VULKAN_IOS_H_ 1 3 | 4 | /* 5 | ** Copyright (c) 2015-2020 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_MVK_ios_surface 1 23 | #define VK_MVK_IOS_SURFACE_SPEC_VERSION 3 24 | #define VK_MVK_IOS_SURFACE_EXTENSION_NAME "VK_MVK_ios_surface" 25 | typedef VkFlags VkIOSSurfaceCreateFlagsMVK; 26 | typedef struct VkIOSSurfaceCreateInfoMVK { 27 | VkStructureType sType; 28 | const void* pNext; 29 | VkIOSSurfaceCreateFlagsMVK flags; 30 | const void* pView; 31 | } VkIOSSurfaceCreateInfoMVK; 32 | 33 | typedef VkResult (VKAPI_PTR *PFN_vkCreateIOSSurfaceMVK)(VkInstance instance, const VkIOSSurfaceCreateInfoMVK* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 34 | 35 | #ifndef VK_NO_PROTOTYPES 36 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateIOSSurfaceMVK( 37 | VkInstance instance, 38 | const VkIOSSurfaceCreateInfoMVK* pCreateInfo, 39 | const VkAllocationCallbacks* pAllocator, 40 | VkSurfaceKHR* pSurface); 41 | #endif 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/vulkan-loader/include/vulkan/vulkan_macos.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_MACOS_H_ 2 | #define VULKAN_MACOS_H_ 1 3 | 4 | /* 5 | ** Copyright (c) 2015-2020 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_MVK_macos_surface 1 23 | #define VK_MVK_MACOS_SURFACE_SPEC_VERSION 3 24 | #define VK_MVK_MACOS_SURFACE_EXTENSION_NAME "VK_MVK_macos_surface" 25 | typedef VkFlags VkMacOSSurfaceCreateFlagsMVK; 26 | typedef struct VkMacOSSurfaceCreateInfoMVK { 27 | VkStructureType sType; 28 | const void* pNext; 29 | VkMacOSSurfaceCreateFlagsMVK flags; 30 | const void* pView; 31 | } VkMacOSSurfaceCreateInfoMVK; 32 | 33 | typedef VkResult (VKAPI_PTR *PFN_vkCreateMacOSSurfaceMVK)(VkInstance instance, const VkMacOSSurfaceCreateInfoMVK* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 34 | 35 | #ifndef VK_NO_PROTOTYPES 36 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateMacOSSurfaceMVK( 37 | VkInstance instance, 38 | const VkMacOSSurfaceCreateInfoMVK* pCreateInfo, 39 | const VkAllocationCallbacks* pAllocator, 40 | VkSurfaceKHR* pSurface); 41 | #endif 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/vulkan-loader/include/vulkan/vulkan_metal.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_METAL_H_ 2 | #define VULKAN_METAL_H_ 1 3 | 4 | /* 5 | ** Copyright (c) 2015-2020 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_EXT_metal_surface 1 23 | 24 | #ifdef __OBJC__ 25 | @class CAMetalLayer; 26 | #else 27 | typedef void CAMetalLayer; 28 | #endif 29 | 30 | #define VK_EXT_METAL_SURFACE_SPEC_VERSION 1 31 | #define VK_EXT_METAL_SURFACE_EXTENSION_NAME "VK_EXT_metal_surface" 32 | typedef VkFlags VkMetalSurfaceCreateFlagsEXT; 33 | typedef struct VkMetalSurfaceCreateInfoEXT { 34 | VkStructureType sType; 35 | const void* pNext; 36 | VkMetalSurfaceCreateFlagsEXT flags; 37 | const CAMetalLayer* pLayer; 38 | } VkMetalSurfaceCreateInfoEXT; 39 | 40 | typedef VkResult (VKAPI_PTR *PFN_vkCreateMetalSurfaceEXT)(VkInstance instance, const VkMetalSurfaceCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 41 | 42 | #ifndef VK_NO_PROTOTYPES 43 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateMetalSurfaceEXT( 44 | VkInstance instance, 45 | const VkMetalSurfaceCreateInfoEXT* pCreateInfo, 46 | const VkAllocationCallbacks* pAllocator, 47 | VkSurfaceKHR* pSurface); 48 | #endif 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/vulkan-loader/include/vulkan/vulkan_vi.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_VI_H_ 2 | #define VULKAN_VI_H_ 1 3 | 4 | /* 5 | ** Copyright (c) 2015-2020 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_NN_vi_surface 1 23 | #define VK_NN_VI_SURFACE_SPEC_VERSION 1 24 | #define VK_NN_VI_SURFACE_EXTENSION_NAME "VK_NN_vi_surface" 25 | typedef VkFlags VkViSurfaceCreateFlagsNN; 26 | typedef struct VkViSurfaceCreateInfoNN { 27 | VkStructureType sType; 28 | const void* pNext; 29 | VkViSurfaceCreateFlagsNN flags; 30 | void* window; 31 | } VkViSurfaceCreateInfoNN; 32 | 33 | typedef VkResult (VKAPI_PTR *PFN_vkCreateViSurfaceNN)(VkInstance instance, const VkViSurfaceCreateInfoNN* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 34 | 35 | #ifndef VK_NO_PROTOTYPES 36 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateViSurfaceNN( 37 | VkInstance instance, 38 | const VkViSurfaceCreateInfoNN* pCreateInfo, 39 | const VkAllocationCallbacks* pAllocator, 40 | VkSurfaceKHR* pSurface); 41 | #endif 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/vulkan-loader/include/vulkan/vulkan_wayland.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_WAYLAND_H_ 2 | #define VULKAN_WAYLAND_H_ 1 3 | 4 | /* 5 | ** Copyright (c) 2015-2020 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_KHR_wayland_surface 1 23 | #define VK_KHR_WAYLAND_SURFACE_SPEC_VERSION 6 24 | #define VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME "VK_KHR_wayland_surface" 25 | typedef VkFlags VkWaylandSurfaceCreateFlagsKHR; 26 | typedef struct VkWaylandSurfaceCreateInfoKHR { 27 | VkStructureType sType; 28 | const void* pNext; 29 | VkWaylandSurfaceCreateFlagsKHR flags; 30 | struct wl_display* display; 31 | struct wl_surface* surface; 32 | } VkWaylandSurfaceCreateInfoKHR; 33 | 34 | typedef VkResult (VKAPI_PTR *PFN_vkCreateWaylandSurfaceKHR)(VkInstance instance, const VkWaylandSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 35 | typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, struct wl_display* display); 36 | 37 | #ifndef VK_NO_PROTOTYPES 38 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateWaylandSurfaceKHR( 39 | VkInstance instance, 40 | const VkWaylandSurfaceCreateInfoKHR* pCreateInfo, 41 | const VkAllocationCallbacks* pAllocator, 42 | VkSurfaceKHR* pSurface); 43 | 44 | VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWaylandPresentationSupportKHR( 45 | VkPhysicalDevice physicalDevice, 46 | uint32_t queueFamilyIndex, 47 | struct wl_display* display); 48 | #endif 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/vulkan-loader/include/vulkan/vulkan_win32.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_WIN32_H_ 2 | #define VULKAN_WIN32_H_ 1 3 | 4 | /* 5 | ** Copyright (c) 2015-2020 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_KHR_win32_surface 1 23 | #define VK_KHR_WIN32_SURFACE_SPEC_VERSION 6 24 | #define VK_KHR_WIN32_SURFACE_EXTENSION_NAME "VK_KHR_win32_surface" 25 | typedef VkFlags VkWin32SurfaceCreateFlagsKHR; 26 | typedef struct VkWin32SurfaceCreateInfoKHR { 27 | VkStructureType sType; 28 | const void* pNext; 29 | VkWin32SurfaceCreateFlagsKHR flags; 30 | HINSTANCE hinstance; 31 | HWND hwnd; 32 | } VkWin32SurfaceCreateInfoKHR; 33 | 34 | typedef VkResult (VKAPI_PTR *PFN_vkCreateWin32SurfaceKHR)(VkInstance instance, const VkWin32SurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 35 | typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex); 36 | 37 | #ifndef VK_NO_PROTOTYPES 38 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateWin32SurfaceKHR( 39 | VkInstance instance, 40 | const VkWin32SurfaceCreateInfoKHR* pCreateInfo, 41 | const VkAllocationCallbacks* pAllocator, 42 | VkSurfaceKHR* pSurface); 43 | 44 | VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWin32PresentationSupportKHR( 45 | VkPhysicalDevice physicalDevice, 46 | uint32_t queueFamilyIndex); 47 | #endif 48 | 49 | 50 | #define VK_KHR_external_memory_win32 1 51 | #define VK_KHR_EXTERNAL_MEMORY_WIN32_SPEC_VERSION 1 52 | #define VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME "VK_KHR_external_memory_win32" 53 | typedef struct VkImportMemoryWin32HandleInfoKHR { 54 | VkStructureType sType; 55 | const void* pNext; 56 | VkExternalMemoryHandleTypeFlagBits handleType; 57 | HANDLE handle; 58 | LPCWSTR name; 59 | } VkImportMemoryWin32HandleInfoKHR; 60 | 61 | typedef struct VkExportMemoryWin32HandleInfoKHR { 62 | VkStructureType sType; 63 | const void* pNext; 64 | const SECURITY_ATTRIBUTES* pAttributes; 65 | DWORD dwAccess; 66 | LPCWSTR name; 67 | } VkExportMemoryWin32HandleInfoKHR; 68 | 69 | typedef struct VkMemoryWin32HandlePropertiesKHR { 70 | VkStructureType sType; 71 | void* pNext; 72 | uint32_t memoryTypeBits; 73 | } VkMemoryWin32HandlePropertiesKHR; 74 | 75 | typedef struct VkMemoryGetWin32HandleInfoKHR { 76 | VkStructureType sType; 77 | const void* pNext; 78 | VkDeviceMemory memory; 79 | VkExternalMemoryHandleTypeFlagBits handleType; 80 | } VkMemoryGetWin32HandleInfoKHR; 81 | 82 | typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandleKHR)(VkDevice device, const VkMemoryGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle); 83 | typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandlePropertiesKHR)(VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, HANDLE handle, VkMemoryWin32HandlePropertiesKHR* pMemoryWin32HandleProperties); 84 | 85 | #ifndef VK_NO_PROTOTYPES 86 | VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleKHR( 87 | VkDevice device, 88 | const VkMemoryGetWin32HandleInfoKHR* pGetWin32HandleInfo, 89 | HANDLE* pHandle); 90 | 91 | VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandlePropertiesKHR( 92 | VkDevice device, 93 | VkExternalMemoryHandleTypeFlagBits handleType, 94 | HANDLE handle, 95 | VkMemoryWin32HandlePropertiesKHR* pMemoryWin32HandleProperties); 96 | #endif 97 | 98 | 99 | #define VK_KHR_win32_keyed_mutex 1 100 | #define VK_KHR_WIN32_KEYED_MUTEX_SPEC_VERSION 1 101 | #define VK_KHR_WIN32_KEYED_MUTEX_EXTENSION_NAME "VK_KHR_win32_keyed_mutex" 102 | typedef struct VkWin32KeyedMutexAcquireReleaseInfoKHR { 103 | VkStructureType sType; 104 | const void* pNext; 105 | uint32_t acquireCount; 106 | const VkDeviceMemory* pAcquireSyncs; 107 | const uint64_t* pAcquireKeys; 108 | const uint32_t* pAcquireTimeouts; 109 | uint32_t releaseCount; 110 | const VkDeviceMemory* pReleaseSyncs; 111 | const uint64_t* pReleaseKeys; 112 | } VkWin32KeyedMutexAcquireReleaseInfoKHR; 113 | 114 | 115 | 116 | #define VK_KHR_external_semaphore_win32 1 117 | #define VK_KHR_EXTERNAL_SEMAPHORE_WIN32_SPEC_VERSION 1 118 | #define VK_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME "VK_KHR_external_semaphore_win32" 119 | typedef struct VkImportSemaphoreWin32HandleInfoKHR { 120 | VkStructureType sType; 121 | const void* pNext; 122 | VkSemaphore semaphore; 123 | VkSemaphoreImportFlags flags; 124 | VkExternalSemaphoreHandleTypeFlagBits handleType; 125 | HANDLE handle; 126 | LPCWSTR name; 127 | } VkImportSemaphoreWin32HandleInfoKHR; 128 | 129 | typedef struct VkExportSemaphoreWin32HandleInfoKHR { 130 | VkStructureType sType; 131 | const void* pNext; 132 | const SECURITY_ATTRIBUTES* pAttributes; 133 | DWORD dwAccess; 134 | LPCWSTR name; 135 | } VkExportSemaphoreWin32HandleInfoKHR; 136 | 137 | typedef struct VkD3D12FenceSubmitInfoKHR { 138 | VkStructureType sType; 139 | const void* pNext; 140 | uint32_t waitSemaphoreValuesCount; 141 | const uint64_t* pWaitSemaphoreValues; 142 | uint32_t signalSemaphoreValuesCount; 143 | const uint64_t* pSignalSemaphoreValues; 144 | } VkD3D12FenceSubmitInfoKHR; 145 | 146 | typedef struct VkSemaphoreGetWin32HandleInfoKHR { 147 | VkStructureType sType; 148 | const void* pNext; 149 | VkSemaphore semaphore; 150 | VkExternalSemaphoreHandleTypeFlagBits handleType; 151 | } VkSemaphoreGetWin32HandleInfoKHR; 152 | 153 | typedef VkResult (VKAPI_PTR *PFN_vkImportSemaphoreWin32HandleKHR)(VkDevice device, const VkImportSemaphoreWin32HandleInfoKHR* pImportSemaphoreWin32HandleInfo); 154 | typedef VkResult (VKAPI_PTR *PFN_vkGetSemaphoreWin32HandleKHR)(VkDevice device, const VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle); 155 | 156 | #ifndef VK_NO_PROTOTYPES 157 | VKAPI_ATTR VkResult VKAPI_CALL vkImportSemaphoreWin32HandleKHR( 158 | VkDevice device, 159 | const VkImportSemaphoreWin32HandleInfoKHR* pImportSemaphoreWin32HandleInfo); 160 | 161 | VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreWin32HandleKHR( 162 | VkDevice device, 163 | const VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfo, 164 | HANDLE* pHandle); 165 | #endif 166 | 167 | 168 | #define VK_KHR_external_fence_win32 1 169 | #define VK_KHR_EXTERNAL_FENCE_WIN32_SPEC_VERSION 1 170 | #define VK_KHR_EXTERNAL_FENCE_WIN32_EXTENSION_NAME "VK_KHR_external_fence_win32" 171 | typedef struct VkImportFenceWin32HandleInfoKHR { 172 | VkStructureType sType; 173 | const void* pNext; 174 | VkFence fence; 175 | VkFenceImportFlags flags; 176 | VkExternalFenceHandleTypeFlagBits handleType; 177 | HANDLE handle; 178 | LPCWSTR name; 179 | } VkImportFenceWin32HandleInfoKHR; 180 | 181 | typedef struct VkExportFenceWin32HandleInfoKHR { 182 | VkStructureType sType; 183 | const void* pNext; 184 | const SECURITY_ATTRIBUTES* pAttributes; 185 | DWORD dwAccess; 186 | LPCWSTR name; 187 | } VkExportFenceWin32HandleInfoKHR; 188 | 189 | typedef struct VkFenceGetWin32HandleInfoKHR { 190 | VkStructureType sType; 191 | const void* pNext; 192 | VkFence fence; 193 | VkExternalFenceHandleTypeFlagBits handleType; 194 | } VkFenceGetWin32HandleInfoKHR; 195 | 196 | typedef VkResult (VKAPI_PTR *PFN_vkImportFenceWin32HandleKHR)(VkDevice device, const VkImportFenceWin32HandleInfoKHR* pImportFenceWin32HandleInfo); 197 | typedef VkResult (VKAPI_PTR *PFN_vkGetFenceWin32HandleKHR)(VkDevice device, const VkFenceGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle); 198 | 199 | #ifndef VK_NO_PROTOTYPES 200 | VKAPI_ATTR VkResult VKAPI_CALL vkImportFenceWin32HandleKHR( 201 | VkDevice device, 202 | const VkImportFenceWin32HandleInfoKHR* pImportFenceWin32HandleInfo); 203 | 204 | VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceWin32HandleKHR( 205 | VkDevice device, 206 | const VkFenceGetWin32HandleInfoKHR* pGetWin32HandleInfo, 207 | HANDLE* pHandle); 208 | #endif 209 | 210 | 211 | #define VK_NV_external_memory_win32 1 212 | #define VK_NV_EXTERNAL_MEMORY_WIN32_SPEC_VERSION 1 213 | #define VK_NV_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME "VK_NV_external_memory_win32" 214 | typedef struct VkImportMemoryWin32HandleInfoNV { 215 | VkStructureType sType; 216 | const void* pNext; 217 | VkExternalMemoryHandleTypeFlagsNV handleType; 218 | HANDLE handle; 219 | } VkImportMemoryWin32HandleInfoNV; 220 | 221 | typedef struct VkExportMemoryWin32HandleInfoNV { 222 | VkStructureType sType; 223 | const void* pNext; 224 | const SECURITY_ATTRIBUTES* pAttributes; 225 | DWORD dwAccess; 226 | } VkExportMemoryWin32HandleInfoNV; 227 | 228 | typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandleNV)(VkDevice device, VkDeviceMemory memory, VkExternalMemoryHandleTypeFlagsNV handleType, HANDLE* pHandle); 229 | 230 | #ifndef VK_NO_PROTOTYPES 231 | VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleNV( 232 | VkDevice device, 233 | VkDeviceMemory memory, 234 | VkExternalMemoryHandleTypeFlagsNV handleType, 235 | HANDLE* pHandle); 236 | #endif 237 | 238 | 239 | #define VK_NV_win32_keyed_mutex 1 240 | #define VK_NV_WIN32_KEYED_MUTEX_SPEC_VERSION 2 241 | #define VK_NV_WIN32_KEYED_MUTEX_EXTENSION_NAME "VK_NV_win32_keyed_mutex" 242 | typedef struct VkWin32KeyedMutexAcquireReleaseInfoNV { 243 | VkStructureType sType; 244 | const void* pNext; 245 | uint32_t acquireCount; 246 | const VkDeviceMemory* pAcquireSyncs; 247 | const uint64_t* pAcquireKeys; 248 | const uint32_t* pAcquireTimeoutMilliseconds; 249 | uint32_t releaseCount; 250 | const VkDeviceMemory* pReleaseSyncs; 251 | const uint64_t* pReleaseKeys; 252 | } VkWin32KeyedMutexAcquireReleaseInfoNV; 253 | 254 | 255 | 256 | #define VK_EXT_full_screen_exclusive 1 257 | #define VK_EXT_FULL_SCREEN_EXCLUSIVE_SPEC_VERSION 4 258 | #define VK_EXT_FULL_SCREEN_EXCLUSIVE_EXTENSION_NAME "VK_EXT_full_screen_exclusive" 259 | 260 | typedef enum VkFullScreenExclusiveEXT { 261 | VK_FULL_SCREEN_EXCLUSIVE_DEFAULT_EXT = 0, 262 | VK_FULL_SCREEN_EXCLUSIVE_ALLOWED_EXT = 1, 263 | VK_FULL_SCREEN_EXCLUSIVE_DISALLOWED_EXT = 2, 264 | VK_FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT = 3, 265 | VK_FULL_SCREEN_EXCLUSIVE_MAX_ENUM_EXT = 0x7FFFFFFF 266 | } VkFullScreenExclusiveEXT; 267 | typedef struct VkSurfaceFullScreenExclusiveInfoEXT { 268 | VkStructureType sType; 269 | void* pNext; 270 | VkFullScreenExclusiveEXT fullScreenExclusive; 271 | } VkSurfaceFullScreenExclusiveInfoEXT; 272 | 273 | typedef struct VkSurfaceCapabilitiesFullScreenExclusiveEXT { 274 | VkStructureType sType; 275 | void* pNext; 276 | VkBool32 fullScreenExclusiveSupported; 277 | } VkSurfaceCapabilitiesFullScreenExclusiveEXT; 278 | 279 | typedef struct VkSurfaceFullScreenExclusiveWin32InfoEXT { 280 | VkStructureType sType; 281 | const void* pNext; 282 | HMONITOR hmonitor; 283 | } VkSurfaceFullScreenExclusiveWin32InfoEXT; 284 | 285 | typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfacePresentModes2EXT)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, uint32_t* pPresentModeCount, VkPresentModeKHR* pPresentModes); 286 | typedef VkResult (VKAPI_PTR *PFN_vkAcquireFullScreenExclusiveModeEXT)(VkDevice device, VkSwapchainKHR swapchain); 287 | typedef VkResult (VKAPI_PTR *PFN_vkReleaseFullScreenExclusiveModeEXT)(VkDevice device, VkSwapchainKHR swapchain); 288 | typedef VkResult (VKAPI_PTR *PFN_vkGetDeviceGroupSurfacePresentModes2EXT)(VkDevice device, const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, VkDeviceGroupPresentModeFlagsKHR* pModes); 289 | 290 | #ifndef VK_NO_PROTOTYPES 291 | VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfacePresentModes2EXT( 292 | VkPhysicalDevice physicalDevice, 293 | const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, 294 | uint32_t* pPresentModeCount, 295 | VkPresentModeKHR* pPresentModes); 296 | 297 | VKAPI_ATTR VkResult VKAPI_CALL vkAcquireFullScreenExclusiveModeEXT( 298 | VkDevice device, 299 | VkSwapchainKHR swapchain); 300 | 301 | VKAPI_ATTR VkResult VKAPI_CALL vkReleaseFullScreenExclusiveModeEXT( 302 | VkDevice device, 303 | VkSwapchainKHR swapchain); 304 | 305 | VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceGroupSurfacePresentModes2EXT( 306 | VkDevice device, 307 | const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, 308 | VkDeviceGroupPresentModeFlagsKHR* pModes); 309 | #endif 310 | 311 | #ifdef __cplusplus 312 | } 313 | #endif 314 | 315 | #endif 316 | -------------------------------------------------------------------------------- /src/vulkan-loader/include/vulkan/vulkan_xcb.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_XCB_H_ 2 | #define VULKAN_XCB_H_ 1 3 | 4 | /* 5 | ** Copyright (c) 2015-2020 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_KHR_xcb_surface 1 23 | #define VK_KHR_XCB_SURFACE_SPEC_VERSION 6 24 | #define VK_KHR_XCB_SURFACE_EXTENSION_NAME "VK_KHR_xcb_surface" 25 | typedef VkFlags VkXcbSurfaceCreateFlagsKHR; 26 | typedef struct VkXcbSurfaceCreateInfoKHR { 27 | VkStructureType sType; 28 | const void* pNext; 29 | VkXcbSurfaceCreateFlagsKHR flags; 30 | xcb_connection_t* connection; 31 | xcb_window_t window; 32 | } VkXcbSurfaceCreateInfoKHR; 33 | 34 | typedef VkResult (VKAPI_PTR *PFN_vkCreateXcbSurfaceKHR)(VkInstance instance, const VkXcbSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 35 | typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, xcb_connection_t* connection, xcb_visualid_t visual_id); 36 | 37 | #ifndef VK_NO_PROTOTYPES 38 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateXcbSurfaceKHR( 39 | VkInstance instance, 40 | const VkXcbSurfaceCreateInfoKHR* pCreateInfo, 41 | const VkAllocationCallbacks* pAllocator, 42 | VkSurfaceKHR* pSurface); 43 | 44 | VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXcbPresentationSupportKHR( 45 | VkPhysicalDevice physicalDevice, 46 | uint32_t queueFamilyIndex, 47 | xcb_connection_t* connection, 48 | xcb_visualid_t visual_id); 49 | #endif 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/vulkan-loader/include/vulkan/vulkan_xlib.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_XLIB_H_ 2 | #define VULKAN_XLIB_H_ 1 3 | 4 | /* 5 | ** Copyright (c) 2015-2020 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_KHR_xlib_surface 1 23 | #define VK_KHR_XLIB_SURFACE_SPEC_VERSION 6 24 | #define VK_KHR_XLIB_SURFACE_EXTENSION_NAME "VK_KHR_xlib_surface" 25 | typedef VkFlags VkXlibSurfaceCreateFlagsKHR; 26 | typedef struct VkXlibSurfaceCreateInfoKHR { 27 | VkStructureType sType; 28 | const void* pNext; 29 | VkXlibSurfaceCreateFlagsKHR flags; 30 | Display* dpy; 31 | Window window; 32 | } VkXlibSurfaceCreateInfoKHR; 33 | 34 | typedef VkResult (VKAPI_PTR *PFN_vkCreateXlibSurfaceKHR)(VkInstance instance, const VkXlibSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 35 | typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, Display* dpy, VisualID visualID); 36 | 37 | #ifndef VK_NO_PROTOTYPES 38 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateXlibSurfaceKHR( 39 | VkInstance instance, 40 | const VkXlibSurfaceCreateInfoKHR* pCreateInfo, 41 | const VkAllocationCallbacks* pAllocator, 42 | VkSurfaceKHR* pSurface); 43 | 44 | VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXlibPresentationSupportKHR( 45 | VkPhysicalDevice physicalDevice, 46 | uint32_t queueFamilyIndex, 47 | Display* dpy, 48 | VisualID visualID); 49 | #endif 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/vulkan-loader/include/vulkan/vulkan_xlib_xrandr.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_XLIB_XRANDR_H_ 2 | #define VULKAN_XLIB_XRANDR_H_ 1 3 | 4 | /* 5 | ** Copyright (c) 2015-2020 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_EXT_acquire_xlib_display 1 23 | #define VK_EXT_ACQUIRE_XLIB_DISPLAY_SPEC_VERSION 1 24 | #define VK_EXT_ACQUIRE_XLIB_DISPLAY_EXTENSION_NAME "VK_EXT_acquire_xlib_display" 25 | typedef VkResult (VKAPI_PTR *PFN_vkAcquireXlibDisplayEXT)(VkPhysicalDevice physicalDevice, Display* dpy, VkDisplayKHR display); 26 | typedef VkResult (VKAPI_PTR *PFN_vkGetRandROutputDisplayEXT)(VkPhysicalDevice physicalDevice, Display* dpy, RROutput rrOutput, VkDisplayKHR* pDisplay); 27 | 28 | #ifndef VK_NO_PROTOTYPES 29 | VKAPI_ATTR VkResult VKAPI_CALL vkAcquireXlibDisplayEXT( 30 | VkPhysicalDevice physicalDevice, 31 | Display* dpy, 32 | VkDisplayKHR display); 33 | 34 | VKAPI_ATTR VkResult VKAPI_CALL vkGetRandROutputDisplayEXT( 35 | VkPhysicalDevice physicalDevice, 36 | Display* dpy, 37 | RROutput rrOutput, 38 | VkDisplayKHR* pDisplay); 39 | #endif 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/vulkan-loader/loader_cmake_config.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewrk/zig-window/313e3090b2eecdc5317291b5b13dc7871023d025/src/vulkan-loader/loader_cmake_config.h -------------------------------------------------------------------------------- /src/vulkan-loader/murmurhash.c: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * `murmurhash.h' - murmurhash 4 | * 5 | * copyright (c) 2014 joseph werle 6 | * Copyright (c) 2015-2016 The Khronos Group Inc. 7 | * Copyright (c) 2015-2016 Valve Corporation 8 | * Copyright (c) 2015-2016 LunarG, Inc. 9 | * 10 | * Permission is hereby granted, free of charge, to any person obtaining a copy 11 | * of this software and/or associated documentation files (the "Materials"), to 12 | * deal in the Materials without restriction, including without limitation the 13 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 14 | * sell copies of the Materials, and to permit persons to whom the Materials are 15 | * furnished to do so, subject to the following conditions: 16 | * 17 | * The above copyright notice(s) and this permission notice shall be included in 18 | * all copies or substantial portions of the Materials. 19 | * 20 | * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 23 | * 24 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 25 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 26 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE 27 | * USE OR OTHER DEALINGS IN THE MATERIALS. 28 | */ 29 | 30 | #include 31 | #include "murmurhash.h" 32 | 33 | uint32_t murmurhash(const char *key, size_t len, uint32_t seed) { 34 | uint32_t c1 = 0xcc9e2d51; 35 | uint32_t c2 = 0x1b873593; 36 | uint32_t r1 = 15; 37 | uint32_t r2 = 13; 38 | uint32_t m = 5; 39 | uint32_t n = 0xe6546b64; 40 | uint32_t h = 0; 41 | uint32_t k = 0; 42 | uint8_t *d = (uint8_t *)key; // 32 bit extract from `key' 43 | const uint32_t *chunks = NULL; 44 | const uint8_t *tail = NULL; // tail - last 8 bytes 45 | int i = 0; 46 | int l = (int)len / 4; // chunk length 47 | 48 | h = seed; 49 | 50 | chunks = (const uint32_t *)(d + l * 4); // body 51 | tail = (const uint8_t *)(d + l * 4); // last 8 byte chunk of `key' 52 | 53 | // for each 4 byte chunk of `key' 54 | for (i = -l; i != 0; ++i) { 55 | // next 4 byte chunk of `key' 56 | k = chunks[i]; 57 | 58 | // encode next 4 byte chunk of `key' 59 | k *= c1; 60 | k = (k << r1) | (k >> (32 - r1)); 61 | k *= c2; 62 | 63 | // append to hash 64 | h ^= k; 65 | h = (h << r2) | (h >> (32 - r2)); 66 | h = h * m + n; 67 | } 68 | 69 | k = 0; 70 | 71 | // remainder 72 | switch (len & 3) { // `len % 4' 73 | case 3: 74 | k ^= (tail[2] << 16); 75 | // fall through 76 | case 2: 77 | k ^= (tail[1] << 8); 78 | // fall through 79 | case 1: 80 | k ^= tail[0]; 81 | k *= c1; 82 | k = (k << r1) | (k >> (32 - r1)); 83 | k *= c2; 84 | h ^= k; 85 | } 86 | 87 | h ^= len; 88 | 89 | h ^= (h >> 16); 90 | h *= 0x85ebca6b; 91 | h ^= (h >> 13); 92 | h *= 0xc2b2ae35; 93 | h ^= (h >> 16); 94 | 95 | return h; 96 | } 97 | -------------------------------------------------------------------------------- /src/vulkan-loader/murmurhash.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * `murmurhash.h' - murmurhash 4 | * 5 | * copyright (c) 2014 joseph werle 6 | * Copyright (c) 2015-2016 The Khronos Group Inc. 7 | * Copyright (c) 2015-2016 Valve Corporation 8 | * Copyright (c) 2015-2016 LunarG, Inc. 9 | * 10 | * Permission is hereby granted, free of charge, to any person obtaining a copy 11 | * of this software and/or associated documentation files (the "Materials"), to 12 | * deal in the Materials without restriction, including without limitation the 13 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 14 | * sell copies of the Materials, and to permit persons to whom the Materials are 15 | * furnished to do so, subject to the following conditions: 16 | * 17 | * The above copyright notice(s) and this permission notice shall be included in 18 | * all copies or substantial portions of the Materials. 19 | * 20 | * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 23 | * 24 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 25 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 26 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE 27 | * USE OR OTHER DEALINGS IN THE MATERIALS. 28 | */ 29 | 30 | #ifndef MURMURHASH_H 31 | #define MURMURHASH_H 1 32 | 33 | #include 34 | 35 | #define MURMURHASH_VERSION "0.0.3" 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | /** 42 | * Returns a murmur hash of `key' based on `seed' 43 | * using the MurmurHash3 algorithm 44 | */ 45 | 46 | uint32_t murmurhash(const char *key, size_t len, uint32_t seed); 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/vulkan-loader/unknown_ext_chain.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 The Khronos Group Inc. 3 | * Copyright (c) 2017 Valve Corporation 4 | * Copyright (c) 2017 LunarG, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author Jon Ashburn 19 | * Author: Lenny Komow 20 | */ 21 | 22 | // This code is used to pass on physical device extensions through the call chain. It must do this without creating a stack frame, 23 | // because the actual parameters of the call are not known. Since the first parameter is known to be a VkPhysicalDevice, it can 24 | // unwrap the physical device, overwriting the wrapped device, and then jump to the next function in the call chain. This code 25 | // attempts to accomplish this by relying on tail-call optimizations, but there is no guarantee that this will work. As a result, 26 | // this code is only compiled on systems where an assembly alternative has not been written. 27 | 28 | #include "vk_loader_platform.h" 29 | #include "loader.h" 30 | 31 | #if defined(__GNUC__) && !defined(__clang__) 32 | #pragma GCC optimize(3) // force gcc to use tail-calls 33 | #endif 34 | 35 | // Trampoline function macro for unknown physical device extension command. 36 | #define PhysDevExtTramp(num) \ 37 | VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp##num(VkPhysicalDevice physical_device) { \ 38 | const struct loader_instance_dispatch_table *disp; \ 39 | disp = loader_get_instance_dispatch(physical_device); \ 40 | disp->phys_dev_ext[num](loader_unwrap_physical_device(physical_device)); \ 41 | } 42 | 43 | // Terminator function macro for unknown physical device extension command. 44 | #define PhysDevExtTermin(num) \ 45 | VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin##num(VkPhysicalDevice physical_device) { \ 46 | struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physical_device; \ 47 | struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; \ 48 | struct loader_instance *inst = (struct loader_instance *)icd_term->this_instance; \ 49 | if (NULL == icd_term->phys_dev_ext[num]) { \ 50 | loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "Extension %s not supported for this physical device", \ 51 | inst->phys_dev_ext_disp_hash[num].func_name); \ 52 | } \ 53 | icd_term->phys_dev_ext[num](phys_dev_term->phys_dev); \ 54 | } 55 | 56 | // Trampoline function macro for unknown physical device extension command. 57 | #define DevExtTramp(num) \ 58 | VKAPI_ATTR void VKAPI_CALL vkdev_ext##num(VkDevice device) { \ 59 | const struct loader_dev_dispatch_table *disp; \ 60 | disp = loader_get_dev_dispatch(device); \ 61 | disp->ext_dispatch.dev_ext[num](device); \ 62 | } 63 | 64 | 65 | // Instantiations of the trampoline 66 | PhysDevExtTramp(0) 67 | PhysDevExtTramp(1) 68 | PhysDevExtTramp(2) 69 | PhysDevExtTramp(3) 70 | PhysDevExtTramp(4) 71 | PhysDevExtTramp(5) 72 | PhysDevExtTramp(6) 73 | PhysDevExtTramp(7) 74 | PhysDevExtTramp(8) 75 | PhysDevExtTramp(9) 76 | PhysDevExtTramp(10) 77 | PhysDevExtTramp(11) 78 | PhysDevExtTramp(12) 79 | PhysDevExtTramp(13) 80 | PhysDevExtTramp(14) 81 | PhysDevExtTramp(15) 82 | PhysDevExtTramp(16) 83 | PhysDevExtTramp(17) 84 | PhysDevExtTramp(18) 85 | PhysDevExtTramp(19) 86 | PhysDevExtTramp(20) 87 | PhysDevExtTramp(21) 88 | PhysDevExtTramp(22) 89 | PhysDevExtTramp(23) 90 | PhysDevExtTramp(24) 91 | PhysDevExtTramp(25) 92 | PhysDevExtTramp(26) 93 | PhysDevExtTramp(27) 94 | PhysDevExtTramp(28) 95 | PhysDevExtTramp(29) 96 | PhysDevExtTramp(30) 97 | PhysDevExtTramp(31) 98 | PhysDevExtTramp(32) 99 | PhysDevExtTramp(33) 100 | PhysDevExtTramp(34) 101 | PhysDevExtTramp(35) 102 | PhysDevExtTramp(36) 103 | PhysDevExtTramp(37) 104 | PhysDevExtTramp(38) 105 | PhysDevExtTramp(39) 106 | PhysDevExtTramp(40) 107 | PhysDevExtTramp(41) 108 | PhysDevExtTramp(42) 109 | PhysDevExtTramp(43) 110 | PhysDevExtTramp(44) 111 | PhysDevExtTramp(45) 112 | PhysDevExtTramp(46) 113 | PhysDevExtTramp(47) 114 | PhysDevExtTramp(48) 115 | PhysDevExtTramp(49) 116 | PhysDevExtTramp(50) 117 | PhysDevExtTramp(51) 118 | PhysDevExtTramp(52) 119 | PhysDevExtTramp(53) 120 | PhysDevExtTramp(54) 121 | PhysDevExtTramp(55) 122 | PhysDevExtTramp(56) 123 | PhysDevExtTramp(57) 124 | PhysDevExtTramp(58) 125 | PhysDevExtTramp(59) 126 | PhysDevExtTramp(60) 127 | PhysDevExtTramp(61) 128 | PhysDevExtTramp(62) 129 | PhysDevExtTramp(63) 130 | PhysDevExtTramp(64) 131 | PhysDevExtTramp(65) 132 | PhysDevExtTramp(66) 133 | PhysDevExtTramp(67) 134 | PhysDevExtTramp(68) 135 | PhysDevExtTramp(69) 136 | PhysDevExtTramp(70) 137 | PhysDevExtTramp(71) 138 | PhysDevExtTramp(72) 139 | PhysDevExtTramp(73) 140 | PhysDevExtTramp(74) 141 | PhysDevExtTramp(75) 142 | PhysDevExtTramp(76) 143 | PhysDevExtTramp(77) 144 | PhysDevExtTramp(78) 145 | PhysDevExtTramp(79) 146 | PhysDevExtTramp(80) 147 | PhysDevExtTramp(81) 148 | PhysDevExtTramp(82) 149 | PhysDevExtTramp(83) 150 | PhysDevExtTramp(84) 151 | PhysDevExtTramp(85) 152 | PhysDevExtTramp(86) 153 | PhysDevExtTramp(87) 154 | PhysDevExtTramp(88) 155 | PhysDevExtTramp(89) 156 | PhysDevExtTramp(90) 157 | PhysDevExtTramp(91) 158 | PhysDevExtTramp(92) 159 | PhysDevExtTramp(93) 160 | PhysDevExtTramp(94) 161 | PhysDevExtTramp(95) 162 | PhysDevExtTramp(96) 163 | PhysDevExtTramp(97) 164 | PhysDevExtTramp(98) 165 | PhysDevExtTramp(99) 166 | PhysDevExtTramp(100) 167 | PhysDevExtTramp(101) 168 | PhysDevExtTramp(102) 169 | PhysDevExtTramp(103) 170 | PhysDevExtTramp(104) 171 | PhysDevExtTramp(105) 172 | PhysDevExtTramp(106) 173 | PhysDevExtTramp(107) 174 | PhysDevExtTramp(108) 175 | PhysDevExtTramp(109) 176 | PhysDevExtTramp(110) 177 | PhysDevExtTramp(111) 178 | PhysDevExtTramp(112) 179 | PhysDevExtTramp(113) 180 | PhysDevExtTramp(114) 181 | PhysDevExtTramp(115) 182 | PhysDevExtTramp(116) 183 | PhysDevExtTramp(117) 184 | PhysDevExtTramp(118) 185 | PhysDevExtTramp(119) 186 | PhysDevExtTramp(120) 187 | PhysDevExtTramp(121) 188 | PhysDevExtTramp(122) 189 | PhysDevExtTramp(123) 190 | PhysDevExtTramp(124) 191 | PhysDevExtTramp(125) 192 | PhysDevExtTramp(126) 193 | PhysDevExtTramp(127) 194 | PhysDevExtTramp(128) 195 | PhysDevExtTramp(129) 196 | PhysDevExtTramp(130) 197 | PhysDevExtTramp(131) 198 | PhysDevExtTramp(132) 199 | PhysDevExtTramp(133) 200 | PhysDevExtTramp(134) 201 | PhysDevExtTramp(135) 202 | PhysDevExtTramp(136) 203 | PhysDevExtTramp(137) 204 | PhysDevExtTramp(138) 205 | PhysDevExtTramp(139) 206 | PhysDevExtTramp(140) 207 | PhysDevExtTramp(141) 208 | PhysDevExtTramp(142) 209 | PhysDevExtTramp(143) 210 | PhysDevExtTramp(144) 211 | PhysDevExtTramp(145) 212 | PhysDevExtTramp(146) 213 | PhysDevExtTramp(147) 214 | PhysDevExtTramp(148) 215 | PhysDevExtTramp(149) 216 | PhysDevExtTramp(150) 217 | PhysDevExtTramp(151) 218 | PhysDevExtTramp(152) 219 | PhysDevExtTramp(153) 220 | PhysDevExtTramp(154) 221 | PhysDevExtTramp(155) 222 | PhysDevExtTramp(156) 223 | PhysDevExtTramp(157) 224 | PhysDevExtTramp(158) 225 | PhysDevExtTramp(159) 226 | PhysDevExtTramp(160) 227 | PhysDevExtTramp(161) 228 | PhysDevExtTramp(162) 229 | PhysDevExtTramp(163) 230 | PhysDevExtTramp(164) 231 | PhysDevExtTramp(165) 232 | PhysDevExtTramp(166) 233 | PhysDevExtTramp(167) 234 | PhysDevExtTramp(168) 235 | PhysDevExtTramp(169) 236 | PhysDevExtTramp(170) 237 | PhysDevExtTramp(171) 238 | PhysDevExtTramp(172) 239 | PhysDevExtTramp(173) 240 | PhysDevExtTramp(174) 241 | PhysDevExtTramp(175) 242 | PhysDevExtTramp(176) 243 | PhysDevExtTramp(177) 244 | PhysDevExtTramp(178) 245 | PhysDevExtTramp(179) 246 | PhysDevExtTramp(180) 247 | PhysDevExtTramp(181) 248 | PhysDevExtTramp(182) 249 | PhysDevExtTramp(183) 250 | PhysDevExtTramp(184) 251 | PhysDevExtTramp(185) 252 | PhysDevExtTramp(186) 253 | PhysDevExtTramp(187) 254 | PhysDevExtTramp(188) 255 | PhysDevExtTramp(189) 256 | PhysDevExtTramp(190) 257 | PhysDevExtTramp(191) 258 | PhysDevExtTramp(192) 259 | PhysDevExtTramp(193) 260 | PhysDevExtTramp(194) 261 | PhysDevExtTramp(195) 262 | PhysDevExtTramp(196) 263 | PhysDevExtTramp(197) 264 | PhysDevExtTramp(198) 265 | PhysDevExtTramp(199) 266 | PhysDevExtTramp(200) 267 | PhysDevExtTramp(201) 268 | PhysDevExtTramp(202) 269 | PhysDevExtTramp(203) 270 | PhysDevExtTramp(204) 271 | PhysDevExtTramp(205) 272 | PhysDevExtTramp(206) 273 | PhysDevExtTramp(207) 274 | PhysDevExtTramp(208) 275 | PhysDevExtTramp(209) 276 | PhysDevExtTramp(210) 277 | PhysDevExtTramp(211) 278 | PhysDevExtTramp(212) 279 | PhysDevExtTramp(213) 280 | PhysDevExtTramp(214) 281 | PhysDevExtTramp(215) 282 | PhysDevExtTramp(216) 283 | PhysDevExtTramp(217) 284 | PhysDevExtTramp(218) 285 | PhysDevExtTramp(219) 286 | PhysDevExtTramp(220) 287 | PhysDevExtTramp(221) 288 | PhysDevExtTramp(222) 289 | PhysDevExtTramp(223) 290 | PhysDevExtTramp(224) 291 | PhysDevExtTramp(225) 292 | PhysDevExtTramp(226) 293 | PhysDevExtTramp(227) 294 | PhysDevExtTramp(228) 295 | PhysDevExtTramp(229) 296 | PhysDevExtTramp(230) 297 | PhysDevExtTramp(231) 298 | PhysDevExtTramp(232) 299 | PhysDevExtTramp(233) 300 | PhysDevExtTramp(234) 301 | PhysDevExtTramp(235) 302 | PhysDevExtTramp(236) 303 | PhysDevExtTramp(237) 304 | PhysDevExtTramp(238) 305 | PhysDevExtTramp(239) 306 | PhysDevExtTramp(240) 307 | PhysDevExtTramp(241) 308 | PhysDevExtTramp(242) 309 | PhysDevExtTramp(243) 310 | PhysDevExtTramp(244) 311 | PhysDevExtTramp(245) 312 | PhysDevExtTramp(246) 313 | PhysDevExtTramp(247) 314 | PhysDevExtTramp(248) 315 | PhysDevExtTramp(249) 316 | 317 | // Instantiations of the terminator 318 | PhysDevExtTermin(0) 319 | PhysDevExtTermin(1) 320 | PhysDevExtTermin(2) 321 | PhysDevExtTermin(3) 322 | PhysDevExtTermin(4) 323 | PhysDevExtTermin(5) 324 | PhysDevExtTermin(6) 325 | PhysDevExtTermin(7) 326 | PhysDevExtTermin(8) 327 | PhysDevExtTermin(9) 328 | PhysDevExtTermin(10) 329 | PhysDevExtTermin(11) 330 | PhysDevExtTermin(12) 331 | PhysDevExtTermin(13) 332 | PhysDevExtTermin(14) 333 | PhysDevExtTermin(15) 334 | PhysDevExtTermin(16) 335 | PhysDevExtTermin(17) 336 | PhysDevExtTermin(18) 337 | PhysDevExtTermin(19) 338 | PhysDevExtTermin(20) 339 | PhysDevExtTermin(21) 340 | PhysDevExtTermin(22) 341 | PhysDevExtTermin(23) 342 | PhysDevExtTermin(24) 343 | PhysDevExtTermin(25) 344 | PhysDevExtTermin(26) 345 | PhysDevExtTermin(27) 346 | PhysDevExtTermin(28) 347 | PhysDevExtTermin(29) 348 | PhysDevExtTermin(30) 349 | PhysDevExtTermin(31) 350 | PhysDevExtTermin(32) 351 | PhysDevExtTermin(33) 352 | PhysDevExtTermin(34) 353 | PhysDevExtTermin(35) 354 | PhysDevExtTermin(36) 355 | PhysDevExtTermin(37) 356 | PhysDevExtTermin(38) 357 | PhysDevExtTermin(39) 358 | PhysDevExtTermin(40) 359 | PhysDevExtTermin(41) 360 | PhysDevExtTermin(42) 361 | PhysDevExtTermin(43) 362 | PhysDevExtTermin(44) 363 | PhysDevExtTermin(45) 364 | PhysDevExtTermin(46) 365 | PhysDevExtTermin(47) 366 | PhysDevExtTermin(48) 367 | PhysDevExtTermin(49) 368 | PhysDevExtTermin(50) 369 | PhysDevExtTermin(51) 370 | PhysDevExtTermin(52) 371 | PhysDevExtTermin(53) 372 | PhysDevExtTermin(54) 373 | PhysDevExtTermin(55) 374 | PhysDevExtTermin(56) 375 | PhysDevExtTermin(57) 376 | PhysDevExtTermin(58) 377 | PhysDevExtTermin(59) 378 | PhysDevExtTermin(60) 379 | PhysDevExtTermin(61) 380 | PhysDevExtTermin(62) 381 | PhysDevExtTermin(63) 382 | PhysDevExtTermin(64) 383 | PhysDevExtTermin(65) 384 | PhysDevExtTermin(66) 385 | PhysDevExtTermin(67) 386 | PhysDevExtTermin(68) 387 | PhysDevExtTermin(69) 388 | PhysDevExtTermin(70) 389 | PhysDevExtTermin(71) 390 | PhysDevExtTermin(72) 391 | PhysDevExtTermin(73) 392 | PhysDevExtTermin(74) 393 | PhysDevExtTermin(75) 394 | PhysDevExtTermin(76) 395 | PhysDevExtTermin(77) 396 | PhysDevExtTermin(78) 397 | PhysDevExtTermin(79) 398 | PhysDevExtTermin(80) 399 | PhysDevExtTermin(81) 400 | PhysDevExtTermin(82) 401 | PhysDevExtTermin(83) 402 | PhysDevExtTermin(84) 403 | PhysDevExtTermin(85) 404 | PhysDevExtTermin(86) 405 | PhysDevExtTermin(87) 406 | PhysDevExtTermin(88) 407 | PhysDevExtTermin(89) 408 | PhysDevExtTermin(90) 409 | PhysDevExtTermin(91) 410 | PhysDevExtTermin(92) 411 | PhysDevExtTermin(93) 412 | PhysDevExtTermin(94) 413 | PhysDevExtTermin(95) 414 | PhysDevExtTermin(96) 415 | PhysDevExtTermin(97) 416 | PhysDevExtTermin(98) 417 | PhysDevExtTermin(99) 418 | PhysDevExtTermin(100) 419 | PhysDevExtTermin(101) 420 | PhysDevExtTermin(102) 421 | PhysDevExtTermin(103) 422 | PhysDevExtTermin(104) 423 | PhysDevExtTermin(105) 424 | PhysDevExtTermin(106) 425 | PhysDevExtTermin(107) 426 | PhysDevExtTermin(108) 427 | PhysDevExtTermin(109) 428 | PhysDevExtTermin(110) 429 | PhysDevExtTermin(111) 430 | PhysDevExtTermin(112) 431 | PhysDevExtTermin(113) 432 | PhysDevExtTermin(114) 433 | PhysDevExtTermin(115) 434 | PhysDevExtTermin(116) 435 | PhysDevExtTermin(117) 436 | PhysDevExtTermin(118) 437 | PhysDevExtTermin(119) 438 | PhysDevExtTermin(120) 439 | PhysDevExtTermin(121) 440 | PhysDevExtTermin(122) 441 | PhysDevExtTermin(123) 442 | PhysDevExtTermin(124) 443 | PhysDevExtTermin(125) 444 | PhysDevExtTermin(126) 445 | PhysDevExtTermin(127) 446 | PhysDevExtTermin(128) 447 | PhysDevExtTermin(129) 448 | PhysDevExtTermin(130) 449 | PhysDevExtTermin(131) 450 | PhysDevExtTermin(132) 451 | PhysDevExtTermin(133) 452 | PhysDevExtTermin(134) 453 | PhysDevExtTermin(135) 454 | PhysDevExtTermin(136) 455 | PhysDevExtTermin(137) 456 | PhysDevExtTermin(138) 457 | PhysDevExtTermin(139) 458 | PhysDevExtTermin(140) 459 | PhysDevExtTermin(141) 460 | PhysDevExtTermin(142) 461 | PhysDevExtTermin(143) 462 | PhysDevExtTermin(144) 463 | PhysDevExtTermin(145) 464 | PhysDevExtTermin(146) 465 | PhysDevExtTermin(147) 466 | PhysDevExtTermin(148) 467 | PhysDevExtTermin(149) 468 | PhysDevExtTermin(150) 469 | PhysDevExtTermin(151) 470 | PhysDevExtTermin(152) 471 | PhysDevExtTermin(153) 472 | PhysDevExtTermin(154) 473 | PhysDevExtTermin(155) 474 | PhysDevExtTermin(156) 475 | PhysDevExtTermin(157) 476 | PhysDevExtTermin(158) 477 | PhysDevExtTermin(159) 478 | PhysDevExtTermin(160) 479 | PhysDevExtTermin(161) 480 | PhysDevExtTermin(162) 481 | PhysDevExtTermin(163) 482 | PhysDevExtTermin(164) 483 | PhysDevExtTermin(165) 484 | PhysDevExtTermin(166) 485 | PhysDevExtTermin(167) 486 | PhysDevExtTermin(168) 487 | PhysDevExtTermin(169) 488 | PhysDevExtTermin(170) 489 | PhysDevExtTermin(171) 490 | PhysDevExtTermin(172) 491 | PhysDevExtTermin(173) 492 | PhysDevExtTermin(174) 493 | PhysDevExtTermin(175) 494 | PhysDevExtTermin(176) 495 | PhysDevExtTermin(177) 496 | PhysDevExtTermin(178) 497 | PhysDevExtTermin(179) 498 | PhysDevExtTermin(180) 499 | PhysDevExtTermin(181) 500 | PhysDevExtTermin(182) 501 | PhysDevExtTermin(183) 502 | PhysDevExtTermin(184) 503 | PhysDevExtTermin(185) 504 | PhysDevExtTermin(186) 505 | PhysDevExtTermin(187) 506 | PhysDevExtTermin(188) 507 | PhysDevExtTermin(189) 508 | PhysDevExtTermin(190) 509 | PhysDevExtTermin(191) 510 | PhysDevExtTermin(192) 511 | PhysDevExtTermin(193) 512 | PhysDevExtTermin(194) 513 | PhysDevExtTermin(195) 514 | PhysDevExtTermin(196) 515 | PhysDevExtTermin(197) 516 | PhysDevExtTermin(198) 517 | PhysDevExtTermin(199) 518 | PhysDevExtTermin(200) 519 | PhysDevExtTermin(201) 520 | PhysDevExtTermin(202) 521 | PhysDevExtTermin(203) 522 | PhysDevExtTermin(204) 523 | PhysDevExtTermin(205) 524 | PhysDevExtTermin(206) 525 | PhysDevExtTermin(207) 526 | PhysDevExtTermin(208) 527 | PhysDevExtTermin(209) 528 | PhysDevExtTermin(210) 529 | PhysDevExtTermin(211) 530 | PhysDevExtTermin(212) 531 | PhysDevExtTermin(213) 532 | PhysDevExtTermin(214) 533 | PhysDevExtTermin(215) 534 | PhysDevExtTermin(216) 535 | PhysDevExtTermin(217) 536 | PhysDevExtTermin(218) 537 | PhysDevExtTermin(219) 538 | PhysDevExtTermin(220) 539 | PhysDevExtTermin(221) 540 | PhysDevExtTermin(222) 541 | PhysDevExtTermin(223) 542 | PhysDevExtTermin(224) 543 | PhysDevExtTermin(225) 544 | PhysDevExtTermin(226) 545 | PhysDevExtTermin(227) 546 | PhysDevExtTermin(228) 547 | PhysDevExtTermin(229) 548 | PhysDevExtTermin(230) 549 | PhysDevExtTermin(231) 550 | PhysDevExtTermin(232) 551 | PhysDevExtTermin(233) 552 | PhysDevExtTermin(234) 553 | PhysDevExtTermin(235) 554 | PhysDevExtTermin(236) 555 | PhysDevExtTermin(237) 556 | PhysDevExtTermin(238) 557 | PhysDevExtTermin(239) 558 | PhysDevExtTermin(240) 559 | PhysDevExtTermin(241) 560 | PhysDevExtTermin(242) 561 | PhysDevExtTermin(243) 562 | PhysDevExtTermin(244) 563 | PhysDevExtTermin(245) 564 | PhysDevExtTermin(246) 565 | PhysDevExtTermin(247) 566 | PhysDevExtTermin(248) 567 | PhysDevExtTermin(249) 568 | 569 | // Instantiations of the device trampoline 570 | DevExtTramp(0) 571 | DevExtTramp(1) 572 | DevExtTramp(2) 573 | DevExtTramp(3) 574 | DevExtTramp(4) 575 | DevExtTramp(5) 576 | DevExtTramp(6) 577 | DevExtTramp(7) 578 | DevExtTramp(8) 579 | DevExtTramp(9) 580 | DevExtTramp(10) 581 | DevExtTramp(11) 582 | DevExtTramp(12) 583 | DevExtTramp(13) 584 | DevExtTramp(14) 585 | DevExtTramp(15) 586 | DevExtTramp(16) 587 | DevExtTramp(17) 588 | DevExtTramp(18) 589 | DevExtTramp(19) 590 | DevExtTramp(20) 591 | DevExtTramp(21) 592 | DevExtTramp(22) 593 | DevExtTramp(23) 594 | DevExtTramp(24) 595 | DevExtTramp(25) 596 | DevExtTramp(26) 597 | DevExtTramp(27) 598 | DevExtTramp(28) 599 | DevExtTramp(29) 600 | DevExtTramp(30) 601 | DevExtTramp(31) 602 | DevExtTramp(32) 603 | DevExtTramp(33) 604 | DevExtTramp(34) 605 | DevExtTramp(35) 606 | DevExtTramp(36) 607 | DevExtTramp(37) 608 | DevExtTramp(38) 609 | DevExtTramp(39) 610 | DevExtTramp(40) 611 | DevExtTramp(41) 612 | DevExtTramp(42) 613 | DevExtTramp(43) 614 | DevExtTramp(44) 615 | DevExtTramp(45) 616 | DevExtTramp(46) 617 | DevExtTramp(47) 618 | DevExtTramp(48) 619 | DevExtTramp(49) 620 | DevExtTramp(50) 621 | DevExtTramp(51) 622 | DevExtTramp(52) 623 | DevExtTramp(53) 624 | DevExtTramp(54) 625 | DevExtTramp(55) 626 | DevExtTramp(56) 627 | DevExtTramp(57) 628 | DevExtTramp(58) 629 | DevExtTramp(59) 630 | DevExtTramp(60) 631 | DevExtTramp(61) 632 | DevExtTramp(62) 633 | DevExtTramp(63) 634 | DevExtTramp(64) 635 | DevExtTramp(65) 636 | DevExtTramp(66) 637 | DevExtTramp(67) 638 | DevExtTramp(68) 639 | DevExtTramp(69) 640 | DevExtTramp(70) 641 | DevExtTramp(71) 642 | DevExtTramp(72) 643 | DevExtTramp(73) 644 | DevExtTramp(74) 645 | DevExtTramp(75) 646 | DevExtTramp(76) 647 | DevExtTramp(77) 648 | DevExtTramp(78) 649 | DevExtTramp(79) 650 | DevExtTramp(80) 651 | DevExtTramp(81) 652 | DevExtTramp(82) 653 | DevExtTramp(83) 654 | DevExtTramp(84) 655 | DevExtTramp(85) 656 | DevExtTramp(86) 657 | DevExtTramp(87) 658 | DevExtTramp(88) 659 | DevExtTramp(89) 660 | DevExtTramp(90) 661 | DevExtTramp(91) 662 | DevExtTramp(92) 663 | DevExtTramp(93) 664 | DevExtTramp(94) 665 | DevExtTramp(95) 666 | DevExtTramp(96) 667 | DevExtTramp(97) 668 | DevExtTramp(98) 669 | DevExtTramp(99) 670 | DevExtTramp(100) 671 | DevExtTramp(101) 672 | DevExtTramp(102) 673 | DevExtTramp(103) 674 | DevExtTramp(104) 675 | DevExtTramp(105) 676 | DevExtTramp(106) 677 | DevExtTramp(107) 678 | DevExtTramp(108) 679 | DevExtTramp(109) 680 | DevExtTramp(110) 681 | DevExtTramp(111) 682 | DevExtTramp(112) 683 | DevExtTramp(113) 684 | DevExtTramp(114) 685 | DevExtTramp(115) 686 | DevExtTramp(116) 687 | DevExtTramp(117) 688 | DevExtTramp(118) 689 | DevExtTramp(119) 690 | DevExtTramp(120) 691 | DevExtTramp(121) 692 | DevExtTramp(122) 693 | DevExtTramp(123) 694 | DevExtTramp(124) 695 | DevExtTramp(125) 696 | DevExtTramp(126) 697 | DevExtTramp(127) 698 | DevExtTramp(128) 699 | DevExtTramp(129) 700 | DevExtTramp(130) 701 | DevExtTramp(131) 702 | DevExtTramp(132) 703 | DevExtTramp(133) 704 | DevExtTramp(134) 705 | DevExtTramp(135) 706 | DevExtTramp(136) 707 | DevExtTramp(137) 708 | DevExtTramp(138) 709 | DevExtTramp(139) 710 | DevExtTramp(140) 711 | DevExtTramp(141) 712 | DevExtTramp(142) 713 | DevExtTramp(143) 714 | DevExtTramp(144) 715 | DevExtTramp(145) 716 | DevExtTramp(146) 717 | DevExtTramp(147) 718 | DevExtTramp(148) 719 | DevExtTramp(149) 720 | DevExtTramp(150) 721 | DevExtTramp(151) 722 | DevExtTramp(152) 723 | DevExtTramp(153) 724 | DevExtTramp(154) 725 | DevExtTramp(155) 726 | DevExtTramp(156) 727 | DevExtTramp(157) 728 | DevExtTramp(158) 729 | DevExtTramp(159) 730 | DevExtTramp(160) 731 | DevExtTramp(161) 732 | DevExtTramp(162) 733 | DevExtTramp(163) 734 | DevExtTramp(164) 735 | DevExtTramp(165) 736 | DevExtTramp(166) 737 | DevExtTramp(167) 738 | DevExtTramp(168) 739 | DevExtTramp(169) 740 | DevExtTramp(170) 741 | DevExtTramp(171) 742 | DevExtTramp(172) 743 | DevExtTramp(173) 744 | DevExtTramp(174) 745 | DevExtTramp(175) 746 | DevExtTramp(176) 747 | DevExtTramp(177) 748 | DevExtTramp(178) 749 | DevExtTramp(179) 750 | DevExtTramp(180) 751 | DevExtTramp(181) 752 | DevExtTramp(182) 753 | DevExtTramp(183) 754 | DevExtTramp(184) 755 | DevExtTramp(185) 756 | DevExtTramp(186) 757 | DevExtTramp(187) 758 | DevExtTramp(188) 759 | DevExtTramp(189) 760 | DevExtTramp(190) 761 | DevExtTramp(191) 762 | DevExtTramp(192) 763 | DevExtTramp(193) 764 | DevExtTramp(194) 765 | DevExtTramp(195) 766 | DevExtTramp(196) 767 | DevExtTramp(197) 768 | DevExtTramp(198) 769 | DevExtTramp(199) 770 | DevExtTramp(200) 771 | DevExtTramp(201) 772 | DevExtTramp(202) 773 | DevExtTramp(203) 774 | DevExtTramp(204) 775 | DevExtTramp(205) 776 | DevExtTramp(206) 777 | DevExtTramp(207) 778 | DevExtTramp(208) 779 | DevExtTramp(209) 780 | DevExtTramp(210) 781 | DevExtTramp(211) 782 | DevExtTramp(212) 783 | DevExtTramp(213) 784 | DevExtTramp(214) 785 | DevExtTramp(215) 786 | DevExtTramp(216) 787 | DevExtTramp(217) 788 | DevExtTramp(218) 789 | DevExtTramp(219) 790 | DevExtTramp(220) 791 | DevExtTramp(221) 792 | DevExtTramp(222) 793 | DevExtTramp(223) 794 | DevExtTramp(224) 795 | DevExtTramp(225) 796 | DevExtTramp(226) 797 | DevExtTramp(227) 798 | DevExtTramp(228) 799 | DevExtTramp(229) 800 | DevExtTramp(230) 801 | DevExtTramp(231) 802 | DevExtTramp(232) 803 | DevExtTramp(233) 804 | DevExtTramp(234) 805 | DevExtTramp(235) 806 | DevExtTramp(236) 807 | DevExtTramp(237) 808 | DevExtTramp(238) 809 | DevExtTramp(239) 810 | DevExtTramp(240) 811 | DevExtTramp(241) 812 | DevExtTramp(242) 813 | DevExtTramp(243) 814 | DevExtTramp(244) 815 | DevExtTramp(245) 816 | DevExtTramp(246) 817 | DevExtTramp(247) 818 | DevExtTramp(248) 819 | DevExtTramp(249) 820 | -------------------------------------------------------------------------------- /src/vulkan-loader/vk_loader_layer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2016 The Khronos Group Inc. 4 | * Copyright (c) 2016 Valve Corporation 5 | * Copyright (c) 2016 LunarG, Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * Author: Mark Lobodzinski 20 | * 21 | */ 22 | #pragma once 23 | 24 | // Linked list node for tree of debug callbacks 25 | typedef struct VkDebugReportContent { 26 | VkDebugReportCallbackEXT msgCallback; 27 | PFN_vkDebugReportCallbackEXT pfnMsgCallback; 28 | VkFlags msgFlags; 29 | } VkDebugReportContent; 30 | 31 | typedef struct VkDebugUtilsMessengerContent { 32 | VkDebugUtilsMessengerEXT messenger; 33 | VkDebugUtilsMessageSeverityFlagsEXT messageSeverity; 34 | VkDebugUtilsMessageTypeFlagsEXT messageType; 35 | PFN_vkDebugUtilsMessengerCallbackEXT pfnUserCallback; 36 | } VkDebugUtilsMessengerContent; 37 | 38 | typedef struct VkLayerDbgFunctionNode_ { 39 | bool is_messenger; 40 | union { 41 | VkDebugReportContent report; 42 | VkDebugUtilsMessengerContent messenger; 43 | }; 44 | void *pUserData; 45 | struct VkLayerDbgFunctionNode_ *pNext; 46 | } VkLayerDbgFunctionNode; 47 | -------------------------------------------------------------------------------- /src/vulkan-loader/vk_loader_platform.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2015-2018 The Khronos Group Inc. 4 | * Copyright (c) 2015-2018 Valve Corporation 5 | * Copyright (c) 2015-2018 LunarG, Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * Author: Ian Elliot 20 | * Author: Jon Ashburn 21 | * Author: Lenny Komow 22 | * 23 | */ 24 | #pragma once 25 | 26 | #if defined(_WIN32) 27 | // WinSock2.h must be included *BEFORE* windows.h 28 | #include 29 | #endif // _WIN32 30 | 31 | #if defined(__Fuchsia__) 32 | #include "dlopen_fuchsia.h" 33 | #endif // defined(__Fuchsia__) 34 | 35 | #include "vulkan/vk_platform.h" 36 | #include "vulkan/vk_sdk_platform.h" 37 | 38 | #if defined(__linux__) || defined(__APPLE__) || defined(__Fuchsia__) 39 | /* Linux-specific common code: */ 40 | 41 | // Headers: 42 | //#ifndef _GNU_SOURCE 43 | //#define _GNU_SOURCE 1 44 | //#endif 45 | #include 46 | 47 | // VK Library Filenames, Paths, etc.: 48 | #define PATH_SEPARATOR ':' 49 | #define DIRECTORY_SYMBOL '/' 50 | 51 | #define VULKAN_DIR "vulkan/" 52 | #define VULKAN_ICDCONF_DIR "icd.d" 53 | #define VULKAN_ICD_DIR "icd" 54 | #define VULKAN_SETTINGSCONF_DIR "settings.d" 55 | #define VULKAN_ELAYERCONF_DIR "explicit_layer.d" 56 | #define VULKAN_ILAYERCONF_DIR "implicit_layer.d" 57 | #define VULKAN_LAYER_DIR "layer" 58 | 59 | #define VK_DRIVERS_INFO_RELATIVE_DIR VULKAN_DIR VULKAN_ICDCONF_DIR 60 | #define VK_SETTINGS_INFO_RELATIVE_DIR VULKAN_DIR VULKAN_SETTINGSCONF_DIR 61 | #define VK_ELAYERS_INFO_RELATIVE_DIR VULKAN_DIR VULKAN_ELAYERCONF_DIR 62 | #define VK_ILAYERS_INFO_RELATIVE_DIR VULKAN_DIR VULKAN_ILAYERCONF_DIR 63 | 64 | #define VK_DRIVERS_INFO_REGISTRY_LOC "" 65 | #define VK_SETTINGS_INFO_REGISTRY_LOC "" 66 | #define VK_ELAYERS_INFO_REGISTRY_LOC "" 67 | #define VK_ILAYERS_INFO_REGISTRY_LOC "" 68 | 69 | #if !defined(DEFAULT_VK_LAYERS_PATH) 70 | #define DEFAULT_VK_LAYERS_PATH "" 71 | #endif 72 | #if !defined(LAYERS_SOURCE_PATH) 73 | #define LAYERS_SOURCE_PATH NULL 74 | #endif 75 | #define LAYERS_PATH_ENV "VK_LAYER_PATH" 76 | #define ENABLED_LAYERS_ENV "VK_INSTANCE_LAYERS" 77 | 78 | // C99: 79 | #define PRINTF_SIZE_T_SPECIFIER "%zu" 80 | 81 | // File IO 82 | static inline bool loader_platform_file_exists(const char *path) { 83 | if (access(path, F_OK)) 84 | return false; 85 | else 86 | return true; 87 | } 88 | 89 | static inline bool loader_platform_is_path_absolute(const char *path) { 90 | if (path[0] == '/') 91 | return true; 92 | else 93 | return false; 94 | } 95 | 96 | static inline char *loader_platform_dirname(char *path) { return dirname(path); } 97 | 98 | #if defined(__linux__) 99 | 100 | // find application path + name. Path cannot be longer than 1024, returns NULL if it is greater than that. 101 | static inline char *loader_platform_executable_path(char *buffer, size_t size) { 102 | ssize_t count = readlink("/proc/self/exe", buffer, size); 103 | if (count == -1) return NULL; 104 | if (count == 0) return NULL; 105 | buffer[count] = '\0'; 106 | return buffer; 107 | } 108 | #elif defined(__APPLE__) // defined(__linux__) 109 | #include 110 | static inline char *loader_platform_executable_path(char *buffer, size_t size) { 111 | pid_t pid = getpid(); 112 | int ret = proc_pidpath(pid, buffer, size); 113 | if (ret <= 0) return NULL; 114 | buffer[ret] = '\0'; 115 | return buffer; 116 | } 117 | #elif defined(__Fuchsia__) 118 | static inline char *loader_platform_executable_path(char *buffer, size_t size) { return NULL; } 119 | #endif // defined (__APPLE__) 120 | 121 | // Compatability with compilers that don't support __has_feature 122 | #ifndef __has_feature 123 | #define __has_feature(x) 0 124 | #endif 125 | 126 | #if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__) 127 | #define LOADER_ADDRESS_SANITIZER 128 | #endif 129 | 130 | // Dynamic Loading of libraries: 131 | typedef void *loader_platform_dl_handle; 132 | // When loading the library, we use RTLD_LAZY so that not all symbols have to be 133 | // resolved at this time (which improves performance). Note that if not all symbols 134 | // can be resolved, this could cause crashes later. Use the LD_BIND_NOW environment 135 | // variable to force all symbols to be resolved here. 136 | #define LOADER_DLOPEN_MODE (RTLD_LAZY | RTLD_LOCAL) 137 | 138 | #if defined(__Fuchsia__) 139 | static inline loader_platform_dl_handle loader_platform_open_driver(const char *libPath) { 140 | return dlopen_fuchsia(libPath, LOADER_DLOPEN_MODE, true); 141 | } 142 | static inline loader_platform_dl_handle loader_platform_open_library(const char *libPath) { 143 | return dlopen_fuchsia(libPath, LOADER_DLOPEN_MODE, false); 144 | } 145 | #else 146 | static inline loader_platform_dl_handle loader_platform_open_library(const char *libPath) { 147 | return dlopen(libPath, LOADER_DLOPEN_MODE); 148 | } 149 | #endif 150 | 151 | static inline const char *loader_platform_open_library_error(const char *libPath) { 152 | #ifdef __Fuchsia__ 153 | return dlerror_fuchsia(); 154 | #else 155 | return dlerror(); 156 | #endif 157 | } 158 | static inline void loader_platform_close_library(loader_platform_dl_handle library) { dlclose(library); } 159 | static inline void *loader_platform_get_proc_address(loader_platform_dl_handle library, const char *name) { 160 | assert(library); 161 | assert(name); 162 | return dlsym(library, name); 163 | } 164 | static inline const char *loader_platform_get_proc_address_error(const char *name) { return dlerror(); } 165 | 166 | // Threads: 167 | typedef pthread_t loader_platform_thread; 168 | #define THREAD_LOCAL_DECL __thread 169 | 170 | // The once init functionality is not used on Linux 171 | #define LOADER_PLATFORM_THREAD_ONCE_DECLARATION(var) 172 | #define LOADER_PLATFORM_THREAD_ONCE_DEFINITION(var) 173 | #define LOADER_PLATFORM_THREAD_ONCE(ctl, func) 174 | 175 | // Thread IDs: 176 | typedef pthread_t loader_platform_thread_id; 177 | static inline loader_platform_thread_id loader_platform_get_thread_id() { return pthread_self(); } 178 | 179 | // Thread mutex: 180 | typedef pthread_mutex_t loader_platform_thread_mutex; 181 | static inline void loader_platform_thread_create_mutex(loader_platform_thread_mutex *pMutex) { pthread_mutex_init(pMutex, NULL); } 182 | static inline void loader_platform_thread_lock_mutex(loader_platform_thread_mutex *pMutex) { pthread_mutex_lock(pMutex); } 183 | static inline void loader_platform_thread_unlock_mutex(loader_platform_thread_mutex *pMutex) { pthread_mutex_unlock(pMutex); } 184 | static inline void loader_platform_thread_delete_mutex(loader_platform_thread_mutex *pMutex) { pthread_mutex_destroy(pMutex); } 185 | typedef pthread_cond_t loader_platform_thread_cond; 186 | static inline void loader_platform_thread_init_cond(loader_platform_thread_cond *pCond) { pthread_cond_init(pCond, NULL); } 187 | static inline void loader_platform_thread_cond_wait(loader_platform_thread_cond *pCond, loader_platform_thread_mutex *pMutex) { 188 | pthread_cond_wait(pCond, pMutex); 189 | } 190 | static inline void loader_platform_thread_cond_broadcast(loader_platform_thread_cond *pCond) { pthread_cond_broadcast(pCond); } 191 | 192 | #define loader_stack_alloc(size) alloca(size) 193 | 194 | #elif defined(_WIN32) // defined(__linux__) 195 | /* Windows-specific common code: */ 196 | // WinBase.h defines CreateSemaphore and synchapi.h defines CreateEvent 197 | // undefine them to avoid conflicts with VkLayerDispatchTable struct members. 198 | #ifdef CreateSemaphore 199 | #undef CreateSemaphore 200 | #endif 201 | #ifdef CreateEvent 202 | #undef CreateEvent 203 | #endif 204 | #include 205 | #include 206 | #include 207 | #include 208 | #include 209 | #include 210 | #include 211 | #ifdef __cplusplus 212 | #include 213 | #include 214 | #endif // __cplusplus 215 | 216 | // VK Library Filenames, Paths, etc.: 217 | #define PATH_SEPARATOR ';' 218 | #define DIRECTORY_SYMBOL '\\' 219 | #define DEFAULT_VK_REGISTRY_HIVE HKEY_LOCAL_MACHINE 220 | #define DEFAULT_VK_REGISTRY_HIVE_STR "HKEY_LOCAL_MACHINE" 221 | #define SECONDARY_VK_REGISTRY_HIVE HKEY_CURRENT_USER 222 | #define SECONDARY_VK_REGISTRY_HIVE_STR "HKEY_CURRENT_USER" 223 | 224 | #define VK_DRIVERS_INFO_RELATIVE_DIR "" 225 | #define VK_SETTINGS_INFO_RELATIVE_DIR "" 226 | #define VK_ELAYERS_INFO_RELATIVE_DIR "" 227 | #define VK_ILAYERS_INFO_RELATIVE_DIR "" 228 | 229 | #ifdef _WIN64 230 | #define HKR_VK_DRIVER_NAME API_NAME "DriverName" 231 | #else 232 | #define HKR_VK_DRIVER_NAME API_NAME "DriverNameWow" 233 | #endif 234 | #define VK_DRIVERS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\" API_NAME "\\Drivers" 235 | #define VK_SETTINGS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\" API_NAME "\\Settings" 236 | #define VK_ELAYERS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\" API_NAME "\\ExplicitLayers" 237 | #define VK_ILAYERS_INFO_REGISTRY_LOC "SOFTWARE\\Khronos\\" API_NAME "\\ImplicitLayers" 238 | 239 | #if !defined(DEFAULT_VK_LAYERS_PATH) 240 | #define DEFAULT_VK_LAYERS_PATH "" 241 | #endif 242 | #if !defined(LAYERS_SOURCE_PATH) 243 | #define LAYERS_SOURCE_PATH NULL 244 | #endif 245 | #define LAYERS_PATH_ENV "VK_LAYER_PATH" 246 | #define ENABLED_LAYERS_ENV "VK_INSTANCE_LAYERS" 247 | 248 | #define PRINTF_SIZE_T_SPECIFIER "%Iu" 249 | 250 | #if defined(_WIN32) 251 | // Get the key for the plug n play driver registry 252 | // The string returned by this function should NOT be freed 253 | static inline const char *LoaderPnpDriverRegistry() { 254 | BOOL is_wow; 255 | IsWow64Process(GetCurrentProcess(), &is_wow); 256 | return is_wow ? "VulkanDriverNameWow" : "VulkanDriverName"; 257 | } 258 | static inline const wchar_t *LoaderPnpDriverRegistryWide() { 259 | BOOL is_wow; 260 | IsWow64Process(GetCurrentProcess(), &is_wow); 261 | return is_wow ? L"VulkanDriverNameWow" : L"VulkanDriverName"; 262 | } 263 | 264 | // Get the key for the plug 'n play explicit layer registry 265 | // The string returned by this function should NOT be freed 266 | static inline const char *LoaderPnpELayerRegistry() { 267 | BOOL is_wow; 268 | IsWow64Process(GetCurrentProcess(), &is_wow); 269 | return is_wow ? "VulkanExplicitLayersWow" : "VulkanExplicitLayers"; 270 | } 271 | static inline const wchar_t *LoaderPnpELayerRegistryWide() { 272 | BOOL is_wow; 273 | IsWow64Process(GetCurrentProcess(), &is_wow); 274 | return is_wow ? L"VulkanExplicitLayersWow" : L"VulkanExplicitLayers"; 275 | } 276 | 277 | // Get the key for the plug 'n play implicit layer registry 278 | // The string returned by this function should NOT be freed 279 | static inline const char *LoaderPnpILayerRegistry() { 280 | BOOL is_wow; 281 | IsWow64Process(GetCurrentProcess(), &is_wow); 282 | return is_wow ? "VulkanImplicitLayersWow" : "VulkanImplicitLayers"; 283 | } 284 | static inline const wchar_t *LoaderPnpILayerRegistryWide() { 285 | BOOL is_wow; 286 | IsWow64Process(GetCurrentProcess(), &is_wow); 287 | return is_wow ? L"VulkanImplicitLayersWow" : L"VulkanImplicitLayers"; 288 | } 289 | #endif 290 | 291 | // File IO 292 | static bool loader_platform_file_exists(const char *path) { 293 | if ((_access(path, 0)) == -1) 294 | return false; 295 | else 296 | return true; 297 | } 298 | 299 | static bool loader_platform_is_path_absolute(const char *path) { 300 | if (!path || !*path) { 301 | return false; 302 | } 303 | if (*path == DIRECTORY_SYMBOL || path[1] == ':') { 304 | return true; 305 | } 306 | return false; 307 | } 308 | 309 | // WIN32 runtime doesn't have dirname(). 310 | static inline char *loader_platform_dirname(char *path) { 311 | char *current, *next; 312 | 313 | // TODO/TBD: Do we need to deal with the Windows's ":" character? 314 | 315 | for (current = path; *current != '\0'; current = next) { 316 | next = strchr(current, DIRECTORY_SYMBOL); 317 | if (next == NULL) { 318 | if (current != path) *(current - 1) = '\0'; 319 | return path; 320 | } else { 321 | // Point one character past the DIRECTORY_SYMBOL: 322 | next++; 323 | } 324 | } 325 | return path; 326 | } 327 | 328 | static inline char *loader_platform_executable_path(char *buffer, size_t size) { 329 | DWORD ret = GetModuleFileName(NULL, buffer, (DWORD)size); 330 | if (ret == 0) return NULL; 331 | if (ret > size) return NULL; 332 | buffer[ret] = '\0'; 333 | return buffer; 334 | } 335 | 336 | // Dynamic Loading: 337 | typedef HMODULE loader_platform_dl_handle; 338 | static loader_platform_dl_handle loader_platform_open_library(const char *lib_path) { 339 | // Try loading the library the original way first. 340 | loader_platform_dl_handle lib_handle = LoadLibrary(lib_path); 341 | if (lib_handle == NULL && GetLastError() == ERROR_MOD_NOT_FOUND) { 342 | // If that failed, then try loading it with broader search folders. 343 | lib_handle = LoadLibraryEx(lib_path, NULL, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS | LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR); 344 | } 345 | return lib_handle; 346 | } 347 | static char *loader_platform_open_library_error(const char *libPath) { 348 | static char errorMsg[164]; 349 | (void)snprintf(errorMsg, 163, "Failed to open dynamic library \"%s\" with error %lu", libPath, GetLastError()); 350 | return errorMsg; 351 | } 352 | static void loader_platform_close_library(loader_platform_dl_handle library) { FreeLibrary(library); } 353 | static void *loader_platform_get_proc_address(loader_platform_dl_handle library, const char *name) { 354 | assert(library); 355 | assert(name); 356 | return (void *)GetProcAddress(library, name); 357 | } 358 | static char *loader_platform_get_proc_address_error(const char *name) { 359 | static char errorMsg[120]; 360 | (void)snprintf(errorMsg, 119, "Failed to find function \"%s\" in dynamic library", name); 361 | return errorMsg; 362 | } 363 | 364 | // Threads: 365 | typedef HANDLE loader_platform_thread; 366 | 367 | // __declspec(thread) is not supported by MinGW compiler (ignored with warning or 368 | // cause error depending on compiler switches) 369 | // 370 | // __thread should be used instead 371 | // 372 | // __MINGW32__ defined for both 32 and 64 bit MinGW compilers, so it is enough to 373 | // detect any (32 or 64) flavor of MinGW compiler. 374 | // 375 | // @note __GNUC__ could be used as a more generic way to detect _any_ 376 | // GCC[-compatible] compiler on Windows, but this fix was tested 377 | // only with MinGW, so keep it explicit at the moment. 378 | #if defined(__MINGW32__) 379 | #define THREAD_LOCAL_DECL __thread 380 | #else 381 | #define THREAD_LOCAL_DECL __declspec(thread) 382 | #endif 383 | 384 | // The once init functionality is not used when building a DLL on Windows. This is because there is no way to clean up the 385 | // resources allocated by anything allocated by once init. This isn't a problem for static libraries, but it is for dynamic 386 | // ones. When building a DLL, we use DllMain() instead to allow properly cleaning up resources. 387 | #define LOADER_PLATFORM_THREAD_ONCE_DECLARATION(var) 388 | #define LOADER_PLATFORM_THREAD_ONCE_DEFINITION(var) 389 | #define LOADER_PLATFORM_THREAD_ONCE(ctl, func) 390 | 391 | // Thread IDs: 392 | typedef DWORD loader_platform_thread_id; 393 | static loader_platform_thread_id loader_platform_get_thread_id() { return GetCurrentThreadId(); } 394 | 395 | // Thread mutex: 396 | typedef CRITICAL_SECTION loader_platform_thread_mutex; 397 | static void loader_platform_thread_create_mutex(loader_platform_thread_mutex *pMutex) { InitializeCriticalSection(pMutex); } 398 | static void loader_platform_thread_lock_mutex(loader_platform_thread_mutex *pMutex) { EnterCriticalSection(pMutex); } 399 | static void loader_platform_thread_unlock_mutex(loader_platform_thread_mutex *pMutex) { LeaveCriticalSection(pMutex); } 400 | static void loader_platform_thread_delete_mutex(loader_platform_thread_mutex *pMutex) { DeleteCriticalSection(pMutex); } 401 | typedef CONDITION_VARIABLE loader_platform_thread_cond; 402 | static void loader_platform_thread_init_cond(loader_platform_thread_cond *pCond) { InitializeConditionVariable(pCond); } 403 | static void loader_platform_thread_cond_wait(loader_platform_thread_cond *pCond, loader_platform_thread_mutex *pMutex) { 404 | SleepConditionVariableCS(pCond, pMutex, INFINITE); 405 | } 406 | static void loader_platform_thread_cond_broadcast(loader_platform_thread_cond *pCond) { WakeAllConditionVariable(pCond); } 407 | 408 | #define loader_stack_alloc(size) _alloca(size) 409 | #else // defined(_WIN32) 410 | 411 | #error The "loader_platform.h" file must be modified for this OS. 412 | 413 | // NOTE: In order to support another OS, an #elif needs to be added (above the 414 | // "#else // defined(_WIN32)") for that OS, and OS-specific versions of the 415 | // contents of this file must be created. 416 | 417 | // NOTE: Other OS-specific changes are also needed for this OS. Search for 418 | // files with "WIN32" in it, as a quick way to find files that must be changed. 419 | 420 | #endif // defined(_WIN32) 421 | 422 | // returns true if the given string appears to be a relative or absolute 423 | // path, as opposed to a bare filename. 424 | static inline bool loader_platform_is_path(const char *path) { return strchr(path, DIRECTORY_SYMBOL) != NULL; } 425 | -------------------------------------------------------------------------------- /src/vulkan-loader/wsi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 The Khronos Group Inc. 3 | * Copyright (c) 2015-2016 Valve Corporation 4 | * Copyright (c) 2015-2016 LunarG, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * Author: Ian Elliott 19 | * 20 | */ 21 | 22 | #ifndef WSI_H 23 | #define WSI_H 24 | 25 | #include "vk_loader_platform.h" 26 | #include "loader.h" 27 | 28 | typedef struct { 29 | union { 30 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR 31 | VkIcdSurfaceWayland wayland_surf; 32 | #endif // VK_USE_PLATFORM_WAYLAND_KHR 33 | #ifdef VK_USE_PLATFORM_WIN32_KHR 34 | VkIcdSurfaceWin32 win_surf; 35 | #endif // VK_USE_PLATFORM_WIN32_KHR 36 | #ifdef VK_USE_PLATFORM_XCB_KHR 37 | VkIcdSurfaceXcb xcb_surf; 38 | #endif // VK_USE_PLATFORM_XCB_KHR 39 | #ifdef VK_USE_PLATFORM_XLIB_KHR 40 | VkIcdSurfaceXlib xlib_surf; 41 | #endif // VK_USE_PLATFORM_XLIB_KHR 42 | #ifdef VK_USE_PLATFORM_DIRECTFB_EXT 43 | VkIcdSurfaceDirectFB directfb_surf; 44 | #endif // VK_USE_PLATFORM_DIRECTFB_EXT 45 | #ifdef VK_USE_PLATFORM_MACOS_MVK 46 | VkIcdSurfaceMacOS macos_surf; 47 | #endif // VK_USE_PLATFORM_MACOS_MVK 48 | #ifdef VK_USE_PLATFORM_FUCHSIA 49 | VkIcdSurfaceImagePipe imagepipe_surf; 50 | #endif // VK_USE_PLATFORM_FUCHSIA 51 | #ifdef VK_USE_PLATFORM_METAL_EXT 52 | VkIcdSurfaceMetal metal_surf; 53 | #endif // VK_USE_PLATFORM_METAL_EXT 54 | VkIcdSurfaceDisplay display_surf; 55 | VkIcdSurfaceHeadless headless_surf; 56 | }; 57 | uint32_t base_size; // Size of VkIcdSurfaceBase 58 | uint32_t platform_size; // Size of corresponding VkIcdSurfaceXXX 59 | uint32_t non_platform_offset; // Start offset to base_size 60 | uint32_t entire_size; // Size of entire VkIcdSurface 61 | VkSurfaceKHR *real_icd_surfaces; 62 | } VkIcdSurface; 63 | 64 | bool wsi_swapchain_instance_gpa(struct loader_instance *ptr_instance, const char *name, void **addr); 65 | 66 | void wsi_create_instance(struct loader_instance *ptr_instance, const VkInstanceCreateInfo *pCreateInfo); 67 | bool wsi_unsupported_instance_extension(const VkExtensionProperties *ext_prop); 68 | 69 | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateHeadlessSurfaceEXT(VkInstance instance, 70 | const VkHeadlessSurfaceCreateInfoEXT *pCreateInfo, 71 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); 72 | 73 | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, 74 | const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain); 75 | 76 | VKAPI_ATTR void VKAPI_CALL terminator_DestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, 77 | const VkAllocationCallbacks *pAllocator); 78 | 79 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, 80 | uint32_t queueFamilyIndex, VkSurfaceKHR surface, 81 | VkBool32 *pSupported); 82 | 83 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, 84 | VkSurfaceKHR surface, 85 | VkSurfaceCapabilitiesKHR *pSurfaceCapabilities); 86 | 87 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, 88 | uint32_t *pSurfaceFormatCount, 89 | VkSurfaceFormatKHR *pSurfaceFormats); 90 | 91 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, 92 | VkSurfaceKHR surface, uint32_t *pPresentModeCount, 93 | VkPresentModeKHR *pPresentModes); 94 | 95 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDeviceGroupSurfacePresentModesKHR( 96 | VkDevice device, 97 | VkSurfaceKHR surface, 98 | VkDeviceGroupPresentModeFlagsKHR* pModes); 99 | 100 | #ifdef VK_USE_PLATFORM_WIN32_KHR 101 | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo, 102 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); 103 | VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice physicalDevice, 104 | uint32_t queueFamilyIndex); 105 | #endif 106 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR 107 | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWaylandSurfaceKHR(VkInstance instance, 108 | const VkWaylandSurfaceCreateInfoKHR *pCreateInfo, 109 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); 110 | VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceWaylandPresentationSupportKHR(VkPhysicalDevice physicalDevice, 111 | uint32_t queueFamilyIndex, 112 | struct wl_display *display); 113 | #endif 114 | #ifdef VK_USE_PLATFORM_XCB_KHR 115 | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateXcbSurfaceKHR(VkInstance instance, const VkXcbSurfaceCreateInfoKHR *pCreateInfo, 116 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); 117 | 118 | VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceXcbPresentationSupportKHR(VkPhysicalDevice physicalDevice, 119 | uint32_t queueFamilyIndex, 120 | xcb_connection_t *connection, 121 | xcb_visualid_t visual_id); 122 | #endif 123 | #ifdef VK_USE_PLATFORM_XLIB_KHR 124 | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateXlibSurfaceKHR(VkInstance instance, const VkXlibSurfaceCreateInfoKHR *pCreateInfo, 125 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); 126 | VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice physicalDevice, 127 | uint32_t queueFamilyIndex, Display *dpy, 128 | VisualID visualID); 129 | #endif 130 | #ifdef VK_USE_PLATFORM_DIRECTFB_EXT 131 | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDirectFBSurfaceEXT(VkInstance instance, 132 | const VkDirectFBSurfaceCreateInfoEXT *pCreateInfo, 133 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); 134 | VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceDirectFBPresentationSupportEXT(VkPhysicalDevice physicalDevice, 135 | uint32_t queueFamilyIndex, 136 | IDirectFB *dfb); 137 | #endif 138 | #ifdef VK_USE_PLATFORM_MACOS_MVK 139 | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateMacOSSurfaceMVK(VkInstance instance, const VkMacOSSurfaceCreateInfoMVK *pCreateInfo, 140 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); 141 | #endif 142 | #ifdef VK_USE_PLATFORM_IOS_MVK 143 | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateIOSSurfaceMVK(VkInstance instance, const VkIOSSurfaceCreateInfoMVK *pCreateInfo, 144 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); 145 | #endif 146 | #if defined(VK_USE_PLATFORM_METAL_EXT) 147 | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateMetalSurfaceEXT(VkInstance instance, const VkMetalSurfaceCreateInfoEXT *pCreateInfo, 148 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); 149 | #endif 150 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physicalDevice, 151 | uint32_t *pPropertyCount, 152 | VkDisplayPropertiesKHR *pProperties); 153 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceDisplayPlanePropertiesKHR(VkPhysicalDevice physicalDevice, 154 | uint32_t *pPropertyCount, 155 | VkDisplayPlanePropertiesKHR *pProperties); 156 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physicalDevice, uint32_t planeIndex, 157 | uint32_t *pDisplayCount, VkDisplayKHR *pDisplays); 158 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayModePropertiesKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, 159 | uint32_t *pPropertyCount, 160 | VkDisplayModePropertiesKHR *pProperties); 161 | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDisplayModeKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, 162 | const VkDisplayModeCreateInfoKHR *pCreateInfo, 163 | const VkAllocationCallbacks *pAllocator, VkDisplayModeKHR *pMode); 164 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayPlaneCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkDisplayModeKHR mode, 165 | uint32_t planeIndex, 166 | VkDisplayPlaneCapabilitiesKHR *pCapabilities); 167 | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDisplayPlaneSurfaceKHR(VkInstance instance, 168 | const VkDisplaySurfaceCreateInfoKHR *pCreateInfo, 169 | const VkAllocationCallbacks *pAllocator, 170 | VkSurfaceKHR *pSurface); 171 | 172 | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateSharedSwapchainsKHR(VkDevice device, uint32_t swapchainCount, 173 | const VkSwapchainCreateInfoKHR *pCreateInfos, 174 | const VkAllocationCallbacks *pAllocator, 175 | VkSwapchainKHR *pSwapchains); 176 | 177 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDevicePresentRectanglesKHR(VkPhysicalDevice physicalDevice, 178 | VkSurfaceKHR surface, 179 | uint32_t* pRectCount, 180 | VkRect2D* pRects); 181 | 182 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceDisplayProperties2KHR(VkPhysicalDevice physicalDevice, 183 | uint32_t *pPropertyCount, 184 | VkDisplayProperties2KHR *pProperties); 185 | 186 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceDisplayPlaneProperties2KHR(VkPhysicalDevice physicalDevice, 187 | uint32_t *pPropertyCount, 188 | VkDisplayPlaneProperties2KHR *pProperties); 189 | 190 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayModeProperties2KHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, 191 | uint32_t *pPropertyCount, 192 | VkDisplayModeProperties2KHR *pProperties); 193 | 194 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayPlaneCapabilities2KHR(VkPhysicalDevice physicalDevice, 195 | const VkDisplayPlaneInfo2KHR *pDisplayPlaneInfo, 196 | VkDisplayPlaneCapabilities2KHR *pCapabilities); 197 | #ifdef VK_USE_PLATFORM_FUCHSIA 198 | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateImagePipeSurfaceFUCHSIA(VkInstance instance, const VkImagePipeSurfaceCreateInfoFUCHSIA *pCreateInfo, 199 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); 200 | #endif 201 | 202 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceCapabilities2KHR( 203 | VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, 204 | VkSurfaceCapabilities2KHR *pSurfaceCapabilities); 205 | 206 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceFormats2KHR(VkPhysicalDevice physicalDevice, 207 | const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, 208 | uint32_t *pSurfaceFormatCount, 209 | VkSurfaceFormat2KHR *pSurfaceFormats); 210 | 211 | #endif // WSI_H 212 | -------------------------------------------------------------------------------- /src/xproto.zig: -------------------------------------------------------------------------------- 1 | pub const X_PROTOCOL = 11; 2 | pub const X_PROTOCOL_REVISION = 0; 3 | pub const xcb_setup_request_t = extern struct { 4 | byte_order: u8, 5 | pad0: u8, 6 | protocol_major_version: u16, 7 | protocol_minor_version: u16, 8 | authorization_protocol_name_len: u16, 9 | authorization_protocol_data_len: u16, 10 | pad1: [2]u8, 11 | }; 12 | --------------------------------------------------------------------------------