except: prefer safer try_foo style accessors
This commit is contained in:
parent
01ec49efe9
commit
7bc8870e06
25
instance.cpp
25
instance.cpp
@ -83,17 +83,14 @@ instance::instance (const create_info_t &info):
|
||||
std::set<std::string>
|
||||
instance::extensions (void) const
|
||||
{
|
||||
uint32_t expected = 0;
|
||||
error::try_code (vkEnumerateInstanceExtensionProperties (nullptr, &expected, nullptr));
|
||||
auto values = error::try_values (
|
||||
vkEnumerateInstanceExtensionProperties, nullptr
|
||||
);
|
||||
|
||||
VkExtensionProperties props[expected];
|
||||
uint32_t found = expected;
|
||||
error::try_code (vkEnumerateInstanceExtensionProperties (nullptr, &found, props));
|
||||
|
||||
std::set<std::string> ext;
|
||||
for (const auto &i: props)
|
||||
ext.insert (i.extensionName);
|
||||
return ext;
|
||||
std::set<std::string> strings;
|
||||
for (const auto &i: values)
|
||||
strings.insert (i.extensionName);
|
||||
return strings;
|
||||
}
|
||||
|
||||
|
||||
@ -101,11 +98,5 @@ instance::extensions (void) const
|
||||
std::vector<VkLayerProperties>
|
||||
instance::available_layers (void)
|
||||
{
|
||||
|
||||
uint32_t count;
|
||||
vk::error::try_code (vkEnumerateInstanceLayerProperties (&count, nullptr));
|
||||
|
||||
std::vector<VkLayerProperties> layers (count);
|
||||
vk::error::try_code (vkEnumerateInstanceLayerProperties (&count, layers.data ()));
|
||||
return layers;
|
||||
return error::try_values (vkEnumerateInstanceLayerProperties);
|
||||
}
|
||||
|
@ -27,19 +27,17 @@ using cruft::vk::physical_device;
|
||||
std::set<std::string>
|
||||
physical_device::extensions (void) const
|
||||
{
|
||||
uint32_t expected = 0;
|
||||
error::try_code (vkEnumerateDeviceExtensionProperties (native (), nullptr, &expected, nullptr));
|
||||
auto values = error::try_values (
|
||||
vkEnumerateDeviceExtensionProperties, native (), nullptr
|
||||
);
|
||||
|
||||
VkExtensionProperties props[expected];
|
||||
uint32_t found = expected;
|
||||
error::try_code (vkEnumerateDeviceExtensionProperties (native (), nullptr, &found, props));
|
||||
|
||||
std::set<std::string> ext;
|
||||
for (const auto &i: props)
|
||||
ext.insert (i.extensionName);
|
||||
return ext;
|
||||
std::set<std::string> strings;
|
||||
for (const auto &i: values)
|
||||
strings.emplace (i.extensionName);
|
||||
return strings;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
VkPhysicalDeviceProperties
|
||||
physical_device::properties (void) const
|
||||
|
Loading…
Reference in New Issue
Block a user