libcruft-vk/traits.cpp

36 lines
1.1 KiB
C++
Raw Normal View History

/*
2018-08-04 15:24:36 +10:00
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright:
* 2017, Danny Robson <danny@nerdcruft.net>
*/
#include "./traits.hpp"
2017-09-14 00:31:23 +10:00
#include "./instance.hpp"
///////////////////////////////////////////////////////////////////////////////
#define INSTANTIATE(KLASS, NAME, FUNC) \
decltype(FUNC)* cruft::vk::life_traits<KLASS>::NAME = nullptr
INSTANTIATE(VkDebugReportCallbackEXT, create, vkCreateDebugReportCallbackEXT);
INSTANTIATE(VkDebugReportCallbackEXT, destroy, vkDestroyDebugReportCallbackEXT);
///////////////////////////////////////////////////////////////////////////////
2017-09-14 00:31:23 +10:00
void
cruft::vk::load_traits (instance &i)
{
#define LOAD(KLASS,NAME,FUNC) \
try { \
cruft::vk::life_traits<KLASS>::NAME = i.proc<decltype(&FUNC)> (#FUNC); \
} catch (const vk::invalid_argument&) \
{ ; }
LOAD(VkDebugReportCallbackEXT, create, vkCreateDebugReportCallbackEXT);
LOAD(VkDebugReportCallbackEXT, destroy, vkDestroyDebugReportCallbackEXT);
}