vk_layer_interface.h revision 1dd712aefdc771297823b24f26d768cd8bd14d49
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 Confidential Information as defined by the Khronos
18 * Membership Agreement until designated non-confidential by Khronos, at which
19 * point this condition clause shall be removed.
20 *
21 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 *
25 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
26 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
27 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
28 * USE OR OTHER DEALINGS IN THE MATERIALS.
29 *
30 */
31#pragma once
32
33#include <vulkan/vulkan.h>
34#include <vulkan/vk_ext_debug_report.h>
35
36// ------------------------------------------------------------------------------------------------
37// CreateInstance and CreateDevice support structures
38
39typedef enum VkLayerFunction_ {
40    VK_LAYER_FUNCTION_LINK = 0,
41    VK_LAYER_FUNCTION_DEVICE = 1,
42    VK_LAYER_FUNCTION_INSTANCE = 2
43} VkLayerFunction;
44
45/*
46 * When creating the device chain the loader needs to pass
47 * down information about it's device structure needed at
48 * the end of the chain. Passing the data via the
49 * VkLayerInstanceInfo avoids issues with finding the
50 * exact instance being used.
51 */
52typedef struct VkLayerInstanceInfo_ {
53    void* instance_info;
54    PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
55} VkLayerInstanceInfo;
56
57typedef struct VkLayerInstanceLink_ {
58    struct VkLayerInstanceLink_* pNext;
59    PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
60} VkLayerInstanceLink;
61
62/*
63 * When creating the device chain the loader needs to pass
64 * down information about it's device structure needed at
65 * the end of the chain. Passing the data via the
66 * VkLayerDeviceInfo avoids issues with finding the
67 * exact instance being used.
68 */
69typedef struct VkLayerDeviceInfo_ {
70    void* device_info;
71    PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
72} VkLayerDeviceInfo;
73
74typedef struct {
75    VkStructureType sType;  // VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO
76    const void* pNext;
77    VkLayerFunction function;
78    union {
79        VkLayerInstanceLink* pLayerInfo;
80        VkLayerInstanceInfo instanceInfo;
81    } u;
82} VkLayerInstanceCreateInfo;
83
84typedef struct VkLayerDeviceLink_ {
85    struct VkLayerDeviceLink_* pNext;
86    PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
87    PFN_vkGetDeviceProcAddr pfnNextGetDeviceProcAddr;
88} VkLayerDeviceLink;
89
90typedef struct {
91    VkStructureType sType;  // VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO
92    const void* pNext;
93    VkLayerFunction function;
94    union {
95        VkLayerDeviceLink* pLayerInfo;
96        VkLayerDeviceInfo deviceInfo;
97    } u;
98} VkLayerDeviceCreateInfo;
99