instance: add constructor from base info type

This commit is contained in:
Danny Robson 2017-09-01 12:14:15 +10:00
parent 1ac4db07ff
commit ba3a49eccf
2 changed files with 25 additions and 13 deletions

View File

@ -21,24 +21,35 @@ using cruft::vk::instance;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
instance::create_info::create_info () static const VkInstanceCreateInfo DEFAULT_INFO = {
{ .sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; .pNext = nullptr,
pNext = nullptr; .flags = 0,
flags = 0;
pApplicationInfo = nullptr; .pApplicationInfo = nullptr,
enabledLayerCount = 0; .enabledLayerCount = 0,
ppEnabledLayerNames = nullptr; .ppEnabledLayerNames = nullptr,
enabledExtensionCount = 0; .enabledExtensionCount = 0,
ppEnabledExtensionNames = nullptr; .ppEnabledExtensionNames = nullptr
} };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
instance::instance (const VkInstanceCreateInfo &info): instance::create_info::create_info ():
create_info (DEFAULT_INFO)
{ ; }
//-----------------------------------------------------------------------------
instance::create_info::create_info (const VkInstanceCreateInfo &base):
VkInstanceCreateInfo (base)
{ ; }
///////////////////////////////////////////////////////////////////////////////
instance::instance (const create_info &info):
instantiated (&info, nullptr) instantiated (&info, nullptr)
{ ; } { ; }

View File

@ -30,9 +30,10 @@ namespace cruft::vk {
struct instance : public instantiated<instance> { struct instance : public instantiated<instance> {
struct create_info : public VkInstanceCreateInfo { struct create_info : public VkInstanceCreateInfo {
create_info (); create_info ();
create_info (const VkInstanceCreateInfo&);
}; };
instance (const VkInstanceCreateInfo &info); instance (const create_info &info);
std::set<std::string> extensions (void) const; std::set<std::string> extensions (void) const;
}; };