Thank you for open-sourcing this modern C++ Vulkan wrapper library. Our project is currently trying to use vulkan-hpp, but I noticed that some methods which return std containers use std::allocator, as shown below.
// wrapper function for command vkEnumerateInstanceExtensionProperties, see
// https://registry.khronos.org/vulkan/specs/latest/man/html/vkEnumerateInstanceExtensionProperties.html
VULKAN_HPP_NODISCARD typename ResultValueType<std::vector<ExtensionProperties>>::type
enumerateInstanceExtensionProperties( Optional<std::string const> layerName VULKAN_HPP_DEFAULT_ASSIGNMENT( nullptr ) ) const;
// wrapper function for command vkEnumerateInstanceLayerProperties, see
// https://registry.khronos.org/vulkan/specs/latest/man/html/vkEnumerateInstanceLayerProperties.html
VULKAN_HPP_NODISCARD typename ResultValueType<std::vector<LayerProperties>>::type enumerateInstanceLayerProperties() const;
This means that if I need to store this data, I have to copy it into our pmr containers to keep the types consistent. It would be ideal if a macro could be added to enable or disable a custom allocator. My personal idea is as follows:
template<T>
using VKHppStdContainerAllocator =
#if defined(VULKAN_HPP_USE_PMR_ALLOCATOR)
std::polymorphic_allocator<T>;
#else
std::allocator<T>;
#endif
// wrapper function for command vkEnumerateInstanceExtensionProperties, see
// https://registry.khronos.org/vulkan/specs/latest/man/html/vkEnumerateInstanceExtensionProperties.html
// add allocator
VULKAN_HPP_NODISCARD typename ResultValueType<std::vector<ExtensionProperties, VKHppStdContainerAllocator<ExtensionProperties>>>::type
enumerateInstanceExtensionProperties( Optional<std::string const> layerName VULKAN_HPP_DEFAULT_ASSIGNMENT( nullptr ) ) const;
// wrapper function for command vkEnumerateInstanceLayerProperties, see
// https://registry.khronos.org/vulkan/specs/latest/man/html/vkEnumerateInstanceLayerProperties.html
VULKAN_HPP_NODISCARD typename ResultValueType<std::vector<LayerProperties, VKHppStdContainerAllocator<LayerProperties>>>::type enumerateInstanceLayerProperties() const;
PS. If this issue is acceptable and this repository welcomes PRs, I would be happy to try contributing this part of the code.
Thank you for open-sourcing this modern C++ Vulkan wrapper library. Our project is currently trying to use
vulkan-hpp, but I noticed that some methods which return std containers usestd::allocator, as shown below.This means that if I need to store this data, I have to copy it into our
pmrcontainers to keep the types consistent. It would be ideal if a macro could be added to enable or disable a custom allocator. My personal idea is as follows:PS. If this issue is acceptable and this repository welcomes PRs, I would be happy to try contributing this part of the code.