SDL 2.0
vk_layer.h
Go to the documentation of this file.
1//
2// File: vk_layer.h
3//
4/*
5 * Copyright (c) 2015-2017 The Khronos Group Inc.
6 * Copyright (c) 2015-2017 Valve Corporation
7 * Copyright (c) 2015-2017 LunarG, Inc.
8 *
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 *
21 */
22
23/* Need to define dispatch table
24 * Core struct can then have ptr to dispatch table at the top
25 * Along with object ptrs for current and next OBJ
26 */
27#pragma once
28
29#include "vulkan.h"
30#if defined(__GNUC__) && __GNUC__ >= 4
31#define VK_LAYER_EXPORT __attribute__((visibility("default")))
32#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
33#define VK_LAYER_EXPORT __attribute__((visibility("default")))
34#else
35#define VK_LAYER_EXPORT
36#endif
37
38#define MAX_NUM_UNKNOWN_EXTS 250
39
40 // Loader-Layer version negotiation API. Versions add the following features:
41 // Versions 0/1 - Initial. Doesn't support vk_layerGetPhysicalDeviceProcAddr
42 // or vk_icdNegotiateLoaderLayerInterfaceVersion.
43 // Version 2 - Add support for vk_layerGetPhysicalDeviceProcAddr and
44 // vk_icdNegotiateLoaderLayerInterfaceVersion.
45#define CURRENT_LOADER_LAYER_INTERFACE_VERSION 2
46#define MIN_SUPPORTED_LOADER_LAYER_INTERFACE_VERSION 1
47
48#define VK_CURRENT_CHAIN_VERSION 1
49
50// Typedef for use in the interfaces below
51typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_GetPhysicalDeviceProcAddr)(VkInstance instance, const char* pName);
52
53// Version negotiation values
58
59// Version negotiation structures
62 void *pNext;
68
69// Version negotiation functions
71
72// Function prototype for unknown physical device extension command
73typedef VkResult(VKAPI_PTR *PFN_PhysDevExt)(VkPhysicalDevice phys_device);
74
75// ------------------------------------------------------------------------------------------------
76// CreateInstance and CreateDevice support structures
77
78/* Sub type of structure for instance and device loader ext of CreateInfo.
79 * When sType == VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO
80 * or sType == VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO
81 * then VkLayerFunction indicates struct type pointed to by pNext
82 */
83typedef enum VkLayerFunction_ {
87
88typedef struct VkLayerInstanceLink_ {
89 struct VkLayerInstanceLink_ *pNext;
93
94/*
95 * When creating the device chain the loader needs to pass
96 * down information about it's device structure needed at
97 * the end of the chain. Passing the data via the
98 * VkLayerDeviceInfo avoids issues with finding the
99 * exact instance being used.
100 */
101typedef struct VkLayerDeviceInfo_ {
105
106typedef VkResult (VKAPI_PTR *PFN_vkSetInstanceLoaderData)(VkInstance instance,
107 void *object);
109 void *object);
110
111typedef struct {
112 VkStructureType sType; // VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO
113 const void *pNext;
115 union {
118 } u;
120
121typedef struct VkLayerDeviceLink_ {
122 struct VkLayerDeviceLink_ *pNext;
126
127typedef struct {
128 VkStructureType sType; // VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO
129 const void *pNext;
131 union {
134 } u;
136
137#ifdef __cplusplus
138extern "C" {
139#endif
140
142
143typedef enum VkChainType {
149
150typedef struct VkChainHeader {
155
158 VkResult(VKAPI_PTR *pfnNextLayer)(const struct VkEnumerateInstanceExtensionPropertiesChain *, const char *, uint32_t *,
161
162#if defined(__cplusplus)
163 inline VkResult CallDown(const char *pLayerName, uint32_t *pPropertyCount, VkExtensionProperties *pProperties) const {
164 return pfnNextLayer(pNextLink, pLayerName, pPropertyCount, pProperties);
165 }
166#endif
168
173
174#if defined(__cplusplus)
175 inline VkResult CallDown(uint32_t *pPropertyCount, VkLayerProperties *pProperties) const {
176 return pfnNextLayer(pNextLink, pPropertyCount, pProperties);
177 }
178#endif
180
185
186#if defined(__cplusplus)
187 inline VkResult CallDown(uint32_t *pApiVersion) const {
188 return pfnNextLayer(pNextLink, pApiVersion);
189 }
190#endif
192
193#ifdef __cplusplus
194}
195#endif
unsigned int uint32_t
GLuint object
static SDL_AudioDeviceID device
Definition: loopwave.c:37
uint32_t size
Definition: vk_layer.h:153
VkChainType type
Definition: vk_layer.h:151
uint32_t version
Definition: vk_layer.h:152
const char uint32_t VkExtensionProperties *const struct VkEnumerateInstanceExtensionPropertiesChain * pNextLink
Definition: vk_layer.h:160
VkResult(VKAPI_PTR *pfnNextLayer)(const struct VkEnumerateInstanceExtensionPropertiesChain *
VkResult(VKAPI_PTR *pfnNextLayer)(const struct VkEnumerateInstanceLayerPropertiesChain *
uint32_t VkLayerProperties *const struct VkEnumerateInstanceLayerPropertiesChain * pNextLink
Definition: vk_layer.h:172
VkResult(VKAPI_PTR *pfnNextLayer)(const struct VkEnumerateInstanceVersionChain *
uint32_t *const struct VkEnumerateInstanceVersionChain * pNextLink
Definition: vk_layer.h:184
VkStructureType sType
Definition: vk_layer.h:128
VkLayerDeviceLink * pLayerInfo
Definition: vk_layer.h:132
VkLayerFunction function
Definition: vk_layer.h:130
PFN_vkSetDeviceLoaderData pfnSetDeviceLoaderData
Definition: vk_layer.h:133
const void * pNext
Definition: vk_layer.h:129
PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr
Definition: vk_layer.h:103
void * device_info
Definition: vk_layer.h:102
VkLayerInstanceLink * pLayerInfo
Definition: vk_layer.h:116
PFN_vkSetInstanceLoaderData pfnSetInstanceLoaderData
Definition: vk_layer.h:117
VkStructureType sType
Definition: vk_layer.h:112
VkLayerFunction function
Definition: vk_layer.h:114
VkNegotiateLayerStructType sType
Definition: vk_layer.h:61
uint32_t loaderLayerInterfaceVersion
Definition: vk_layer.h:63
PFN_vkGetDeviceProcAddr pfnGetDeviceProcAddr
Definition: vk_layer.h:65
PFN_GetPhysicalDeviceProcAddr pfnGetPhysicalDeviceProcAddr
Definition: vk_layer.h:66
PFN_vkGetInstanceProcAddr pfnGetInstanceProcAddr
Definition: vk_layer.h:64
VKAPI_ATTR VkResult VKAPI_CALL vkNegotiateLoaderLayerInterfaceVersion(VkNegotiateLayerInterface *pVersionStruct)
VkResult(VKAPI_PTR * PFN_vkSetDeviceLoaderData)(VkDevice device, void *object)
Definition: vk_layer.h:108
VkResult(VKAPI_PTR * PFN_PhysDevExt)(VkPhysicalDevice phys_device)
Definition: vk_layer.h:73
VkChainType
Definition: vk_layer.h:143
@ VK_CHAIN_TYPE_UNKNOWN
Definition: vk_layer.h:144
@ VK_CHAIN_TYPE_ENUMERATE_INSTANCE_VERSION
Definition: vk_layer.h:147
@ VK_CHAIN_TYPE_ENUMERATE_INSTANCE_LAYER_PROPERTIES
Definition: vk_layer.h:146
@ VK_CHAIN_TYPE_ENUMERATE_INSTANCE_EXTENSION_PROPERTIES
Definition: vk_layer.h:145
VkLayerFunction
Definition: vk_layer.h:83
@ VK_LAYER_LINK_INFO
Definition: vk_layer.h:84
@ VK_LOADER_DATA_CALLBACK
Definition: vk_layer.h:85
VkResult(VKAPI_PTR * PFN_vkSetInstanceLoaderData)(VkInstance instance, void *object)
Definition: vk_layer.h:106
PFN_vkVoidFunction(VKAPI_PTR * PFN_GetPhysicalDeviceProcAddr)(VkInstance instance, const char *pName)
Definition: vk_layer.h:51
VkResult(VKAPI_PTR * PFN_vkNegotiateLoaderLayerInterfaceVersion)(VkNegotiateLayerInterface *pVersionStruct)
Definition: vk_layer.h:70
VkNegotiateLayerStructType
Definition: vk_layer.h:54
@ LAYER_NEGOTIATE_INTERFACE_STRUCT
Definition: vk_layer.h:56
@ LAYER_NEGOTIATE_UNINTIALIZED
Definition: vk_layer.h:55
#define VKAPI_CALL
Definition: vk_platform.h:52
#define VKAPI_ATTR
Definition: vk_platform.h:51
#define VKAPI_PTR
Definition: vk_platform.h:53
PFN_vkVoidFunction(VKAPI_PTR * PFN_vkGetDeviceProcAddr)(VkDevice device, const char *pName)
Definition: vulkan_core.h:2860
VkResult
Definition: vulkan_core.h:120
void(VKAPI_PTR * PFN_vkVoidFunction)(void)
Definition: vulkan_core.h:2024
PFN_vkVoidFunction(VKAPI_PTR * PFN_vkGetInstanceProcAddr)(VkInstance instance, const char *pName)
Definition: vulkan_core.h:2859
VkStructureType
Definition: vulkan_core.h:159