RetroArch
vk_layer.h
Go to the documentation of this file.
1 /* File: vk_layer.h */
2 
3 /*
4  * Copyright (c) 2015-2017 The Khronos Group Inc.
5  * Copyright (c) 2015-2017 Valve Corporation
6  * Copyright (c) 2015-2017 LunarG, Inc.
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21 
22 /* Need to define dispatch table
23  * Core struct can then have ptr to dispatch table at the top
24  * Along with object ptrs for current and next OBJ
25  */
26 #pragma once
27 
28 #include "vulkan.h"
29 #if defined(__GNUC__) && __GNUC__ >= 4
30 #define VK_LAYER_EXPORT __attribute__((visibility("default")))
31 #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
32 #define VK_LAYER_EXPORT __attribute__((visibility("default")))
33 #else
34 #define VK_LAYER_EXPORT
35 #endif
36 
37 /* Definition for VkLayerDispatchTable and VkLayerInstanceDispatchTable now appear in externally generated header */
38 #include "vk_layer_dispatch_table.h"
39 
40 #define MAX_NUM_UNKNOWN_EXTS 250
41 
42  /* Loader-Layer version negotiation API. Versions add the following features:
43  * Versions 0/1 - Initial. Doesn't support vk_layerGetPhysicalDeviceProcAddr
44  * or vk_icdNegotiateLoaderLayerInterfaceVersion.
45  * Version 2 - Add support for vk_layerGetPhysicalDeviceProcAddr and
46  * vk_icdNegotiateLoaderLayerInterfaceVersion.
47  */
48 #define CURRENT_LOADER_LAYER_INTERFACE_VERSION 2
49 #define MIN_SUPPORTED_LOADER_LAYER_INTERFACE_VERSION 1
50 
51 #define VK_CURRENT_CHAIN_VERSION 1
52 
53 /* Version negotiation values */
58 
59 /* Version negotiation structures */
60 typedef struct VkNegotiateLayerInterface {
62  void *pNext;
68 
69 /* Version negotiation functions */
71 
72 /* Function prototype for unknown physical device extension command */
73 typedef 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  */
83 typedef enum VkLayerFunction_ {
87 
88 typedef struct VkLayerInstanceLink_ {
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  */
101 typedef struct VkLayerDeviceInfo_ {
102  void *device_info;
105 
106 typedef VkResult (VKAPI_PTR *PFN_vkSetInstanceLoaderData)(VkInstance instance,
107  void *object);
109  void *object);
110 
111 typedef struct {
112  VkStructureType sType; /* VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO */
113  const void *pNext;
114  VkLayerFunction function;
115  union {
118  } u;
120 
121 typedef struct VkLayerDeviceLink_ {
126 
127 typedef struct {
128  VkStructureType sType; /* VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO */
129  const void *pNext;
130  VkLayerFunction function;
131  union {
134  } u;
136 
137 #ifdef __cplusplus
138 extern "C" {
139 #endif
140 
142 
143 typedef enum VkChainType {
148 } VkChainType;
149 
150 typedef struct VkChainHeader {
154 } 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 
183  VkResult(VKAPI_PTR *pfnNextLayer)(const struct VkEnumerateInstanceVersionChain *, uint32_t *);
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
VkResult(VKAPI_PTR * PFN_vkSetInstanceLoaderData)(VkInstance instance, void *object)
Definition: vk_layer.h:106
PFN_vkVoidFunction(VKAPI_PTR * PFN_vkGetDeviceProcAddr)(VkDevice device, const char *pName)
Definition: vulkan_core.h:2731
uint32_t version
Definition: vk_layer.h:152
const void * pNext
Definition: vk_layer.h:113
enum VkLayerFunction_ VkLayerFunction
void * pNext
Definition: vk_layer.h:62
VKAPI_ATTR VkResult VKAPI_CALL vkNegotiateLoaderLayerInterfaceVersion(VkNegotiateLayerInterface *pVersionStruct)
PFN_vkGetInstanceProcAddr pfnGetInstanceProcAddr
Definition: vk_layer.h:64
PFN_vkSetInstanceLoaderData pfnSetInstanceLoaderData
Definition: vk_layer.h:117
VkResult(VKAPI_PTR * PFN_vkNegotiateLoaderLayerInterfaceVersion)(VkNegotiateLayerInterface *pVersionStruct)
Definition: vk_layer.h:70
Definition: vk_layer.h:84
Definition: vk_layer.h:111
Definition: vulkan_core.h:1928
uint32_t size
Definition: vk_layer.h:153
#define VKAPI_PTR
Definition: vk_platform.h:68
PFN_GetPhysicalDeviceProcAddr pfnNextGetPhysicalDeviceProcAddr
Definition: vk_layer.h:91
VkLayerFunction_
Definition: vk_layer.h:83
const void * pNext
Definition: vk_layer.h:129
VkResult(VKAPI_PTR *pfnNextLayer)(const struct VkEnumerateInstanceExtensionPropertiesChain *
VkResult(VKAPI_PTR * PFN_vkSetDeviceLoaderData)(VkDevice device, void *object)
Definition: vk_layer.h:108
PFN_vkVoidFunction(VKAPI_PTR * PFN_GetPhysicalDeviceProcAddr)(VkInstance instance, const char *pName)
Definition: vk_icd.h:52
Definition: vk_layer.h:85
Definition: vk_layer.h:150
Definition: vk_layer.h:55
struct VkLayerInstanceLink_ VkLayerInstanceLink
struct VkEnumerateInstanceVersionChain VkEnumerateInstanceVersionChain
PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr
Definition: vk_layer.h:90
struct VkLayerDeviceLink_ * pNext
Definition: vk_layer.h:122
struct VkEnumerateInstanceExtensionPropertiesChain VkEnumerateInstanceExtensionPropertiesChain
Definition: vk_layer.h:144
Definition: vk_layer.h:60
PFN_vkGetDeviceProcAddr pfnGetDeviceProcAddr
Definition: vk_layer.h:65
struct VkEnumerateInstanceLayerPropertiesChain VkEnumerateInstanceLayerPropertiesChain
VkChainType
Definition: vk_layer.h:143
VkResult(VKAPI_PTR *pfnNextLayer)(const struct VkEnumerateInstanceVersionChain *
uint32_t *const struct VkEnumerateInstanceVersionChain * pNextLink
Definition: vk_layer.h:184
Definition: vk_layer.h:121
PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr
Definition: vk_layer.h:103
#define VKAPI_CALL
Definition: vk_platform.h:67
VkStructureType sType
Definition: vk_layer.h:128
Definition: vk_layer.h:101
void * device_info
Definition: vk_layer.h:102
VkLayerDeviceLink * pLayerInfo
Definition: vk_layer.h:132
Definition: vk_layer.h:169
VkResult
Definition: vulkan_core.h:124
uint32_t loaderLayerInterfaceVersion
Definition: vk_layer.h:63
Definition: vk_layer.h:88
VkChainHeader header
Definition: vk_layer.h:157
PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr
Definition: vk_layer.h:123
Definition: vk_layer.h:127
VkNegotiateLayerStructType sType
Definition: vk_layer.h:61
VkStructureType sType
Definition: vk_layer.h:112
PFN_vkGetDeviceProcAddr pfnNextGetDeviceProcAddr
Definition: vk_layer.h:124
VkStructureType
Definition: vulkan_core.h:162
PFN_vkSetDeviceLoaderData pfnSetDeviceLoaderData
Definition: vk_layer.h:133
VkChainHeader header
Definition: vk_layer.h:170
struct VkChainHeader VkChainHeader
VkNegotiateLayerStructType
Definition: vk_layer.h:54
Definition: vk_layer.h:56
VkResult(VKAPI_PTR *pfnNextLayer)(const struct VkEnumerateInstanceLayerPropertiesChain *
VkChainHeader header
Definition: vk_layer.h:182
const char uint32_t VkExtensionProperties *const struct VkEnumerateInstanceExtensionPropertiesChain * pNextLink
Definition: vk_layer.h:160
uint32_t VkLayerProperties *const struct VkEnumerateInstanceLayerPropertiesChain * pNextLink
Definition: vk_layer.h:172
Definition: vk_layer.h:181
#define VKAPI_ATTR
Definition: vk_platform.h:66
struct VkLayerInstanceLink_ * pNext
Definition: vk_layer.h:89
Definition: vulkan_core.h:1933
VkChainType type
Definition: vk_layer.h:151
struct VkLayerDeviceLink_ VkLayerDeviceLink
struct nk_device device
Definition: nk_common.c:44
VkResult(VKAPI_PTR * PFN_PhysDevExt)(VkPhysicalDevice phys_device)
Definition: vk_layer.h:73
unsigned int uint32_t
Definition: stdint.h:126
VkLayerInstanceLink * pLayerInfo
Definition: vk_layer.h:116
struct VkLayerDeviceInfo_ VkLayerDeviceInfo
GLuint object
Definition: glsym_es2.h:109
PFN_GetPhysicalDeviceProcAddr pfnGetPhysicalDeviceProcAddr
Definition: vk_layer.h:66
PFN_vkVoidFunction(VKAPI_PTR * PFN_vkGetInstanceProcAddr)(VkInstance instance, const char *pName)
Definition: vulkan_core.h:2730
struct VkNegotiateLayerInterface VkNegotiateLayerInterface