| 1266 | } |
| 1267 | |
| 1268 | VKAPI_ATTR VkResult VKAPI_CALL CreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, |
| 1269 | VkInstance *pInstance) { |
| 1270 | #if defined(_WIN32) && defined(_CRTDBG_MODE_FILE) |
| 1271 | #if !defined(NDEBUG) |
| 1272 | _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); |
| 1273 | _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); |
| 1274 | #endif |
| 1275 | // Avoid "Abort, Retry, Ignore" dialog boxes |
| 1276 | _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT); |
| 1277 | SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX); |
| 1278 | _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE); |
| 1279 | _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); |
| 1280 | #endif |
| 1281 | VkLayerInstanceCreateInfo *chain_info = get_chain_info(pCreateInfo, VK_LAYER_LINK_INFO); |
| 1282 | |
| 1283 | assert(chain_info->u.pLayerInfo); |
| 1284 | PFN_vkGetInstanceProcAddr fpGetInstanceProcAddr = chain_info->u.pLayerInfo->pfnNextGetInstanceProcAddr; |
| 1285 | assert(fpGetInstanceProcAddr); |
| 1286 | PFN_vkCreateInstance fpCreateInstance = (PFN_vkCreateInstance)fpGetInstanceProcAddr(VK_NULL_HANDLE, "vkCreateInstance"); |
| 1287 | if (fpCreateInstance == NULL) { |
| 1288 | return VK_ERROR_INITIALIZATION_FAILED; |
| 1289 | } |
| 1290 | |
| 1291 | // Advance the link info for the next element on the chain |
| 1292 | chain_info->u.pLayerInfo = chain_info->u.pLayerInfo->pNext; |
| 1293 | |
| 1294 | VkResult result = fpCreateInstance(pCreateInfo, pAllocator, pInstance); |
| 1295 | if (result != VK_SUCCESS) return result; |
| 1296 | |
| 1297 | initInstanceTable(*pInstance, fpGetInstanceProcAddr); |
| 1298 | |
| 1299 | init_screenshot(pCreateInfo, pAllocator); |
| 1300 | |
| 1301 | return result; |
| 1302 | } |
| 1303 | |
| 1304 | VKAPI_ATTR void VKAPI_CALL DestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator) { |
| 1305 | shutdown_screenshot(); |
nothing calls this directly
no test coverage detected