Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 1 | /* |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 2 | * |
Courtney Goeltzenleuchter | 8a17da5 | 2015-10-29 13:50:34 -0600 | [diff] [blame] | 3 | * Copyright (C) 2015 Valve Corporation |
Michael Lentine | 9268944 | 2015-09-09 12:39:13 -0700 | [diff] [blame] | 4 | * Copyright (C) 2015 Google Inc. |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 7 | * copy of this software and associated documentation files (the "Software"), |
| 8 | * to deal in the Software without restriction, including without limitation |
| 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 10 | * and/or sell copies of the Software, and to permit persons to whom the |
| 11 | * Software is furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be included |
| 14 | * in all copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 21 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 22 | * DEALINGS IN THE SOFTWARE. |
Courtney Goeltzenleuchter | 96cd795 | 2015-10-30 11:14:30 -0600 | [diff] [blame] | 23 | * |
| 24 | * Author: David Pinedo <david@lunarg.com> |
| 25 | * Author: Jon Ashburn <jon@lunarg.com> |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 26 | */ |
Jon Ashburn | 227a942 | 2014-11-26 11:10:26 -0700 | [diff] [blame] | 27 | #include <string.h> |
| 28 | #include <stdlib.h> |
| 29 | #include <assert.h> |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 30 | #include "vk_dispatch_table_helper.h" |
David Pinedo | 329ca9e | 2015-11-06 12:54:48 -0700 | [diff] [blame] | 31 | #include "vulkan/vk_layer.h" |
Tobin Ehlis | 56d204a | 2015-07-03 10:15:26 -0600 | [diff] [blame] | 32 | #include "vk_layer_table.h" |
Courtney Goeltzenleuchter | 326075a | 2015-07-05 11:10:06 -0600 | [diff] [blame] | 33 | #include "vk_layer_extension_utils.h" |
Jon Ashburn | 227a942 | 2014-11-26 11:10:26 -0700 | [diff] [blame] | 34 | |
David Pinedo | 07238d4 | 2015-07-09 16:23:44 -0600 | [diff] [blame] | 35 | static const VkLayerProperties globalLayerProps[] = { |
| 36 | { |
Michael Lentine | 88467fa | 2016-01-19 14:19:38 -0600 | [diff] [blame] | 37 | "VK_LAYER_LUNARG_basic", |
David Pinedo | 07238d4 | 2015-07-09 16:23:44 -0600 | [diff] [blame] | 38 | VK_API_VERSION, // specVersion |
Courtney Goeltzenleuchter | 1335a4c | 2016-01-08 11:50:04 -0700 | [diff] [blame] | 39 | 1, // implementationVersion |
| 40 | "LunarG Sample Layer", |
David Pinedo | 07238d4 | 2015-07-09 16:23:44 -0600 | [diff] [blame] | 41 | } |
| 42 | }; |
| 43 | |
Jon Ashburn | 227a942 | 2014-11-26 11:10:26 -0700 | [diff] [blame] | 44 | |
Chia-I Wu | af9e4fd | 2015-11-06 06:42:02 +0800 | [diff] [blame] | 45 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkLayerExtension1(VkDevice device) |
Jon Ashburn | 227a942 | 2014-11-26 11:10:26 -0700 | [diff] [blame] | 46 | { |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 47 | printf("In vkLayerExtension1() call w/ device: %p\n", (void*)device); |
| 48 | printf("vkLayerExtension1 returning SUCCESS\n"); |
| 49 | return VK_SUCCESS; |
Jon Ashburn | 227a942 | 2014-11-26 11:10:26 -0700 | [diff] [blame] | 50 | } |
| 51 | |
Courtney Goeltzenleuchter | 326075a | 2015-07-05 11:10:06 -0600 | [diff] [blame] | 52 | static const VkLayerProperties basic_physicaldevice_layers[] = { |
Courtney Goeltzenleuchter | 1c7c65d | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 53 | { |
Michael Lentine | 5d96e52 | 2015-12-11 10:49:51 -0800 | [diff] [blame] | 54 | "VK_LAYER_LUNARG_basic", |
Courtney Goeltzenleuchter | 326075a | 2015-07-05 11:10:06 -0600 | [diff] [blame] | 55 | VK_API_VERSION, |
| 56 | VK_MAKE_VERSION(0, 1, 0), |
Mark Lobodzinski | 2e87e61 | 2015-12-30 08:16:12 -0700 | [diff] [blame] | 57 | "Sample layer: basic, implements vkLayerExtension1", |
Courtney Goeltzenleuchter | 1c7c65d | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 58 | } |
Jon Ashburn | eb2728b | 2015-04-10 14:33:07 -0600 | [diff] [blame] | 59 | }; |
| 60 | |
Courtney Goeltzenleuchter | 326075a | 2015-07-05 11:10:06 -0600 | [diff] [blame] | 61 | /* Must use Vulkan name so that loader finds it */ |
Chia-I Wu | af9e4fd | 2015-11-06 06:42:02 +0800 | [diff] [blame] | 62 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceLayerProperties( |
Courtney Goeltzenleuchter | 326075a | 2015-07-05 11:10:06 -0600 | [diff] [blame] | 63 | VkPhysicalDevice physicalDevice, |
| 64 | uint32_t* pCount, |
| 65 | VkLayerProperties* pProperties) |
Jon Ashburn | eb2728b | 2015-04-10 14:33:07 -0600 | [diff] [blame] | 66 | { |
Courtney Goeltzenleuchter | 326075a | 2015-07-05 11:10:06 -0600 | [diff] [blame] | 67 | /* Mem tracker's physical device layers are the same as global */ |
| 68 | return util_GetLayerProperties(ARRAY_SIZE(basic_physicaldevice_layers), basic_physicaldevice_layers, |
| 69 | pCount, pProperties); |
Tony Barbour | 426b905 | 2015-06-24 16:06:58 -0600 | [diff] [blame] | 70 | } |
Jon Ashburn | eb2728b | 2015-04-10 14:33:07 -0600 | [diff] [blame] | 71 | |
Courtney Goeltzenleuchter | 326075a | 2015-07-05 11:10:06 -0600 | [diff] [blame] | 72 | static const VkExtensionProperties basic_physicaldevice_extensions[] = { |
| 73 | { |
| 74 | "vkLayerExtension1", |
| 75 | VK_MAKE_VERSION(0, 1, 0), |
Courtney Goeltzenleuchter | 326075a | 2015-07-05 11:10:06 -0600 | [diff] [blame] | 76 | } |
| 77 | }; |
| 78 | |
Chia-I Wu | af9e4fd | 2015-11-06 06:42:02 +0800 | [diff] [blame] | 79 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties( |
Courtney Goeltzenleuchter | 326075a | 2015-07-05 11:10:06 -0600 | [diff] [blame] | 80 | VkPhysicalDevice physicalDevice, |
| 81 | const char *pLayerName, |
| 82 | uint32_t *pCount, |
| 83 | VkExtensionProperties *pProperties) |
Tony Barbour | 426b905 | 2015-06-24 16:06:58 -0600 | [diff] [blame] | 84 | { |
Jon Ashburn | aff81ff | 2015-11-02 17:37:20 -0700 | [diff] [blame] | 85 | if (pLayerName == NULL) { |
| 86 | return instance_dispatch_table(physicalDevice)->EnumerateDeviceExtensionProperties( |
| 87 | physicalDevice, |
| 88 | NULL, |
| 89 | pCount, |
| 90 | pProperties); |
| 91 | } else { |
| 92 | return util_GetExtensionProperties(ARRAY_SIZE(basic_physicaldevice_extensions), |
| 93 | basic_physicaldevice_extensions, |
| 94 | pCount, pProperties); |
| 95 | } |
Jon Ashburn | eb2728b | 2015-04-10 14:33:07 -0600 | [diff] [blame] | 96 | } |
| 97 | |
Courtney Goeltzenleuchter | 2bdf6da | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 98 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL basic_CreateInstance( |
| 99 | const VkInstanceCreateInfo* pCreateInfo, |
| 100 | const VkAllocationCallbacks* pAllocator, |
| 101 | VkInstance* pInstance) |
| 102 | { |
| 103 | VkLayerInstanceCreateInfo *chain_info = get_chain_info(pCreateInfo, VK_LAYER_LINK_INFO); |
| 104 | |
| 105 | assert(chain_info->u.pLayerInfo); |
| 106 | PFN_vkGetInstanceProcAddr fpGetInstanceProcAddr = chain_info->u.pLayerInfo->pfnNextGetInstanceProcAddr; |
| 107 | PFN_vkCreateInstance fpCreateInstance = (PFN_vkCreateInstance) fpGetInstanceProcAddr(NULL, "vkCreateInstance"); |
| 108 | if (fpCreateInstance == NULL) { |
| 109 | return VK_ERROR_INITIALIZATION_FAILED; |
| 110 | } |
| 111 | |
| 112 | // Advance the link info for the next element on the chain |
| 113 | chain_info->u.pLayerInfo = chain_info->u.pLayerInfo->pNext; |
| 114 | |
| 115 | VkResult result = fpCreateInstance(pCreateInfo, pAllocator, pInstance); |
| 116 | if (result != VK_SUCCESS) |
| 117 | return result; |
| 118 | |
| 119 | initInstanceTable(*pInstance, fpGetInstanceProcAddr); |
| 120 | |
| 121 | return result; |
| 122 | } |
| 123 | |
Chia-I Wu | af9e4fd | 2015-11-06 06:42:02 +0800 | [diff] [blame] | 124 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL basic_EnumeratePhysicalDevices( |
Jon Ashburn | 2666e2f | 2015-05-15 15:09:35 -0600 | [diff] [blame] | 125 | VkInstance instance, |
| 126 | uint32_t* pPhysicalDeviceCount, |
| 127 | VkPhysicalDevice* pPhysicalDevices) |
| 128 | { |
Jon Ashburn | 2666e2f | 2015-05-15 15:09:35 -0600 | [diff] [blame] | 129 | printf("At start of wrapped vkEnumeratePhysicalDevices() call w/ inst: %p\n", (void*)instance); |
Jon Ashburn | 5a10d21 | 2015-06-01 10:02:09 -0600 | [diff] [blame] | 130 | VkResult result = instance_dispatch_table(instance)->EnumeratePhysicalDevices(instance, pPhysicalDeviceCount, pPhysicalDevices); |
Jon Ashburn | 2666e2f | 2015-05-15 15:09:35 -0600 | [diff] [blame] | 131 | printf("Completed wrapped vkEnumeratePhysicalDevices() call w/ count %u\n", *pPhysicalDeviceCount); |
| 132 | return result; |
| 133 | } |
| 134 | |
Courtney Goeltzenleuchter | 2bdf6da | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 135 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL basic_CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDevice* pDevice) |
Jon Ashburn | 227a942 | 2014-11-26 11:10:26 -0700 | [diff] [blame] | 136 | { |
Courtney Goeltzenleuchter | 2bdf6da | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 137 | printf("VK_LAYER_LUNARG_Basic: At start of vkCreateDevice() call w/ gpu: %p\n", (void*)physicalDevice); |
| 138 | |
| 139 | VkLayerDeviceCreateInfo *chain_info = get_chain_info(pCreateInfo, VK_LAYER_LINK_INFO); |
| 140 | |
| 141 | assert(chain_info->u.pLayerInfo); |
| 142 | PFN_vkGetInstanceProcAddr fpGetInstanceProcAddr = chain_info->u.pLayerInfo->pfnNextGetInstanceProcAddr; |
| 143 | PFN_vkGetDeviceProcAddr fpGetDeviceProcAddr = chain_info->u.pLayerInfo->pfnNextGetDeviceProcAddr; |
| 144 | PFN_vkCreateDevice fpCreateDevice = (PFN_vkCreateDevice) fpGetInstanceProcAddr(NULL, "vkCreateDevice"); |
| 145 | if (fpCreateDevice == NULL) { |
| 146 | return VK_ERROR_INITIALIZATION_FAILED; |
| 147 | } |
| 148 | |
| 149 | // Advance the link info for the next element on the chain |
| 150 | chain_info->u.pLayerInfo = chain_info->u.pLayerInfo->pNext; |
| 151 | |
| 152 | VkResult result = fpCreateDevice(physicalDevice, pCreateInfo, pAllocator, pDevice); |
| 153 | if (result != VK_SUCCESS) { |
| 154 | return result; |
| 155 | } |
| 156 | |
| 157 | initDeviceTable(*pDevice, fpGetDeviceProcAddr); |
| 158 | |
| 159 | printf("VK_LAYER_LUNARG_Basic: Completed vkCreateDevice() call w/ pDevice, Device %p: %p\n", (void*)pDevice, (void *) *pDevice); |
Jon Ashburn | 227a942 | 2014-11-26 11:10:26 -0700 | [diff] [blame] | 160 | return result; |
| 161 | } |
Jon Ashburn | 2666e2f | 2015-05-15 15:09:35 -0600 | [diff] [blame] | 162 | |
Jon Ashburn | 17f3737 | 2015-05-19 16:34:53 -0600 | [diff] [blame] | 163 | /* hook DestroyDevice to remove tableMap entry */ |
Chia-I Wu | af9e4fd | 2015-11-06 06:42:02 +0800 | [diff] [blame] | 164 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL basic_DestroyDevice(VkDevice device, const VkAllocationCallbacks* pAllocator) |
Jon Ashburn | 17f3737 | 2015-05-19 16:34:53 -0600 | [diff] [blame] | 165 | { |
Courtney Goeltzenleuchter | 9f17194 | 2015-06-13 21:22:12 -0600 | [diff] [blame] | 166 | dispatch_key key = get_dispatch_key(device); |
Chia-I Wu | 69f4012 | 2015-10-26 21:10:41 +0800 | [diff] [blame] | 167 | device_dispatch_table(device)->DestroyDevice(device, pAllocator); |
Courtney Goeltzenleuchter | 9f17194 | 2015-06-13 21:22:12 -0600 | [diff] [blame] | 168 | destroy_device_dispatch_table(key); |
Jon Ashburn | 17f3737 | 2015-05-19 16:34:53 -0600 | [diff] [blame] | 169 | } |
| 170 | |
| 171 | /* hook DestroyInstance to remove tableInstanceMap entry */ |
Chia-I Wu | af9e4fd | 2015-11-06 06:42:02 +0800 | [diff] [blame] | 172 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL basic_DestroyInstance(VkInstance instance, const VkAllocationCallbacks* pAllocator) |
Jon Ashburn | 17f3737 | 2015-05-19 16:34:53 -0600 | [diff] [blame] | 173 | { |
Courtney Goeltzenleuchter | 9f17194 | 2015-06-13 21:22:12 -0600 | [diff] [blame] | 174 | dispatch_key key = get_dispatch_key(instance); |
Chia-I Wu | 69f4012 | 2015-10-26 21:10:41 +0800 | [diff] [blame] | 175 | instance_dispatch_table(instance)->DestroyInstance(instance, pAllocator); |
Courtney Goeltzenleuchter | 9f17194 | 2015-06-13 21:22:12 -0600 | [diff] [blame] | 176 | destroy_instance_dispatch_table(key); |
Jon Ashburn | 17f3737 | 2015-05-19 16:34:53 -0600 | [diff] [blame] | 177 | } |
| 178 | |
Chia-I Wu | af9e4fd | 2015-11-06 06:42:02 +0800 | [diff] [blame] | 179 | VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL basic_GetPhysicalDeviceFormatProperties(VkPhysicalDevice gpu, VkFormat format, VkFormatProperties *pFormatInfo) |
Jon Ashburn | 227a942 | 2014-11-26 11:10:26 -0700 | [diff] [blame] | 180 | { |
Courtney Goeltzenleuchter | ab36aa6 | 2015-07-12 12:40:29 -0600 | [diff] [blame] | 181 | printf("At start of wrapped vkGetPhysicalDeviceFormatProperties() call w/ gpu: %p\n", (void*)gpu); |
Courtney Goeltzenleuchter | 01d2ae1 | 2015-10-20 16:40:38 -0600 | [diff] [blame] | 182 | instance_dispatch_table(gpu)->GetPhysicalDeviceFormatProperties(gpu, format, pFormatInfo); |
Courtney Goeltzenleuchter | ab36aa6 | 2015-07-12 12:40:29 -0600 | [diff] [blame] | 183 | printf("Completed wrapped vkGetPhysicalDeviceFormatProperties() call w/ gpu: %p\n", (void*)gpu); |
Jon Ashburn | 227a942 | 2014-11-26 11:10:26 -0700 | [diff] [blame] | 184 | } |
| 185 | |
Chia-I Wu | af9e4fd | 2015-11-06 06:42:02 +0800 | [diff] [blame] | 186 | VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice device, const char* pName) |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 187 | { |
Courtney Goeltzenleuchter | 2bdf6da | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 188 | if (!strcmp("vkGetDeviceProcAddr", pName)) |
Courtney Goeltzenleuchter | a4c8c71 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 189 | return (PFN_vkVoidFunction) vkGetDeviceProcAddr; |
Jon Ashburn | 17f3737 | 2015-05-19 16:34:53 -0600 | [diff] [blame] | 190 | if (!strcmp("vkDestroyDevice", pName)) |
Courtney Goeltzenleuchter | a4c8c71 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 191 | return (PFN_vkVoidFunction) basic_DestroyDevice; |
Jon Ashburn | 79b78ac | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 192 | if (!strcmp("vkLayerExtension1", pName)) |
Courtney Goeltzenleuchter | a4c8c71 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 193 | return (PFN_vkVoidFunction) vkLayerExtension1; |
Courtney Goeltzenleuchter | 2bdf6da | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 194 | |
| 195 | if (device == NULL) |
| 196 | return NULL; |
| 197 | |
| 198 | if (device_dispatch_table(device)->GetDeviceProcAddr == NULL) |
| 199 | return NULL; |
| 200 | return device_dispatch_table(device)->GetDeviceProcAddr(device, pName); |
Jon Ashburn | 79b78ac | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 201 | } |
| 202 | |
Chia-I Wu | af9e4fd | 2015-11-06 06:42:02 +0800 | [diff] [blame] | 203 | VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance, const char* pName) |
Jon Ashburn | 79b78ac | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 204 | { |
Courtney Goeltzenleuchter | 2bdf6da | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 205 | if (!strcmp("vkGetInstanceProcAddr", pName)) |
Courtney Goeltzenleuchter | a4c8c71 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 206 | return (PFN_vkVoidFunction) vkGetInstanceProcAddr; |
Courtney Goeltzenleuchter | 74c4ce9 | 2015-09-14 17:22:16 -0600 | [diff] [blame] | 207 | if (!strcmp("vkEnumerateDeviceLayerProperties", pName)) |
| 208 | return (PFN_vkVoidFunction) vkEnumerateDeviceLayerProperties; |
| 209 | if (!strcmp("vkEnumerateDeviceExtensionProperties", pName)) |
| 210 | return (PFN_vkVoidFunction) vkEnumerateDeviceExtensionProperties; |
Courtney Goeltzenleuchter | ab36aa6 | 2015-07-12 12:40:29 -0600 | [diff] [blame] | 211 | if (!strcmp("vkGetPhysicalDeviceFormatProperties", pName)) |
Courtney Goeltzenleuchter | a4c8c71 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 212 | return (PFN_vkVoidFunction) basic_GetPhysicalDeviceFormatProperties; |
Courtney Goeltzenleuchter | 2bdf6da | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 213 | if (!strcmp("vkCreateInstance", pName)) |
| 214 | return (PFN_vkVoidFunction) basic_CreateInstance; |
Jon Ashburn | 17f3737 | 2015-05-19 16:34:53 -0600 | [diff] [blame] | 215 | if (!strcmp("vkDestroyInstance", pName)) |
Courtney Goeltzenleuchter | a4c8c71 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 216 | return (PFN_vkVoidFunction) basic_DestroyInstance; |
Courtney Goeltzenleuchter | 2bdf6da | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 217 | if (!strcmp("vkCreateDevice", pName)) |
| 218 | return (PFN_vkVoidFunction) basic_CreateDevice; |
Jon Ashburn | 2666e2f | 2015-05-15 15:09:35 -0600 | [diff] [blame] | 219 | if (!strcmp("vkEnumeratePhysicalDevices", pName)) |
Courtney Goeltzenleuchter | a4c8c71 | 2015-07-12 14:35:22 -0600 | [diff] [blame] | 220 | return (PFN_vkVoidFunction) basic_EnumeratePhysicalDevices; |
Jon Ashburn | 4f2575f | 2015-05-28 16:25:02 -0600 | [diff] [blame] | 221 | |
Courtney Goeltzenleuchter | 2bdf6da | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 222 | if (instance == NULL) |
| 223 | return NULL; |
| 224 | |
Courtney Goeltzenleuchter | 326075a | 2015-07-05 11:10:06 -0600 | [diff] [blame] | 225 | if (instance_dispatch_table(instance)->GetInstanceProcAddr == NULL) |
| 226 | return NULL; |
| 227 | return instance_dispatch_table(instance)->GetInstanceProcAddr(instance, pName); |
Jon Ashburn | 227a942 | 2014-11-26 11:10:26 -0700 | [diff] [blame] | 228 | } |
David Pinedo | 07238d4 | 2015-07-09 16:23:44 -0600 | [diff] [blame] | 229 | |
Chia-I Wu | af9e4fd | 2015-11-06 06:42:02 +0800 | [diff] [blame] | 230 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pCount, VkExtensionProperties* pProperties) |
David Pinedo | 07238d4 | 2015-07-09 16:23:44 -0600 | [diff] [blame] | 231 | { |
| 232 | return util_GetExtensionProperties(0, NULL, pCount, pProperties); |
| 233 | } |
| 234 | |
Chia-I Wu | af9e4fd | 2015-11-06 06:42:02 +0800 | [diff] [blame] | 235 | VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties(uint32_t *pCount, VkLayerProperties* pProperties) |
David Pinedo | 07238d4 | 2015-07-09 16:23:44 -0600 | [diff] [blame] | 236 | { |
| 237 | return util_GetLayerProperties(ARRAY_SIZE(globalLayerProps), globalLayerProps, pCount, pProperties); |
| 238 | } |