Courtney Goeltzenleuchter | 89e99e6 | 2015-04-08 18:04:29 -0600 | [diff] [blame] | 1 | #ifndef VKICD_H |
| 2 | #define VKICD_H |
| 3 | |
| 4 | #include <stdint.h> |
| 5 | #include <stdbool.h> |
Courtney Goeltzenleuchter | 2040b43 | 2015-04-09 11:52:55 -0600 | [diff] [blame] | 6 | #include "vk_platform.h" |
Mark Lobodzinski | eccbb37 | 2015-09-01 09:00:16 -0600 | [diff] [blame] | 7 | #include "vk_sdk_platform.h" |
Courtney Goeltzenleuchter | 89e99e6 | 2015-04-08 18:04:29 -0600 | [diff] [blame] | 8 | |
| 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 | |
| 17 | typedef union _VK_LOADER_DATA { |
Courtney Goeltzenleuchter | b24b258 | 2015-07-22 08:35:04 -0600 | [diff] [blame] | 18 | uintptr_t loaderMagic; |
Courtney Goeltzenleuchter | 89e99e6 | 2015-04-08 18:04:29 -0600 | [diff] [blame] | 19 | void *loaderData; |
| 20 | } VK_LOADER_DATA; |
| 21 | |
Tony Barbour | de4124d | 2015-07-03 10:33:54 -0600 | [diff] [blame] | 22 | static inline void set_loader_magic_value(void* pNewObject) { |
Courtney Goeltzenleuchter | 89e99e6 | 2015-04-08 18:04:29 -0600 | [diff] [blame] | 23 | VK_LOADER_DATA *loader_info = (VK_LOADER_DATA *) pNewObject; |
| 24 | loader_info->loaderMagic = ICD_LOADER_MAGIC; |
| 25 | } |
| 26 | |
Tony Barbour | de4124d | 2015-07-03 10:33:54 -0600 | [diff] [blame] | 27 | static inline bool valid_loader_magic_value(void* pNewObject) { |
Courtney Goeltzenleuchter | 89e99e6 | 2015-04-08 18:04:29 -0600 | [diff] [blame] | 28 | const VK_LOADER_DATA *loader_info = (VK_LOADER_DATA *) pNewObject; |
Courtney Goeltzenleuchter | 5f70fc4 | 2015-07-24 10:18:40 -0600 | [diff] [blame] | 29 | return (loader_info->loaderMagic & 0xffffffff) == ICD_LOADER_MAGIC; |
Courtney Goeltzenleuchter | 89e99e6 | 2015-04-08 18:04:29 -0600 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | #endif // VKICD_H |
| 33 | |