aboutsummaryrefslogtreecommitdiff
path: root/include/vulkan/vk_icd.h
blob: 634d653f630f6f34e1b1af71dd68b7368e223e80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef VKICD_H
#define VKICD_H

#include <stdint.h>
#include <stdbool.h>
#include "vk_platform.h"
#include "vk_sdk_platform.h"

/*
 * The ICD must reserve space for a pointer for the loader's dispatch
 * table, at the start of <each object>.
 * The ICD must initialize this variable using the SET_LOADER_MAGIC_VALUE macro.
 */

#define ICD_LOADER_MAGIC   0x01CDC0DE

typedef union _VK_LOADER_DATA {
  uintptr_t loaderMagic;
  void *loaderData;
} VK_LOADER_DATA;

static inline void set_loader_magic_value(void* pNewObject) {
    VK_LOADER_DATA *loader_info = (VK_LOADER_DATA *) pNewObject;
    loader_info->loaderMagic = ICD_LOADER_MAGIC;
}

static inline bool valid_loader_magic_value(void* pNewObject) {
    const VK_LOADER_DATA *loader_info = (VK_LOADER_DATA *) pNewObject;
    return (loader_info->loaderMagic & 0xffffffff) == ICD_LOADER_MAGIC;
}

#endif // VKICD_H