mirror of
https://github.com/charles-lunarg/vk-bootstrap.git
synced 2024-11-10 02:41:47 +00:00
Add PhysicalDevice::is_extension_present()
Convenience function to check if a given extension would be enabled on the physical device.
This commit is contained in:
parent
454fb23d52
commit
f9717f66bb
@ -1369,6 +1369,11 @@ bool PhysicalDevice::has_separate_transfer_queue() const {
|
||||
}
|
||||
std::vector<VkQueueFamilyProperties> PhysicalDevice::get_queue_families() const { return queue_families; }
|
||||
std::vector<std::string> PhysicalDevice::get_extensions() const { return extensions; }
|
||||
bool PhysicalDevice::is_extension_present(const char* ext) const {
|
||||
return std::find_if(std::begin(extensions), std::end(extensions), [ext](std::string const& ext_name) {
|
||||
return ext_name == ext;
|
||||
}) != std::end(extensions);
|
||||
}
|
||||
PhysicalDevice::operator VkPhysicalDevice() const { return this->physical_device; }
|
||||
|
||||
// ---- Queues ---- //
|
||||
|
@ -495,6 +495,9 @@ struct PhysicalDevice {
|
||||
// Query the list of extensions which should be enabled
|
||||
std::vector<std::string> get_extensions() const;
|
||||
|
||||
// Returns true if an extension should be enabled on the device
|
||||
bool is_extension_present(const char* extension) const;
|
||||
|
||||
// A conversion function which allows this PhysicalDevice to be used
|
||||
// in places where VkPhysicalDevice would have been used.
|
||||
operator VkPhysicalDevice() const;
|
||||
|
@ -113,6 +113,9 @@ TEST_CASE("Instance with surface", "[VkBootstrap.bootstrap]") {
|
||||
.set_minimum_version(1, 0)
|
||||
.select();
|
||||
REQUIRE(phys_dev_ret.has_value());
|
||||
|
||||
REQUIRE(phys_dev_ret->is_extension_present(VK_KHR_DRIVER_PROPERTIES_EXTENSION_NAME));
|
||||
REQUIRE(!phys_dev_ret->is_extension_present(VK_KHR_16BIT_STORAGE_EXTENSION_NAME));
|
||||
}
|
||||
|
||||
vkb::destroy_surface(instance, surface);
|
||||
|
Loading…
Reference in New Issue
Block a user