From 345b4280698fb3da4cc95bf05abee776624604a8 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Wed, 13 Mar 2019 14:50:23 +1100 Subject: [PATCH] tools/hello: cache the vkCreateDebugReportCallbackEXT lookup --- tools/hello.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/hello.cpp b/tools/hello.cpp index acba2aa..4ec9632 100644 --- a/tools/hello.cpp +++ b/tools/hello.cpp @@ -299,12 +299,16 @@ VkResult _vkCreateDebugReportCallbackEXT ( const VkAllocationCallbacks* pAllocator, VkDebugReportCallbackEXT* pCallback ) noexcept { - return reinterpret_cast ( + static auto fn = reinterpret_cast< + decltype(_vkCreateDebugReportCallbackEXT)* + > ( vkGetInstanceProcAddr ( instance, "vkCreateDebugReportCallbackEXT" ) - ) (instance, pCreateInfo, pAllocator, pCallback); + ); + + return fn (instance, pCreateInfo, pAllocator, pCallback); }