vk_layer_interface.h revision e2948d83f352b9a093252a06757f76a88f5355d3
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
35// ------------------------------------------------------------------------------------------------
36// CreateInstance and CreateDevice support structures
37
38typedef enum VkLayerFunction_ {
39    VK_LAYER_FUNCTION_LINK = 0,
40    VK_LAYER_FUNCTION_DEVICE = 1,
41    VK_LAYER_FUNCTION_INSTANCE = 2
42} VkLayerFunction;
43
44/*
45 * When creating the device chain the loader needs to pass
46 * down information about it's device structure needed at
47 * the end of the chain. Passing the data via the
48 * VkLayerInstanceInfo avoids issues with finding the
49 * exact instance being used.
50 */
51typedef struct VkLayerInstanceInfo_ {
52    void* instance_info;
53    PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
54} VkLayerInstanceInfo;
55
56typedef struct VkLayerInstanceLink_ {
57    struct VkLayerInstanceLink_* pNext;
58    PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
59} VkLayerInstanceLink;
60
61/*
62 * When creating the device chain the loader needs to pass
63 * down information about it's device structure needed at
64 * the end of the chain. Passing the data via the
65 * VkLayerDeviceInfo avoids issues with finding the
66 * exact instance being used.
67 */
68typedef struct VkLayerDeviceInfo_ {
69    void* device_info;
70    PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
71} VkLayerDeviceInfo;
72
73typedef struct {
74    VkStructureType sType;  // VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO
75    const void* pNext;
76    VkLayerFunction function;
77    union {
78        VkLayerInstanceLink* pLayerInfo;
79        VkLayerInstanceInfo instanceInfo;
80    } u;
81} VkLayerInstanceCreateInfo;
82
83typedef struct VkLayerDeviceLink_ {
84    struct VkLayerDeviceLink_* pNext;
85    PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
86    PFN_vkGetDeviceProcAddr pfnNextGetDeviceProcAddr;
87} VkLayerDeviceLink;
88
89typedef struct {
90    VkStructureType sType;  // VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO
91    const void* pNext;
92    VkLayerFunction function;
93    union {
94        VkLayerDeviceLink* pLayerInfo;
95        VkLayerDeviceInfo deviceInfo;
96    } u;
97} VkLayerDeviceCreateInfo;
98