blob: 634d653f630f6f34e1b1af71dd68b7368e223e80 [file] [log] [blame]
Courtney Goeltzenleuchter89e99e62015-04-08 18:04:29 -06001#ifndef VKICD_H
2#define VKICD_H
3
4#include <stdint.h>
5#include <stdbool.h>
Courtney Goeltzenleuchter2040b432015-04-09 11:52:55 -06006#include "vk_platform.h"
Mark Lobodzinskieccbb372015-09-01 09:00:16 -06007#include "vk_sdk_platform.h"
Courtney Goeltzenleuchter89e99e62015-04-08 18:04:29 -06008
9/*
10 * The ICD must reserve space for a pointer for the loader's dispatch
11 * table, at the start of <each object>.
12 * The ICD must initialize this variable using the SET_LOADER_MAGIC_VALUE macro.
13 */
14
15#define ICD_LOADER_MAGIC 0x01CDC0DE
16
17typedef union _VK_LOADER_DATA {
Courtney Goeltzenleuchterb24b2582015-07-22 08:35:04 -060018 uintptr_t loaderMagic;
Courtney Goeltzenleuchter89e99e62015-04-08 18:04:29 -060019 void *loaderData;
20} VK_LOADER_DATA;
21
Tony Barbourde4124d2015-07-03 10:33:54 -060022static inline void set_loader_magic_value(void* pNewObject) {
Courtney Goeltzenleuchter89e99e62015-04-08 18:04:29 -060023 VK_LOADER_DATA *loader_info = (VK_LOADER_DATA *) pNewObject;
24 loader_info->loaderMagic = ICD_LOADER_MAGIC;
25}
26
Tony Barbourde4124d2015-07-03 10:33:54 -060027static inline bool valid_loader_magic_value(void* pNewObject) {
Courtney Goeltzenleuchter89e99e62015-04-08 18:04:29 -060028 const VK_LOADER_DATA *loader_info = (VK_LOADER_DATA *) pNewObject;
Courtney Goeltzenleuchter5f70fc42015-07-24 10:18:40 -060029 return (loader_info->loaderMagic & 0xffffffff) == ICD_LOADER_MAGIC;
Courtney Goeltzenleuchter89e99e62015-04-08 18:04:29 -060030}
31
32#endif // VKICD_H
33