2 * Copyright (c) 2019, 2021 Arm Limited.
4 * SPDX-License-Identifier: MIT
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26 #include "util/custom_allocator.hpp"
31 #include <vulkan/vulkan.h>
32 #include <vulkan/vk_layer.h>
40 extension_list(const util::allocator& allocator);
42 extension_list(const extension_list &rhs) = delete;
43 const extension_list &operator=(const extension_list &rhs) = delete;
46 * @brief Obtain a vector of #VkExtensionProperties equivalent to this extension_list object.
48 const util::vector<VkExtensionProperties> &get_extension_props() const
54 * @brief Get the allocator used to manage the memory of this object.
56 const util::allocator get_allocator() const
62 * @brief Append pointers to extension strings to the given vector.
64 * @warning Pointers in the vector are referring to string allocated in this extension_list and will become invalid
65 * if the extension_list is modified (e.g. by adding/removing elements.)
67 * @param[out] out A vector of C strings to which all extension are appended.
69 * @return A boolean indicating whether the operation was successful. If this is @c false, then @p out is
72 bool get_extension_strings(util::vector<const char*> &out) const;
74 bool contains(const extension_list &req) const;
75 bool contains(const char *ext) const;
76 void remove(const char *ext);
77 VkResult add(const char *ext);
78 VkResult add(VkExtensionProperties ext_prop);
79 VkResult add(const char **ext_list, uint32_t count);
80 VkResult add(const extension_list &ext_list);
81 VkResult add(const struct VkEnumerateInstanceExtensionPropertiesChain *chain);
82 VkResult add(PFN_vkEnumerateInstanceExtensionProperties fpEnumerateInstanceExtensionProperties);
83 VkResult add(VkPhysicalDevice dev);
84 VkResult add(const char *const *extensions, uint32_t count);
85 VkResult add(const VkExtensionProperties *props, uint32_t count);
88 util::allocator m_alloc;
89 util::vector<VkExtensionProperties> m_ext_props;