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 ()
{
sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
pNext = nullptr;
flags = 0;
static const VkInstanceCreateInfo DEFAULT_INFO = {
.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
.pNext = nullptr,
.flags = 0,
pApplicationInfo = nullptr;
.pApplicationInfo = nullptr,
enabledLayerCount = 0;
ppEnabledLayerNames = nullptr;
.enabledLayerCount = 0,
.ppEnabledLayerNames = nullptr,
enabledExtensionCount = 0;
ppEnabledExtensionNames = nullptr;
}
.enabledExtensionCount = 0,
.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)
{ ; }

View File

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