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  * Copyright (c) 2016 Google Inc.
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining a copy
8  * of this software and/or associated documentation files (the "Materials"), to
9  * deal in the Materials without restriction, including without limitation the
10  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
11  * sell copies of the Materials, and to permit persons to whom the Materials are
12  * furnished to do so, subject to the following conditions:
13  *
14  * The above copyright notice(s) and this permission notice shall be included in
15  * all copies or substantial portions of the Materials.
16  *
17  * THE MATERIALS ARE 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.
20  *
21  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
22  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
24  * USE OR OTHER DEALINGS IN THE MATERIALS.
25  *
26  */
27 #pragma once
28 
29 #include <vulkan/vulkan.h>
30 
31 // ------------------------------------------------------------------------------------------------
32 // CreateInstance and CreateDevice support structures
33 
34 typedef enum VkLayerFunction_ {
35     VK_LAYER_FUNCTION_LINK = 0,
36     VK_LAYER_FUNCTION_DATA_CALLBACK = 1
37 } VkLayerFunction;
38 
39 typedef struct VkLayerInstanceLink_ {
40     struct VkLayerInstanceLink_* pNext;
41     PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
42 } VkLayerInstanceLink;
43 
44 typedef VkResult(VKAPI_PTR* PFN_vkSetInstanceLoaderData)(VkInstance instance,
45                                                          void* object);
46 typedef VkResult(VKAPI_PTR* PFN_vkSetDeviceLoaderData)(VkDevice device,
47                                                        void* object);
48 
49 typedef struct {
50     VkStructureType sType;  // VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO
51     const void* pNext;
52     VkLayerFunction function;
53     union {
54         VkLayerInstanceLink* pLayerInfo;
55         PFN_vkSetInstanceLoaderData pfnSetInstanceLoaderData;
56     } u;
57 } VkLayerInstanceCreateInfo;
58 
59 typedef struct VkLayerDeviceLink_ {
60     struct VkLayerDeviceLink_* pNext;
61     PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
62     PFN_vkGetDeviceProcAddr pfnNextGetDeviceProcAddr;
63 } VkLayerDeviceLink;
64 
65 typedef struct {
66     VkStructureType sType;  // VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO
67     const void* pNext;
68     VkLayerFunction function;
69     union {
70         VkLayerDeviceLink* pLayerInfo;
71         PFN_vkSetDeviceLoaderData pfnSetDeviceLoaderData;
72     } u;
73 } VkLayerDeviceCreateInfo;
74