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>
|
std::set<std::string>
|
||||||
instance::extensions (void) const
|
instance::extensions (void) const
|
||||||
{
|
{
|
||||||
uint32_t expected = 0;
|
auto values = error::try_values (
|
||||||
error::try_code (vkEnumerateInstanceExtensionProperties (nullptr, &expected, nullptr));
|
vkEnumerateInstanceExtensionProperties, nullptr
|
||||||
|
);
|
||||||
|
|
||||||
VkExtensionProperties props[expected];
|
std::set<std::string> strings;
|
||||||
uint32_t found = expected;
|
for (const auto &i: values)
|
||||||
error::try_code (vkEnumerateInstanceExtensionProperties (nullptr, &found, props));
|
strings.insert (i.extensionName);
|
||||||
|
return strings;
|
||||||
std::set<std::string> ext;
|
|
||||||
for (const auto &i: props)
|
|
||||||
ext.insert (i.extensionName);
|
|
||||||
return ext;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -101,11 +98,5 @@ instance::extensions (void) const
|
|||||||
std::vector<VkLayerProperties>
|
std::vector<VkLayerProperties>
|
||||||
instance::available_layers (void)
|
instance::available_layers (void)
|
||||||
{
|
{
|
||||||
|
return error::try_values (vkEnumerateInstanceLayerProperties);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
@ -27,19 +27,17 @@ using cruft::vk::physical_device;
|
|||||||
std::set<std::string>
|
std::set<std::string>
|
||||||
physical_device::extensions (void) const
|
physical_device::extensions (void) const
|
||||||
{
|
{
|
||||||
uint32_t expected = 0;
|
auto values = error::try_values (
|
||||||
error::try_code (vkEnumerateDeviceExtensionProperties (native (), nullptr, &expected, nullptr));
|
vkEnumerateDeviceExtensionProperties, native (), nullptr
|
||||||
|
);
|
||||||
|
|
||||||
VkExtensionProperties props[expected];
|
std::set<std::string> strings;
|
||||||
uint32_t found = expected;
|
for (const auto &i: values)
|
||||||
error::try_code (vkEnumerateDeviceExtensionProperties (native (), nullptr, &found, props));
|
strings.emplace (i.extensionName);
|
||||||
|
return strings;
|
||||||
std::set<std::string> ext;
|
|
||||||
for (const auto &i: props)
|
|
||||||
ext.insert (i.extensionName);
|
|
||||||
return ext;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
VkPhysicalDeviceProperties
|
VkPhysicalDeviceProperties
|
||||||
physical_device::properties (void) const
|
physical_device::properties (void) const
|
||||||
|
Loading…
Reference in New Issue
Block a user